:root {
    --bg: #0f172a;
    --panel: #111827;
    --card: #ffffff;
    --muted: #f3f4f6;
    --text: #111827;
    --text-light: #e5e7eb;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --border: #d1d5db;
    --success: #166534;
    --success-bg: #dcfce7;
    --error: #991b1b;
    --error-bg: #fee2e2;
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background: #f8fafc;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: var(--bg);
    color: var(--text-light);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner,
.footer-inner,
.page-header,
.hero-grid,
.split-grid,
.stats-grid,
.cards-grid {
    display: grid;
    gap: 24px;
}

.header-inner {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 18px 0;
}

.brand {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

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

.site-footer {
    background: var(--bg);
    color: var(--text-light);
    margin-top: 48px;
}

.footer-inner {
    grid-template-columns: 1fr 1fr;
    padding: 32px 0;
}

.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: var(--text-light);
    padding: 72px 0;
}

.hero-grid {
    grid-template-columns: 1.25fr 0.75fr;
    align-items: center;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(2.2rem, 4vw, 4rem);
}

.lead {
    font-size: 1.15rem;
    line-height: 1.7;
    max-width: 720px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 8px 14px;
    margin-bottom: 16px;
}

.hero-actions,
.inline-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.section { padding: 48px 0; }
.section.muted { background: var(--muted); }
.narrow { min-height: 60vh; display: grid; align-items: center; }
.narrow-container { width: min(540px, calc(100% - 32px)); }

.cards-grid {
    grid-template-columns: repeat(4, 1fr);
}
.cards-grid.two-columns { grid-template-columns: repeat(2, 1fr); }
.stats-grid { grid-template-columns: repeat(4, 1fr); }
.split-grid { grid-template-columns: 0.9fr 1.1fr; align-items: start; }
.page-header { grid-template-columns: 1fr auto; align-items: center; margin-bottom: 24px; }

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

.panel-preview { color: var(--text); }
.check-list { padding-left: 18px; margin: 0; line-height: 1.9; }

.button,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.button.primary,
.link-button {
    background: var(--primary);
    color: #fff;
}
.button.primary:hover,
.link-button:hover { background: var(--primary-dark); }
.button.ghost {
    background: transparent;
    border-color: rgba(255,255,255,0.35);
    color: inherit;
}
.button.ghost.small { padding: 10px 14px; }
.button.full { width: 100%; }
.link-button {
    appearance: none;
}

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

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}

textarea { resize: vertical; }

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

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

th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

th { font-size: 0.9rem; color: #475569; }

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
}

