:root {
    --bg: #f4efe6;
    --surface: #fffdf8;
    --ink: #1f2933;
    --muted: #5c6773;
    --line: #d8cfc1;
    --accent: #c76b2a;
    --accent-deep: #8b3c13;
    --accent-soft: #f3d1bb;
    --success: #2e7d4f;
    --warning: #8f4d0a;
    --shadow: 0 18px 40px rgba(56, 41, 29, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(199, 107, 42, 0.18), transparent 28%),
        linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
}

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

.shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(251, 247, 240, 0.88);
    border-bottom: 1px solid rgba(139, 60, 19, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.site-nav a {
    color: var(--muted);
    padding-bottom: 0.15rem;
    border-bottom: 2px solid transparent;
}

.site-nav a.is-active,
.site-nav a:hover {
    color: var(--accent-deep);
    border-color: var(--accent);
}

.header-auth {
    padding: 0.7rem 1rem;
    white-space: nowrap;
}

.header-auth.is-active {
    background: var(--accent-deep);
}

/* Mobile hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hero,
.section {
    padding: 4rem 0;
}

.hero-grid,
.cards,
.feature-grid,
.footer-grid,
.two-col,
.steps {
    display: grid;
    gap: 1.5rem;
}

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

.cards,
.feature-grid,
.steps,
.footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.eyebrow {
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(199, 107, 42, 0.12);
    color: var(--accent-deep);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    line-height: 1.05;
    margin: 0 0 1rem;
}

h1 {
    font-size: clamp(2.8rem, 5vw, 5rem);
}

h2 {
    font-size: clamp(2rem, 3vw, 3rem);
}

p {
    color: var(--muted);
    line-height: 1.7;
}

.panel,
.card,
.result-block,
.form-shell {
    background: var(--surface);
    border: 1px solid rgba(92, 103, 115, 0.14);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.panel,
.form-shell {
    padding: 2rem;
}

.card,
.result-block {
    padding: 1.5rem;
}

.cta-row,
.pill-row {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

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

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fffaf4;
    cursor: pointer;
}

.button.secondary {
    background: transparent;
    border-color: rgba(139, 60, 19, 0.24);
    color: var(--accent-deep);
}

.recall-results-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 1.5rem;
    align-items: center;
}

.recall-card-active {
    border-color: rgba(46, 125, 79, 0.22);
}

.recall-card-inactive {
    border-color: rgba(92, 103, 115, 0.18);
    background: rgba(255, 253, 248, 0.92);
}

.recall-status-pill-active {
    background: rgba(46, 125, 79, 0.14);
    color: var(--success);
}

.recall-status-pill-inactive {
    background: rgba(92, 103, 115, 0.12);
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(31, 41, 51, 0.06);
    color: var(--ink);
    font-size: 0.92rem;
}

.stat {
    font-size: 2rem;
    color: var(--accent-deep);
    font-weight: 700;
}

.field {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(92, 103, 115, 0.22);
    background: #fff;
}

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

.split-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.site-footer {
    padding: 3rem 0 4rem;
    border-top: 1px solid rgba(92, 103, 115, 0.12);
}

.site-footer a {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--muted);
}

.notice {
    padding: 1rem 1.2rem;
    border-radius: 16px;
    background: rgba(46, 125, 79, 0.1);
    color: var(--success);
}

.warning {
    background: rgba(143, 77, 10, 0.12);
    color: var(--warning);
}

.impersonation-bar {
    background: var(--ink);
    color: #fffaf4;
    font-size: 0.9rem;
}

.impersonation-bar a {
    color: #fffaf4;
    font-weight: 700;
}

.impersonation-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
}

.support-chat {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.support-chat-toggle {
    box-shadow: var(--shadow);
}

.support-chat-panel {
    width: min(380px, calc(100vw - 1.5rem));
    border-radius: 22px;
    border: 1px solid rgba(92, 103, 115, 0.14);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.support-chat-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(92, 103, 115, 0.12);
    background: linear-gradient(180deg, rgba(255, 253, 248, 1), rgba(243, 209, 187, 0.3));
}

.support-chat-header strong {
    display: block;
    margin-bottom: 0.2rem;
}

.support-chat-header p {
    margin: 0;
    font-size: 0.86rem;
}

.support-chat-close {
    background: transparent;
    color: var(--ink);
    border: 0;
    padding: 0;
    font-size: 1.6rem;
    line-height: 1;
}

.support-chat-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(251, 247, 240, 0.75);
}

.support-chat-message {
    display: flex;
    margin-bottom: 0.8rem;
}

.support-chat-message.is-self {
    justify-content: flex-end;
}

.support-chat-bubble {
    max-width: 88%;
    border-radius: 16px;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(92, 103, 115, 0.12);
}

.support-chat-bubble strong,
.support-chat-bubble p {
    display: block;
}

.support-chat-bubble strong {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.support-chat-bubble p {
    margin: 0;
    color: var(--ink);
    line-height: 1.5;
    font-size: 0.92rem;
}

.support-chat-bubble-visitor {
    background: rgba(199, 107, 42, 0.16);
}

.support-chat-bubble-assistant {
    background: #fff;
}

.support-chat-bubble-admin {
    background: rgba(46, 125, 79, 0.12);
}

.support-chat-form {
    padding: 0.95rem 1rem 1rem;
    border-top: 1px solid rgba(92, 103, 115, 0.12);
}

.support-chat-identity {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.support-chat-form textarea {
    min-height: 100px;
    margin-bottom: 0.75rem;
}

.support-chat-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.support-chat-status,
.support-chat-empty {
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .hero-grid,
    .two-col,
    .cards,
    .feature-grid,
    .steps,
    .footer-grid,
    .split-list {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .header-actions {
        order: 2;
        margin-left: 0;
    }

    .nav-toggle {
        display: flex;
        order: 3;
        margin-left: auto;
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
        order: 4;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(92, 103, 115, 0.08);
    }

    .hero-img {
        max-width: 340px;
    }

    .recall-results-grid {
        grid-template-columns: 1fr;
    }

    .impersonation-bar-inner,
    .support-chat-footer-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .support-chat {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .support-chat-panel {
        width: 100%;
    }

    .support-chat-identity {
        grid-template-columns: 1fr;
    }
}

/* Hero visual */
.hero-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-img {
    width: 100%;
    max-width: 520px;
    height: auto;
    filter: drop-shadow(0 12px 32px rgba(199, 107, 42, 0.12));
}

/* Step cards */
.step-card {
    text-align: center;
    padding: 2rem 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 48px rgba(56, 41, 29, 0.16);
}

.step-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    display: block;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fffaf4;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

/* Value cards */
.value-card {
    padding: 2rem 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.value-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 48px rgba(56, 41, 29, 0.16);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

/* Brand logo */
.brand img {
    height: 36px;
    width: auto;
}

/* Symptom mode toggle */
.intake-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(92, 103, 115, 0.22);
    width: fit-content;
}

.intake-toggle label {
    padding: 0.65rem 1.2rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--muted);
    background: var(--surface);
    transition: all 0.15s ease;
    user-select: none;
}

