/* ═══════════════════════════════════════════════════════════
   DigiHealth — Patient Portal
   Editorial system: ink on paper, periwinkle blocks, hairlines,
   massive Archivo display type, underline navigation.

   Tokens are the single source of truth — every color, radius,
   and speed in this file derives from :root.
   ═══════════════════════════════════════════════════════════ */

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

:root {
    /* color */
    --ink: #15161A;
    --ink-deep: #000000;
    --paper: #FFFFFF;
    --peri: #6376CE;
    /* periwinkle block color from reference */
    --peri-deep: #4D5FB0;
    --peri-tint: #EDF0FB;
    --peri-soft: #C9D1F0;
    --hairline: #E6E6E3;
    --muted: #70737B;
    /* secondary text */
    --faint: #ADAFB6;
    /* placeholders, indices, tertiary */
    --on-peri: rgba(255, 255, 255, .88);
    --on-peri-dim: rgba(255, 255, 255, .72);
    --on-peri-line: rgba(255, 255, 255, .28);
    --error: #B3261E;
    --error-bg: #FBEDEC;
    --error-line: #F0CFCC;
    /* shape & motion */
    --r-block: 14px;
    --r-card: 10px;
    --speed: .15s;
    /* type */
    --font-display: 'Archivo', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --track-label: .13em;
}

html {
    scroll-behavior: smooth;
    height: 100%
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    height: 100%;
}

.hidden {
    display: none !important
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
    font-size: inherit
}

button:disabled {
    cursor: not-allowed;
    opacity: .55
}

input {
    font-family: inherit
}

a {
    color: inherit
}

img,
svg {
    display: block;
    max-width: 100%
}

ul {
    list-style: none
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: #D6D6D2;
    border-radius: 99px
}

:focus-visible {
    outline: 2px solid var(--peri);
    outline-offset: 2px
}

@media (prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important
    }

    html {
        scroll-behavior: auto
    }
}

.noscript-banner {
    background: var(--ink);
    color: #fff;
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 100;
    background: var(--ink);
    color: #fff;
    border-radius: 0 0 8px 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: top var(--speed) ease;
}

.skip-link:focus {
    top: 0
}

/* ── Shared atoms ─────────────────────────────────────────── */
.eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    color: var(--muted);
}

.eyebrow-light {
    color: var(--on-peri)
}

.rule {
    border: none;
    border-top: 1px solid var(--hairline);
    margin: 56px 0
}

.rule-tight {
    margin: 32px 0 48px
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 9px 9px 20px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    transition: transform var(--speed) ease, background var(--speed) ease;
}

.btn-pill:hover:not(:disabled) {
    transform: translateY(-1px)
}

.btn-pill:active:not(:disabled) {
    transform: translateY(0)
}

.pill-arrow {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.btn-dark .pill-arrow {
    background: rgba(255, 255, 255, .16)
}

.btn-dark:hover:not(:disabled) {
    background: var(--ink-deep)
}

.btn-light {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--hairline);
    transition: background var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease;
}

.btn-light:hover:not(:disabled) {
    background: var(--peri-tint);
    border-color: var(--peri-deep);
    color: var(--peri-deep);
}

.btn-light .pill-arrow {
    background: var(--peri-tint);
    color: var(--peri-deep)
}

.full-width {
    width: 100%;
    justify-content: space-between
}

.form-error {
    font-size: 12.5px;
    color: var(--error);
    background: var(--error-bg);
    border: 1px solid var(--error-line);
    border-radius: 8px;
    padding: 9px 12px;
}

/* ═══ AUTH — dark sage-glass landing ═══════════════════════
   Scoped to .auth-screen; the in-app editorial system is
   untouched. Tokens for this surface live here.            */
