/* ==========================================================================
   DESIGN TOKENS — restyle the whole portal from here (corporate colours,
   font, radius). Everything below uses these variables.
   ========================================================================== */
:root {
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-head: "Titillium Web", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, ui-monospace, monospace;

  --brand: #05538f;          /* VIA blue: primary buttons, active nav, links */
  --brand-hover: #033a63;
  --brand-soft: #e8f2fa;     /* selected rows, soft highlights */
  --on-brand: #ffffff;

  --bg: #f4f9fd;             /* page background */
  --surface: #ffffff;        /* cards, tables, modals */
  --surface-2: #f6f8fa;      /* table headers, subtle panels */
  --border: #dde3e9;
  --border-strong: #c3ccd5;
  --text: #0f1b26;
  --muted: #566573;
  --faint: #7d8b98;

  --sidebar-bg: #02233d;
  --sidebar-text: #c4d3e0;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: rgba(255,255,255,.09);

  --danger: #e32420;   --danger-soft: #fdecea;
  --warning: #a35a00;  --warning-soft: #fef3e2;
  --success: #00923c;  --success-soft: #e6f5ec;
  --info: #0a6bb0;     --info-soft: #e8f2fa;
  --violet: #5b4bb5;   --violet-soft: #efedfa;
  --neutral: #475867;  --neutral-soft: #edf0f3;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(2,35,61,.06), 0 1px 3px rgba(2,35,61,.08);
  --shadow-lg: 0 12px 32px rgba(2,35,61,.22);
  --shadow-blue: 0 4px 12px rgba(5,83,143,.28);
  --sidebar-w: 236px;
}

