/* ==============================================================
   SNAP Dental Labs — Clinic Portal Design System
   Aligned with snapdentallabs.com brand (cobalt #0836b9, lime #37ca37,
   Inter typography, light surfaces with bold blue accents).
   ============================================================== */

:root {
    /* Brand */
    --snap-blue:        #0836b9;
    --snap-blue-bright: #188bf6;
    --snap-blue-deep:   #062f94;
    --snap-blue-tint:   #eef3ff;
    --snap-blue-tint-2: #dde7ff;

    --snap-green:       #16a34a;
    --snap-green-deep:  #15803d;
    --snap-green-tint:  #dcfce7;

    --snap-amber:       #b45309;
    --snap-amber-tint:  #fef3c7;

    --snap-red:         #b42318;
    --snap-red-tint:    #fee4e2;

    --snap-purple:      #6941c6;
    --snap-purple-tint: #ede9fe;

    /* Surfaces */
    --bg:           #f7f8fb;
    --surface:      #ffffff;
    --surface-alt:  #fafbfc;
    --surface-hover:#f4f6fa;

    --border:        #e4e7ec;
    --border-strong: #d0d5dd;

    /* Text */
    --text:           #101828;
    --text-secondary: #344054;
    --text-muted:     #667085;
    --text-faint:     #98a2b3;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow:     0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md:  0 4px 8px -2px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
    --shadow-lg:  0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
    --focus-ring: 0 0 0 3px rgba(8, 54, 185, 0.18);

    /* Layout */
    --sidebar-w: 248px;
    --content-pad: 36px;
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    /* Type */
    --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Client portal: full-width top strip, then sidebar + main row */
body.clinic-portal-body {
    flex-direction: column;
}
.clinic-surface {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

/* Referral program CTA — edge-to-edge under browser chrome */
.clinic-refer-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    flex-shrink: 0;
    width: 100%;
    background: linear-gradient(90deg, #0836b9 0%, #188bf6 100%);
    color: #fff;
    border-radius: 0;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(8, 54, 185, 0.2);
    font-family: inherit;
    transition: filter 0.08s ease;
    box-sizing: border-box;
}
.clinic-refer-strip:hover {
    filter: brightness(1.04);
    color: #fff;
}
.clinic-refer-strip__badge {
    flex-shrink: 0;
    background: #37ca37;
    color: #052e05;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.7px;
}
.clinic-refer-strip__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    line-height: 1.35;
    min-width: 0;
}
.clinic-refer-strip__text strong { color: #fff; font-weight: 700; }
.clinic-refer-strip__sub {
    color: #dbe7ff;
    font-size: 12px;
    font-weight: 400;
}
.clinic-refer-strip__cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.clinic-refer-strip:hover .clinic-refer-strip__cta { background: rgba(255, 255, 255, 0.28); }
@media (max-width: 640px) {
    .clinic-refer-strip { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
    .clinic-refer-strip__text { font-size: 13px; width: 100%; order: 2; }
    .clinic-refer-strip__badge { order: 1; }
    .clinic-refer-strip__cta { order: 3; margin-left: auto; }
}

a { color: var(--snap-blue); text-decoration: none; }
a:hover { color: var(--snap-blue-deep); }

/* ============== SIDEBAR ============== */

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    padding: 22px 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 6px;
}

.sidebar .brand img {
    height: 28px;
    width: auto;
    object-fit: contain;
    object-position: left center;
    align-self: flex-start;
}

.sidebar .brand .label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar nav a.active {
    background: var(--snap-blue-tint);
    color: var(--snap-blue);
    font-weight: 600;
}

/* Matches both the legacy <a> link and the new <button> inside the
   CSRF-posting form. The button carries style="all:unset" inline, so
   these rules need to re-establish the layout and color treatment to
   match the rest of the sidebar nav. */
.sidebar nav a.signout,
.sidebar nav .signout-form .signout {
    margin-top: 8px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 14px;
    font-size: 14px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    background: transparent;
    /* Reset <button> defaults so the signout row has the exact same
       height, padding, and typography as the sibling <a> nav links. */
    border: none;
    text-align: left;
    font-family: inherit;
    line-height: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.sidebar nav a.signout:hover,
.sidebar nav .signout-form .signout:hover,
.sidebar nav .signout-form .signout:focus-visible {
    background: var(--surface-hover);
    color: var(--snap-red);
    outline: none;
}

.sidebar nav .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    stroke-width: 1.8;
}

.sidebar nav a.active .nav-icon { color: var(--snap-blue); }

/* Impressions: sidebar group (Send to Snap / Track to Snap) */
.sidebar nav .nav-item-group {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 2px 0 4px;
    padding: 0 0 4px;
    border-left: 2px solid var(--border);
    margin-left: 10px;
    padding-left: 2px;
}
.sidebar nav .nav-item-group__title {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 14px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}
.sidebar nav .nav-sublink {
    display: flex;
    align-items: center;
    padding: 7px 14px 7px 22px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    margin: 0 0 0 4px;
}
.sidebar nav .nav-sublink:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.sidebar nav .nav-sublink.active {
    background: var(--snap-blue-tint);
    color: var(--snap-blue);
    font-weight: 600;
}

.sidebar .help {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
}
.sidebar .help .heading {
    color: var(--text);
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.sidebar .help a {
    color: var(--snap-blue);
    text-decoration: none;
    font-weight: 500;
}
.sidebar .help a:hover { color: var(--snap-blue-deep); text-decoration: underline; }

.sidebar .user-info {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.sidebar .user-info .name { color: var(--text); font-weight: 600; line-height: 1.3; }
.sidebar .user-info .secondary {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 3px;
    word-break: break-word;
}

/* ============== MAIN CONTENT ============== */

.main {
    flex: 1;
    padding: var(--content-pad);
    overflow-y: auto;
    min-width: 0;
}

.main > .container { max-width: 1180px; margin: 0 auto; }

.page-header { margin-bottom: 28px; }
.page-header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 28px 0 14px;
    letter-spacing: -0.01em;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--snap-blue);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 16px;
}
.back-link:hover { color: var(--snap-blue-deep); }

/* ============== CARDS ============== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.card-header h2 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.card-header .desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ============== HERO STATS (dashboard top) ============== */

.hero-pair {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.hero-stat,
.savings-stat {
    color: white;
    padding: 28px 32px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    min-height: 152px;
}

.savings-stat {
    display: flex;
    align-items: center;
    gap: 24px;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}
.hero-stat .hs-main {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.flight-track {
    display: block;
    width: 100%;
    height: 36px;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.hero-stat        { background: linear-gradient(120deg, var(--snap-blue)  0%, var(--snap-blue-deep)   100%); }
.savings-stat     { background: linear-gradient(120deg, var(--snap-green) 0%, var(--snap-green-deep) 100%); }

.hero-stat::after,
.savings-stat::after {
    content: "";
    position: absolute; top: -40%; right: -10%;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, transparent 70%);
    pointer-events: none;
}

.hero-stat .big,
.savings-stat .big {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
    flex-shrink: 0;
}
.hero-stat .label,
.savings-stat .label {
    font-size: 17px;
    font-weight: 600;
    opacity: 0.97;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.hero-stat .sub,
.savings-stat .sub {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 6px;
    line-height: 1.45;
    max-width: 320px;
}

.savings-stat .savings-pct {
    display: inline-block;
    background: rgba(255,255,255,0.16);
    color: white;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    letter-spacing: 0.01em;
}

.savings-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    margin: -10px 0 24px;
    font-style: italic;
}

@media (max-width: 860px) {
    .hero-pair { grid-template-columns: 1fr; gap: 12px; }
    .hero-stat, .savings-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 22px;
        min-height: 0;
    }
    .hero-stat .big, .savings-stat .big { font-size: 42px; }
    .hero-stat .sub, .savings-stat .sub { max-width: 100%; }
}

/* ============== STAT CARDS ============== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}
.stat-card .value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-card .value.brand   { color: var(--snap-blue); }
.stat-card .value.success { color: var(--snap-green); }
.stat-card .value.warn    { color: var(--snap-amber); }

/* Clickable variant — applied when a stat-card is rendered as an anchor
   so it deep-links into the filtered cases list. Inherit color/decoration
   so the numbers don't get the default browser link styling. */
a.stat-card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a.stat-card:hover {
    border-color: var(--snap-blue);
    box-shadow: 0 2px 10px rgba(8, 54, 185, 0.08);
    transform: translateY(-1px);
}
a.stat-card:focus-visible {
    outline: 2px solid var(--snap-blue);
    outline-offset: 2px;
}

/* ============== TABS ============== */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.tab {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--snap-blue);
    border-bottom-color: var(--snap-blue);
    font-weight: 600;
}
.tab .count {
    color: var(--text-faint);
    margin-left: 4px;
    font-size: 12px;
}
.tab.active .count { color: var(--snap-blue); }

/* ============== TABLES ============== */

.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* overflow-x:auto lets wide tables scroll sideways on narrow
       viewports instead of clipping the rightmost column; overflow-y
       stays hidden so the rounded corners stay sharp. */
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: var(--shadow-sm);
}

table.data {
    width: 100%;
    border-collapse: collapse;
}
table.data thead th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
}
table.data tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
    color: var(--text);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-alt); }