.auth-screen {
    --night: #0E1512;
    --night-2: #13201A;
    --sage: #8FC7A0;
    --sage-bright: #A9DCB9;
    --mist: #9CC4E0;
    --on-night: #E9F0EB;
    --on-night-dim: #93A89B;
    --night-line: rgba(255, 255, 255, .10);
    --glass: rgba(255, 255, 255, .05);

    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 20px;
    background:
        radial-gradient(700px 420px at 12% 8%, rgba(168, 216, 182, .55), transparent 65%),
        radial-gradient(680px 460px at 90% 90%, rgba(160, 200, 226, .5), transparent 65%),
        linear-gradient(135deg, #E2EFE3 0%, #D7E7EC 100%);
    font-family: 'Outfit', var(--font-body);
}

.auth-shell {
    position: relative;
    width: 100%;
    max-width: 1100px;
    background:
        radial-gradient(520px 340px at 78% 0%, rgba(143, 199, 160, .16), transparent 70%),
        radial-gradient(420px 300px at 0% 100%, rgba(156, 196, 224, .10), transparent 70%),
        linear-gradient(160deg, var(--night-2) 0%, var(--night) 55%);
    border-radius: 28px;
    overflow: hidden;
    color: var(--on-night);
    padding: 30px 44px 0;
    box-shadow: 0 30px 80px rgba(14, 21, 18, .35);
}

/* glossy orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none
}

.orb-a {
    width: 46px;
    height: 46px;
    top: 108px;
    left: 26px;
    background: radial-gradient(circle at 32% 28%, #fff 0%, #CFE6F2 22%, #9CC4E0 48%, #4D6E84 100%);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .35));
}

.orb-b {
    width: 26px;
    height: 26px;
    top: 188px;
    left: 118px;
    background: radial-gradient(circle at 32% 28%, #fff 0%, #D8EFDE 25%, #8FC7A0 55%, #43705333 100%);
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .3));
}

.orb-c {
    width: 16px;
    height: 16px;
    top: 84px;
    left: 172px;
    background: radial-gradient(circle at 32% 28%, #fff 0%, #E7D8F0 30%, #B49CD4 60%, #5d4a7a 100%);
    opacity: .9;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .3));
}

/* topbar */
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 26px;
}

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

.ring-logo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 5px solid var(--sage);
    background: transparent;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, .35), 0 2px 6px rgba(0, 0, 0, .35);
}

.auth-brand-name {
    font-weight: 500;
    font-size: 15.5px;
    letter-spacing: .01em
}

.auth-topbar-note {
    font-size: 12px;
    color: var(--on-night-dim);
    letter-spacing: .04em;
}

/* body grid */
.auth-body {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 48px;
    align-items: center;
    padding: 26px 0 38px;
}

.auth-intro {
    position: relative;
    min-height: 380px;
    padding-top: 18px
}

.auth-headline {
    font-weight: 300;
    font-size: clamp(42px, 5.4vw, 68px);
    line-height: 1.04;
    letter-spacing: -.015em;
    color: #fff;
    margin-bottom: 22px;
    position: relative;
    z-index: 1;
}

.auth-lede {
    max-width: 34ch;
    font-size: 13.5px;
    line-height: 1.7;
    font-weight: 300;
    color: var(--on-night-dim);
    margin-bottom: 34px;
}

/* capsule visual (pill-shaped “photo” stand-in) */
.auth-capsule {
    position: absolute;
    right: -6px;
    top: 96px;
    width: min(250px, 42%);
    aspect-ratio: 2/1.05;
    border-radius: 999px;
    overflow: hidden;
    background:
        radial-gradient(120% 140% at 30% 20%, rgba(255, 255, 255, .34), transparent 55%),
        linear-gradient(150deg, #DCE9E2 0%, #AFC9BC 45%, #5F7E6E 100%);
    border: 1px solid rgba(255, 255, 255, .35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .4), inset 0 1px 1px rgba(255, 255, 255, .5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.capsule-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .4) 48%, transparent 58%);
}

.capsule-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--sage);
    box-shadow: 0 6px 16px rgba(20, 40, 28, .35), inset 0 1px 2px rgba(255, 255, 255, .5);
    position: relative;
}