.stat-label { color: #475569; font-weight: 700; }

.flash-wrapper { margin-top: 18px; }
.flash {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-weight: 600;
}
.flash-success {
    background: var(--success-bg);
    color: var(--success);
}
.flash-error {
    background: var(--error-bg);
    color: var(--error);
}

.auth-card { max-width: 100%; }

@media (max-width: 960px) {
    .hero-grid,
    .split-grid,
    .cards-grid,
    .cards-grid.two-columns,
    .stats-grid,
    .page-header,
    .footer-inner,
    .header-inner {
        grid-template-columns: 1fr;
    }

    .main-nav {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}


.brand {
    display: inline-flex;
    align-items: center;
}
.brand img {
    height: 42px;
    width: auto;
    display: block;
}
.footer-logo {
    height: 40px;
    width: auto;
    display: block;
    margin-bottom: 10px;
}
.hero-logo {
    display: block;
    height: 62px;
    width: auto;
    margin-bottom: 18px;
}
@media (max-width: 960px) {
    .brand img { height: 38px; }
    .hero-logo { height: 54px; }
}


.hero-logo { width: 280px; max-width: 100%; margin-bottom: 14px; }
.footer-logo { width: 180px; max-width: 100%; }
.brand img { height: 34px; width: auto; display: block; }

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

.faq-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.emphasis-card {
    border: 2px solid rgba(29, 78, 216, 0.18);
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 700;
}

.pill-success {
    background: var(--success-bg);
    color: var(--success);
}

.pill-muted {
    background: #e5e7eb;
    color: #475569;
}

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

.faq-admin-list {
    display: grid;
    gap: 18px;
}

.faq-admin-item {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
}

.faq-admin-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.button.danger {
    background: #b91c1c;
    color: #fff;
}

.button.ghost.dark {
    color: var(--text);
    border-color: var(--border);
}

.small-button { padding: 10px 14px; }

.chatbot-toggle {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 80;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 18px 42px rgba(29, 78, 216, 0.36);
    padding: 16px 22px;
    cursor: pointer;
}

.chatbot-panel {
    position: fixed;
    right: 22px;
    bottom: 86px;
    width: min(380px, calc(100% - 24px));
    z-index: 90;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg);
    color: #fff;
    padding: 16px 18px;
}

.chatbot-header small {
    display: block;
    margin-top: 4px;
    color: rgba(255,255,255,0.75);
}

.chatbot-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.chatbot-messages {
    max-height: 290px;
    overflow-y: auto;
    padding: 18px;
    background: #f8fafc;
    display: grid;
    gap: 12px;
}

.chatbot-message {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.5;
}

.chatbot-message-bot {
    background: #fff;
    color: var(--text);
    border: 1px solid #e5e7eb;
}

.chatbot-message-user {
    justify-self: end;
    background: var(--primary);
    color: #fff;
}

.chatbot-message-system {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.chatbot-form {
    padding: 18px;
    display: grid;
    gap: 14px;
}

.chatbot-label {
    display: grid;
    gap: 10px;
}

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

.chatbot-option {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

.chatbot-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chatbot-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

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

@media (max-width: 640px) {
    .chatbot-panel {
        right: 12px;
        bottom: 78px;
        width: calc(100% - 24px);
    }

    .chatbot-toggle {
        right: 12px;
        bottom: 12px;
        width: calc(100% - 24px);
        border-radius: 18px;
    }
}

.split-grid-docs {
    grid-template-columns: 0.92fr 1.08fr;
}

.hint-box {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}

.warning-box {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.summary-preview-box {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

.summary-preview-box p,
.summary-preview-box h3 {
    margin: 0;
}

.summary-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.6;
}

.doc-summary-cell {
    min-width: 280px;
    color: #334155;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compact-form {
    margin-bottom: 12px;
}

.suggestions-list {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.suggestion-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    background: #fff;
}

.suggestion-item strong,
.suggestion-item p {
    display: block;
    margin: 0 0 8px;
}

.card-top-gap {
    margin-top: 24px;
}

.draft-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.card-top-gap { margin-top: 24px; }
.card-top-gap-sm { margin-top: 18px; }
.page-header-stack { grid-template-columns: 1fr; }
.stats-grid-three { grid-template-columns: repeat(3, 1fr); }
.two-columns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.detail-list {
    display: grid;
    gap: 14px;
}
.detail-list > div {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}
.detail-list strong {
    color: #475569;
}
.mini-list {
    display: grid;
    gap: 12px;
}
.mini-list-item {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #fff;
}
.mini-list-item span {
    color: #475569;
    font-size: 0.95rem;
}
@media (max-width: 960px) {
    .stats-grid-three,
    .two-columns-grid {
        grid-template-columns: 1fr;
    }
}


.page-header-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.inline-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.button.ghost.dark, .button.ghost.dark.small-button { border-color:#cbd5e1; color:#0f172a; background:#fff; }
.button.small-button { padding:10px 14px; }
.button.danger-outline { background:#fff; border-color:#fca5a5; color:#991b1b; }
.card-top-gap { margin-top: 24px; }
.card-top-gap-sm { margin-top: 16px; }
.detail-list { display:grid; gap:12px; }
.detail-list div { display:grid; gap:4px; padding:12px; border:1px solid #e5e7eb; border-radius:12px; background:#f8fafc; }
.mini-list { display:grid; gap:12px; }
.mini-list-item { padding:14px; border:1px solid #e5e7eb; border-radius:12px; background:#f8fafc; display:grid; gap:6px; }
.mini-list-item p { margin: 0; color:#475569; line-height:1.6; }
.message-thread { display:grid; gap:14px; }
.message-bubble { border-radius:16px; padding:14px 16px; max-width: 860px; }
.message-inbound { background:#eff6ff; border:1px solid #bfdbfe; }
.message-outbound { background:#f0fdf4; border:1px solid #bbf7d0; }
.message-meta { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:8px; font-size:0.92rem; color:#475569; }
.message-bubble p { margin:0; line-height:1.7; }
.portal-request-item { border-left:4px solid #1d4ed8; }
.portal-case-chip { display:grid; gap:4px; background:#fff; color:#0f172a; padding:14px 16px; border-radius:14px; border:1px solid #e5e7eb; }
.muted-text { color:#475569; }
@media (max-width: 960px) {
    .message-meta { flex-direction:column; align-items:flex-start; }
}
