:root {
    --bg: #f7f5ef;
    --card: #ffffff;
    --text: #1f2b25;
    --muted: #7b847e;

    --green: #173c2d;
    --green-soft: #24543f;

    --gold: #b58a43;
    --gold-soft: #e8dcc3;

    --red: #a53b3b;
    --red-dark: #842d2d;

    --border: #e8e4db;
    --shadow: 0 12px 35px rgba(28, 46, 37, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Tahoma,
        "Segoe UI",
        Arial,
        sans-serif;

    background:
        radial-gradient(
            circle at top right,
            rgba(181, 138, 67, 0.08),
            transparent 320px
        ),
        var(--bg);

    color: var(--text);
}

button,
input,
textarea {
    font-family: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}


/* =========================
   PAGE
========================= */

.page {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 32px 18px 42px;
}


/* =========================
   HEADER
========================= */

.header {
    display: flex;
    align-items: center;
    gap: 15px;

    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(232, 228, 219, 0.9);

    padding: 17px 18px;
    margin-bottom: 22px;

    border-radius: 22px;

    box-shadow: var(--shadow);

    backdrop-filter: blur(8px);
}

.logo {
    width: 57px;
    height: 57px;

    object-fit: contain;

    background: #ffffff;

    border: 1px solid var(--gold-soft);

    border-radius: 16px;

    padding: 7px;

    flex-shrink: 0;
}

.header h1 {
    margin: 0 0 5px;

    font-size: 21px;
    font-weight: 800;

    color: var(--green);

    letter-spacing: -0.3px;
}

.header p {
    margin: 0;

    color: var(--muted);

    font-size: 12.5px;
    line-height: 1.7;
}


/* =========================
   MAIN ACTIONS
========================= */

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-bottom: 18px;
}

.action-card {
    position: relative;
    overflow: hidden;

    min-height: 145px;

    border: 1px solid var(--border);
    background: var(--card);

    border-radius: 21px;

    padding: 22px 13px;

    cursor: pointer;
    text-align: center;

    box-shadow:
        0 8px 24px rgba(31, 43, 37, 0.05);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease;
}

.action-card::before {
    content: "";

    position: absolute;

    width: 95px;
    height: 95px;

    border-radius: 50%;

    background: rgba(181, 138, 67, 0.055);

    top: -45px;
    left: -35px;
}

.action-card:hover {
    transform: translateY(-3px);

    border-color: #d9ccb4;

    box-shadow:
        0 12px 30px rgba(31, 43, 37, 0.09);
}

.action-card:active {
    transform: translateY(0);
}

.action-card .icon {
    display: flex;

    width: 46px;
    height: 46px;

    align-items: center;
    justify-content: center;

    margin: 0 auto 13px;

    border-radius: 14px;

    background: #f3eee4;

    color: var(--green);

    font-size: 27px;
    line-height: 1;
}

.action-card strong {
    display: block;

    color: var(--green);

    font-size: 15px;
    font-weight: 800;

    margin-bottom: 7px;
}

.action-card small {
    display: block;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.7;
}


/* =========================
   PANEL
========================= */

.panel {
    display: none;

    background: var(--card);

    border: 1px solid var(--border);

    border-radius: 22px;

    padding: 23px;

    margin-top: 16px;

    box-shadow: var(--shadow);

    animation: panelIn 0.22s ease;
}

