:root {
    --ink: #1f2937;
    --muted: #64748b;
    --line: #dbe3ea;
    --soft: #f5f8fa;
    --paper: #ffffff;
    --accent: #b3262e;
    --accent-dark: #861c23;
    --accent-soft: #fff1f2;
    --success: #166534;
    --warning: #8a4b08;
    --danger: #991b1b;
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { background: #eef2f5; }
body {
    margin: 0;
    color: var(--ink);
    background: #eef2f5;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.shell {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    padding-inline: clamp(14px, 2.25vw, 38px);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}
.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(179,38,46,.2);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 19px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 12px; }

.top-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}
.user-name {
    color: var(--muted);
    font-size: 14px;
}
.inline-form { display: inline; margin: 0; }
.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-dark);
}

.site-main { min-height: calc(100vh - 150px); padding: 28px 0 56px; }
.site-footer {
    background: white;
    border-top: 1px solid var(--line);
    color: var(--muted);
}
.footer-inner {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    font-size: 13px;
}
.footer-inner p { margin: 0; }

.hero {
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 36px;
    align-items: center;
    padding: 56px 0 34px;
}
.hero h1 {
    margin: 0 0 18px;
    font-size: clamp(38px, 6vw, 66px);
    line-height: 1.02;
    letter-spacing: -.05em;
}
.hero p {
    max-width: 720px;
    color: var(--muted);
    font-size: 19px;
}
.hero-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.hero-card ol { margin: 0; padding-left: 22px; }
.hero-card li + li { margin-top: 14px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}
.page-head h1, .page-head h2 { margin: 0 0 4px; line-height: 1.16; }
.page-head p { margin: 0; color: var(--muted); }

.case-header {
    padding: 24px;
    margin-bottom: 0;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
}
.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: var(--muted);
    font-size: 14px;
}
.case-nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 0 14px;
    margin-bottom: 24px;
    background: white;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
}
.case-nav a {
    padding: 15px 13px 13px;
    white-space: nowrap;
    color: var(--muted);
    border-bottom: 3px solid transparent;
}
.case-nav a:hover { color: var(--ink); text-decoration: none; }
.case-nav a.active {
    color: var(--accent-dark);
    border-bottom-color: var(--accent);
    font-weight: 700;
}

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(15,23,42,.035);
}
.card.pad { padding: 22px; }
.card h2, .card h3 { margin-top: 0; }
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3, .card-head p { margin: 0; }
.card-body { padding: 22px; }

.stat {
    padding: 20px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.stat strong { display: block; font-size: 30px; line-height: 1; }
.stat span { display: block; margin-top: 8px; color: var(--muted); font-size: 14px; }

.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 17px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }
.button.secondary {
    background: white;
    color: var(--accent-dark);
    border-color: #e8b7ba;
}
.button.secondary:hover { background: var(--accent-soft); }
.button.neutral {
    background: white;
    color: var(--ink);
    border-color: var(--line);
}
.button.danger {
    background: white;
    color: var(--danger);
    border-color: #fecaca;
}
.button.small { min-height: 36px; padding: 7px 12px; font-size: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

form { margin: 0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 16px;
}
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 14px; }
.field .help { color: var(--muted); font-size: 12px; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(179,38,46,.11);
}
input[type="checkbox"] { width: 18px; min-height: 18px; }
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 18px;
    margin-top: 18px;
    border-top: 1px solid var(--line);
}

.alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 10px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}
.alert.success { border-color: #bbf7d0; background: #f0fdf4; color: var(--success); }
.alert.warning { border-color: #fed7aa; background: #fff7ed; color: var(--warning); }
.alert.danger, .alert.error { border-color: #fecaca; background: #fef2f2; color: var(--danger); }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-dark); }
.badge.success { background: #dcfce7; color: var(--success); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}
th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
tr:last-child td { border-bottom: 0; }

.record-list { display: grid; gap: 12px; }
.record {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
}
.record h3, .record p { margin-top: 0; }
.record p:last-child { margin-bottom: 0; }
.record-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 14px;
    color: var(--muted);
    font-size: 13px;
}

.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted);
    background: #fafcfd;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}
.empty h3 { color: var(--ink); margin-top: 0; }

.auth-shell { width: min(520px, 100%); margin: 28px auto; }
.auth-shell .card { padding: 28px; }

.steps {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}
.step {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.step.active { color: var(--accent-dark); border-color: #e8b7ba; background: var(--accent-soft); }

.repeat-row {
    position: relative;
    padding: 18px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfd;
}
.repeat-row .remove-row {
    position: absolute;
    top: 10px;
    right: 10px;
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 28px 0 12px;
}
.section-title h2, .section-title h3 { margin: 0; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.pre-line { white-space: pre-line; }
.document-name { overflow-wrap: anywhere; }
.progress-note {
    padding: 20px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid #e8b7ba;
}
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 24px;
}
.details-grid dt { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.details-grid dd { margin: 3px 0 0; }

@media (max-width: 900px) {
    .hero, .grid.three, .grid.four { grid-template-columns: 1fr 1fr; }
    .header-inner { min-height: 64px; }
    .brand small, .user-name { display: none; }
}
@media (max-width: 700px) {
    .shell { width: 100%; padding-inline: 10px; }
    .site-main { padding-top: 20px; }
    .hero, .grid.two, .grid.three, .grid.four, .form-grid, .form-grid.three, .details-grid {
        grid-template-columns: 1fr;
    }
    .page-head { flex-direction: column; }
    .top-nav { gap: 10px; font-size: 14px; }
    .case-header { padding: 18px; }
    .case-nav { padding-inline: 8px; }
    .footer-inner { padding: 18px 0; display: block; }
    .footer-inner p + p { margin-top: 8px; }
    .steps { overflow-x: auto; }
    .step { min-width: 150px; }
}

/* CivilDocket v1.1 procedure and timeline components */
.button-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.check-row { display:flex; gap:9px; align-items:center; font-weight:700; min-height:42px; }
.check-row input { width:auto; }
.notice { padding:16px 18px; border-radius:12px; border:1px solid var(--line); background:#fff; }
.notice.warning { background:#fff8e8; border-color:#ecd6a1; }
.source-box { display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center; margin-top:12px; padding:11px 13px; border-radius:10px; background:#f7f9fb; border:1px solid var(--line); font-size:13px; }
.source-box strong { color:var(--ink); }
.deadline-card { border-left:4px solid var(--accent); }
.muted-record { opacity:.75; }
.subnav { display:flex; gap:8px; overflow-x:auto; padding:8px 0 4px; }
.subnav a { white-space:nowrap; padding:9px 13px; border-radius:999px; border:1px solid var(--line); background:#fff; color:var(--muted); font-weight:700; font-size:13px; }
.subnav a.active { background:var(--accent-soft); border-color:#e8b7ba; color:var(--accent-dark); }
.timeline { position:relative; display:grid; gap:16px; margin-top:22px; padding-left:30px; }
.timeline::before { content:""; position:absolute; left:10px; top:3px; bottom:3px; width:2px; background:#d9e0e7; }
.timeline-item { position:relative; }
.timeline-marker { position:absolute; left:-26px; top:22px; width:12px; height:12px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px #fff, 0 0 0 5px #d9e0e7; }
.timeline-content h3 { margin:7px 0 0; }
@media (max-width:700px) {
    .button-row { width:100%; }
    .button-row .button { flex:1; text-align:center; }
    .timeline { padding-left:22px; }
    .timeline-marker { left:-20px; }
}


/* Full-viewport application loading state */
html.app-busy,
html.app-busy body { overflow: hidden; }

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(248, 250, 252, .86);
    backdrop-filter: blur(5px);
}
.app-loader[hidden] { display: none !important; }
.app-loader-panel {
    min-width: min(360px, calc(100vw - 32px));
    max-width: 520px;
    padding: 26px 28px;
    text-align: center;
    background: rgba(255,255,255,.98);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15,23,42,.18);
}
.app-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border: 5px solid #e2e8f0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: civildocket-spin .72s linear infinite;
}
.app-loader-title {
    display: block;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 18px;
}
.app-loader-message { margin: 0; color: var(--muted); }
@keyframes civildocket-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .app-spinner { animation-duration: 1.5s; }
}

button[disabled], .button[aria-disabled="true"] {
    cursor: wait;
    opacity: .68;
}

/* The case workspace uses the available browser width. */
.case-header,
.case-nav,
.card,
.stat { max-width: none; }

/* Keep authentication forms readable while the application itself is fluid. */
.auth-wrap { width: min(560px, 100%); margin-inline: auto; }

@media (min-width: 1500px) {
    .grid.three { grid-template-columns: repeat(3, minmax(280px, 1fr)); }
    .grid.four { grid-template-columns: repeat(4, minmax(240px, 1fr)); }
}

/* CivilDocket v1.3 verified opening-intake review */
.claim-review-grid { display:grid; gap:10px; }
.claim-review-row {
    display:grid;
    grid-template-columns:minmax(300px, .85fr) minmax(320px, 1.15fr);
    gap:12px 18px;
    align-items:end;
    padding:14px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fbfcfd;
}
.claim-review-row.selected { border-color:#e8b7ba; background:var(--accent-soft); }
.claim-review-row .record-meta { grid-column:1 / -1; }
.claim-check { align-items:flex-start; }
.claim-check span { display:grid; gap:3px; }
.claim-check small { color:var(--muted); font-weight:600; }
.relationship-grid { display:grid; gap:10px; }
.relationship-row {
    display:grid;
    grid-template-columns:minmax(220px,.75fr) minmax(220px,1fr) minmax(260px,1.2fr);
    gap:12px;
    align-items:end;
    padding:12px;
    border:1px solid var(--line);
    border-radius:10px;
    background:#fff;
}
.relationship-row > strong { align-self:center; overflow-wrap:anywhere; }
@media (max-width:900px) {
    .claim-review-row,
    .relationship-row { grid-template-columns:1fr; }
    .claim-review-row .record-meta { grid-column:auto; }
}
.roadmap-grid { display:grid; grid-template-columns:repeat(4,minmax(220px,1fr)); gap:12px; }
.roadmap-step { display:flex; gap:12px; padding:15px; border:1px solid var(--line); border-radius:12px; background:#fbfcfd; }
.roadmap-step > span { flex:0 0 34px; width:34px; height:34px; display:grid; place-items:center; border-radius:50%; background:#e8edf2; color:var(--muted); font-weight:800; }
.roadmap-step strong { display:block; margin-bottom:5px; }
.roadmap-step p { margin:0; color:var(--muted); font-size:13px; }
.roadmap-step.complete > span { background:#dcf4e6; color:#17653a; }
.roadmap-step.attention > span { background:#fff0cd; color:#7b5611; }
.roadmap-step.active > span { background:var(--accent-soft); color:var(--accent-dark); }
@media (max-width:1100px) { .roadmap-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:700px) { .roadmap-grid { grid-template-columns:1fr; } }

/* CivilDocket v1.3.1 opening/response intake */
.file-picker input[type="file"],
input[type="file"][data-persistent-files] {
    width: 100%;
    padding: 14px;
    border: 1px dashed #b9c5d1;
    border-radius: 12px;
    background: #fbfcfd;
}
.file-tray {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}
.file-tray:empty { display: none; }
.file-tray-item,
.compact-document-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}
.file-type-badge {
    flex: 0 0 42px;
    width: 42px;
    min-height: 48px;
    display: grid;
    place-items: center;
    padding: 4px;
    border-radius: 8px;
    background: #eef2f7;
    border: 1px solid #d6dee7;
    color: #344256;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
    overflow: hidden;
}
.file-type-badge[data-file-extension="PDF"] { background: #fff0f0; border-color: #f3c4c4; color: #9b1c1c; }
.file-type-badge[data-file-extension="DOCX"],
.file-type-badge[data-file-extension="DOC"] { background: #edf5ff; border-color: #bfd7f6; color: #1d4f91; }
.file-type-badge[data-file-extension="JPG"],
.file-type-badge[data-file-extension="JPEG"],
.file-type-badge[data-file-extension="PNG"] { background: #effaf2; border-color: #c7e8d0; color: #25643a; }
.file-tray-details {
    min-width: 0;
    flex: 1;
}
.file-tray-details strong,
.file-tray-details small { display: block; }
.file-tray-details strong {
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.file-tray-details small { color: var(--muted); margin-top: 2px; }
.file-tray-remove {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-weight: 700;
    padding: 7px 4px;
}
.response-package-list { display: grid; gap: 14px; }
.response-package-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fbfcfd;
}
.response-package-card h3 { margin: 7px 0 0; }
.compact-document-list { display: grid; gap: 8px; margin-top: 14px; }
.grow { min-width: 0; flex: 1; }
.position-grid { display: grid; gap: 12px; }
.position-card {
    position: relative;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfd;
}
.position-card .remove-row { position: absolute; top: 10px; right: 12px; }

@media (max-width: 700px) {
    .file-tray-item, .compact-document-row { align-items: flex-start; }
    .file-tray-remove { margin-left: auto; }
    .steps-four .step { min-width: 170px; }
}
.file-row-inline { display:flex; align-items:center; gap:10px; min-width:0; }
.file-row-inline .file-type-badge { flex-basis:34px; width:34px; min-height:38px; }

/* CivilDocket v1.3.2 evidence-backed intake review */
.evidence-quote {
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 3px solid #7f8fa4;
    border-radius: 0 8px 8px 0;
    background: #f5f7fa;
    color: #334155;
    font-size: 13px;
    line-height: 1.5;
}
.evidence-quote strong { color: #1f2937; }

/* CivilDocket v1.3.2 evidence correction controls */
.section-title.compact { align-items: flex-start; margin: 12px 0; }
.deceased-parent-review { position: relative; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft, #fafafa); }
.deceased-parent-review .remove-row { position: absolute; top: 10px; right: 12px; }
.verifier-cost-note { max-width: 360px; margin: 0; }
@media (max-width: 760px) { .verifier-cost-note { max-width: none; width: 100%; } }