.document-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.uploaded-document { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.uploaded-document a { display: inline-flex; align-items: center; gap: 5px; overflow-wrap: anywhere; }
.uploaded-document .svg-ic { flex: 0 0 16px; width: 16px; height: 16px; }
.upload-status { margin: 5px 0; overflow-wrap: anywhere; }
.upload-status:empty { display: none; }
.upload-status.upload-error { color: #b42318; }

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1, h2, .brand-title, .kpi .value, .modal-head h2 { font-family: var(--font-head); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-family: var(--font-head); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; word-wrap: break-word; }
.svg-ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Boot / spinner */
.boot { min-height: 100vh; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Sign-in
   ========================================================================== */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; }
.login-card .eyebrow { font-family: var(--font-head); font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .14em; }
.login-card h1 { margin: 6px 0 4px; }
.login { background: linear-gradient(180deg, var(--sidebar-bg) 0, var(--sidebar-bg) 220px, var(--bg) 220px); }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; }
.code-input { font-size: 24px !important; letter-spacing: 10px; text-align: center; font-family: var(--font-mono) !important; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning); font-size: 13px; margin-bottom: 16px; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.error { background: var(--danger-soft); color: var(--danger); }

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--sidebar-bg) var(--sidebar-w), transparent var(--sidebar-w)); }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { position: relative; width: 36px; height: 36px; border-radius: 8px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: .06em; flex: none; }
.brand-mark::after { content: ""; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: #00923c; box-shadow: 0 7px 0 #e32420; }
.brand-title { color: #fff; font-weight: 650; font-size: 14px; line-height: 1.2; }
.brand-sub { font-family: var(--font-head); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--sidebar-text); cursor: pointer; text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--sidebar-active-bg); color: #fff; }
.nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); box-shadow: inset 3px 0 0 #4fa3dc; }
.nav .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.nav .sep { height: 1px; background: rgba(255,255,255,.06); margin: 8px 4px; }
.me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 13px; }
.me .name { color: #fff; font-weight: 600; }
.me .sub { opacity: .7; font-size: 12px; }
.me a { color: var(--sidebar-text); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; cursor: pointer; }
.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.busy { height: 2px; background: transparent; position: sticky; top: 0; z-index: 30; overflow: hidden; }
.busy.on::after { content: ""; display: block; height: 100%; width: 40%; background: var(--brand); animation: busy 1s ease-in-out infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.view { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary { box-shadow: var(--shadow-blue); transition: transform .2s ease-out, background .2s; }
.btn.primary:hover { background: var(--brand-hover); transform: translateY(-1px); }
.btn.primary:active { background: #02233d; transform: none; }
.btn:not(.primary):not(.ghost):not(.danger):not(.success):hover { background: var(--brand-soft); border-color: #8fc4e8; }
.btn.danger { color: var(--danger); border-color: #f4b9b7; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--neutral-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 28px; height: 28px; }

/* ==========================================================================
   Cards, KPIs, lists
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head .meta { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); cursor: default; }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: #8fc4e8; background: var(--brand-soft); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 30px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .value.alert { color: var(--danger); }
.kpi .sub { color: var(--faint); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.items li:last-child { border-bottom: 0; }
.items li:hover { background: var(--surface-2); }
.items .main-col { flex: 1; min-width: 0; }
.items .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items .sub { color: var(--muted); font-size: 12.5px; }
.items li.static { cursor: default; }
.items li.static:hover { background: none; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--text); font-weight: 550; margin-bottom: 4px; }

/* ==========================================================================
   Badges, chips
   ========================================================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.st-open, .st-assigned { background: var(--neutral-soft); color: var(--neutral); }
.st-under-review { background: var(--info-soft); color: var(--info); }
.st-pending-pm, .st-replied { background: var(--warning-soft); color: var(--warning); }
.st-closed, .st-accepted { background: var(--success-soft); color: var(--success); }
.st-on-hold { background: var(--violet-soft); color: var(--violet); }
.st-cancelled, .st-withdrawn { background: var(--neutral-soft); color: var(--faint); }
.st-returned, .st-overdue { background: var(--danger-soft); color: var(--danger); }
.type { display: inline-block; font-family: var(--font-head); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; padding: 2px 7px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); }
.urgent { color: var(--danger); font-weight: 600; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px 2px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.avatar { font-family: var(--font-head); width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 700; color: #fff; background: var(--neutral); flex: none; }
.avatar.lg { width: 32px; height: 32px; font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.assigned { background: var(--neutral); } .dot.replied { background: var(--warning); } .dot.accepted { background: var(--success); } .dot.returned { background: var(--danger); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--font-head); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .code { font-family: var(--font-mono); font-size: 12px; font-weight: 500; white-space: nowrap; }
.table .title-cell { min-width: 220px; }
.table .title-cell .t { font-weight: 550; }
.bar { position: relative; height: 6px; background: var(--neutral-soft); border-radius: 3px; min-width: 60px; margin-top: 6px; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); border-radius: 3px; }

/* ==========================================================================
   Toolbar & forms
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 220px; position: relative; }
.toolbar .search input { padding-left: 32px; width: 100%; }
.toolbar .search .svg-ic { position: absolute; left: 10px; top: 10px; color: var(--faint); }
.toolbar select { width: auto; max-width: 210px; }
.toolbar label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); width: 100%; outline: none;
}
textarea { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field > label .req { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 14px; }
.form-grid .c2 { grid-column: span 2; } .form-grid .c3 { grid-column: span 3; } .form-grid .c4 { grid-column: span 4; } .form-grid .c6 { grid-column: span 6; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 -4px; grid-column: span 6; padding-top: 8px; border-top: 1px solid var(--border); }
.links-editor .lrow { display: grid; grid-template-columns: 1fr 2fr 32px; gap: 8px; margin-bottom: 8px; }
.picker { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); max-height: 260px; overflow-y: auto; }
.picker .grp { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px 4px; background: var(--surface-2); position: sticky; top: 0; }
.picker label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.picker label:hover { background: var(--surface-2); }
.picker label.disabled { opacity: .5; cursor: not-allowed; }
.picker .who { flex: 1; min-width: 0; }
.picker .who .n { font-weight: 550; }
.picker .who .s { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 12px; height: 34px; cursor: pointer; font-weight: 550; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }

/* ==========================================================================
   Request detail
   ========================================================================== */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; margin-bottom: 10px; font-size: 13px; }
.back:hover { color: var(--text); text-decoration: none; }
.detail-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.detail-title .code { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; word-wrap: break-word; }
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.doclist li + li { border-top: 1px dashed var(--border); }
.doclist a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asg { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.asg + .asg { margin-top: 12px; }
.asg-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.asg-head .who { flex: 1; min-width: 160px; }
.asg-head .n { font-weight: 600; }
.asg-head .s { font-size: 12px; color: var(--muted); }
.asg .block { margin-top: 12px; }
.asg .block .lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.quote { background: var(--surface-2); border-left: 3px solid var(--border-strong); padding: 10px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: pre-wrap; word-wrap: break-word; }
.quote.pm { border-left-color: var(--warning); background: var(--warning-soft); }
.quote.final { border-left-color: var(--success); background: var(--success-soft); }
.asg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--border); position: relative; margin-left: 4px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.timeline .when { color: var(--faint); font-size: 12px; }

/* ==========================================================================
   Timesheet
   ========================================================================== */
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-nav .range { font-weight: 650; min-width: 190px; text-align: center; }
.day { border-bottom: 1px solid var(--border); }
.day:last-child { border-bottom: 0; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface-2); }
.day-head .d { font-weight: 650; }
.day-head .tot { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-head.today .d::after { content: "Today"; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 4px; }
.day.empty-day .day-head { background: transparent; }
.day.empty-day .tot { color: var(--faint); font-weight: 500; }
.entry { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 70px 64px; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.entry .what .t { font-weight: 550; }
.entry .hrs { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.entry .ops { display: flex; gap: 2px; justify-content: flex-end; }
.lock { color: var(--faint); }

/* ==========================================================================
   Modal & toast
   ========================================================================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2,35,61,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; display: flex; flex-direction: column; }
.modal.wide { max-width: 820px; }
.modal-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; font-weight: 400; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.modal-foot .left { margin-right: auto; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13.5px; animation: fade .15s ease-out; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .18s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(16,24,40,.35); z-index: 35; }
  .mobilebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--sidebar-bg); color: #fff; position: sticky; top: 0; z-index: 20; }
  .mobilebar .t { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobilebar button { background: transparent; border: 0; color: #fff; padding: 4px; cursor: pointer; display: grid; }
  .view { padding: 16px 16px 40px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .c2, .form-grid .c3 { grid-column: span 1; }
  .form-grid .c4, .form-grid .c6, .section-label { grid-column: span 2; }
  h1 { font-size: 19px; }
  /* Tables become cards */
  table.table.responsive thead { display: none; }
  table.table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .table.responsive td { border: 0; padding: 3px 0 3px 104px; position: relative; min-height: 24px; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; position: absolute; left: 0; top: 5px; width: 96px; }
  .toolbar select { max-width: none; flex: 1 1 140px; }
  .table.responsive td.num { text-align: left; }
  .table.responsive td[data-label=""] { padding-left: 0; }
  .table.responsive td[data-label=""]::before { display: none; }
  .table.responsive tfoot { display: block; }
  .entry { grid-template-columns: 1fr 60px; }
  .entry .act { grid-column: 1; grid-row: 2; }
  .entry .ops { grid-column: 2; grid-row: 2; }
  .links-editor .lrow { grid-template-columns: 1fr 32px; }
  .links-editor .lrow .lbl-in { grid-column: span 2; }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  #toast-root { left: 16px; right: 16px; }
}