.panel.active {
    display: block;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-title {
    position: relative;

    font-weight: 800;
    font-size: 17px;

    color: var(--green);

    padding-bottom: 14px;
    margin-bottom: 18px;

    border-bottom: 1px solid #f0ede6;
}

.panel-title::after {
    content: "";

    position: absolute;

    right: 0;
    bottom: -1px;

    width: 42px;
    height: 2px;

    border-radius: 20px;

    background: var(--gold);
}


/* =========================
   FORM
========================= */

label {
    display: block;

    margin: 16px 0 7px;

    font-size: 12.5px;
    font-weight: 700;

    color: #36473f;
}

label:first-of-type {
    margin-top: 0;
}

label span {
    color: var(--red);
}

label small {
    margin-right: 4px;

    color: #9a9f9b;

    font-weight: 400;
}

input,
textarea {
    width: 100%;

    border: 1px solid #dedbd3;

    border-radius: 13px;

    padding: 13px 14px;

    outline: none;

    background: #fbfbf9;

    color: #26332d;

    font-size: 15px;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
}

input::placeholder,
textarea::placeholder {
    color: #a5aaa6;
}

input:focus,
textarea:focus {
    background: #ffffff;

    border-color: var(--gold);

    box-shadow:
        0 0 0 3px rgba(181, 138, 67, 0.11);
}

textarea {
    resize: vertical;

    min-height: 125px;

    line-height: 1.8;
}


/* =========================
   PHONE
========================= */

.phone-input {
    direction: ltr;
    text-align: left;

    unicode-bidi: plaintext;

    font-family: Arial, sans-serif;

    font-size: 17px;
    letter-spacing: 0.4px;
}

.phone-search-input {
    unicode-bidi: plaintext;
}


/* =========================
   BUTTONS
========================= */

.primary-btn,
.danger-btn {
    width: 100%;

    border: 0;

    border-radius: 13px;

    padding: 14px 16px;

    margin-top: 19px;

    font-size: 14px;
    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease,
        box-shadow 0.15s ease;
}

.primary-btn {
    background:
        linear-gradient(
            135deg,
            var(--green),
            var(--green-soft)
        );

    color: #ffffff;

    box-shadow:
        0 8px 20px rgba(23, 60, 45, 0.16);
}

.danger-btn {
    background:
        linear-gradient(
            135deg,
            var(--red-dark),
            var(--red)
        );

    color: #ffffff;

    box-shadow:
        0 8px 20px rgba(132, 45, 45, 0.14);
}

.primary-btn:hover,
.danger-btn:hover {
    opacity: 0.94;

    transform: translateY(-1px);
}

.primary-btn:active,
.danger-btn:active {
    transform: translateY(0);
}


/* =========================
   ALERTS
========================= */

.alert {
    border-radius: 14px;

    padding: 13px 15px;

    margin-bottom: 16px;

    font-size: 13px;
    line-height: 1.7;

    border: 1px solid transparent;
}

.alert.success {
    color: #24643f;
    background: #edf7f0;
    border-color: #d5eadb;
}

.alert.error {
    color: #9a3131;
    background: #fdf0f0;
    border-color: #f2d6d6;
}

.alert.warning {
    color: #855f1b;
    background: #fff8e9;
    border-color: #f0e0ba;
}

.alert.safe {
    color: #2d6847;
    background: #eef7f1;
    border-color: #d8eadd;
}


/* =========================
   RESULT CARD
========================= */

.result-card {
    margin-top: 21px;

    border: 1px solid #e8dfd5;

    border-radius: 18px;

    overflow: hidden;

    background: #ffffff;

    box-shadow:
        0 7px 22px rgba(32, 42, 36, 0.05);
}

.result-warning {
    padding: 13px 16px;

    text-align: center;

    background:
        linear-gradient(
            135deg,
            #8c3131,
            #a94848
        );

    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}

.result-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 14px 17px;

    border-bottom: 1px solid #efede8;
}

.result-row span,
.notes-box span,
.dates span {
    color: #888f8b;

    font-size: 11px;
}

.result-row strong {
    color: #26372f;

    font-size: 13px;
}

.notes-box {
    padding: 15px 17px;

    border-bottom: 1px solid #efede8;
}

.notes-box p {
    margin: 7px 0 0;

    color: #37453e;

    font-size: 13px;
    line-height: 1.9;
}

.dates {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 10px;

    padding: 14px 17px;

    background: #faf9f6;
}

.dates strong {
    display: block;

    margin-top: 5px;

    color: #48554f;

    font-size: 10.5px;
    font-weight: 600;
}


/* =========================
   FOOTER
========================= */

footer {
    margin-top: 34px;

    padding-top: 17px;

    border-top: 1px solid rgba(222, 218, 207, 0.7);

    text-align: center;

    color: #999f9b;

    font-size: 10.5px;
}

footer span {
    margin: 0 5px;

    color: var(--gold);
}


/* =========================
   MOBILE
========================= */

@media (max-width: 480px) {

    .page {
        padding:
            18px
            13px
            30px;
    }

    .header {
        padding: 14px 15px;

        border-radius: 19px;

        margin-bottom: 16px;
    }

    .logo {
        width: 52px;
        height: 52px;

        border-radius: 14px;
    }

    .header h1 {
        font-size: 19px;
    }

    .header p {
        font-size: 11.5px;
    }

    .actions {
        gap: 9px;
    }

    .action-card {
        min-height: 135px;

        padding: 19px 9px;

        border-radius: 18px;
    }

    .action-card .icon {
        width: 42px;
        height: 42px;

        font-size: 24px;

        border-radius: 13px;
    }

    .action-card strong {
        font-size: 13.5px;
    }

    .action-card small {
        font-size: 10.5px;
    }

    .panel {
        padding: 18px;

        border-radius: 19px;
    }

    .panel-title {
        font-size: 16px;
    }

    input,
    textarea {
        font-size: 16px;
    }

    .dates {
        grid-template-columns: 1fr;
    }
}
.back-btn {
    display: block;
    text-align: center;
    margin-top: 10px;
    padding: 13px;
    border-radius: 13px;
    text-decoration: none;
    color: var(--green);
    background: #f5f3ed;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
}
.record-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px;
}