table.data .muted { color: var(--text-muted); }
table.data .num   { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }
table.data a.row-link { color: var(--snap-blue); font-weight: 500; }
table.data a.row-link:hover { color: var(--snap-blue-deep); text-decoration: underline; }

/* ============== BADGES (status pills) ============== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-active     { background: var(--snap-blue-tint);   color: var(--snap-blue); }
.badge-in-transit { background: var(--snap-amber-tint);  color: var(--snap-amber); }
.badge-complete   { background: var(--snap-green-tint);  color: var(--snap-green-deep); }
.badge-dead       { background: var(--snap-red-tint);    color: var(--snap-red); }
.badge-unknown    { background: #f2f4f7;                  color: var(--text-muted); }

/* invoice-specific */
.badge-pending    { background: var(--snap-amber-tint);  color: var(--snap-amber); }
.badge-charged    { background: var(--snap-green-tint);  color: var(--snap-green-deep); }
.badge-declined   { background: var(--snap-red-tint);    color: var(--snap-red); }
.badge-nopm       { background: var(--snap-purple-tint); color: var(--snap-purple); }

/* tracking pill (carrier + number) */
.tracking-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--snap-blue-tint);
    color: var(--snap-blue);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    font-family: var(--font-mono);
}

/* Per-row "Download receipt" button in the All Cases table. Subtle so
   it doesn't compete with the primary row link (the case ID), but tall
   enough to be a comfortable click target. Stays blue on hover so it
   reads as the action column. */
