:root {
    color-scheme: light;
    --ink: #18222f;
    --muted: #647386;
    --line: rgba(116, 134, 153, 0.24);
    --panel: rgba(255, 255, 255, 0.9);
    --panel-strong: #ffffff;
    --soft: #eef6f3;
    --accent: #0f9a9e;
    --accent-strong: #08767c;
    --accent-glow: rgba(15, 154, 158, 0.26);
    --indigo: #314b8f;
    --gold: #d89b2b;
    --danger: #c7352c;
    --success: #129253;
    --radius: 8px;
    --shadow: 0 22px 60px rgba(22, 38, 54, 0.14);
    --shadow-soft: 0 12px 30px rgba(22, 38, 54, 0.09);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(15, 154, 158, 0.18), transparent 32rem),
        radial-gradient(circle at 88% 10%, rgba(216, 155, 43, 0.16), transparent 30rem),
        linear-gradient(135deg, #f5faf8 0%, #edf4f8 46%, #fbfcff 100%);
    min-height: 100vh;
}

body::before {
    background:
        linear-gradient(rgba(255, 255, 255, 0.42) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    align-items: center;
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 14px 34px rgba(25, 45, 64, 0.1);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1180px;
    min-height: 76px;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    display: flex;
    font-size: 18px;
    font-weight: 800;
    gap: 11px;
    letter-spacing: 0;
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--accent), var(--indigo));
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    box-shadow: 0 12px 24px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: white;
    display: inline-flex;
    font-size: 18px;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.menu-toggle {
    align-items: center;
    background: linear-gradient(135deg, var(--accent), var(--indigo));
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 12px 24px var(--accent-glow);
    color: white;
    cursor: pointer;
    display: none;
    font-size: 18px;
    height: 44px;
    justify-content: center;
    width: 48px;
}

.nav a,
.btn {
    align-items: center;
    border: 1px solid rgba(127, 145, 164, 0.28);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 252, 0.86));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 18px rgba(25, 45, 64, 0.08);
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 750;
    gap: 8px;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
}

.nav a:hover,
.btn:hover {
    border-color: rgba(15, 154, 158, 0.5);
    box-shadow: 0 13px 28px rgba(25, 45, 64, 0.12);
    transform: translateY(-1px);
}

.btn.primary,
.nav a:hover {
    background: linear-gradient(135deg, var(--accent), var(--indigo));
    border-color: transparent;
    color: white;
}