.capsule-ring::after {
    content: '';
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    background: #fff;
    opacity: .92;
}

.auth-wave {
    width: min(440px, 86%);
    height: 24px;
    display: block;
    opacity: .9
}

/* form glass card */
.auth-card {
    background: var(--glass);
    border: 1px solid var(--night-line);
    border-radius: 22px;
    padding: 34px 32px 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-title {
    font-weight: 400;
    font-size: 27px;
    letter-spacing: -.01em;
    color: #fff;
    margin-bottom: 6px;
}

.auth-sub {
    color: var(--on-night-dim);
    font-size: 13px;
    font-weight: 300;
    margin-bottom: 28px
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 7px
}

.field-group label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--on-night-dim);
}

.field-group input,
.field-group select {
    border: 1px solid var(--night-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    padding: 11px 14px;
    font-size: 14px;
    color: var(--on-night);
    font-family: inherit;
    transition: border-color var(--speed) ease, background var(--speed) ease;
}

.field-group input::placeholder {
    color: #5F7468
}

.field-group input:focus,
.field-group select:focus {
    outline: none;
    border-color: var(--sage);
    background: rgba(255, 255, 255, .07);
}

.field-group select option {
    background: var(--night-2);
    color: var(--on-night);
}

.auth-screen :focus-visible {
    outline-color: var(--sage)
}

.login-tabs, .register-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--night-line);
    padding-bottom: 2px;
}

.login-tab, .register-tab {
    flex: 1;
    text-align: center;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--on-night-dim);
    border-bottom: 2px solid transparent;
    transition: color var(--speed) ease, border-bottom-color var(--speed) ease;
}

.login-tab:hover, .register-tab:hover {
    color: #fff;
}

.login-tab.active, .register-tab.active {
    color: var(--sage-bright);
    font-weight: 600;
    border-bottom-color: var(--sage);
}

.auth-switch {
    margin-top: 22px;
    font-size: 12.5px;
    font-weight: 300;
    color: var(--on-night-dim)
}

.auth-switch a {
    color: var(--sage-bright);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px
}

/* sage CTA pill */
.btn-sage {
    background: var(--sage);
    color: var(--night)
}

.btn-sage .btn-label {
    font-weight: 600
}

.btn-sage .pill-arrow {
    background: rgba(14, 21, 18, .18);
    color: var(--night)
}

.btn-sage:hover:not(:disabled) {
    background: var(--sage-bright)
}

/* error on dark */
.auth-screen .form-error {
    color: #FFB4AD;
    background: rgba(179, 38, 30, .16);
    border: 1px solid rgba(255, 180, 173, .3);
}

/* bottom feature strip */
.auth-strip {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
    border-top: 1px solid var(--night-line);
    padding: 16px 0 18px;
}

.strip-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: .03em;
    color: var(--on-night-dim);
}

.strip-item::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sage);
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(143, 199, 160, .6);
}

@media (max-width:980px) {
    .auth-shell {
        padding: 24px 26px 0
    }

    .auth-body {
        grid-template-columns: 1fr;
        gap: 30px;
        padding-bottom: 30px
    }

    .auth-intro {
        min-height: 0;
        padding-top: 6px
    }

    .auth-capsule {
        position: relative;
        right: auto;
        top: auto;
        width: min(240px, 70%);
        margin: 0 0 26px;
    }

    .auth-lede {
        margin-bottom: 24px
    }

    .orb-a {
        top: 88px;
        left: 8px;
        width: 36px;
        height: 36px
    }

    .orb-b {
        top: 150px;
        left: 78px
    }

    .orb-c {
        top: 70px;
        left: 128px
    }

    .auth-strip {
        gap: 18px 28px
    }
}

/* ═══ APP SHELL ════════════════════════════════════════════ */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 28px;
    height: 62px;
    flex-shrink: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
}

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

.brand-mark {
    width: 12px;
    height: 12px;
    background: var(--peri);
    border-radius: 3px;
    position: relative;
    flex-shrink: 0;
}