.record-actions form {
    margin: 0;
}

.edit-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    margin-top: 0;
}

.delete-btn {
    width: 100%;
    height: 100%;

    border: 1px solid #efd4d4;
    border-radius: 13px;

    padding: 14px;

    background: #fff5f5;
    color: #9c3434;

    font-size: 13px;
    font-weight: 800;

    cursor: pointer;
}

.delete-btn:hover {
    background: #fbeaea;
}

@media (max-width: 480px) {
    .record-actions {
        grid-template-columns: 1fr;
    }
}
.header {
    position: relative;
}

.logout-btn {
    margin-right: auto;

    text-decoration: none;

    color: #8a3a3a;

    background: #fff4f4;

    border: 1px solid #efdada;

    border-radius: 11px;

    padding: 9px 12px;

    font-size: 11px;
    font-weight: 700;
}

.logout-btn:hover {
    background: #fbeaea;
}

.login-page {
    max-width: 500px;
}

.login-panel {
    margin-top: 0;
}


/* =========================
   RECORDS SUMMARY
========================= */

.records-summary {
    display: grid;
    grid-template-columns: 145px 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.records-count-card,
.view-records-btn {
    min-height: 88px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 8px 24px rgba(31, 43, 37, 0.05);
}

.records-count-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 13px;
    text-align: center;
}

.records-count-card span {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.records-count-card strong {
    color: var(--green);
    font-size: 27px;
    line-height: 1;
}

.view-records-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.view-records-btn:hover {
    transform: translateY(-2px);
    border-color: #d9ccb4;
    box-shadow: 0 12px 30px rgba(31, 43, 37, 0.08);
}

.view-records-icon {
    display: flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: #f3eee4;
    color: var(--green);
    font-size: 19px;
}

.view-records-btn strong {
    display: block;
    color: var(--green);
    font-size: 13.5px;
    margin-bottom: 4px;
}

.view-records-btn small {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
}


/* =========================
   ALL RECORDS PAGE
========================= */

.records-page {
    max-width: 760px;
}

.records-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.records-toolbar .back-btn {
    margin: 0;
    white-space: nowrap;
}

.records-search-panel {
    display: block;
    margin-top: 0;
    margin-bottom: 16px;
}

.records-search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    align-items: end;
}

.records-search-form .primary-btn {
    width: auto;
    min-width: 90px;
    margin-top: 0;
    height: 48px;
}

.records-search-form input {
    height: 48px;
}

.records-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 2px 14px;
    color: var(--muted);
    font-size: 11px;
}

.records-list {
    display: grid;
    gap: 13px;
}

.record-list-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 7px 22px rgba(32, 42, 36, 0.045);
}

.record-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    background: #faf9f6;
    border-bottom: 1px solid #efede8;
}

.record-list-number {
    direction: ltr;
    unicode-bidi: plaintext;
    font-family: Arial, sans-serif;
    color: var(--green);
    font-size: 15px;
    font-weight: 800;
    text-align: left;
}

.record-list-id {
    color: #a0a49f;
    font-size: 10px;
}

.record-list-body {
    padding: 14px 16px;
}

.record-list-field {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
    padding: 7px 0;
}

.record-list-field + .record-list-field {
    border-top: 1px dashed #efede8;
}

.record-list-field span {
    color: #8b918d;
    font-size: 11px;
}

.record-list-field strong,
.record-list-field p {
    margin: 0;
    color: #33423b;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.8;
    word-break: break-word;
}

.record-list-field p {
    font-weight: 400;
}

.record-list-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
    background: #faf9f6;
    border-top: 1px solid #efede8;
}

.record-list-date span {
    display: block;
    color: #969b97;
    font-size: 10px;
    margin-bottom: 4px;
}

.record-list-date strong {
    color: #4a5750;
    font-size: 10.5px;
}

.record-list-card .record-actions {
    border-top: 1px solid #efede8;
}

.empty-records {
    padding: 34px 20px;
    border: 1px dashed #ddd5c7;
    border-radius: 18px;
    background: rgba(255,255,255,.65);
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.clear-search-link {
    color: var(--green);
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 480px) {
    .records-summary {
        grid-template-columns: 105px 1fr;
        gap: 9px;
    }

    .records-count-card,
    .view-records-btn {
        min-height: 82px;
        border-radius: 16px;
    }

    .records-count-card strong {
        font-size: 24px;
    }

    .view-records-btn {
        padding: 12px;
        gap: 9px;
    }

    .view-records-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        font-size: 17px;
    }

    .records-search-form {
        grid-template-columns: 1fr;
    }

    .records-search-form .primary-btn {
        width: 100%;
    }

    .record-list-field {
        grid-template-columns: 78px 1fr;
    }

    .record-list-dates {
        grid-template-columns: 1fr;
    }
}
