:root {
  --ink: #172326;
  --muted: #627276;
  --paper: #f4f6f2;
  --panel: #ffffff;
  --line: #dce3dd;
  --navy: #183b44;
  --teal: #0f766e;
  --mint: #dff1ea;
  --gold: #d6a53a;
  --red: #a73b3b;
  --shadow: 0 14px 40px rgba(24, 59, 68, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 Inter, "Segoe UI", Arial, sans-serif; }
a { color: var(--teal); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.14; }
h1 { font: 750 clamp(2rem, 5vw, 3.75rem)/1.05 Inter, "Segoe UI", Arial, sans-serif; letter-spacing: -.045em; }
h2 { font-size: 1.3rem; }
button, input, select, textarea { font: inherit; }

.site-header { height: 76px; padding: 0 max(24px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--navy); font-weight: 700; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: white; background: var(--navy); letter-spacing: -.05em; }
nav { display: flex; align-items: center; gap: 20px; }
nav > a:not(.button) { color: var(--ink); font-weight: 600; }
.disclaimer-bar { padding: 7px 20px; text-align: center; color: #fff; background: var(--navy); font-size: 12px; }
.page-shell { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 230px); margin: 0 auto; padding: 54px 0 80px; }
footer { padding: 28px max(24px, calc((100vw - 1180px)/2)); color: var(--muted); background: #e9eeea; border-top: 1px solid var(--line); font-size: 12px; }
footer p { margin-bottom: 5px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 12px 0 8px; }
.footer-links a { color: var(--navy); font-weight: 700; }

.button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--teal); border-radius: 8px; background: var(--teal); color: white; font-weight: 700; cursor: pointer; }
.button:hover { filter: brightness(.94); }
.button-ghost { color: var(--navy); border-color: #aac0bc; background: transparent; }
.button-small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.button-full { width: 100%; }
.button-row { display: flex; gap: 12px; margin: 28px 0 14px; }
.compact-actions { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin-bottom: 13px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.microcopy, .muted, .form-foot, label small { color: var(--muted); font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 26px; font-weight: 600; }

.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 70px; align-items: center; padding: 38px 0 74px; }
.hero h1 { max-width: 760px; }
.hero-copy { max-width: 650px; color: var(--muted); font-size: 19px; }
.hero-card { padding: 32px; border: 1px solid #cad8d2; border-radius: 18px; background: linear-gradient(145deg, #fff 20%, #e9f2ed); box-shadow: var(--shadow); }
.hero-card h2 { margin: 20px 0; }
.feature-list { list-style: none; margin: 0; padding: 0; }
.feature-list li { display: flex; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); font-weight: 600; }
.feature-list span { color: var(--teal); font-size: 12px; }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.trust-grid article { padding: 25px; border-top: 3px solid var(--teal); background: white; }
.trust-grid p { color: var(--muted); margin-bottom: 0; }
.feature-section { margin-top: 48px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.tool-card { display: block; color: var(--ink); border-top: 4px solid var(--teal); }
.tool-card h2 { margin: 13px 0 8px; }
.tool-card p:last-child { color: var(--muted); margin-bottom: 0; }
.feature-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-card { box-shadow: none; }
.feature-card .status-pill { margin-bottom: 15px; }
.feature-card h3 { margin-bottom: 10px; }
.feature-card p { color: var(--muted); margin-bottom: 0; }
.law-section { display: grid; grid-template-columns: 1.4fr .6fr; gap: 28px; align-items: center; margin-top: 22px; border-top: 4px solid var(--navy); }
.law-section p:last-child { color: var(--muted); margin-bottom: 0; }

.panel { padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 4px 18px rgba(24,59,68,.035); }
.page-heading { margin-bottom: 34px; }
.page-heading h1 { margin-bottom: 10px; font-size: clamp(2rem, 4vw, 3rem); }
.page-heading p:last-child { color: var(--muted); }
.heading-row, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; }
.section-heading { align-items: center; margin-bottom: 18px; }
.section-heading h2, .section-heading p { margin-bottom: 4px; }
.section-heading p { color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.stat-card { padding: 22px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 8px 0 3px; color: var(--navy); font-size: 32px; }
.case-list { margin: 0 -10px -10px; }
.case-row { display: grid; grid-template-columns: 46px 1fr auto auto 22px; gap: 16px; align-items: center; padding: 16px 10px; border-top: 1px solid var(--line); color: var(--ink); }
.case-row:hover { background: #f8faf8; }
.case-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--navy); background: var(--mint); font-weight: 700; }
.case-main strong, .case-main span { display: block; }
.case-main span { color: var(--muted); font-size: 13px; }
.row-arrow { color: var(--teal); font-size: 20px; }
.status-pill { display: inline-flex; width: fit-content; padding: 4px 9px; border-radius: 99px; color: var(--navy); background: #e9efed; font-size: 11px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.risk-low { color: #276544; background: #daf0e1; }
.risk-medium { color: #805f13; background: #f8e9bb; }
.risk-high, .risk-urgent { color: #8f3030; background: #f5d8d5; }
.risk-unreviewed, .risk-unknown { color: #5b6769; background: #e7ebea; }

.empty-state { padding: 60px 20px; text-align: center; }
.empty-state p { color: var(--muted); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--mint); font-size: 26px; }
.empty-compact { padding: 25px 0 5px; text-align: center; }

.auth-layout { width: min(920px, 100%); margin: 15px auto; display: grid; grid-template-columns: 1fr 410px; gap: 70px; align-items: center; }
.auth-intro h1 { font-size: 3.2rem; }
.auth-intro p:last-child { color: var(--muted); font-size: 17px; }
.form-card { display: grid; gap: 18px; }
.form-card label, .action-panel label { display: grid; gap: 7px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 12px 13px; color: var(--ink); border: 1px solid #bdc9c5; border-radius: 7px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
textarea { resize: vertical; }
.form-foot { margin: 0; text-align: center; }
.optional { color: var(--muted); font-weight: 400; }
.narrow-page { width: min(760px, 100%); margin: auto; }
.wide-form { padding: 34px; }

.case-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.summary-card { padding: 19px; border-radius: 10px; background: var(--navy); color: white; }
.summary-card span { display: block; opacity: .7; font-size: 12px; }
.summary-card strong { display: block; margin-top: 6px; }
.text-high, .text-urgent { color: #ffc0b7; }
.two-column { display: grid; grid-template-columns: 1.35fr .65fr; gap: 22px; }
.document-row { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-top: 1px solid var(--line); }
.document-info { min-width: 0; flex: 1; }
.inline-action { margin-left: auto; }
.button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.file-icon { width: 43px; height: 48px; display: grid; place-items: center; border-radius: 6px; color: var(--teal); background: var(--mint); font-size: 10px; font-weight: 700; }
.document-row strong, .document-row span { display: block; }
.document-row span { color: var(--muted); font-size: 12px; }
.action-panel { background: linear-gradient(155deg, #fff, #eaf3ef); }
.action-panel form { display: grid; gap: 15px; margin-top: 20px; }
.panel-divider { width: 100%; margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.model-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.text-link { display: block; margin-top: 18px; font-weight: 700; text-align: center; }

.upload-card { display: grid; gap: 20px; padding: 32px; }
.upload-zone { padding: 45px 25px; text-align: center; border: 2px dashed #a9bdb7; border-radius: 10px; background: #f8fbf9; }
.upload-zone p { color: var(--muted); }
.upload-zone input { max-width: 430px; }
.upload-symbol { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-size: 22px; }
.privacy-note { padding: 14px 16px; border-left: 3px solid var(--gold); background: #fff8e8; color: #685832; font-size: 13px; }

.analysis-hero { margin-bottom: 22px; border-left: 5px solid var(--teal); }
.rerun-panel { display: grid; grid-template-columns: 1fr minmax(320px, .7fr); gap: 34px; align-items: end; margin-bottom: 22px; background: linear-gradient(155deg, #fff, #eaf3ef); }
.rerun-panel h2 { margin-bottom: 7px; }
.rerun-panel p:last-child { margin-bottom: 0; color: var(--muted); }
.rerun-panel form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.rerun-panel label { display: grid; gap: 7px; font-weight: 600; }
.configuration-status { display: flex; align-items: center; gap: 8px; margin-top: 15px; font-size: 13px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; }
.status-ready { background: #2c8a5b; box-shadow: 0 0 0 3px #d9efe2; }
.status-missing { background: #b24a42; box-shadow: 0 0 0 3px #f4dcd9; }
.ocr-warning, .text-override { grid-column: 1 / -1; }
.ocr-warning { padding: 13px 15px; border-left: 3px solid var(--gold); background: #fff8e8; }
.ocr-warning p { margin: 4px 0 0; color: #685832; font-size: 13px; }
.text-override small { color: var(--muted); font-weight: 400; }
.analysis-hero h2 { margin-top: 14px; }
.analysis-hero p { margin-bottom: 0; color: var(--muted); font-size: 16px; }
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.info-item { padding: 14px 0; border-top: 1px solid var(--line); }
.info-item p { margin: 4px 0 0; color: var(--muted); }
.fact-list div { display: grid; grid-template-columns: 130px 1fr; gap: 15px; padding: 10px 0; border-top: 1px solid var(--line); }
.fact-list dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.fact-list dd { margin: 0; }
.issue-row { display: grid; grid-template-columns: 65px 1fr; gap: 15px; padding: 17px 0; border-top: 1px solid var(--line); }
.issue-row p { margin: 4px 0 0; color: var(--muted); }
.number-list, .question-list { margin: 0; padding-left: 22px; }
.number-list li, .question-list li { padding: 6px 0 6px 5px; }
.disclaimer-panel { margin-top: 22px; border-left: 4px solid var(--gold); background: #fffaf0; }
.disclaimer-panel p { margin: 5px 0 0; color: #675d48; }
.attorney-questions-panel { margin-top: 22px; border-top: 4px solid var(--navy); }
.attorney-question-list { display: grid; gap: 10px; margin: 18px 0 0; padding-left: 24px; }
.attorney-question-list li { padding-left: 5px; }
.follow-up-panel { margin-top: 22px; }
.follow-up-panel .section-heading p:last-child { max-width: 650px; }
.conversation-list { display: grid; gap: 18px; margin: 22px 0; }
.conversation-turn { display: grid; gap: 10px; }
.question-bubble, .answer-bubble { padding: 15px 18px; border-radius: 10px; }
.question-bubble { margin-left: min(90px, 10%); background: #eef3f1; }
.answer-bubble { margin-right: min(55px, 6%); border-left: 4px solid var(--teal); background: #e7f3ef; }
.question-bubble span, .answer-bubble span { display: block; margin-bottom: 5px; color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.question-bubble p, .answer-bubble p { margin: 0; white-space: pre-wrap; }
.follow-up-form { display: grid; gap: 9px; padding-top: 20px; border-top: 1px solid var(--line); }
.follow-up-form label { font-weight: 700; }
.form-action-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.form-action-row small { color: var(--muted); }
.retail-form-panel { display: grid; grid-template-columns: .7fr 1.3fr; gap: 34px; align-items: start; margin-bottom: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.retail-result { border-left-color: var(--gold); }
.search-panel { margin-bottom: 22px; }
.result-list { display: grid; gap: 16px; }
.resource-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.resource-card p:last-child { margin-bottom: 0; }
.checklist-list { display: grid; gap: 10px; }
.checklist-row { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbf9; font-weight: 600; }
.checklist-row input { width: auto; margin-top: 4px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pricing-card h2 { font-size: 2.2rem; }
.pricing-card .button { margin-top: 18px; }
.policy-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.policy-sidebar { position: sticky; top: 18px; }
.policy-nav { display: grid; gap: 8px; }
.policy-nav a { padding: 10px 12px; border-radius: 8px; color: var(--navy); font-weight: 700; }
.policy-nav a.active, .policy-nav a:hover { background: var(--mint); color: var(--teal); }
.policy-content h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.policy-summary { color: var(--muted); font-size: 18px; }
.policy-content section { margin-top: 28px; }
.policy-content li { margin-bottom: 10px; }

.admin-stat-grid { grid-template-columns: repeat(4, 1fr); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 22px; }
.admin-panel { margin-bottom: 22px; }
.admin-check-list { display: grid; gap: 12px; }
.admin-check { display: grid; grid-template-columns: auto 120px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.admin-check small { color: var(--muted); }
.admin-kv { display: grid; gap: 10px; margin: 20px 0 0; }
.admin-kv div { display: grid; grid-template-columns: 145px 1fr; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.admin-kv dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.admin-kv dd { margin: 0; overflow-wrap: anywhere; }
.admin-table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 12px 10px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.admin-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.admin-actions form { margin: 0; }
.admin-actions button { padding: 0; color: var(--teal); border: 0; background: none; cursor: pointer; font-weight: 700; }
.admin-list { display: grid; gap: 12px; }
.admin-list a, .admin-list div { display: block; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink); }
.admin-list span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.admin-marker { max-height: 160px; overflow: auto; padding: 14px; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 8px; background: #f8fbf9; color: var(--muted); font-size: 12px; }
.security-form { margin-top: 20px; }
.text-button { padding: 0; color: var(--teal); border: 0; background: none; cursor: pointer; font-weight: 700; }
code { overflow-wrap: anywhere; color: var(--navy); }
.qr-setup { display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: center; margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbf9; }
.qr-setup img { width: 168px; height: 168px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.qr-setup p { margin-bottom: 0; color: var(--muted); }

.response-card { margin-bottom: 22px; }
.response-card h2 { margin: 12px 0 3px; }
.letter-preview { max-height: 620px; margin: 20px 0; padding: 28px; overflow: auto; white-space: pre-wrap; color: #273233; border: 1px solid var(--line); background: #fcfcfa; font: 14px/1.7 Georgia, serif; }
.alert { margin-bottom: 22px; padding: 14px 17px; border-radius: 8px; }
.alert-error { color: #842e2e; border: 1px solid #e8b9b5; background: #fbe8e6; }
.alert-warning { color: #685832; border: 1px solid #e8d49f; background: #fff8e8; }
.alert-success { color: #276544; border: 1px solid #b8dbc5; background: #e6f4eb; }
.working-overlay { position: fixed; inset: 0; z-index: 1000; display: none; place-items: center; padding: 24px; background: rgba(15, 35, 40, .62); backdrop-filter: blur(3px); }
.working-overlay[hidden] { display: none !important; }
.working-overlay.is-visible { display: grid; }
.working-card { width: min(420px, 100%); padding: 36px; text-align: center; border-radius: 14px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.working-card h2 { margin: 18px 0 8px; }
.working-card p { margin: 0; color: var(--muted); }
.working-progress { margin-top: 22px; }
.working-progress-track { height: 10px; overflow: hidden; border-radius: 99px; background: #dce8e4; }
.working-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--teal); transition: width .35s ease; }
.working-progress strong { display: block; margin-top: 9px; color: var(--navy); font-size: 13px; }
.spinner { width: 44px; height: 44px; margin: auto; border: 4px solid #d8e8e3; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
.install-prompt { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; align-items: center; gap: 12px; max-width: min(460px, calc(100% - 36px)); padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.install-prompt[hidden] { display: none !important; }
.install-prompt span { color: var(--navy); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .working-overlay { display: none !important; }
}

@media (max-width: 850px) {
  .hero, .auth-layout, .two-column, .analysis-grid, .rerun-panel, .retail-form-panel, .admin-grid, .policy-layout { grid-template-columns: 1fr; gap: 28px; }
  .policy-sidebar { position: static; }
  .trust-grid, .stat-grid, .case-summary-grid, .feature-card-grid, .admin-stat-grid, .tool-grid, .pricing-grid { grid-template-columns: 1fr 1fr; }
  .resource-card { grid-template-columns: 1fr; }
  .law-section { grid-template-columns: 1fr; }
  .case-row { grid-template-columns: 46px 1fr auto; }
  .case-row .status-pill:first-of-type, .row-arrow { display: none; }
  .heading-row { align-items: flex-start; }
}
@media (max-width: 560px) {
  .site-header { padding: 0 16px; }
  .brand > span:last-child { display: none; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 35px; }
  .trust-grid, .stat-grid, .case-summary-grid, .feature-card-grid, .admin-stat-grid, .tool-grid, .pricing-grid { grid-template-columns: 1fr; }
  .admin-check, .admin-kv div { grid-template-columns: 1fr; }
  .qr-setup { grid-template-columns: 1fr; }
  .heading-row, .section-heading { flex-direction: column; }
  .heading-row .button { width: 100%; }
  .hero { padding-top: 10px; }
  .hero h1, .auth-intro h1 { font-size: 2.35rem; }
  .button-row { flex-direction: column; }
  .rerun-panel form { grid-template-columns: 1fr; }
  .form-action-row { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .case-row { grid-template-columns: 42px 1fr; }
  .case-row .status-pill { display: none; }
  .panel { padding: 20px; }
  .install-prompt { left: 12px; right: 12px; bottom: 12px; flex-wrap: wrap; }
  nav > a:not(.button) { display: none; }
}