.brand-mark::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: #fff;
    border-radius: 1px;
    clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%);
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -.02em;
}

.topbar-nav {
    display: flex;
    gap: 4px
}

.topnav-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: color var(--speed) ease;
}

.topnav-btn:hover {
    color: var(--ink)
}

.topnav-btn.active {
    color: var(--ink);
    font-weight: 600;
    border-bottom-color: var(--ink)
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 18px
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 9px
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge.badge-low {
    background: rgba(34, 197, 94, 0.1);
    color: rgb(34, 197, 94);
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.badge.badge-medium {
    background: rgba(249, 115, 22, 0.1);
    color: rgb(249, 115, 22);
    border: 1px solid rgba(249, 115, 22, 0.2);
}
.badge.badge-high {
    background: rgba(239, 68, 68, 0.1);
    color: rgb(239, 68, 68);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--peri);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-display);
}

.user-name {
    font-size: 13px;
    font-weight: 600
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    padding: 7px 14px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    transition: color var(--speed) ease, border-color var(--speed) ease;
}

.btn-logout:hover {
    color: var(--ink);
    border-color: var(--ink)
}

/* ── Layout ── */
.content-wrapper {
    display: flex;
    flex: 1;
    min-height: 0
}

.sidebar {
    width: 228px;
    flex-shrink: 0;
    border-right: 1px solid var(--hairline);
    padding: 30px 22px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: var(--track-label);
    color: var(--muted);
}

.sidebar-nav {
    display: flex;
    flex-direction: column
}

.sidenav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 2px;
    text-align: left;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
    transition: color var(--speed) ease;
}

.sidenav-btn:first-child {
    border-top: 1px solid var(--hairline)
}

.sidenav-btn:hover {
    color: var(--ink)
}

.sidenav-btn.active {
    color: var(--ink);
    font-weight: 600
}

.sidenav-index {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--faint);
    width: 18px;
    flex-shrink: 0;
    transition: color var(--speed) ease;
}

.sidenav-btn.active .sidenav-index {
    color: var(--peri-deep)
}

.chat-badge {
    margin-left: auto;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--peri-deep);
    background: var(--peri-tint);
    padding: 3px 8px;
    border-radius: 999px;
}

.sidebar-foot {
    margin-top: auto;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--faint);
    max-width: 20ch
}

/* main-content is a flex column so the chat view can fill the
   remaining height without any hardcoded calc() offsets */
.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 36px 44px 0;
}

.main-content:focus {
    outline: none
}

/* Views */
.view {
    display: none;
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    animation: viewIn .3s ease;
}

.view.active {
    display: block
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(6px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

/* ═══ HOME ═════════════════════════════════════════════════ */
.display-row {
    overflow: hidden;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 26px
}

.display-word {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    font-size: clamp(54px, 9.5vw, 128px);
    line-height: .95;
    letter-spacing: -.045em;
    white-space: nowrap;
}

/* Hero block */
.hero-block {
    background: var(--peri);
    color: #fff;
    border-radius: var(--r-block);
    padding: 46px 48px 0;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    column-gap: 32px;
}

.hero-copy {
    padding-bottom: 44px
}

.hero-heading {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(34px, 4.2vw, 52px);
    line-height: 1.02;
    letter-spacing: -.03em;
    margin: 16px 0 18px;
    overflow-wrap: anywhere;
}

.hero-sub {
    max-width: 42ch;
    color: var(--on-peri);
    margin-bottom: 26px
}

.hero-illo {
    align-self: end;
    justify-self: center;
    width: min(300px, 100%);
    margin-bottom: -6px
}

.hero-note {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--on-peri-line);
    padding: 16px 0 18px;
    font-size: 12px;
    color: var(--on-peri-dim);
}

.hero-note p {
    max-width: 52ch
}

.hero-note-link {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Trust strip */
.trust-strip {
    display: flex;
    align-items: center;
    gap: 36px;
    margin-top: 30px
}

.trust-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.5;
    flex-shrink: 0;
}

.trust-items {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 30px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--faint);
}

