:root {
    --ink: #17211f;
    --muted: #687471;
    --paper: #f4f3ee;
    --surface: #ffffff;
    --line: #dfe3df;
    --brand: #174d45;
    --brand-dark: #0e3832;
    --accent: #c7a86a;
    --danger: #9b2f2f;
    --success: #236a4b;
    --shadow: 0 18px 50px rgba(20, 38, 34, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 10% 0%, #fff 0, transparent 32rem), var(--paper); }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.8rem); line-height: 1.03; letter-spacing: -.04em; }
h2 { font-size: 1.25rem; }
p { color: var(--muted); line-height: 1.65; }

.topbar { min-height: 72px; padding: 0 5vw; display: flex; align-items: center; gap: 2rem; border-bottom: 1px solid rgba(23, 33, 31, .08); background: rgba(255, 255, 255, .85); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; background: var(--brand); border-radius: 13px; font-size: .82rem; letter-spacing: .04em; }
.nav { display: flex; gap: .4rem; margin-right: auto; }
.nav a { padding: .65rem .85rem; text-decoration: none; color: var(--muted); border-radius: 9px; }
.nav a:hover { color: var(--ink); background: var(--paper); }
.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-menu span { display: grid; text-align: right; }
.user-menu small { color: var(--muted); }

.container { width: min(1160px, 90vw); margin: 0 auto; padding: 4.5rem 0; }
.page-heading { display: flex; justify-content: space-between; align-items: start; gap: 2rem; margin-bottom: 2.5rem; }
.page-heading h1 { margin-bottom: .6rem; }
.page-heading p { max-width: 700px; }
.eyebrow { display: inline-block; color: var(--brand); text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .13em; margin-bottom: .8rem; }
.muted { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
.auth-shell { min-height: calc(100vh - 162px); display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: clamp(3rem, 8vw, 8rem); }
.auth-copy h1 { max-width: 780px; }
.auth-copy p { max-width: 590px; font-size: 1.12rem; }
.auth-card { display: grid; gap: 1.25rem; padding: 2rem; }

label { display: grid; gap: .5rem; font-size: .87rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cbd2ce; border-radius: 10px; background: #fff; color: var(--ink); padding: .82rem .9rem; font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(23, 77, 69, .14); border-color: var(--brand); }
button:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: .7rem 1rem; border: 0; border-radius: 10px; font: inherit; font-weight: 750; cursor: pointer; text-decoration: none; }
.button-primary { color: #fff; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-quiet { color: var(--muted); background: transparent; }
.button-danger { color: #fff; background: var(--danger); }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.metric-card { display: grid; gap: .45rem; padding: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 18px; text-decoration: none; box-shadow: var(--shadow); }
.metric-card strong { font-size: 2.7rem; line-height: 1; letter-spacing: -.05em; }
.metric-card small { color: var(--brand); font-weight: 700; }
.metric-muted { box-shadow: none; background: rgba(255,255,255,.5); }
.metric-muted small { color: var(--muted); }
.callout { margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.callout h2, .callout p { margin-bottom: .2rem; }
.status-dot, .badge { display: inline-flex; align-items: center; width: fit-content; white-space: nowrap; padding: .45rem .72rem; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.status-dot { color: var(--brand); background: #e4efec; }
.badge-neutral { color: #4d5b57; background: #edf0ee; }

.split-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.form-card { display: grid; gap: 1rem; position: sticky; top: 96px; }
.table-card { padding: 0; overflow: hidden; }
.card-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.5rem .7rem; }
.card-heading h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.5rem; text-align: left; border-top: 1px solid var(--line); }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.empty-state { padding: 2rem 1.5rem; border-top: 1px solid var(--line); margin: 0; }
.alert { margin-bottom: 1.5rem; padding: 1rem 1.15rem; border-radius: 12px; font-weight: 650; }
.alert-error { color: var(--danger); background: #faeaea; border: 1px solid #f0caca; }
.alert-success { color: var(--success); background: #e4f2e9; border: 1px solid #c7e3d1; }
.error-card { max-width: 700px; margin: 8vh auto; }
.heading-actions, .table-actions, .form-footer { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; }
.table-actions form { margin: 0; }
.table-subtitle { display: block; color: var(--muted); margin-top: .25rem; }
.badge-danger { color: var(--danger); background: #faeaea; margin-top: .35rem; }
.badge-warning { color: #805d16; background: #fff1c9; margin-top: .35rem; }
.demand-form { display: grid; gap: 1.35rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checkbox-label { display: flex; align-items: center; align-self: end; min-height: 46px; }
.checkbox-label input { width: auto; }
.inline-case-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: end; padding: 1rem; border: 1px dashed #b9c6c1; border-radius: 12px; background: #f7faf8; }
.inline-case-box small { grid-column: 1 / -1; }
.detail-title { font-size: clamp(1.8rem, 3.4vw, 3rem); max-width: 820px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.detail-card { display: grid; gap: 1rem; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin: 0; }
.detail-list div { padding: .85rem; background: #f7f8f6; border-radius: 10px; }
.detail-list dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.detail-list dd { margin: .35rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.deadline-summary { padding: 1rem; border-radius: 12px; background: #e8f1ee; color: var(--brand-dark); font-weight: 750; }
.deadline-overdue { background: #faeaea; color: var(--danger); }
.danger-zone { padding-top: 1rem; border-top: 1px solid var(--line); }
.comment-form { display: grid; gap: .7rem; }
.timeline { display: grid; gap: .7rem; }
.timeline-item { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.timeline-item header { display: flex; justify-content: space-between; gap: 1rem; }
.timeline-item time { color: var(--muted); font-size: .8rem; }
.timeline-item p { margin: .65rem 0 0; color: var(--ink); overflow-wrap: anywhere; }
.link-danger { margin-top: .5rem; padding: 0; border: 0; color: var(--danger); background: none; cursor: pointer; }
.history-card { margin-top: 1rem; }
.history-card code { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Visor geral de demandas — Sessao 3 */
:focus-visible { outline: 3px solid rgba(23, 77, 69, .3); outline-offset: 3px; }
.button-secondary { color: var(--brand-dark); background: #e6efec; border: 1px solid #cbded8; }
.button-secondary:hover { background: #d9e9e4; }
.button-small { min-height: 34px; padding: .45rem .7rem; font-size: .8rem; }
.button-prominent { min-height: 48px; padding-inline: 1.25rem; box-shadow: 0 10px 24px rgba(23, 77, 69, .18); }
.page-heading-compact { margin-bottom: 1.5rem; }
.demand-heading { align-items: center; margin-bottom: 1.4rem; }
.demand-heading h1 { margin-bottom: .4rem; }
.demand-heading p { margin-bottom: 0; }
.demand-tabs { display: flex; gap: .4rem; padding: .35rem; margin-bottom: 1rem; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .7); }
.demand-tabs a { padding: .7rem 1rem; border-radius: 9px; color: var(--muted); font-weight: 750; text-decoration: none; white-space: nowrap; }
.demand-tabs a:hover { color: var(--ink); background: #f4f6f4; }
.demand-tabs a.is-active { color: #fff; background: var(--brand); }
.card-flat { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .68); }
.list-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.scope-switch { display: inline-flex; padding: .25rem; border-radius: 11px; background: #e9ece9; }
.scope-switch a { padding: .62rem .8rem; border-radius: 8px; color: var(--muted); font-size: .84rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.scope-switch a.is-active { color: var(--ink); background: #fff; box-shadow: 0 2px 10px rgba(23, 33, 31, .08); }
.filter-panel { min-width: 0; }
.filter-panel summary { margin-left: auto; width: fit-content; padding: .62rem .8rem; border-radius: 9px; color: var(--brand); font-size: .84rem; font-weight: 800; cursor: pointer; list-style-position: inside; }
.filter-panel[open] summary { margin-bottom: 1rem; background: #edf3f1; }
.filter-form { display: grid; grid-template-columns: repeat(4, minmax(135px, 1fr)); gap: .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.filter-form label { font-size: .78rem; }
.filter-form input, .filter-form select { padding: .68rem .75rem; }
.filter-actions { grid-column: span 2; display: flex; align-items: end; justify-content: flex-end; gap: .6rem; }
.demand-list-card { padding: 0; overflow: hidden; }
.list-summary { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.list-summary strong { color: var(--ink); font-size: 1.05rem; }
.demand-table { table-layout: fixed; }
.demand-table th:nth-child(1) { width: 34%; }
.demand-table th:nth-child(2) { width: 20%; }
.demand-table th:nth-child(3) { width: 25%; }
.demand-table th:nth-child(4) { width: 21%; }
.demand-table th { border-top: 0; background: #fafbfa; }
.demand-table td { vertical-align: top; }
.demand-table tbody tr { transition: background .16s ease; }
.demand-table tbody tr:hover { background: #fafcfb; }
.demand-table td strong, .demand-table td small { display: block; }
.demand-table td small { margin-top: .38rem; color: var(--muted); line-height: 1.4; }
.demand-link { display: -webkit-box; overflow: hidden; color: var(--ink); font-weight: 800; line-height: 1.4; text-decoration-color: transparent; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.demand-link:hover { color: var(--brand); text-decoration-color: currentColor; }
.badge-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.badge-row .badge { padding: .3rem .55rem; font-size: .68rem; }
.badge-status { color: #40514c; background: #edf0ee; }
.badge-priority-low { color: #53625e; background: #edf0ee; }
.badge-priority-normal { color: #315b50; background: #e5f0ed; }
.badge-priority-high { color: #805d16; background: #fff1c9; }
.badge-priority-urgent { color: var(--danger); background: #faeaea; }
.deadline-pill, .fatal-pill { display: block; width: fit-content; margin-top: .45rem; padding: .3rem .55rem; border-radius: 7px; color: #316253; background: #e7f1ee; font-size: .72rem; font-weight: 800; }
.deadline-pill.is-overdue, .fatal-pill.is-overdue { color: var(--danger); background: #faeaea; }
.deadline-pill.is-today, .fatal-pill.is-today { color: #805d16; background: #fff1c9; }
.fatal-pill { color: #6f461f; background: #f7ede1; }
.restore-inline { margin-top: .7rem; }
.demand-empty { padding: 3rem 1.5rem; text-align: center; }
.demand-empty strong { display: block; margin-bottom: .4rem; font-size: 1.05rem; }
.demand-empty p { margin-bottom: 0; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 1rem; border-top: 1px solid var(--line); font-size: .86rem; }
.pagination a { color: var(--brand); font-weight: 800; }

.required-mark { color: var(--danger); }
.optional-label { color: var(--muted); font-size: .72rem; font-weight: 500; }

/* Exportacao generica — Sessao 4 */
.export-client-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 1rem; margin-bottom: 1.4rem; }
.export-selection { display: grid; gap: 1rem; }
.export-selection-heading, .export-group-heading, .export-actions, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.export-selection-heading h2, .export-group-heading strong, .section-heading h2 { margin: 0; }
.export-groups { display: grid; gap: 1rem; }
.export-group { padding: 0; overflow: hidden; }
.export-group-heading { padding: 1.2rem 1.35rem; border-bottom: 1px solid var(--line); background: #fafbf9; }
.export-case-toggle, .export-demand-toggle { display: flex; align-items: flex-start; gap: .8rem; min-width: 0; cursor: pointer; }
.export-case-toggle input, .export-demand-toggle input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin-top: .15rem; accent-color: var(--brand); }
.export-case-toggle span, .export-demand-toggle span { display: grid; gap: .25rem; min-width: 0; }
.export-case-toggle small, .export-demand-toggle small { color: var(--muted); font-weight: 600; }
.export-case-observation { padding: 1rem 1.35rem; border-bottom: 1px solid var(--line); background: #f7faf8; }
.export-demands { display: grid; }
.export-demand { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, .75fr); align-items: start; gap: 1rem; padding: 1.15rem 1.35rem; border-top: 1px solid var(--line); }
.export-demand:first-child { border-top: 0; }
.export-demand-toggle strong { line-height: 1.45; overflow-wrap: anywhere; }
.export-actions { position: sticky; bottom: 1rem; padding: 1rem 1.2rem; border: 1px solid #cbded8; border-radius: 14px; background: rgba(255, 255, 255, .96); box-shadow: var(--shadow); }
.export-actions p { margin: 0; }
.report-preview { max-width: 880px; margin: 0 auto 1rem; padding: clamp(1.5rem, 5vw, 3.5rem); }
.report-preview-header { padding-bottom: 1.5rem; border-bottom: 2px solid var(--brand); }
.report-preview-header > span { color: var(--brand); font-size: .76rem; font-weight: 850; letter-spacing: .12em; }
.report-preview-header h2 { margin: 1rem 0 .6rem; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.report-preview-header p { margin: 0; }
.report-case { margin-top: 2rem; }
.report-case > h3 { padding: .75rem 1rem; border-left: 4px solid var(--accent); background: #f1f4f2; color: var(--brand); }
.report-observation { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fafbf9; }
.report-observation p { margin: .4rem 0 0; color: var(--ink); }
.report-demand { margin-top: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.report-demand > div { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.report-demand p { margin: .7rem 0 0; color: var(--ink); }
.text-export-card { max-width: 880px; margin: 0 auto 1rem; }
.text-export-card textarea { margin-top: 1rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.5; }
.copy-feedback { min-height: 1.5rem; margin: .65rem 0 0; color: var(--success); font-weight: 700; }
.export-download-actions { display: flex; justify-content: flex-end; gap: .75rem; max-width: 880px; margin: 0 auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.fatal-deadline-control { display: grid; gap: .75rem; }
.toggle-label { display: flex; align-items: center; min-height: 46px; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fafbfa; }
.toggle-label input, .check-option input { width: auto; flex: 0 0 auto; }
.collaborator-fieldset { min-width: 0; margin: 0; padding: .8rem; border: 1px solid #cbd2ce; border-radius: 10px; }
.collaborator-fieldset legend { padding: 0 .25rem; font-size: .87rem; font-weight: 700; }
.check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; max-height: 150px; overflow-y: auto; }
.check-option { display: flex; align-items: center; gap: .55rem; padding: .45rem; border-radius: 7px; font-weight: 550; }
.check-option:hover { background: #f3f6f4; }
.demand-form-compact { padding: .15rem .2rem .2rem; box-shadow: none; border: 0; }
.demand-dialog { width: min(940px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px rgba(13, 31, 27, .28); }
.demand-dialog::backdrop { background: rgba(15, 27, 24, .58); backdrop-filter: blur(3px); }
.dialog-shell { max-height: calc(100vh - 2rem); padding: 1.4rem; overflow-y: auto; }
.dialog-header { position: sticky; top: -1.4rem; z-index: 2; display: flex; align-items: start; justify-content: space-between; margin: -1.4rem -1.4rem 1.25rem; padding: 1.3rem 1.4rem 1rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.dialog-header h2 { margin-bottom: 0; font-size: 1.5rem; }
.dialog-header .eyebrow { margin-bottom: .35rem; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: #f0f2f0; font-size: 1.6rem; cursor: pointer; }
.icon-button:hover { color: var(--ink); background: #e4e8e5; }

.detail-heading { align-items: center; margin-bottom: 1.5rem; }
.detail-badges { margin-top: .85rem; }
.badge-fatal { color: #70451e; background: #f6e9da; }
.detail-notice { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.detail-notice div { display: grid; gap: .25rem; }
.readonly-notice { color: #36544c; background: #e9f1ef; border: 1px solid #ccddd8; }
.detail-grid-main { grid-template-columns: minmax(0, 1fr) 270px; margin-bottom: 1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading h2, .section-heading .eyebrow { margin-bottom: 0; }
.section-heading .eyebrow { margin-bottom: .25rem; }
.detail-list-wide { grid-column: 1 / -1; }
.deadline-panel { display: grid; gap: .75rem; padding: 1rem; border: 1px solid #cfe1db; border-radius: 13px; color: #28574a; background: #edf5f2; }
.deadline-panel.is-overdue { color: var(--danger); border-color: #edcccc; background: #faeeee; }
.deadline-panel.is-today { color: #755513; border-color: #efdfae; background: #fff7dd; }
.deadline-panel > div { display: grid; gap: .3rem; }
.deadline-panel-label { font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.deadline-panel-fatal { padding-top: .75rem; border-top: 1px solid currentColor; color: #70451e; }
.deadline-panel-fatal.is-overdue { color: var(--danger); }
.deadline-panel-fatal.is-today { color: #755513; }
.trash-confirmation { padding-top: 1rem; border-top: 1px solid var(--line); }
.trash-confirmation summary, .inline-delete-confirmation summary { width: fit-content; color: var(--danger); font-size: .82rem; font-weight: 800; cursor: pointer; }
.trash-confirmation > div { margin-top: .8rem; padding: 1rem; border: 1px solid #efcece; border-radius: 12px; background: #fff7f7; }
.trash-confirmation p { margin: .25rem 0 .75rem; }
.metadata-card { position: sticky; top: 96px; box-shadow: none; }
.metadata-list { display: grid; gap: 1rem; margin: 0; }
.metadata-list div { padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.metadata-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.metadata-list dt { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.metadata-list dd { margin: .25rem 0 0; font-weight: 750; }
.detail-content-grid { align-items: stretch; }
.detail-content-grid .history-card { margin-top: 0; }
.count-pill { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 .45rem; border-radius: 999px; color: var(--brand); background: #e5efec; font-size: .78rem; font-weight: 850; }
.section-intro { margin: -.35rem 0 .25rem; font-size: .86rem; }
.comment-form { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fafbfa; }
.comment-form .button { justify-self: end; }
.comment-item header { justify-content: flex-start; align-items: center; }
.comment-item header > div:last-child { display: grid; gap: .12rem; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--brand); font-size: .8rem; font-weight: 850; }
.inline-delete-confirmation { margin-top: .65rem; }
.inline-delete-confirmation form { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: .45rem; color: var(--muted); font-size: .77rem; }
.inline-delete-confirmation .link-danger { margin: 0; font-weight: 800; }
.empty-inline { margin-bottom: 0; }
.history-timeline { gap: 0; }
.history-item { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: .65rem; padding: .2rem 0 1.1rem; border: 0; border-radius: 0; }
.history-marker { position: relative; width: 10px; height: 10px; margin-top: .35rem; border: 2px solid #fff; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px #bcd2cc; }
.history-marker::after { content: ''; position: absolute; top: 10px; left: 2px; width: 2px; height: calc(100% + 75px); background: #d7e1de; }
.history-item:last-child .history-marker::after { display: none; }
.history-item header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem .8rem; }
.history-item p { margin-top: .3rem; line-height: 1.5; }

@media (max-width: 820px) {
    .topbar { position: static; flex-wrap: wrap; padding: .8rem 5vw; gap: .7rem 1.2rem; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .user-menu { margin-left: auto; }
    .user-menu span { display: none; }
    .container { padding: 2.5rem 0; }
    .auth-shell, .split-layout, .detail-grid { grid-template-columns: 1fr; }
    .auth-copy { padding-top: 2rem; }
    .form-card { position: static; }
    .metric-grid { grid-template-columns: 1fr; }
    .form-grid, .form-grid-3, .detail-list, .inline-case-box { grid-template-columns: 1fr; }
    .heading-actions, .form-footer { flex-wrap: wrap; }
    .demand-heading { align-items: flex-start; }
    .list-toolbar { grid-template-columns: 1fr; }
    .scope-switch { width: 100%; }
    .scope-switch a { flex: 1; text-align: center; }
    .filter-panel summary { margin-left: 0; }
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-actions { grid-column: 1 / -1; }
    .detail-grid-main { grid-template-columns: 1fr; }
    .metadata-card { position: static; }
    .detail-notice { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
    .container { width: min(92vw, 1160px); }
    .page-heading { gap: 1rem; }
    .demand-heading { display: grid; }
    .button-prominent { width: 100%; }
    .demand-tabs { width: 100%; }
    .demand-tabs a { flex: 1; text-align: center; }
    .filter-form { grid-template-columns: 1fr; }
    .filter-actions { grid-column: 1; justify-content: stretch; }
    .filter-actions .button { flex: 1; }
    .demand-table-wrap { overflow: visible; }
    .demand-table, .demand-table tbody { display: block; }
    .demand-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
    .demand-table tr { display: block; padding: 1rem 1.1rem; border-top: 1px solid var(--line); }
    .demand-table tbody tr:first-child { border-top: 0; }
    .demand-table td { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: .25rem .7rem; width: 100%; padding: .68rem 0; border: 0; }
    .demand-table td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 8; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
    .demand-table td > * { grid-column: 2; }
    .demand-main-cell { padding-top: 0; }
    .check-list { grid-template-columns: 1fr; }
    .dialog-shell { padding: 1rem; }
    .dialog-header { top: -1rem; margin: -1rem -1rem 1rem; padding: 1rem; }
    .demand-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
    .demand-dialog .form-footer { display: grid; }
    .demand-dialog .form-footer .button { width: 100%; }
    .detail-heading { align-items: flex-start; }
    .detail-heading .heading-actions { width: 100%; }
    .detail-heading .heading-actions .button { flex: 1; }
    .comment-form .button { width: 100%; }
    .export-client-form, .export-demand { grid-template-columns: 1fr; }
    .export-client-form .button { width: 100%; }
    .export-selection-heading, .export-group-heading, .export-actions, .report-demand > div { align-items: flex-start; }
    .export-actions { display: grid; bottom: .5rem; }
    .export-actions .button, .export-download-actions .button { width: 100%; }
    .export-download-actions { display: grid; }
}
