:root {
    --bg: #f5f7f4;
    --ink: #17231f;
    --muted: #68756f;
    --line: #dfe7e1;
    --panel: #ffffff;
    --green: #1f7a5c;
    --green-dark: #11533d;
    --mint: #dff3e8;
    --amber: #f4b942;
    --rose: #e9867a;
    --blue: #427cba;
    --shadow: 0 18px 50px rgba(31, 56, 46, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px clamp(18px, 4vw, 56px);
    background: rgba(245, 247, 244, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav a,
.sidebar a {
    border-radius: 8px;
    color: var(--muted);
    padding: 10px 13px;
    font-weight: 700;
}

.main-nav a.is-active,
.sidebar a.is-active,
.main-nav a:hover,
.sidebar a:hover {
    background: var(--ink);
    color: #fff;
}

.menu-toggle {
    display: none;
    border: 0;
    background: var(--ink);
    color: #fff;
    border-radius: 8px;
    padding: 10px 12px;
}

.page {
    width: min(1220px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 70px;
}

.eyebrow,
.pill,
.section-head span,
.recipe-card > span {
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    background: var(--mint);
    padding: 8px 11px;
}

.hero,
.public-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
    gap: 28px;
    align-items: stretch;
    padding: 22px 0 36px;
}

.hero h1,
.public-hero h1 {
    max-width: 860px;
    margin: 18px 0 16px;
    font-size: clamp(42px, 6vw, 74px);
    line-height: .98;
}

.hero p,
.public-hero p {
    max-width: 700px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.hero-actions,
.slot-row,
.meta-line,
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    padding: 0 16px;
}

.btn.primary {
    background: var(--green);
    color: #fff;
}

.btn.secondary {
    background: var(--mint);
    color: var(--green-dark);
}

.btn.ghost {
    border-color: var(--line);
    background: #fff;
}

.hero-panel,
.surface,
.specialist-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 22px;
}

.panel-head,
.card-top,
.section-head.row,
.timeline article,
.mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-head {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.panel-head span,
.mini-row em,
.stat-card span,
.specialist-card p,
.timeline p,
.patient-tab span {
    color: var(--muted);
}

.mini-row {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
}

.mini-row:last-child {
    border-bottom: 0;
}

.mini-row b {
    color: var(--green);
}

.mini-row em,
.status,
.rating {
    border-radius: 999px;
    background: #eef4f1;
    color: var(--green-dark);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    padding: 7px 9px;
}

.stats-grid,
.specialist-grid,
.recipe-grid,
.clinic-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0 28px;
}

.stat-card {
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    padding: 20px;
}

.stat-card strong {
    display: block;
    margin: 12px 0 5px;
    font-size: 32px;
}

.stat-card em {
    color: var(--amber);
    font-style: normal;
    font-weight: 800;
}

.split {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
    margin: 18px 0;
}

.surface {
    padding: 24px;
}

.surface.dark {
    background: var(--ink);
    color: #fff;
}

.section-head h1,
.section-head h2 {
    margin: 8px 0 18px;
    font-size: clamp(26px, 3vw, 38px);
}

.insight-list {
    display: grid;
    gap: 12px;
}

.insight {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.insight strong,
.insight span,
.insight em {
    display: block;
}

.insight span {
    color: var(--blue);
    font-size: 13px;
    font-weight: 800;
    margin-top: 4px;
}

.insight p,
.roadmap {
    color: var(--muted);
    line-height: 1.55;
}

.insight em {
    color: var(--green-dark);
    font-style: normal;
    font-weight: 700;
}

.dark .roadmap {
    color: #d7e2dc;
}

.roadmap li {
    margin-bottom: 14px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 15px 12px;
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.search-box,
.intake-form,
.consult-form,
.stack-form {
    display: grid;
    gap: 12px;
}

.search-box {
    align-self: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: var(--shadow);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    min-height: 46px;
    padding: 12px 13px;
}

textarea {
    min-height: 116px;
    resize: vertical;
}

.specialist-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.clinic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.clinic-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.clinic-card h3 {
    margin: 0;
}

.clinic-card p {
    color: var(--muted);
    line-height: 1.5;
}

.specialist-card {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 16px;
    padding: 18px;
}

.avatar {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 8px;
    background: var(--mint);
    color: var(--green-dark);
    font-weight: 900;
}

.specialist-card h2 {
    margin: 0;
    font-size: 20px;
}

.meta-line span,
.tag-cloud span {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
}

.slot-row {
    margin-top: 16px;
}

.slot-row button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 800;
    padding: 10px 12px;
}

.intake-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.intake-form textarea,
.intake-form button {
    grid-column: span 4;
}

.workspace {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 18px;
}

.sidebar {
    position: sticky;
    top: 92px;
    align-self: start;
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.work-main {
    display: grid;
    gap: 18px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.timeline time {
    color: var(--green);
    font-weight: 900;
}

.patient-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
}

.patient-tab {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    margin-bottom: 10px;
    padding: 14px;
    text-align: left;
}

.patient-tab strong,
.patient-tab span {
    display: block;
}

.patient-tab.is-active {
    border-color: var(--green);
    background: var(--mint);
}

.patient-pane {
    display: none;
}

.patient-pane.is-active {
    display: block;
}

.patient-detail h3 {
    margin: 22px 0 10px;
}

.clean-list {
    margin: 0;
    padding-left: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recipe-card ul {
    line-height: 1.8;
    padding-left: 18px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(23, 35, 31, .48);
    padding: 18px;
}

.modal.is-open {
    display: flex;
}

.modal-box {
    width: min(460px, 100%);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 24px;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #eef4f1;
    cursor: pointer;
    font-size: 22px;
}

@media (max-width: 980px) {
    .hero,
    .public-hero,
    .split,
    .workspace,
    .patient-layout {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .specialist-grid,
    .recipe-grid,
    .clinic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar {
        position: static;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .main-nav {
        position: absolute;
        left: 18px;
        right: 18px;
        top: 74px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 10px;
        box-shadow: var(--shadow);
    }

    .main-nav.is-open {
        display: flex;
    }

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

    .brand small {
        display: none;
    }

    .hero h1,
    .public-hero h1 {
        font-size: 40px;
    }

    .stats-grid,
    .specialist-grid,
    .recipe-grid,
    .clinic-grid,
    .intake-form,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .intake-form textarea,
    .intake-form button {
        grid-column: span 1;
    }

    .section-head.row,
    .timeline article,
    .card-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .sidebar {
        grid-template-columns: 1fr 1fr;
    }
}