.trust-items li {
    display: flex;
    align-items: center;
    gap: 8px
}

.trust-items li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--peri-soft);
    flex-shrink: 0;
}

/* Section heads */
.section-head {
    margin-bottom: 34px
}

.section-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    margin-top: 12px;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(28px, 3.6vw, 44px);
    line-height: 1.02;
    letter-spacing: -.03em;
}

.section-side {
    max-width: 30ch;
    font-size: 12.5px;
    color: var(--muted);
    text-align: right
}

/* Services grid — image-top / text-bottom cards */
.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px
}

.service-card {
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color var(--speed) ease, transform var(--speed) ease;
}

.service-card:hover {
    border-color: var(--ink);
    transform: translateY(-2px)
}

.service-figure {
    padding: 18px 14px 10px
}

.fig-a,
.fig-c {
    background: var(--peri-tint)
}

.fig-b,
.fig-d {
    background: var(--peri-soft)
}

.service-body {
    padding: 16px 18px 20px;
    border-top: 1px solid var(--hairline)
}

.service-num {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.service-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16.5px;
    letter-spacing: -.01em;
    margin-bottom: 6px;
}

.service-desc {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.55
}

/* Process band */
.process-block {
    background: var(--peri);
    color: #fff;
    border-radius: var(--r-block);
    padding: 44px 48px 56px;
    margin-top: 56px;
}

.process-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    margin: 14px 0 38px;
}

.process-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(28px, 3.4vw, 42px);
    line-height: 1.02;
    letter-spacing: -.03em;
}

.process-side {
    max-width: 32ch;
    font-size: 12.5px;
    color: var(--on-peri);
    text-align: right
}

.process-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px
}

.process-step {
    border-top: 1px solid rgba(255, 255, 255, .35);
    padding-top: 18px
}

.step-offset {
    transform: translateY(22px)
}

.step-num {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 5px;
    padding: 3px 7px;
    margin-bottom: 14px;
}

.process-step h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -.01em;
    margin-bottom: 8px;
}

.process-step p {
    font-size: 12.5px;
    color: var(--on-peri);
    max-width: 30ch
}

/* Quote card */
.quote-card {
    background: var(--ink);
    color: #fff;
    border-radius: var(--r-block);
    padding: 44px 48px;
}

.quote-mark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 64px;
    line-height: .6;
    display: block;
    margin-bottom: 18px;
    color: var(--peri-soft);
}

.quote-card blockquote {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(19px, 2.4vw, 27px);
    line-height: 1.3;
    letter-spacing: -.015em;
    max-width: 36ch;
    margin-bottom: 28px;
}

.quote-card figcaption {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, .22);
    padding-top: 16px;
}

.quote-who {
    font-size: 13px;
    font-weight: 600
}

.quote-role {
    font-size: 11.5px;
    color: rgba(255, 255, 255, .6)
}

/* FAQ */
.faq-section {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 48px
}

.faq-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px
}

.faq-list {
    display: flex;
    flex-direction: column
}

.faq-item {
    border-bottom: 1px solid var(--hairline)
}

.faq-item:first-child {
    border-top: 1px solid var(--hairline)
}

.faq-item summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.faq-item summary::-webkit-details-marker {
    display: none
}

.faq-toggle {
    width: 24px;
    height: 24px;
    border: 1px solid var(--hairline);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: border-color var(--speed) ease;
}