.btn.primary:hover {
    background: linear-gradient(135deg, var(--accent-strong), #263f7f);
}

.btn.danger {
    background: linear-gradient(180deg, #fff8f7, #ffe9e5);
    border-color: rgba(199, 53, 44, 0.28);
    color: var(--danger);
}

.btn.success {
    background: linear-gradient(135deg, #18a75f, #0d7d51);
    border-color: transparent;
    color: white;
}

.shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: 32px 24px 60px;
    position: relative;
    z-index: 1;
}

.hero,
.panel,
.prescription {
    backdrop-filter: blur(18px);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    overflow: hidden;
    padding: 26px 30px;
    position: relative;
}

.hero::after {
    background: linear-gradient(135deg, rgba(15, 154, 158, 0.16), rgba(216, 155, 43, 0.14));
    border-radius: 8px;
    content: "";
    height: 120px;
    position: absolute;
    right: -65px;
    top: -70px;
    transform: rotate(18deg);
    width: 220px;
}

.eyebrow {
    align-items: center;
    color: var(--accent-strong);
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    gap: 8px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.hero h1,
.page-head h1 {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.03;
    margin: 0 0 14px;
}

.hero h1 {
    font-size: clamp(30px, 4.2vw, 46px);
    margin-bottom: 10px;
}

.page-head h1 {
    align-items: center;
    display: flex;
    gap: 12px;
}

.hero p,
.page-head p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
    margin: 0;
    max-width: 740px;
}

.hero p {
    max-width: 620px;
}

.hero-lead {
    font-size: 18px !important;
    font-weight: 700;
}

.section-title {
    align-items: center;
    display: flex;
    font-size: 30px !important;
    gap: 10px;
}

.stats {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(239, 247, 247, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 10px;
    padding: 12px;
    position: relative;
    z-index: 1;
}

.stat {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.stat i {
    color: var(--gold);
    font-size: 18px;
    margin-bottom: 8px;
}

.stat strong {
    display: block;
    font-size: 28px;
    line-height: 1;
}

.stat span {
    color: var(--muted);
    display: block;
    margin-top: 4px;
}

.panel {
    margin-top: 24px;
    padding: 26px;
}

.page-head {
    align-items: end;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    gap: 17px;
}

.field label {
    align-items: center;
    color: #314051;
    display: flex;
    font-size: 13px;
    font-weight: 800;
    gap: 8px;
    margin-bottom: 8px;
}

.field label i {
    color: var(--accent);
}

input,
textarea,
select {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(116, 134, 153, 0.3);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 2px rgba(25, 45, 64, 0.04);
    color: var(--ink);
    font: inherit;
    min-height: 48px;
    padding: 12px 13px;
    width: 100%;
}

textarea {
    line-height: 1.55;
    min-height: 150px;
    resize: vertical;
}

input:focus,
textarea:focus {
    background: white;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(15, 154, 158, 0.13), inset 0 1px 2px rgba(25, 45, 64, 0.04);
    outline: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.alert {
    border-radius: var(--radius);
    font-weight: 700;
    margin-bottom: 16px;
    padding: 13px 14px;
}

.alert.error {
    background: #fff3f1;
    border: 1px solid rgba(199, 53, 44, 0.2);
    color: var(--danger);
}

.alert.success {
    background: #e8f9f0;
    border: 1px solid rgba(18, 146, 83, 0.2);
    color: var(--success);
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 15px 13px;
    text-align: left;
    vertical-align: top;
}

tr:last-child td {
    border-bottom: 0;
}

th {
    background: rgba(239, 247, 247, 0.82);
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

tbody tr {
    background: rgba(255, 255, 255, 0.66);
}

tbody tr:hover {
    background: rgba(240, 250, 250, 0.92);
}

.search-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.results {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.result-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 251, 0.88));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    padding: 16px;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.result-btn strong {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-bottom: 7px;
}

.result-btn strong i {
    color: var(--accent);
}

.result-btn:hover {
    border-color: rgba(15, 154, 158, 0.5);
    box-shadow: 0 16px 34px rgba(22, 38, 54, 0.13);
    transform: translateY(-1px);
}

.prescription {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
        linear-gradient(135deg, rgba(15, 154, 158, 0.08), rgba(216, 155, 43, 0.08));
    margin-top: 24px;
    padding: 28px;
}

.rx-head {
    border-bottom: 2px solid rgba(24, 34, 47, 0.16);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 16px;
}

.rx-title {
    font-size: 25px;
    font-weight: 850;
}

.rx-box {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rx-box textarea {
    min-height: 190px;
}

.muted {
    color: var(--muted);
}

@media (max-width: 820px) {
    .topbar {
        align-items: center;
        border-radius: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px;
        padding: 14px 16px;
    }

    .brand {
        justify-content: flex-start;
        min-width: 0;
        text-align: left;
    }

    .brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .nav {
        display: none;
        grid-column: 1 / -1;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .nav.is-open {
        display: grid;
    }

    .nav a {
        min-width: 0;
        padding-inline: 10px;
    }

    .page-head,
    .rx-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero,
    .rx-box,
    .search-row {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 22px 18px;
    }

    .shell {
        padding: 20px 14px 44px;
    }

    .panel,
    .prescription {
        padding: 20px;
    }

    .btn,
    .search-row .btn {
        width: 100%;
    }

    .actions .btn,
    .actions form {
        flex: 1 1 160px;
    }

    .actions form .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nav {
        grid-template-columns: 1fr;
    }

    .brand {
        font-size: 16px;
    }

    .hero h1,
    .page-head h1 {
        font-size: 32px;
    }

    .section-title {
        font-size: 24px !important;
    }

    .hero p,
    .page-head p {
        font-size: 15px;
    }

    .stat {
        padding: 14px;
    }
}

@media print {
    body {
        background: white;
    }

    body::before,
    .topbar,
    .hero,
    .lookup-panel,
    .no-print {
        display: none !important;
    }

    .shell {
        max-width: none;
        padding: 0;
    }

    .prescription {
        border: 0;
        box-shadow: none;
        margin: 0;
    }
}