.receipt-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1;
    transition: all 0.12s ease;
    white-space: nowrap;
}
.receipt-btn:hover {
    background: var(--snap-blue-tint);
    color: var(--snap-blue);
    border-color: var(--snap-blue);
}
.receipt-btn svg { flex-shrink: 0; }
.tracking-pill:hover {
    background: var(--snap-blue-tint-2);
    color: var(--snap-blue-deep);
}
.tracking-pill .carrier { font-family: var(--font-sans); font-weight: 600; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    line-height: 1.2;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-muted); color: var(--text); }
.btn:focus-visible { box-shadow: var(--focus-ring); outline: none; }

.btn-primary {
    background: var(--snap-blue);
    border-color: var(--snap-blue);
    color: white;
}
.btn-primary:hover {
    background: var(--snap-blue-deep);
    border-color: var(--snap-blue-deep);
    color: white;
}

.btn-success {
    background: var(--snap-green);
    border-color: var(--snap-green);
    color: white;
}
.btn-success:hover {
    background: var(--snap-green-deep);
    border-color: var(--snap-green-deep);
    color: white;
}

.btn-ghost { border-color: var(--border); color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ============== FORMS ============== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder { color: var(--text-faint); }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--snap-blue);
    box-shadow: var(--focus-ring);
}

label.field-label,
.field-label {
    display: block;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 500;
}
.field-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row { margin-bottom: 18px; max-width: 420px; }

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

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-err  { background: var(--snap-red-tint);   color: #7a271a; border-color: #fda4af; }
.alert-ok   { background: var(--snap-green-tint); color: var(--snap-green-deep); border-color: #86efac; }
.alert-info { background: var(--snap-blue-tint);  color: var(--snap-blue-deep);  border-color: #c7d7ff; }

/* ============== SEARCH BAR ============== */

.smart-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.smart-bar:focus-within {
    border-color: var(--snap-blue);
    box-shadow: var(--focus-ring);
}
.smart-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    padding: 9px 4px;
    font-family: inherit;
    box-shadow: none;
}
.smart-bar input:focus { box-shadow: none; }
.smart-bar .icon {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.date-row {
    display: flex; gap: 12px; align-items: end; margin-top: 14px;
    flex-wrap: wrap;
}
.date-row .field { display: flex; flex-direction: column; min-width: 140px; }
.date-row label {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
    font-weight: 500;
}
.date-row input[type="date"] { padding: 8px 10px; font-size: 13px; }

.search-actions {
    display: flex; gap: 8px; margin-top: 14px; align-items: center;
}
.result-count {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: auto;
}

/* ============== DETAIL GRID (case detail) ============== */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    max-width: 920px;
    margin-bottom: 24px;
}
.detail-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.detail-item .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}
.detail-item .val {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}
.detail-item .val.muted { color: var(--text-muted); font-weight: 400; }

/* ============== EMPTY STATES ============== */

.empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.empty .big {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
.empty .sub { font-size: 14px; color: var(--text-muted); }

/* ============== SMALL HELPERS ============== */

.muted { color: var(--text-muted); }
.right { text-align: right; }
.flex-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; padding: 0; }

.dot {
    display: inline-block; width: 6px; height: 6px;
    border-radius: 50%; vertical-align: middle; margin-right: 4px;
}
.dot-active   { background: var(--snap-blue); }
.dot-success  { background: var(--snap-green); }
.dot-warn     { background: var(--snap-amber); }
.dot-danger   { background: var(--snap-red); }

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

@media (max-width: 860px) {
    body { flex-direction: column; }
    body.clinic-portal-body .clinic-surface {
        flex-direction: column;
    }
    .sidebar {
        width: 100%; height: auto; position: static;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .sidebar .brand { padding: 14px 16px 12px; }
    .sidebar nav {
        flex-direction: row; flex-wrap: wrap; gap: 4px;
        padding: 10px 12px; overflow-x: auto;
    }
    .sidebar nav a { padding: 7px 12px; font-size: 13px; }
    .sidebar nav a.signout { margin-top: 0; }
    .sidebar .user-info, .sidebar .help { display: none; }
    .main { padding: 22px 18px; }
    .page-header h1 { font-size: 24px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    table.data thead th { padding: 10px 12px; font-size: 11px; }
    table.data tbody td { padding: 12px; font-size: 13px; }
    .detail-grid { grid-template-columns: 1fr; }
}

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

.login-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-shell .login-brand {
    flex: 1;
    background: linear-gradient(135deg, var(--snap-blue) 0%, var(--snap-blue-deep) 100%);
    color: white;
    padding: 60px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-shell .login-brand::after {
    content: "";
    position: absolute; top: -20%; right: -25%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.login-shell .login-brand .wordmark img { height: 36px; filter: brightness(0) invert(1); }
.login-shell .login-brand .pitch {
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-shell .login-brand .pitch h2 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 14px;
}
.login-shell .login-brand .pitch p {
    font-size: 16px;
    line-height: 1.55;
    opacity: 0.92;
}
.login-shell .login-brand .footer {
    font-size: 13px;
    opacity: 0.65;
    position: relative;
    z-index: 1;
}

.login-shell .login-form-wrap {
    flex: 0 0 460px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.login-shell .login-card {
    width: 100%;
    max-width: 360px;
}
.login-shell .login-card h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.login-shell .login-card .lead {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}
.login-shell form { display: flex; flex-direction: column; gap: 14px; }
.login-shell button[type="submit"] {
    margin-top: 6px;
    padding: 11px;
    font-size: 15px;
}
.login-shell .portal-hint {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 860px) {
    .login-shell { flex-direction: column; }
    .login-shell .login-brand {
        flex: 0 0 auto;
        padding: 36px 28px;
    }
    .login-shell .login-brand .pitch h2 { font-size: 26px; }
    .login-shell .login-brand .footer { display: none; }
    .login-shell .login-form-wrap { flex: 1; padding: 30px 22px; }
}
