/* Shared workspace: quiet surfaces, readable hierarchy and consistent controls. */
:root {
  --bone: #f5f6f8; --bone-2: #eef0f3; --paper-warm: #fafbfc;
  --ink: #202733; --ink-2: #364152; --muted: #657080; --muted-2: #929aa5;
  --line: #e1e5eb; --line-soft: #edf0f4; --line-strong: #c2c9d2;
  --saffron: #ac1828; --saffron-deep: #8c1020; --saffron-soft: #f8e8eb; --saffron-tint: #fdf3f5;
  --r-sm: 7px; --r-md: 10px; --r-lg: 14px;
  --mono: var(--sans); --sh-sm: 0 1px 3px rgb(16 24 40 / 3%);
}
body::before { display: none; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 200; background: var(--paper); padding: 12px 20px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.app { grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: var(--paper); color: var(--ink-2); border-color: var(--line); padding: 24px 14px 16px; overflow-y: auto; z-index: 40; }
.brand { padding: 0 10px 26px; gap: 10px; }
.brand-mark { width: 38px; height: 38px; }
.brand-name { color: var(--ink); font-size: 21px; font-weight: 750; letter-spacing: -.7px; }
.brand-sub { color: var(--muted); font: 12px var(--sans); text-transform: none; letter-spacing: 0; margin-top: 6px; }
.nav-label { color: var(--muted); font: 600 11px var(--sans); letter-spacing: .06em; padding: 20px 14px 8px; }
.nav-item { min-height: 42px; padding: 10px 13px; border-radius: 8px; color: var(--ink-2); font-size: 13px; gap: 11px; }
.nav-item:hover { background: var(--bone); color: var(--ink); }
.nav-item.active { color: var(--saffron); background: var(--saffron-soft); border-color: transparent; font-weight: 650; }
.nav-item.active::before { display: none; }
.nav-item .badge { color: var(--muted); background: var(--bone-2); font: 600 11px var(--sans); }
.sidebar-foot { border-color: var(--line); gap: 10px; padding-top: 18px; }
.user-name { color: var(--ink); font-weight: 600; }
.user-role { color: var(--muted); font: 11px var(--sans); letter-spacing: 0; text-transform: none; }
.signout { color: var(--muted); border-color: var(--line); min-width: 34px; min-height: 34px; }
.topbar { min-height: 76px; padding: 16px 32px; gap: 12px; background: var(--paper); border-color: var(--line); }
.crumbs { font: 500 12px var(--sans); letter-spacing: 0; text-transform: none; min-width: 0; flex-wrap: wrap; }
.topbar-search { width: min(340px, 40vw); background: var(--bone); border-color: transparent; border-radius: 8px; }
.search-submit { display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 38px; border-color: var(--line); border-radius: 8px; }
.menu-toggle, .nav-backdrop { display: none; }
.page { padding: 30px 32px 70px; width: 100%; max-width: 1600px; margin: 0 auto; }
.page-head { border: 0; padding-bottom: 0; margin-bottom: 26px; gap: 20px; }
.page-eyebrow { color: var(--muted); font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.page-title { font-size: 28px; font-weight: 650; letter-spacing: -.8px; line-height: 1.2; }
.page-title em { color: inherit; font-style: normal; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 8px; }
.btn { min-height: 40px; height: auto; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 550; box-shadow: none; }
.btn-sm { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.btn-accent { color: #fff; }
.btn-primary { color: #fff; background: #293345; border-color: #293345; }
.page-actions { flex-wrap: wrap; gap: 8px; }
.metric-row { background: transparent; border: 0; gap: 16px; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 24px; }
.metric, .metric:last-child { border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; min-height: 122px; box-shadow: var(--sh-sm); }
.metric-label { font: 500 12px var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted); }
.metric-value { font-size: clamp(21px, 2vw, 29px); font-weight: 650; gap: 6px; margin-top: 14px; flex-wrap: wrap; white-space: normal; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric-delta { margin-top: 10px; font: 11px var(--sans); max-width: none; }
.panel { box-shadow: var(--sh-sm); min-width: 0; }
.panel-head { background: var(--paper); min-height: 62px; padding: 18px 20px; gap: 12px; }
.panel-title { font-size: 14px; font-weight: 650; }
.panel-meta { font-size: 12px; }
.panel-body { max-width: 100%; overflow-x: auto; }
.row-2 { grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); align-items: start; }
.row-2 > *, .row-2-eq > *, .search-results > * { min-width: 0; }
.t { width: 100%; }
.t th { color: var(--muted); background: var(--paper-warm); font: 550 11px var(--sans); letter-spacing: 0; text-transform: none; padding: 12px 18px; }
.t td { font-size: 13px; padding: 16px 18px; line-height: 1.5; }
.t .num { font-variant-numeric: tabular-nums; }
.t .code { white-space: nowrap; color: var(--muted); }
.text-link { color: var(--saffron); font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.pill { letter-spacing: 0; text-transform: none; font: 500 11px var(--sans); border-radius: 5px; padding: 4px 8px; }
.tabs, .section-tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.tabs button, .section-tab { min-height: 44px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.quick-actions .btn { background: var(--paper); color: var(--ink-2); }
.task-row, .result-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.task-row:hover, .result-row:hover { background: var(--paper-warm); }
.task-title { display: block; font-size: 13px; font-weight: 550; }
.task-meta { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.task-action { color: var(--saffron); font-size: 12px; white-space: nowrap; }
.results-summary { color: var(--muted); font-size: 12px; margin: 16px 0; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; background: var(--paper); padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 16px; }
.filter-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 550; color: var(--ink-2); flex: 1 1 160px; min-width: 0; }
.filter-field.grow { flex: 2 1 240px; }
.filter-field input, .filter-field select { height: 40px; min-width: 0; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 13px; }
.empty-state { padding: 38px 24px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); font-size: 16px; font-weight: 600; margin: 12px 0 6px; }
.empty-state p { margin: 0 0 16px; }
.empty-state .icon { width: 24px; height: 24px; }
.search-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.record-form { max-width: 1020px; }
.form-guidance { color: var(--muted); margin: -8px 0 22px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 24px; padding: 24px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field { min-width: 0; }
.form-field textarea { min-height: 86px; }
.field-label { font-size: 13px; font-weight: 550; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding: 16px 0; }
.form-error-summary { padding: 14px 18px; border-radius: 8px; border: 1px solid var(--brick); background: var(--brick-soft); color: var(--brick); margin-bottom: 20px; }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; color: var(--muted); font-size: 12px; }
[data-theme="dark"] { --bone: #12171f; --bone-2: #252d38; --paper: #1b222c; --paper-warm: #202833; --ink: #e9edf3; --ink-2: #d2d9e3; --muted: #a2aec0; --line: #35404f; --line-soft: #2a3441; --saffron: #ff8b97; --saffron-soft: #40232c; }
[data-theme="dark"] .sidebar, [data-theme="dark"] .topbar { background: var(--paper); }
[data-theme="dark"] .btn-accent { background: #ac1828; border-color: #ac1828; color: #fff; }
@media (max-width: 1150px) {
  .app { grid-template-columns: 216px minmax(0, 1fr); }
  .page, .topbar { padding-inline: 24px; }
  .row-2 { grid-template-columns: minmax(0, 1fr); }
  .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { display: block; }
  .main { width: 100%; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; height: 100dvh; transform: translateX(-100%); visibility: hidden; transition: transform .18s ease; }
  .nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .nav-open { overflow: hidden; }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: #16213080; border: 0; z-index: 39; }
  .menu-toggle { display: inline-flex; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; position: sticky; top: 0; z-index: 30; }
  .crumbs { flex: 1; width: auto; }
  .topbar-search { order: 2; width: 100%; margin: 0; }
  .page { padding: 24px 16px 90px; }
  .page-title { font-size: 25px; }
  .page-head { gap: 16px; margin-bottom: 22px; }
  .page-actions { width: 100%; }
  .metric-row { gap: 10px; }
  .metric, .metric:last-child, .metric:nth-child(2), .metric:nth-child(-n+2) { padding: 16px 14px; min-height: 110px; border: 1px solid var(--line); }
  .metric-value { font-size: 23px; }
  .t { min-width: 600px; }
  .record-table { display: block; min-width: 0; }
  .record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .record-table tbody, .record-table tr { display: block; }
  .record-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .record-table td { display: block; padding: 7px 16px; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .record-table td[data-label] { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; text-align: left; }
  .record-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-weight: 500; font-size: 12px; }
  .panel-body { overflow-x: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); padding: 20px 16px; gap: 20px; }
  .form-actions { position: sticky; bottom: 0; background: var(--bone); border-top: 1px solid var(--line); z-index: 5; }
  .form-actions .btn { flex: 1; justify-content: center; }
  .search-results { grid-template-columns: minmax(0, 1fr); }
  .filter-bar { padding: 14px; }
  .filter-field, .filter-field.grow { flex-basis: 100%; }
  .task-row { padding: 16px; }
  .quick-actions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .quick-actions .btn { flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