.faq-toggle::before,
.faq-toggle::after {
    content: '';
    position: absolute;
    background: var(--ink);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.faq-toggle::before {
    width: 10px;
    height: 1.6px
}

.faq-toggle::after {
    width: 1.6px;
    height: 10px;
    transition: opacity var(--speed) ease
}

.faq-item[open] .faq-toggle::after {
    opacity: 0
}

.faq-item summary:hover .faq-toggle {
    border-color: var(--ink)
}

.faq-item p {
    padding: 0 36px 18px 2px;
    font-size: 13px;
    color: var(--muted);
    max-width: 58ch
}

/* Footer */
.footer-block {
    background: var(--peri);
    color: #fff;
    border-radius: var(--r-block) var(--r-block) 0 0;
    padding: 44px 48px 24px;
    margin-top: 64px;
    overflow: hidden;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.footer-tagline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -.015em;
}

.footer-links {
    display: flex;
    gap: 56px
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 9px;
    align-items: flex-start
}

.footer-link {
    font-size: 13px;
    color: var(--on-peri);
    padding: 0;
    text-underline-offset: 3px;
}

.footer-link:hover {
    text-decoration: underline
}

.footer-word {
    font-family: var(--font-display);
    font-weight: 800;
    text-transform: uppercase;
    font-size: clamp(44px, 9.4vw, 150px);
    line-height: .9;
    letter-spacing: -.04em;
    text-align: center;
    white-space: nowrap;
    color: #fff;
    user-select: none;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-top: 1px solid var(--on-peri-line);
    margin-top: 34px;
    padding-top: 16px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--on-peri-dim);
}

/* ═══ SUB-VIEWS (visits / prescriptions / reports) ═════════ */
.view-head {
    margin-top: 6px
}

.view-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.02;
    letter-spacing: -.03em;
    margin: 12px 0 8px;
}

.view-sub {
    color: var(--muted);
    font-size: 13.5px
}

.empty-state {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
    padding-bottom: 72px;
}

.empty-illo {
    max-width: 300px;
    margin: 0 auto 10px
}

.empty-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -.01em;
    margin-bottom: 8px;
}

.empty-desc {
    color: var(--muted);
    font-size: 13px;
    max-width: 42ch;
    margin: 0 auto
}

.empty-cta {
    margin-top: 22px
}

/* ═══ CLINIC CHAT ══════════════════════════════════════════ */
/* Fills the rest of main-content via flex — no height calc() */
.view-chat.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding-bottom: 24px;
}

.chat-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
}

.chat-head .view-title {
    font-size: clamp(24px, 3vw, 34px);
    margin: 10px 0 0
}

.chat-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--peri-deep);
    background: var(--peri-tint);
    border-radius: 999px;
    padding: 6px 12px;
    white-space: nowrap;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--peri);
    animation: pulse 1.8s ease infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .35
    }
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 4px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-bubble-wrap {
    display: flex;
    gap: 11px;
    align-items: flex-end;
    max-width: 78%
}

.chat-bubble-wrap.user-wrap {
    align-self: flex-end;
    flex-direction: row-reverse
}

.chat-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-display);
}

.doctor-avatar {
    background: var(--peri-tint);
    border: 1px solid var(--peri-soft);
    padding: 6px
}

.doctor-avatar svg {
    width: 100%;
    height: 100%
}

.user-avatar-chat {
    background: var(--ink);
    color: #fff
}

.chat-bubble {
    padding: 12px 16px;
    font-size: 13.5px;
    line-height: 1.6;
    border-radius: 14px;
    overflow-wrap: anywhere;
}

.bot-bubble {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-bottom-left-radius: 4px;
}

.user-bubble {
    background: var(--peri);
    color: #fff;
    border-bottom-right-radius: 4px
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 3px 2px
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--peri-soft);
    animation: typing 1.2s ease infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: .15s
}

.typing-dots span:nth-child(3) {
    animation-delay: .3s
}

@keyframes typing {

    0%,
    100% {
        opacity: .35;
        transform: translateY(0)
    }

    50% {
        opacity: 1;
        transform: translateY(-3px)
    }
}

.chat-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    padding: 6px 6px 6px 20px;
    background: var(--paper);
    transition: border-color var(--speed) ease;
}

.chat-input-row:focus-within {
    border-color: var(--ink)
}

.chat-input-row input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--ink);
    min-width: 0;
}

