:root {
  --ink: #26211E;
  --muted: #6F6965;
  --paper: #F5F4F2;
  --surface: #FFFFFF;
  --rule: #D8D4D0;
  --surface-subtle: #ECE9E6;
  --orange: #D95712;
  --orange-dark: #9D3509;
  --orange-soft: #FFF2E9;
  --control-compact: 1.625rem;
  --input-compact: 2rem;
  --page-gap: .75rem;
  --dock: var(--ink);
  --cold: var(--orange-dark);
  --dispatch: var(--orange);
  --exception: var(--orange-dark);
  --white: var(--surface);
  --shared: var(--surface-subtle);
  --private: var(--orange-soft);
  --display: "Aptos Display", "Segoe UI", Arial, sans-serif;
  --body: Aptos, "Segoe UI", Arial, sans-serif;
  --data: Consolas, "Courier New", monospace;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  line-height: 1.45;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--orange-dark); text-underline-offset: .2em; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .5rem .75rem; color: var(--surface); background: var(--orange-dark); }
.skip-link:focus { top: 1rem; }
.app-shell { min-height: 100vh; }
.handoff-rail { color: var(--ink); border-bottom: 1px solid var(--rule); background: var(--surface); }
.handoff-mark { display: flex; align-items: center; gap: .75rem; min-width: 16rem; padding: .625rem 1rem; color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.brand-logo { display: block; width: 6.75rem; max-width: 34vw; height: auto; object-fit: contain; }
.brand-copy { display: grid; gap: .1rem; min-width: 0; }
.brand-copy strong { font-size: .875rem; line-height: 1.15; }
.brand-copy > span { color: var(--muted); font-size: .625rem; line-height: 1.25; }
.route-label, .eyebrow, .field-key { font-family: var(--data); font-size: .69rem; letter-spacing: .08em; text-transform: uppercase; }
.handoff-rail nav { display: flex; overflow-x: auto; scrollbar-width: thin; }
.handoff-rail nav a, .rail-account a, .rail-account .text-button { display: inline-flex; flex: 0 0 auto; align-items: center; height: var(--control-compact); min-height: var(--control-compact); padding: 0 .75rem; color: var(--ink); border: 0; background: transparent; line-height: 1; text-decoration: none; white-space: nowrap; }
.handoff-rail nav a:hover, .rail-account a:hover, .rail-account .text-button:hover { background: var(--orange-soft); }
.handoff-rail nav a[aria-current="page"] { color: var(--orange-dark); box-shadow: inset 0 -3px var(--orange); background: var(--orange-soft); }
.rail-account { display: flex; align-items: center; justify-content: flex-end; border-top: 1px solid var(--rule); }
.text-button { height: var(--control-compact); min-height: var(--control-compact); padding: 0; border: 0; color: var(--orange-dark); background: transparent; line-height: 1; text-decoration: underline; text-underline-offset: .2em; }
.workspace-bar { min-height: 2.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 1rem; border-bottom: 1px solid var(--rule); background: var(--surface); }
.route-label { margin: 0; color: var(--muted); }
.identity { min-width: 0; text-align: right; font-size: .82rem; }
.identity strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-shell, #app, #intake-form, .intake-section { min-width: 0; }
#app { width: min(100%, 94rem); margin: 0 auto; padding: var(--page-gap); animation: manifest-in 180ms ease-out; }

@keyframes manifest-in { from { opacity: 0; transform: translateY(3px); } }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; color: var(--ink); margin-top: 0; }
h1 { max-width: 28ch; font-size: clamp(1.5rem, 2.5vw, 2.25rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.2rem, 2vw, 1.625rem); }
p { max-width: 72ch; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--rule); }
.page-head h1 { margin-bottom: .25rem; }
.page-head p { margin: 0; color: var(--muted); }
.page-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--page-gap); margin-bottom: var(--page-gap); padding: .125rem 0 .625rem .625rem; border-bottom: 1px solid var(--rule); border-left: 3px solid var(--orange); }
.page-toolbar h1 { margin: 0 0 .125rem; font-size: clamp(1.35rem, 2vw, 1.75rem); }
.page-toolbar p { margin: 0; color: var(--muted); font-size: .8125rem; }
.workspace-panel { min-width: 0; padding: .75rem; border: 1px solid var(--rule); background: var(--surface); box-shadow: 0 1px 2px #26211e0d; }
.workspace-panel + .workspace-panel { margin-top: var(--page-gap); }
.workspace-panel h2 { margin-bottom: .5rem; font-size: 1rem; }
.panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: -.125rem 0 .625rem; padding-bottom: .5rem; border-bottom: 1px solid var(--surface-subtle); }
.panel-heading h2, .panel-heading p { margin: 0; }
.loading-state { display: flex; align-items: center; min-height: 3.25rem; color: var(--muted); font-size: .8125rem; }
.loading-state::before { width: .45rem; height: .45rem; margin-right: .5rem; border-radius: 50%; background: var(--orange); box-shadow: .75rem 0 var(--orange-soft); content: ""; }
.error-state { border-left: 3px solid var(--orange-dark); }
.button, button.button { display: inline-flex; align-items: center; justify-content: center; height: var(--control-compact); min-height: var(--control-compact); padding-block: 0; padding-inline: .625rem; border: 1px solid var(--orange-dark); border-radius: 2px; color: var(--surface); background: var(--orange-dark); font-size: .8125rem; font-weight: 700; line-height: 1; text-decoration: none; }
.button:hover, button.button:hover { background: var(--ink); }
.button.secondary { color: var(--orange-dark); background: var(--surface); }
.button.danger { border-color: var(--exception); background: var(--exception); }
.button.quiet { color: var(--ink); border-color: var(--rule); background: var(--surface); }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.panel { padding: 1rem; border: 1px solid var(--rule); background: var(--surface); box-shadow: 0 1px 2px #26211e0d; }
.panel + .panel { margin-top: 1rem; }
.muted { color: var(--muted); }
.data { font-family: var(--data); }
.error-banner, .notice-banner { margin: 0 0 1rem; padding: .8rem 1rem; border-left: 5px solid var(--exception); background: #fae8e5; }
.notice-banner { border-color: var(--dispatch); background: var(--private); }
.empty-state { padding: 2rem 1rem; border: 1px dashed var(--rule); text-align: center; background: #ffffff80; }

.report-summary { display: flex; align-items: baseline; gap: .5rem; margin: var(--page-gap) 0; }
.report-summary .eyebrow { flex-basis: 100%; margin: 0; }
.report-total { font-family: var(--data); font-size: 1.5rem; color: var(--orange-dark); }
.report-grid { display: grid; gap: var(--page-gap); }
.report-grid .workspace-panel { padding: .625rem; }
.report-grid h2 { margin: 0 0 .25rem; font-size: .9375rem; }
.report-filter-panel .filter-grid { gap: .5rem; }
.report-feedback { min-height: 1.25rem; color: var(--muted); font-size: .75rem; }
.report-register-panel { margin-top: var(--page-gap); }
.report-data-register .data-register-scroll { max-height: 22rem; }
.chart-frame { min-width: 0; overflow-x: auto; }
.chart-frame svg { display: block; width: 100%; min-width: 34rem; height: auto; color: var(--dock); }
.chart-frame text { fill: var(--ink); font-family: var(--data); font-size: 11px; }
.chart-value { font-weight: 800; }
@keyframes chart-reveal { from { opacity: 0; transform: scale(.96); } }
.chart-mark { color: var(--cold); animation: chart-reveal 300ms ease-out; transition: opacity 300ms ease, transform 300ms ease; transform-origin: center; }
.chart-mark rect, .chart-mark circle { fill: var(--cold); stroke: var(--dock); stroke-width: 1; }
.chart-mark:hover, .chart-mark:focus { opacity: .78; }
.chart-mark:focus-visible { outline: none; }
.chart-mark:focus-visible rect, .chart-mark:focus-visible circle, .chart-mark:focus-visible path { stroke: var(--dispatch); stroke-width: 5; }
.chart-area { fill: #d9571218; }
.chart-line { fill: none; stroke: var(--cold); stroke-width: 4; }
.chart-donut { fill: none; stroke: currentColor; stroke-width: 38; }
.chart-empty-ring { fill: none; stroke: var(--rule); stroke-width: 38; }
.chart-series-0 { color: #9D3509; }.chart-series-1 { color: #D95712; }.chart-series-2 { color: #E87932; }
.chart-series-3 { color: #B7683D; }.chart-series-4 { color: #7A4A32; }.chart-series-5 { color: #D59A72; }.chart-series-6 { color: #6F6965; }
.chart-legend { fill: currentColor !important; font-weight: 800; }
.exact-value { min-height: 1.5rem; margin: .35rem 0 0; color: var(--muted); font-family: var(--data); }

.register-grid { display: grid; gap: .75rem; }
.register-card { position: relative; min-height: 8rem; padding: 1rem; border: 1px solid var(--rule); border-left: 6px solid var(--cold); background: #fff; }
.register-card::after { content: attr(data-mark); position: absolute; right: .8rem; top: .4rem; font-family: var(--data); font-size: 2rem; color: #18324a17; }
.register-card.urgent { border-left-color: var(--exception); }
.register-card strong { display: block; font-family: var(--data); font-size: 2.25rem; color: var(--dock); }
.register-card span { font-weight: 700; }
.recent-ledger { margin-top: 1rem; }
.status-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--page-gap); border: 1px solid var(--rule); border-left: 3px solid var(--orange); background: var(--surface); }
.status-strip-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .5rem; align-items: center; min-height: 3.25rem; padding: .45rem .625rem; border-right: 1px solid var(--surface-subtle); color: var(--ink); text-decoration: none; }
.status-strip-item:hover { background: var(--orange-soft); }
.status-strip-item.is-urgent { color: var(--orange-dark); background: #fffaf6; }
.status-strip-item strong { grid-row: span 2; font-size: 1.25rem; }
.status-strip-item span { font-size: .75rem; font-weight: 700; }
.status-strip-item small { color: var(--muted); font-size: .625rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--page-gap); }
.dashboard-grid .workspace-panel { margin: 0; }
.dashboard-recent { min-width: 0; }
.dashboard-recent .compact-table th { position: sticky; z-index: 1; top: 0; }
.compact-table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--surface-subtle); }
.compact-table { width: 100%; border-spacing: 0; font-size: .75rem; }
.compact-table th { height: 1.875rem; padding: .25rem .45rem; border-bottom: 1px solid var(--rule); color: var(--muted); background: var(--surface-subtle); font-family: var(--data); font-size: .625rem; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.compact-table td { height: 2rem; padding: .25rem .45rem; border-bottom: 1px solid var(--surface-subtle); vertical-align: middle; }
.compact-table tbody tr:nth-child(even) { background: #faf9f8; }
.compact-table tbody tr:hover { background: var(--orange-soft); }
.recent-ticket-table { min-width: 50rem; }
.compact-empty { padding: 1rem; }
.compact-empty h3, .compact-empty p { margin: 0; }
.distribution-list { display: grid; gap: .125rem; margin: 0; padding: 0; list-style: none; }
.distribution-list a { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(4rem, 1.2fr) 2.25rem; gap: .5rem; align-items: center; min-height: 1.75rem; padding: .125rem .25rem; color: var(--ink); font-size: .75rem; text-decoration: none; }
.distribution-list a:hover { background: var(--orange-soft); }
.distribution-track { height: .375rem; overflow: hidden; background: var(--surface-subtle); }
.distribution-track span { display: block; width: calc(var(--distribution) * 100%); height: 100%; background: var(--orange); }
.distribution-list strong { color: var(--orange-dark); text-align: right; }

.register-page-head { margin-bottom: .5rem; }
.register-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin-bottom: .5rem; padding: .375rem; border: 1px solid var(--rule); background: var(--surface); }
.register-filter-panel { padding: .625rem; }
.register-filter-grid { gap: .5rem; }
.register-filter-grid label > span, .register-filter-actions label > span { margin-bottom: .15rem; font-size: .6875rem; }
.register-filter-actions { margin-top: .5rem; gap: .375rem; }
.register-filter-actions label { min-width: 12rem; }
.register-feedback { min-height: 1.75rem; padding: .375rem .125rem; color: var(--muted); font-size: .75rem; }
.data-register-tools { position: relative; display: flex; justify-content: flex-end; min-height: 0; }
.column-picker { position: absolute; z-index: 8; right: .25rem; top: .25rem; }
.column-picker > summary { height: var(--control-compact); padding: .35rem .625rem; border: 1px solid var(--rule); color: var(--orange-dark); background: var(--surface); font-size: .75rem; font-weight: 700; cursor: pointer; list-style-position: inside; }
.column-picker-panel { width: min(24rem, calc(100vw - 3rem)); padding: .625rem; border: 1px solid var(--rule); background: var(--surface); box-shadow: 0 .5rem 1.5rem #26211e1c; }
.column-picker-panel p { margin: 0 0 .5rem; color: var(--muted); font-size: .75rem; }
.column-picker-panel ul { max-height: min(28rem, 65vh); overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.column-picker-panel li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; min-height: 2rem; border-top: 1px solid var(--surface-subtle); }
.column-picker-panel label { display: flex; align-items: center; gap: .4rem; font-size: .75rem; }
.column-picker-panel label > span { margin: 0; }
.column-move-controls { display: inline-flex; }
.column-move-controls button { width: 1.75rem; height: 1.5rem; border: 1px solid var(--rule); color: var(--ink); background: var(--surface); }
.data-register-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--rule); background: var(--surface); scrollbar-width: thin; }
.data-register { width: max-content; min-width: 100%; table-layout: fixed; border-spacing: 0; color: var(--ink); background: var(--surface); font-size: .75rem; }
.data-register thead th { position: sticky; z-index: 3; top: 0; height: 2rem; padding: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-align: left; background: var(--surface-subtle); }
.data-register tbody tr:nth-child(even) td { background: #faf9f8; }
.data-register tbody tr:hover td, .data-register tbody tr:focus td { background: var(--orange-soft); }
.data-register tbody tr { cursor: pointer; }
.data-register td { height: 1.875rem; overflow: hidden; padding: .25rem .5rem; border-right: 1px solid var(--surface-subtle); border-bottom: 1px solid var(--surface-subtle); white-space: nowrap; text-overflow: clip; }
.data-register .register-frozen { position: sticky; z-index: 2; left: var(--register-left); background: var(--surface); }
.data-register thead .register-frozen { z-index: 5; background: var(--surface-subtle); }
.register-sort { width: calc(100% - .5rem); height: 100%; overflow: hidden; padding: 0 .5rem; border: 0; color: var(--ink); background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.register-sort:hover { color: var(--orange-dark); background: var(--orange-soft); }
.register-resize { position: absolute; z-index: 1; right: -.25rem; top: 0; width: .5rem; height: 100%; padding: 0; border: 0; border-right: 2px solid transparent; background: transparent; cursor: col-resize; }
.register-resize:hover, .register-resize:focus-visible { border-right-color: var(--orange); }
.register-status, .register-priority { font-weight: 700; }
.register-status-closed, .register-priority-low { color: var(--muted); }
.register-status-in-progress { color: var(--orange-dark); }
.register-status-resolved { color: #17664e; }
.register-priority-urgent { color: #9d2424; }
.register-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; min-height: 2.25rem; padding: .375rem .5rem; border: 1px solid var(--rule); border-top: 0; color: var(--muted); background: var(--surface); font-size: .75rem; }
.register-pagination label { display: inline-flex; align-items: center; gap: .375rem; }
.register-pagination label > span { margin: 0; color: var(--muted); }
.register-pagination select { width: auto; height: var(--control-compact); min-height: var(--control-compact); }

.filter-grid, .form-grid { display: grid; grid-template-columns: 1fr; gap: .8rem; }
label, fieldset { min-width: 0; }
label > span, .label { display: block; margin-bottom: .3rem; color: var(--dock); font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink); background: var(--surface); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { height: var(--input-compact); min-height: var(--input-compact); padding-block: 0; padding-inline: .5rem; line-height: 1.25; }
textarea { min-height: 7rem; padding: .5rem; line-height: 1.4; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; min-height: 1.1rem; }
input[type="file"] { height: auto; min-height: var(--input-compact); padding: .25rem; line-height: normal; }
fieldset { padding: 1rem; border: 1px solid var(--rule); }
legend { padding: 0 .35rem; font-family: var(--display); font-weight: 800; color: var(--dock); }
.choice-list { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.choice-list label { display: flex; align-items: center; gap: .4rem; }

.ticket-ledger { margin: 1rem 0 0; padding: 0; list-style: none; border-top: 2px solid var(--dock); }
.ticket-row { display: grid; gap: .45rem; padding: .9rem .75rem; border-bottom: 1px solid var(--rule); background: #fff; }
.ticket-row:hover { background: #f8fbf8; }
.ticket-row-title { font-size: 1.05rem; font-weight: 800; color: var(--dock); }
.ticket-meta { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; color: var(--muted); font-size: .83rem; }
.state-label { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .45rem; border: 1px solid currentColor; font-size: .75rem; font-weight: 800; }
.state-label.urgent { color: #8f2f27; background: #fbe8e5; }
.state-label.progress { color: #075d59; background: var(--shared); }
.state-label.waiting { color: #72500b; background: var(--private); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); white-space: nowrap; }
.intake-page-head { margin-bottom: .5rem; }
.intake-page-head h1 { font-size: 1.375rem; }
.required-note { color: var(--muted); font-size: .6875rem; }
.required-note span { color: var(--orange-dark); font-weight: 800; }
.intake-selector { padding: .625rem; border-top: 3px solid var(--orange); }
.process-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .375rem; }
.process-heading h2, .intake-section h2 { margin: 0; font-size: 1rem; }
.process-heading p, .intake-section header p, .intake-action-bar span { margin: 0; color: var(--muted); font-size: .6875rem; }
.process-rail { display: grid; grid-template-columns: repeat(7, minmax(7rem, 1fr)); overflow-x: auto; margin: 0 0 .625rem; padding: 0; border: 1px solid var(--rule); list-style: none; scrollbar-width: thin; }
.process-rail li { min-width: 0; border-right: 1px solid var(--rule); }
.process-rail li:last-child { border-right: 0; }
.process-choice { position: relative; width: 100%; min-height: 2.625rem; padding: .375rem .5rem .375rem .75rem; border: 0; color: var(--ink); background: var(--surface); text-align: left; font-size: .75rem; font-weight: 700; line-height: 1.2; }
.process-choice::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.process-choice:hover { color: var(--orange-dark); background: var(--orange-soft); }
.process-choice.active { color: var(--orange-dark); background: var(--orange-soft); }
.process-choice.active::before { background: var(--orange-dark); }
.intake-selector-grid { display: grid; gap: .5rem; }
.intake-selector-grid output { display: flex; align-items: center; min-height: var(--input-compact); padding: 0 .5rem; border: 1px solid var(--surface-subtle); border-radius: 2px; color: var(--muted); background: #faf9f8; font-family: var(--data); font-size: .6875rem; }
.intake-section { margin-top: .5rem; padding: .625rem; border: 1px solid var(--rule); background: var(--surface); }
.intake-section > header { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .5rem; align-items: start; margin: -.625rem -.625rem .625rem; padding: .5rem .625rem; border-bottom: 1px solid var(--surface-subtle); background: #faf9f8; }
.section-index { margin: 0 !important; color: var(--orange-dark) !important; font-family: var(--data); font-size: .6875rem !important; font-weight: 800; }
.intake-field-grid { display: grid; gap: .5rem; }
.intake-field-grid label > span, .attachment-group label > span { margin-bottom: .15rem; font-size: .6875rem; }
.field-help { display: block; margin: -.05rem 0 .2rem; color: var(--muted); font-size: .6875rem; font-weight: 400; }
.choice-field { padding: .5rem; }
.choice-field legend { font-family: var(--body); font-size: .75rem; }
.intake-note { grid-column: 1 / -1; padding: .5rem .625rem; border-left: 3px solid var(--orange); background: var(--orange-soft); font-size: .75rem; }
.intake-note p { margin: .15rem 0 0; }
.narrative-grid textarea { min-height: 5rem; }
.product-table-scroll { display: block; width: 100%; min-width: 0; max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; contain: inline-size layout paint; margin-bottom: .5rem; border: 1px solid var(--rule); scrollbar-width: thin; }
.product-table { width: max-content; min-width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .6875rem; }
.product-table th { color: var(--ink); background: var(--surface-subtle); font-weight: 800; text-align: left; }
.product-table th, .product-table td { min-width: 8.25rem; padding: .25rem; border-right: 1px solid var(--surface-subtle); border-bottom: 1px solid var(--surface-subtle); }
.product-table th:first-child, .product-table td:first-child { min-width: 2.5rem; width: 2.5rem; text-align: center; }
.product-table th:last-child, .product-table td:last-child { min-width: 4rem; width: 4rem; }
.product-table tbody tr:nth-child(even) { background: #faf9f8; }
.product-table input, .product-table select { min-width: 7.75rem; }
.product-table .text-button { font-size: .6875rem; }
.attachment-section { padding-bottom: .75rem; }
.attachment-group + .attachment-group { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--surface-subtle); }
.attachment-empty { margin: .35rem 0; color: var(--muted); font-size: .6875rem; }
.attachment-preview-list { display: grid; gap: .375rem; margin-top: .375rem; }
.attachment-preview { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .5rem; align-items: center; min-height: 3.5rem; padding: .375rem; border: 1px solid var(--surface-subtle); background: #faf9f8; }
.attachment-preview[data-upload-status="failed"] { border-left: 3px solid #9D2424; }
.attachment-preview[data-upload-status="uploaded"] { border-left: 3px solid #17664E; }
.attachment-preview img, .attachment-file-icon { width: 3rem; height: 2.75rem; border: 1px solid var(--rule); object-fit: cover; background: var(--surface); }
.attachment-file-icon { display: grid; place-items: center; color: var(--muted); font-family: var(--data); font-size: .625rem; }
.attachment-preview-copy { display: grid; min-width: 0; gap: .125rem; }
.attachment-preview-copy strong { overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview-copy > span, .upload-error { color: var(--muted); font-size: .6875rem; }
.upload-progress { display: grid; grid-template-columns: minmax(4rem, 8rem) auto; gap: .375rem; align-items: center; color: var(--muted); font-size: .625rem; text-transform: capitalize; }
.upload-progress progress { width: 100%; height: .375rem; accent-color: var(--orange-dark); }
.upload-error { color: #9D2424; }
.intake-action-bar { position: sticky; z-index: 9; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .5rem; padding: .5rem .625rem; border: 1px solid var(--rule); border-top: 2px solid var(--orange-dark); background: #fffffff2; box-shadow: 0 -.25rem .75rem #26211e0d; }
.intake-action-bar div { display: grid; min-width: 0; }
.intake-action-bar strong { font-size: .75rem; }
.intake-action-bar .button { flex: 0 0 auto; }
.review-list { display: grid; grid-template-columns: minmax(8rem, .4fr) 1fr; margin: 0; }
.review-list dt, .review-list dd { margin: 0; padding: .55rem; border-bottom: 1px solid var(--rule); }
.review-list dt { font-weight: 800; }

.ticket-detail-page { min-width: 0; }
.ticket-workspace-head { display: grid; grid-template-columns: minmax(11rem, .7fr) minmax(26rem, 1.5fr) auto; gap: .75rem; align-items: end; margin-bottom: .5rem; padding: .5rem .625rem; border: 1px solid var(--rule); border-top: 2px solid var(--orange-dark); background: var(--surface); }
.ticket-title-block { min-width: 0; }
.ticket-title-block > a { display: inline-block; margin-bottom: .2rem; font-size: .6875rem; }
.ticket-title-block .eyebrow { margin: 0; color: var(--orange-dark); }
.ticket-title-block h1 { overflow: hidden; margin: .125rem 0 0; font-size: 1.25rem; text-overflow: ellipsis; white-space: nowrap; }
.ticket-head-facts { display: grid; grid-template-columns: repeat(4, minmax(6rem, 1fr)); gap: .25rem .625rem; margin: 0; }
.ticket-head-facts div { min-width: 0; }
.ticket-head-facts dt { color: var(--muted); font-size: .625rem; letter-spacing: .04em; text-transform: uppercase; }
.ticket-head-facts dd { overflow: hidden; margin: 0; font-size: .75rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.status-label::before { content: "●"; margin-right: .3rem; color: var(--orange-dark); }
.ticket-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .375rem; }
.ticket-inline-action { display: flex; align-items: end; gap: .25rem; }
.ticket-inline-action label > span { margin-bottom: .1rem; font-size: .625rem; }
.ticket-inline-action select, .ticket-inline-action input { width: 7.25rem; height: var(--control-compact); min-height: var(--control-compact); padding-block: 0; font-size: .75rem; }
.ticket-inline-action .final-comment input { width: 10rem; }
.ticket-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; min-width: 0; }
.ticket-pane { min-width: 0; border: 1px solid var(--rule); background: var(--surface); }
.ticket-pane-head { min-height: 3.125rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .375rem .5rem; border-bottom: 1px solid var(--rule); background: #faf9f8; }
.ticket-pane-head .eyebrow { margin: 0; color: var(--muted); font-size: .5625rem; }
.ticket-pane-head h2 { margin: .1rem 0 0; font-size: .9375rem; }
.ticket-pane-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: .5rem; scrollbar-width: thin; }
.ticket-pane-communication { position: sticky; top: .5rem; align-self: start; min-height: 0; border-top: 2px solid var(--orange-dark); }
.workspace-section + .workspace-section { margin-top: .75rem; padding-top: .625rem; border-top: 1px solid var(--surface-subtle); }
.workspace-section h3 { margin: 0 0 .35rem; font-size: .75rem; letter-spacing: .02em; }
.narrative-record p { margin: 0 0 .625rem; font-size: .75rem; white-space: pre-wrap; }
.workspace-empty { margin: .35rem 0; padding: .5rem; color: var(--muted); border: 1px dashed var(--rule); font-size: .6875rem; }
.dense-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--surface-subtle); scrollbar-width: thin; }
.dense-table { width: 100%; border-collapse: collapse; font-size: .6875rem; }
.dense-table th, .dense-table td { min-width: 6rem; padding: .3rem .375rem; border-bottom: 1px solid var(--surface-subtle); text-align: left; vertical-align: top; }
.dense-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #faf9f8; font-size: .625rem; letter-spacing: .03em; text-transform: uppercase; }
.dense-table tbody tr:nth-child(even) { background: #fcfbfa; }
.dense-table .field-key { font-size: .5625rem; }
.product-line-table th, .product-line-table td { white-space: nowrap; }
.audit-table { min-width: 38rem; }
.audit-table th:first-child, .audit-table td:first-child { min-width: 8rem; white-space: nowrap; }
.audit-table th:last-child, .audit-table td:last-child { min-width: 14rem; }
.audit-context { margin: -.1rem 0 .35rem; font-size: .6875rem; }
.compact-upload { display: flex; align-items: end; gap: .375rem; margin-top: .375rem; }
.compact-upload label { flex: 1; min-width: 0; }
.compact-upload label > span { margin-bottom: .1rem; font-size: .625rem; }
.compact-upload input { min-width: 0; height: var(--control-compact); min-height: var(--control-compact); padding: .1rem; font-size: .6875rem; }
.communication-head .text-button { flex: 0 0 auto; font-size: .6875rem; }
.channel-tabs { display: grid; min-height: 0; }
[role="tablist"] { display: flex; border-bottom: 1px solid var(--rule); }
[role="tab"] { flex: 1; min-height: 2rem; padding: .35rem; border: 0; border-bottom: 2px solid transparent; color: var(--ink); background: var(--surface); font-size: .6875rem; font-weight: 800; }
[role="tab"][aria-selected="true"] { color: var(--orange-dark); border-bottom-color: var(--orange-dark); background: var(--orange-soft); }
[role="tab"][data-channel="internal"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); background: var(--orange-soft); }
.channel-panel { display: grid; grid-template-rows: auto minmax(7rem, 1fr) auto; min-height: 0; padding: .5rem; background: var(--surface); }
.channel-panel.internal { background: #fffaf6; }
.channel-scope, .privacy-warning { margin: 0 0 .375rem; padding: .375rem .5rem; color: var(--muted); border-left: 3px solid var(--rule); background: #faf9f8; font-size: .6875rem; }
.privacy-warning { color: var(--ink); border-left-color: var(--orange); background: var(--orange-soft); }
.conversation-scroll { min-height: 7rem; overflow-y: auto; overscroll-behavior: contain; padding-right: .25rem; scrollbar-width: thin; }
.message-list { margin: 0; padding: 0; list-style: none; }
.message { padding: .5rem; border-bottom: 1px solid var(--surface-subtle); background: var(--surface); }
.message:nth-child(even) { background: #fcfbfa; }
.internal .message { background: #fffaf6; }
.message header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem; font-size: .625rem; }
.message header time { color: var(--muted); }
.message p { margin: .25rem 0 0; font-size: .75rem; white-space: pre-wrap; }
.message-composer { display: grid; gap: .25rem; margin-top: .375rem; padding-top: .375rem; border-top: 1px solid var(--rule); }
.message-composer label > span { margin-bottom: .1rem; font-size: .625rem; }
.message-composer textarea { min-height: 3.25rem; max-height: 7rem; resize: vertical; font-size: .75rem; }
.message-composer input[type="file"] { height: var(--control-compact); min-height: var(--control-compact); padding: .1rem; font-size: .625rem; }
.message-composer .button { justify-self: end; }

.admin-subnav { display: flex; overflow-x: auto; margin-bottom: var(--page-gap); border: 1px solid var(--rule); background: var(--surface); scrollbar-width: thin; }
.admin-subnav a { display: inline-flex; align-items: center; height: var(--control-compact); padding: 0 .625rem; border-right: 1px solid var(--surface-subtle); color: var(--ink); font-size: .75rem; text-decoration: none; white-space: nowrap; }
.admin-subnav a:hover, .admin-subnav a:focus-visible { color: var(--orange-dark); background: var(--orange-soft); }
.administration-grid { display: grid; gap: var(--page-gap); }
.administration-grid .workspace-panel { margin: 0 0 var(--page-gap); }
.admin-user-table { min-width: 42rem; }
.admin-audit-panel { margin-top: 0; border-left: 3px solid var(--orange); }
.admin-audit-panel > p { margin-bottom: 0; font-size: .8125rem; }
.admin-audit-filters .filter-grid { gap: .5rem; }
.admin-audit-safety { margin: .625rem 0; padding: .375rem .5rem; border-left: 3px solid var(--orange); background: var(--orange-soft); font-size: .6875rem !important; }
.admin-audit-table { min-width: 50rem; }
.compact-actions { gap: .375rem; margin-top: .625rem; }
.template-register { margin: 0; padding: 0; list-style: none; }
.template-register li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; min-height: 2.5rem; padding: .375rem 0; border-bottom: 1px solid var(--surface-subtle); }
.template-register small { display: block; color: var(--muted); font-size: .6875rem; }
.template-builder-panel { max-height: 70vh; overflow: auto; }
.preference-panel { max-width: 52rem; }
.preference-list { border-top: 1px solid var(--rule); }
.preference-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; min-height: 2.75rem; padding: .375rem .5rem; border-bottom: 1px solid var(--rule); }
.preference-row:nth-child(even) { background: #faf9f8; }
.preference-row strong, .preference-row small { display: block; }
.preference-locked { border-left: 3px solid var(--orange); background: var(--orange-soft) !important; }
.preference-row input { width: 1.2rem; }
.identity-chip { display: grid; padding: .25rem .5rem; border: 1px solid var(--rule); background: var(--surface); font-size: .75rem; }
.identity-chip small { color: var(--muted); }
.toast-region { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(24rem, calc(100vw - 2rem)); }
.toast { padding: .8rem 1rem; color: #fff; background: var(--dock); box-shadow: 0 6px 24px #0003; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--paper); }
.auth-card { width: min(100%, 25rem); padding: .875rem; border: 1px solid var(--rule); border-top: 3px solid var(--orange); background: var(--surface); box-shadow: 0 .75rem 2rem #26211e12; }
.auth-toolbar { margin: -.875rem -.875rem .75rem; padding: .625rem .875rem; border-bottom: 1px solid var(--rule); background: #faf9f8; }
.auth-brand { display: flex; align-items: center; gap: .75rem; }
.auth-logo { display: block; width: 7.5rem; max-width: 38%; height: auto; object-fit: contain; }
.auth-brand div { display: grid; gap: .125rem; }
.auth-brand strong { font-size: .875rem; line-height: 1.15; }
.auth-brand span { color: var(--muted); font-size: .625rem; line-height: 1.25; }
.auth-card h1 { margin-bottom: .25rem; font-size: 1.35rem; }
.auth-card > p { margin-top: 0; color: var(--muted); font-size: .875rem; }
.auth-card form { display: grid; gap: .625rem; }

@media (min-width: 768px) {
  #app { padding: .875rem 1rem 2rem; }
  .register-grid { grid-template-columns: repeat(2, 1fr); }
  .status-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-recent { grid-column: 1 / -1; }
  .dashboard-recent .compact-table-scroll { max-height: 13rem; overflow-y: auto; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .register-filter-grid { grid-template-columns: repeat(5, minmax(8rem, 1fr)); }
  .register-search { grid-column: span 2; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intake-selector-grid { grid-template-columns: minmax(12rem, 1.25fr) minmax(12rem, 1fr) minmax(8rem, .5fr); }
  .intake-field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intake-field-grid .field-wide { grid-column: span 3; }
  .narrative-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .narrative-grid .field-wide { grid-column: auto; }
  .attachment-preview-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-row { grid-template-columns: minmax(7rem, .7fr) minmax(12rem, 2fr) minmax(13rem, 1fr); align-items: center; }
  .ticket-summary { grid-template-columns: minmax(0, 1.5fr) minmax(16rem, .7fr); }
  .administration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  :root {
    --control-compact: 1.75rem;
    --input-compact: 1.875rem;
    --page-gap: .5rem;
  }

  html { font-size: 16px; }
  body { font-size: 13px; }
  #app { width: 100%; max-width: none; padding: .5rem; }
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.0625rem; }
  .workspace-bar { min-height: 2.25rem; padding: .25rem .75rem; }
  .identity { font-size: .75rem; }
  .button, button.button { padding-inline: .5rem; font-size: .75rem; }
  .button-row { gap: .375rem; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select { font-size: .75rem; }
  textarea { font-size: .75rem; }

  .page-head { gap: .5rem; margin-bottom: .5rem; padding-bottom: .375rem; }
  .page-head h1, .page-toolbar h1 { font-size: 1.25rem; }
  .page-head p, .page-toolbar p { font-size: .75rem; }
  .page-toolbar { gap: .5rem; margin-bottom: .375rem; padding: 0 0 .375rem .5rem; }
  .workspace-panel, .panel { padding: .5rem; }
  .workspace-panel + .workspace-panel, .panel + .panel { margin-top: .5rem; }
  .panel-heading { gap: .375rem; margin-bottom: .375rem; padding-bottom: .25rem; }

  .status-strip-item { min-height: 2.5rem; padding: .25rem .5rem; }
  .status-strip-item strong { font-size: 1rem; }
  .register-card { min-height: 5.5rem; padding: .625rem; }
  .register-card strong { font-size: 1.625rem; }
  .dashboard-recent .compact-table-scroll { max-height: 10rem; }
  .compact-table th { height: 1.5rem; padding: .15rem .375rem; }
  .compact-table td { height: 1.625rem; padding: .15rem .375rem; }

  .register-toolbar { margin-bottom: .375rem; padding: .25rem; }
  .register-filter-panel { padding: .5rem; }
  .register-feedback { min-height: 1.25rem; padding: .2rem 0; }
  .data-register thead th { height: 1.625rem; }
  .data-register td { height: 1.625rem; padding: .15rem .375rem; }
  .register-pagination { min-height: 1.875rem; padding: .25rem .375rem; }

  .intake-page-head { margin-bottom: .375rem; }
  .intake-selector { padding: .5rem; }
  .process-rail { margin-bottom: .375rem; }
  .process-choice { min-height: 1.875rem; padding: .25rem .375rem .25rem .625rem; }
  .intake-section { margin-top: .375rem; padding: .5rem; }
  .intake-section > header { margin: -.5rem -.5rem .5rem; padding: .375rem .5rem; }
  .intake-field-grid { gap: .375rem .5rem; }
  .narrative-grid textarea { min-height: 3.5rem; }
  .product-table th, .product-table td { padding: .15rem .2rem; }
  .attachment-preview { min-height: 2.75rem; }
  .intake-action-bar { margin-top: .375rem; padding: .375rem .5rem; }

  .report-grid .workspace-panel { padding: .5rem; }
  .chart-frame { min-height: 9rem; }
  .template-register li { min-height: 2rem; padding: .25rem 0; }
  .preference-row { min-height: 2.125rem; padding: .25rem .375rem; }

  .ticket-workspace-head { gap: .5rem; margin-bottom: .375rem; padding: .375rem .5rem; }
  .ticket-title-block h1 { font-size: 1.0625rem; }
  .ticket-pane-head { min-height: 2.5rem; padding: .25rem .375rem; }
  .ticket-pane-scroll { padding: .375rem; }
  [role="tab"] { min-height: 1.875rem; padding: .25rem; }
  .channel-panel { padding: .375rem; }
  .message { padding: .375rem; }
  .message-composer textarea { min-height: 2.75rem; }
}

@media (min-width: 1200px) {
  .app-shell { display: grid; grid-template-columns: 12rem minmax(0, 1fr); }
  .handoff-rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--rule); border-bottom: 0; }
  .handoff-mark { display: grid; min-width: 0; padding: .625rem .75rem; }
  .brand-logo { width: 6.25rem; max-width: 100%; }
  .handoff-rail nav { display: grid; overflow: visible; }
  .handoff-rail nav a[aria-current="page"] { box-shadow: inset 3px 0 var(--orange); }
  .rail-account { margin-top: auto; display: grid; justify-content: stretch; }
  .workspace-bar { padding-inline: 1rem; }
  .register-grid { grid-template-columns: repeat(4, 1fr); }
  .ticket-workspace {
    grid-template-columns: minmax(15rem, .95fr) minmax(16rem, 1fr) minmax(18rem, 1.05fr);
    height: calc(100dvh - 10.5rem);
    max-height: calc(100dvh - 10.5rem);
    min-height: 24rem;
  }
  .ticket-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: 100%; overflow: hidden; }
  .ticket-pane-communication { grid-template-rows: auto minmax(0, 1fr); height: 100%; top: .5rem; }
  .ticket-pane-communication .channel-tabs { grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .ticket-pane-communication .channel-panel { overflow: hidden; }
}

@media (max-width: 767px) {
  .facts { grid-template-columns: 1fr; }
  .review-list { grid-template-columns: 1fr; }
  .review-list dd { padding-top: 0; }
  .page-head .button, .page-toolbar > .button { width: 100%; }
  .button-row > .button { flex: 1 1 10rem; }
  .process-rail { grid-template-columns: repeat(7, minmax(8rem, 1fr)); }
  .intake-action-bar { align-items: stretch; }
  .intake-action-bar .button { height: auto; min-height: var(--input-compact); }
  .register-toolbar .button { flex: 1 1 auto; width: auto; }
  .register-pagination { justify-content: flex-start; }
  .ticket-workspace-head { grid-template-columns: 1fr; align-items: stretch; }
  .ticket-head-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-head-actions, .ticket-inline-action { justify-content: stretch; }
  .ticket-inline-action { flex-wrap: wrap; }
  .ticket-inline-action label, .ticket-inline-action select, .ticket-inline-action input, .ticket-inline-action .final-comment input { width: 100%; }
  .ticket-pane-communication { position: static; }
  .channel-panel { min-height: 24rem; }
  .template-register li { grid-template-columns: 1fr; }
  .template-register .button-row { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .chart-mark { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