.intake-toggle input {
    display: none;
}

.intake-toggle input:checked + label {
    background: var(--accent);
    color: #fffaf4;
}

/* Symptom chips */
.symptom-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.symptom-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(199, 107, 42, 0.24);
    background: rgba(199, 107, 42, 0.06);
    color: var(--accent-deep);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.symptom-chip:hover,
.symptom-chip.selected {
    background: var(--accent);
    color: #fffaf4;
    border-color: var(--accent);
}

/* Diagnosis mode sections */
.intake-section {
    display: none;
}

.intake-section.active {
    display: block;
}

/* Guide / help steps */
.guide-steps {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.step-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid rgba(143, 77, 10, 0.1);
    border-radius: 10px;
    padding: 1.25rem;
}

.step-num {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.step-card p {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.97rem;
}

.step-card code {
    background: rgba(143, 77, 10, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.92em;
}
/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted, #888);
    animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat header actions (new chat + close) */
.support-chat-header-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
}
.support-chat-new {
    background: transparent;
    color: var(--ink);
    border: 1px solid rgba(92,103,115,0.2);
    border-radius: 6px;
    padding: 0;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-chat-new:hover {
    background: rgba(199,107,42,0.1);
}

/* Unread badge on chat toggle */
.support-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d32f2f;
    border: 2px solid #fff;
    animation: badgePulse 1.5s ease-in-out infinite;
}
.support-chat-toggle {
    position: relative;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Chat bubble header (name + timestamp) */
.support-chat-bubble-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}
.support-chat-time {
    font-size: 0.72rem;
    color: var(--muted, #888);
    font-weight: 400;
    white-space: nowrap;
}

/* Admin chat message header (admin panel) */
.admin-chat-message-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.admin-chat-time {
    font-size: 0.78rem;
    color: var(--muted, #888);
    font-weight: 400;
}

/* Auto-linkified URLs */
.support-chat-bubble a {
    color: var(--accent, #c76b2a);
    text-decoration: underline;
    word-break: break-all;
}
.support-chat-bubble a:hover {
    opacity: 0.8;
}