.chat-input-row input:focus {
    outline: none
}

.chat-input-row input::placeholder {
    color: var(--faint)
}

.chat-input-row input:disabled {
    color: var(--faint)
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--speed) ease, transform var(--speed) ease;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--peri-deep);
    transform: translateY(-1px)
}

/* ═══ RESPONSIVE ═══════════════════════════════════════════ */
@media (max-width:1080px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .step-offset {
        transform: none
    }
}

@media (max-width:900px) {
    .topbar {
        padding: 0 18px;
        gap: 12px
    }

    .topbar-nav {
        display: none
    }

    .content-wrapper {
        flex-direction: column
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--hairline);
        flex-direction: row;
        align-items: center;
        gap: 14px;
        flex-shrink: 0;
        padding: 10px 18px;
        overflow-x: auto;
    }

    .sidebar-section-label,
    .sidebar-foot {
        display: none
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 4px
    }

    .sidenav-btn,
    .sidenav-btn:first-child {
        border: none;
        border-bottom: 2px solid transparent;
        padding: 9px 10px;
        white-space: nowrap;
    }

    .sidenav-btn.active {
        border-bottom-color: var(--ink)
    }

    .sidenav-index {
        display: none
    }

    .main-content {
        padding: 24px 18px 0
    }

    .hero-block {
        grid-template-columns: 1fr;
        padding: 32px 26px 0
    }

    .hero-illo {
        justify-self: end;
        width: min(230px, 80%)
    }

    .hero-note {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px
    }

    .section-head-row,
    .process-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px
    }

    .section-side,
    .process-side {
        text-align: left
    }

    .process-block {
        padding: 32px 26px 36px
    }

    .process-grid {
        grid-template-columns: 1fr
    }

    .faq-section {
        grid-template-columns: 1fr;
        gap: 28px
    }

    .quote-card {
        padding: 32px 26px
    }

    .footer-block {
        padding: 32px 26px 20px
    }

    .footer-links {
        gap: 36px
    }

    .trust-strip {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px
    }
}

@media (max-width:560px) {
    .services-grid {
        grid-template-columns: 1fr
    }

    .user-name {
        display: none
    }

    .chat-bubble-wrap {
        max-width: 92%
    }
}

/* ═══ STAFF & CLINICAL WORKSPACE PORTAL STYLING ═══════════════ */

/* Role-based Navigation and View Visibility */
.app-shell[data-role="Patient"] .staff-only,
.app-shell[data-role="Patient"] .doctor-only,
.app-shell[data-role="Patient"] .admin-only {
    display: none !important;
}

.app-shell[data-role="Doctor"] .patient-only,
.app-shell[data-role="Doctor"] .admin-only {
    display: none !important;
}

.app-shell[data-role="Receptionist"] .patient-only,
.app-shell[data-role="Receptionist"] .doctor-only,
.app-shell[data-role="Receptionist"] .admin-only {
    display: none !important;
}

.app-shell[data-role="Admin"] .patient-only,
.app-shell[data-role="Admin"] .doctor-only {
    display: none !important;
}

/* Grids & Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.metric-card {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}

.metric-card:hover {
    border-color: var(--peri-soft);
    box-shadow: 0 4px 12px rgba(99, 118, 206, 0.05);
}

.metric-val {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.metric-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
    color: var(--muted);
}

/* Data Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    background: var(--paper);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: var(--peri-tint);
    color: var(--ink);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 2px solid var(--hairline);
    font-size: 11px;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--hairline);
    color: var(--ink);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--peri-tint);
}

.td-empty {
    text-align: center;
    color: var(--muted);
    padding: 36px !important;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.booked {
    background: #E8F0FE;
    color: #1967D2;
}

.status-badge.checked-in {
    background: #FFF4E5;
    color: #B06000;
}

.status-badge.completed {
    background: #E6F4EA;
    color: #137333;
}

.status-badge.cancelled {
    background: var(--error-bg);
    color: var(--error);
}

/* Actions Row */
.action-buttons-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-table-action {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border: 1px solid var(--hairline);
    border-radius: 99px;
    transition: background var(--speed) ease, border-color var(--speed) ease;
}

.btn-table-action:hover {
    border-color: var(--ink);
    background: var(--peri-tint);
}

.btn-table-action.primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.btn-table-action.primary:hover {
    background: var(--peri-deep);
    border-color: var(--peri-deep);
}

/* Form Styles */
.clinical-form {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-block);
    padding: 32px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 24px;
}

.form-grid .field-group.full-row {
    grid-column: span 2;
}

.clinical-form .field-group label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.clinical-form .field-group input,
.clinical-form .field-group select,
.clinical-form .field-group textarea {
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--paper);
    padding: 10px 12px;
    font-size: 13.5px;
    color: var(--ink);
    transition: border-color var(--speed) ease;
}

.clinical-form .field-group input:focus,
.clinical-form .field-group select:focus,
.clinical-form .field-group textarea:focus {
    outline: none;
    border-color: var(--peri);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-row label {
    margin-bottom: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 500 !important;
}

/* Profile Layouts */
.profile-layout,
.appointment-layout,
.prescription-workspace,
.user-mgmt-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    align-items: start;
}

/* Consultation: form wide, AI sidebar fixed */
.consultation-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 960px) {
    .profile-layout,
    .appointment-layout,
    .consultation-layout,
    .prescription-workspace,
    .user-mgmt-layout {
        grid-template-columns: 1fr;
    }
}

.consultation-inputs {
    min-width: 0; /* prevent grid blowout */
}

.consultation-ai-workspace {
    position: sticky;
    top: 24px;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.profile-sidebar-card,
.booking-card {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    padding: 24px;
}

.profile-card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-info-list li {
    font-size: 13px;
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 8px;
}

.profile-info-list li:last-child {
    border-bottom: none;
}

.profile-card-text {
    font-size: 13px;
    background: var(--peri-tint);
    border-radius: 8px;
    padding: 12px;
    line-height: 1.5;
}

/* Clinical Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 4px;
    width: 2px;
    background: var(--hairline);
}

.timeline-card {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    padding: 20px;
    position: relative;
}

.timeline-card::before {
    content: '';
    position: absolute;
    top: 24px;
    left: -20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--peri);
    border: 2px solid var(--paper);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline-meta {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.timeline-title {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 700;
}

.timeline-body {
    font-size: 13px;
    line-height: 1.5;
}

.timeline-empty {
    text-align: center;
    color: var(--muted);
    padding: 40px;
    border: 1px dashed var(--hairline);
    border-radius: var(--r-card);
}

/* AI Panel styles */
.ai-button-row {
    display: flex;
    gap: 12px;
}

.ai-result-panel {
    background: var(--peri-tint);
    border: 1px solid var(--peri-soft);
    border-radius: var(--r-card);
    padding: 20px;
    margin-top: 16px;
}

.ai-panel-title {
    font-family: var(--font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--peri-deep);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: var(--track-label);
}

.ai-content-box {
    font-size: 13px;
    line-height: 1.5;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 16px;
}

.soap-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.soap-editor textarea {
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    resize: vertical;
}

.soap-feedback-box {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

/* Prescription Creator layout */
.prescription-workspace {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
}

@media (max-width: 900px) {
    .prescription-workspace {
        grid-template-columns: 1fr;
    }
}

.med-item-form-box {
    background: var(--peri-tint);
    border-radius: var(--r-card);
    padding: 20px;
}

.prescription-ai-side {
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
    padding: 24px;
}

/* Search Bar */
.search-bar-row {
    display: flex;
    gap: 12px;
    max-width: 700px;
}

.search-bar-row input {
    flex: 1;
    border: 1px solid var(--hairline);
    border-radius: 99px;
    padding: 12px 20px;
    font-size: 13.5px;
}

.search-bar-row input:focus {
    outline: none;
    border-color: var(--peri);
}