/* ==========================================================================
   Core Wealth AMS - interface design system (3.0.2)
   Loaded AFTER app.css by the portal, sign-in and client-portal layouts. New file name + ?v=<hash> on every
   URL, so no browser/server cache can keep serving an older stylesheet. If this file does not load, the
   page shows a warning (partials/ui_check.php reads --ams-ui below).
   Rule of thumb: components are styled here once; pages must not need inline styles to look right.
   ========================================================================== */

/* ---- Carried over from the 3.0.0 stylesheet (bottom navigation + Certificate Desk wizard) so this file is self-sufficient:
   if an old app.css were ever served, these screens would still be laid out correctly. ---- */
.desk-home,.desk { max-width:720px;margin:0 auto }
.desk-cta { display:flex;align-items:center;justify-content:center;min-height:64px;font-size:20px;border-radius:14px;margin:14px 0 }
.desk-counters { display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:8px 0 16px }
.desk-counter { background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:12px;text-align:center;text-decoration:none;color:inherit;display:block }
.desk-counter strong { display:block;font-size:26px;line-height:1.1 }
.desk-counter span { font-size:12px;color:#64748b }
.desk-counter.warn { border-color:#f59e0b;background:#fffbeb }
.desk-search input,.desk input[type=search],.desk input[type=text],.desk input[type=email],.desk input[type=tel],.desk select,.desk textarea { width:100%;min-height:48px;font-size:16px;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;box-sizing:border-box }
.desk textarea { min-height:120px }
.desk label { display:block;font-weight:600;margin:10px 0 4px }
.desk label.desk-inline { display:flex;align-items:flex-start;gap:10px;font-weight:500;min-height:44px;align-items:center }
.desk label.desk-inline input { width:22px;height:22px;flex:0 0 auto }
.desk-h { font-size:13px;text-transform:uppercase;letter-spacing:.04em;color:#64748b;margin:16px 0 6px;display:flex;justify-content:space-between }
.desk-more { font-size:12px;text-transform:none }
.desk-list { display:flex;flex-direction:column;gap:8px }
.desk-item { display:flex;flex-direction:column;gap:2px;text-align:left;width:100%;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:12px 14px;min-height:56px;text-decoration:none;color:inherit;font:inherit;cursor:pointer;box-sizing:border-box }
.desk-item span,.desk-item small { color:#64748b;font-size:13px;font-weight:400 }
.desk-item.desk-check { flex-direction:row;align-items:flex-start;gap:12px }
.desk-item.desk-check input { width:24px;height:24px;margin-top:2px }
.desk-item.desk-check small { display:block }
.desk-item.on { border-color:#1d4ed8;background:#eff6ff }
.desk-empty { color:#64748b;padding:16px;text-align:center }
.desk-card { background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:14px;margin:10px 0 }
.desk-card small { display:block;color:#64748b }
.desk-card.sug { border-color:#f59e0b;background:#fffbeb }
.desk-card.sel { border-color:#16a34a;background:#f0fdf4 }
.desk-hint,.desk-note { color:#64748b;font-size:13px;margin:8px 0 }
.desk-limits { width:100%;font-size:14px;margin-top:8px }
.desk-limits td { padding:3px 0;border-top:1px solid #f1f5f9 }
.desk-limits td:last-child { text-align:right;font-weight:600 }
.desk-top { display:flex;align-items:center;gap:12px;padding:6px 0 }
.desk-back { font-size:34px;text-decoration:none;line-height:1;padding:0 8px;color:#0f2d5a }
.desk-title { display:flex;flex-direction:column }
.desk-title span { font-size:12px;color:#64748b }
.desk-progress { height:6px;background:#e2e8f0;border-radius:6px;overflow:hidden;margin-bottom:10px }
.desk-progress div { height:100%;background:#1d4ed8;width:12%;transition:width .2s }
.desk-body { padding-bottom:96px }
.desk-footer { position:fixed;left:0;right:0;bottom:0;display:flex;gap:10px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #e2e8f0;z-index:20 }
.desk-footer .btn { flex:1;min-height:52px;font-size:16px;border-radius:12px }
.desk-actions { display:flex;flex-wrap:wrap;gap:10px;margin:14px 0 }
.desk-actions .btn { flex:1 1 140px;min-height:50px }
.desk-done { max-width:560px;margin:0 auto;text-align:center }
.desk-done h1 { letter-spacing:.06em }
.desk-check {  }
.desk-done .desk-check { width:84px;height:84px;border-radius:50%;background:#16a34a;color:#fff;font-size:52px;line-height:84px;margin:10px auto }
.desk-summary { text-align:left;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:6px 14px }
.desk-summary div { display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-bottom:1px solid #f1f5f9 }
.desk-summary div:last-child { border:0 }
.desk-summary span { color:#64748b }
@media (min-width:900px) {
  .desk-footer { left:var(--sidebar-w,240px) }
}
.work-item .wi-ic { font-size:20px;width:30px;text-align:center }
.chip.done { background:#dcfce7;color:#166534 }
.pager .cur { background:var(--brand,#0f2d5a);color:#fff }
.bottom-nav { display:none }
@media (max-width:900px) {
  .bottom-nav { display:flex;position:fixed;left:0;right:0;bottom:0;z-index:40;background:#fff;border-top:1px solid #e2e8f0;padding:6px 4px calc(6px + env(safe-area-inset-bottom));justify-content:space-around }
  .bottom-nav a,.bottom-nav button { flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;color:#475569;text-decoration:none;background:none;border:0;min-height:48px;justify-content:center;cursor:pointer;font-family:inherit }
  .bottom-nav a span,.bottom-nav button span { font-size:20px;line-height:1 }
  .bottom-nav a.on { color:var(--brand,#0f2d5a);font-weight:600 }
  .desk-footer { bottom:calc(58px + env(safe-area-inset-bottom)) }
}
.quick-actions { display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px }




:root {
  --ams-ui: '3.0.2.1';
  --ui-bg: #f4f6fa;
  --ui-surface: #ffffff;
  --ui-border: #e2e7ef;
  --ui-border-strong: #cfd7e3;
  --ui-text: #172033;
  --ui-muted: #5b6678;
  --ui-faint: #8792a5;
  --ui-brand: var(--brand, #0f2d5a);
  --ui-brand-soft: #e9eef7;
  --ui-ok: #157347;      --ui-ok-bg: #e8f6ee;      --ui-ok-line: #b7e1c8;
  --ui-warn: #a15c07;    --ui-warn-bg: #fff4dc;    --ui-warn-line: #f2d18a;
  --ui-bad: #b42318;     --ui-bad-bg: #fdecea;     --ui-bad-line: #f5b9b3;
  --ui-info: #1d4ed8;    --ui-info-bg: #e8f0ff;    --ui-info-line: #b9cffa;
  --ui-radius: 12px;
  --ui-radius-sm: 8px;
  --ui-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --ui-shadow-lift: 0 4px 14px rgba(16, 24, 40, .10);
  --ui-focus: 0 0 0 3px rgba(29, 78, 216, .28);
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 256px;
}

/* ---------- Base (portal / sign-in / client portal only; the public website keeps its own look) ---------- */
.app-shell, .auth-shell, .client-shell { font-family: var(--ui-font); color: var(--ui-text); }
.app-shell h1, .app-shell h2, .app-shell h3, .app-shell h4,
.client-shell h1, .client-shell h2, .client-shell h3, .client-shell h4 { font-family: var(--ui-font); color: var(--ui-text); letter-spacing: -.01em; }
body:has(.app-shell), body:has(.client-shell) { background: var(--ui-bg); -webkit-text-size-adjust: 100%; }
.ui-i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: -.2em; }
.muted, .hint { color: var(--ui-muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: none; box-shadow: var(--ui-focus); border-radius: 6px; }
a { text-underline-offset: 2px; }

/* ---------- Shell: sidebar ---------- */
.app-shell { background: var(--ui-bg); }
.sidebar { width: var(--sidebar-w); background: #0d2247; scrollbar-width: thin; scrollbar-color: #2b4372 transparent; }
.sidebar-brand { padding: 18px 18px 16px; gap: 12px; }
.sidebar-brand .mark, .sidebar-brand .mark-img { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
.sidebar-brand .brand-text { min-width: 0; flex: 1; }
.sidebar-brand strong { font-size: 14.5px; overflow-wrap: anywhere; }
.sidebar-brand span { display: block; }
.sidebar-close { display: none; background: none; border: 0; color: #cbd6ea; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; font-size: 20px; align-items: center; justify-content: center; }
.sidebar nav { padding: 6px 10px 28px; }
.sidebar .grp { padding: 18px 12px 6px; font-size: 11px; letter-spacing: .09em; color: #7d90b5; font-weight: 600; }
.sidebar a { gap: 11px; padding: 9px 12px; font-size: 14px; border-radius: 8px; min-height: 38px; }
.sidebar a .ic { width: 20px; display: inline-flex; justify-content: center; opacity: .9; font-size: 17px; }
.sidebar a .lbl { min-width: 0; overflow-wrap: anywhere; }
.sidebar a.active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 3px 0 0 var(--gold, #c8a45c); }
.sidebar a.active .ic { opacity: 1; }
.sidebar-backdrop { display: none; }
.main { margin-left: var(--sidebar-w); }

/* ---------- Shell: top bar ---------- */
.topbar { height: 64px; padding: 0 28px; border-bottom: 1px solid var(--ui-border); background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.2) blur(6px); }
.topbar .search-box { position: relative; flex: 1 1 auto; max-width: 460px; margin: 0; }
.topbar .search-box .ui-i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ui-faint); pointer-events: none; }
.topbar .search-box input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--ui-border); background: var(--ui-bg); font-size: 14px; }
.topbar .search-box input:focus { background: #fff; border-color: var(--ui-brand); }
.topbar-actions { gap: 6px; flex: 0 0 auto; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 19px; color: var(--ui-muted); border-radius: 10px; }
.icon-btn:hover { background: var(--ui-bg); color: var(--ui-text); }
.icon-btn .dot { top: 3px; right: 2px; background: var(--ui-bad); }
.user-chip { border: 0; background: none; font: inherit; color: inherit; padding: 4px 10px 4px 4px; text-align: left; }
.user-chip .av { width: 34px; height: 34px; border-radius: 50%; background: var(--ui-brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.user-chip .meta { display: block; line-height: 1.2; min-width: 0; }
.user-chip .meta strong { display: block; font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .meta span { display: block; font-size: 11.5px; color: var(--ui-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; background: none; border: 0; border-radius: 10px; color: var(--ui-text); font-size: 22px; cursor: pointer; }
.dropdown-menu { border-radius: 12px; border-color: var(--ui-border); box-shadow: 0 12px 32px rgba(16, 24, 40, .14); }
.dropdown-menu a, .dropdown-menu button { padding: 11px 16px; font-size: 14px; }

/* ---------- Content frame ---------- */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100000; background: #fff; color: var(--ui-brand); padding: 10px 16px; border-radius: 8px; font-weight: 650; border: 2px solid var(--ui-brand); text-decoration: none; }
.skip-link:focus { left: 8px; }
main:focus { outline: none; }
.content { padding: 28px 32px 48px; }
.content > * { max-width: 1480px; margin-left: auto; margin-right: auto; }

/* ---------- Page header ---------- */
.page-head { align-items: flex-start; gap: 14px 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 0; }
.page-head p, .page-head .sub { color: var(--ui-muted); font-size: 14px; margin: 4px 0 0; max-width: 70ch; }
.page-actions, .page-head .actions, .head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--ui-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--ui-muted); }

/* ---------- Buttons ---------- */
.btn { min-height: 40px; padding: 8px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; line-height: 1.2; transition: background .12s, border-color .12s, box-shadow .12s; text-align: center; }
.btn .ui-i { font-size: 1.05em; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--ui-brand); border-color: var(--ui-brand); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.btn-primary:hover { filter: brightness(1.12); background: var(--ui-brand); }
.btn-outline { background: #fff; border: 1px solid var(--ui-border-strong); color: var(--ui-text); }
.btn-outline:hover { background: var(--ui-bg); border-color: var(--ui-faint); color: var(--ui-text); }
.btn-danger { background: var(--ui-bad); border-color: var(--ui-bad); }
.btn-danger-outline { background: #fff; color: var(--ui-bad); border: 1px solid var(--ui-bad-line); }
.btn-danger-outline:hover { background: var(--ui-bad-bg); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { box-shadow: var(--ui-focus); }

/* ---------- Cards / panels ---------- */
.panel, .ui-card { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); margin-bottom: 20px; }
.panel-head { padding: 15px 20px; border-bottom: 1px solid var(--ui-border); gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.panel-head a { font-size: 13px; font-weight: 600; }
.panel-body { padding: 18px 20px; }
.panel-body.no-pad { padding: 0; }
.grid { gap: 20px; }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-5 > * { min-width: 0; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }

/* ---------- KPI cards ---------- */
.ui-section { margin: 0 0 26px; }
.ui-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.ui-section__title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ui-muted); font-weight: 700; margin: 0; }
.ui-section__link { font-size: 13px; font-weight: 600; }
.ui-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.ui-kpi { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); color: inherit; text-decoration: none; min-width: 0; transition: box-shadow .12s, border-color .12s, transform .12s; }
a.ui-kpi:hover { text-decoration: none; box-shadow: var(--ui-shadow-lift); border-color: var(--ui-border-strong); transform: translateY(-1px); }
a.ui-kpi:focus-visible { box-shadow: var(--ui-focus); }
.ui-kpi__icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--ui-brand-soft); color: var(--ui-brand); font-size: 21px; }
.ui-kpi__body { min-width: 0; flex: 1; }
.ui-kpi__value { display: block; font-size: 28px; font-weight: 750; line-height: 1.1; color: var(--ui-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ui-kpi__label { display: block; margin-top: 3px; font-size: 13px; color: var(--ui-muted); line-height: 1.3; }
.ui-kpi__go { color: var(--ui-faint); font-size: 16px; flex: 0 0 auto; }
.ui-kpi.is-warn { border-color: var(--ui-warn-line); background: linear-gradient(0deg, var(--ui-warn-bg), var(--ui-warn-bg)) padding-box; }
.ui-kpi.is-warn .ui-kpi__icon { background: #ffe6b0; color: var(--ui-warn); }
.ui-kpi.is-bad { border-color: var(--ui-bad-line); background: var(--ui-bad-bg); }
.ui-kpi.is-bad .ui-kpi__icon { background: #fbd0cb; color: var(--ui-bad); }
.ui-kpi.is-bad .ui-kpi__value { color: var(--ui-bad); }
.ui-kpi.is-good .ui-kpi__icon { background: var(--ui-ok-bg); color: var(--ui-ok); }
.ui-kpi.is-quiet .ui-kpi__value { color: var(--ui-muted); }
.ui-kpis--compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ui-kpis--compact .ui-kpi { padding: 12px 14px; }
.ui-kpis--compact .ui-kpi__icon { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }
.ui-kpis--compact .ui-kpi__value { font-size: 23px; }
.ui-kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* legacy KPI markup used by older pages (kpi / stat-tile / summary-card) gets the same look */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi, .stat-tile, .summary-card { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); padding: 16px 18px; color: inherit; text-decoration: none; display: block; min-width: 0; }
a.kpi:hover { text-decoration: none; box-shadow: var(--ui-shadow-lift); border-color: var(--ui-border-strong); }
.kpi strong { display: block; font-size: 27px; line-height: 1.1; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi span, .kpi-label, .kpi .sub { display: block; font-size: 13px; color: var(--ui-muted); margin-top: 3px; }
.kpi-value { display: block; font-size: 24px; font-weight: 750; line-height: 1.15; margin: 2px 0; }
.kpi.warn, .stat-tile.warn { border-color: var(--ui-warn-line); background: var(--ui-warn-bg); }
.kpi.bad, .kpi.danger, .stat-tile.danger { border-color: var(--ui-bad-line); background: var(--ui-bad-bg); }
.kpi.good { border-color: var(--ui-ok-line); }
.kpi-tight { margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile .lbl { font-size: 12px; letter-spacing: .05em; }
.stat-tile .val { font-family: var(--ui-font); font-size: 26px; font-weight: 750; }

/* ---------- Lists / rows ---------- */
.ui-list { display: flex; flex-direction: column; }
.ui-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--ui-border); color: inherit; text-decoration: none; min-width: 0; }
.ui-row:last-child { border-bottom: 0; }
a.ui-row:hover { background: #f8fafc; text-decoration: none; }
.ui-row__icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--ui-brand-soft); color: var(--ui-brand); font-size: 18px; }
.ui-row__main { flex: 1 1 auto; min-width: 0; }
.ui-row__title { display: block; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; color: var(--ui-text); }
.ui-row__meta { display: block; font-size: 13px; color: var(--ui-muted); margin-top: 2px; overflow-wrap: anywhere; }
.ui-row__end { flex: 0 0 auto; text-align: right; font-size: 12.5px; color: var(--ui-muted); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ui-row__end.is-late { color: var(--ui-bad); font-weight: 600; }
.ui-empty { padding: 28px 20px; text-align: center; color: var(--ui-muted); font-size: 14px; }
.ui-empty .ui-i { display: block; margin: 0 auto 8px; width: 28px; height: 28px; color: var(--ui-faint); }

/* legacy row/list widgets */
.work-item { border-radius: var(--ui-radius-sm); border: 1px solid var(--ui-border); padding: 12px 14px; gap: 12px; background: #fff; margin-bottom: 8px; box-shadow: var(--ui-shadow); }
.work-item:hover { text-decoration: none; border-color: var(--ui-border-strong); box-shadow: var(--ui-shadow-lift); }
.work-item strong { font-weight: 600; overflow-wrap: anywhere; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f6; color: #465066; margin: 0 4px 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { font-size: 14px; }
table.data th { background: #f7f9fc; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; padding: 11px 16px; border-bottom: 1px solid var(--ui-border); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--ui-border); overflow-wrap: break-word; word-break: normal; }
table.data td.nw, table.data th.nw { white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #f8fafc; }
table.data a.row-link { color: var(--ui-text); font-weight: 600; }
table.data a.row-link:hover { color: var(--ui-brand); }
table.data td .btn + .btn, table.data td form + .btn, table.data td .btn + form { margin-left: 4px; }
table.data td:last-child { white-space: nowrap; }
.panel > .table-wrap:first-child table.data thead th:first-child { border-top-left-radius: var(--ui-radius); }

/* bulk-action bar above a list */
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; line-height: 1.4; white-space: nowrap; }
.badge-success { background: var(--ui-ok-bg); color: var(--ui-ok); }
.badge-warning { background: var(--ui-warn-bg); color: var(--ui-warn); }
.badge-danger { background: var(--ui-bad-bg); color: var(--ui-bad); }
.badge-info { background: var(--ui-info-bg); color: var(--ui-info); }
.badge-secondary { background: #eef1f6; color: #465066; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: #38445a; margin-bottom: 6px; }
.field small { color: var(--ui-muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], .field input:not([type]), .form-row input:not([type]), select, textarea {
  min-height: 42px; padding: 9px 12px; border: 1px solid var(--ui-border-strong); border-radius: 10px; background: #fff; font-size: 14.5px; color: var(--ui-text); }
select { padding-right: 32px; }
textarea { min-height: 96px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--ui-info); box-shadow: var(--ui-focus); outline: none; }
input:disabled, select:disabled, textarea:disabled { background: #f1f4f8; color: var(--ui-muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--ui-brand); }
input[type=file] { width: 100%; max-width: 100%; min-height: 44px; padding: 8px 10px; border: 1px dashed var(--ui-border-strong); border-radius: 10px; background: #fafbfd; font-size: 14px; color: var(--ui-muted); }
input[type=file]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 1px solid var(--ui-border-strong); border-radius: 8px; background: #fff; color: var(--ui-text); font-weight: 600; cursor: pointer; }
input[type=color] { width: 56px; height: 44px; padding: 3px; border: 1px solid var(--ui-border-strong); border-radius: 10px; background: #fff; cursor: pointer; }
.form-row { gap: 0 18px; }
.form-row .field { min-width: min(220px, 100%); }
.check-field { align-items: center; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--ui-bad); }
.field .error, .field-error { color: var(--ui-bad); font-size: 12.5px; margin-top: 4px; }
.form-card { border-radius: var(--ui-radius); }

/* filter / toolbar row */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; padding: 0; }
.filters form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; width: 100%; margin: 0; }
.filters input, .filters select { width: auto; min-width: 150px; min-height: 40px; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.filters input[type=text], .filters input[type=search] { flex: 1 1 260px; max-width: 420px; }
.filters .btn { min-height: 40px; }

/* ---------- Tabs / pills ---------- */
.tabs { gap: 4px; border-bottom: 1px solid var(--ui-border); margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--ui-muted); min-height: 44px; display: inline-flex; align-items: center; }
.tabs a.active { color: var(--ui-brand); border-color: var(--ui-brand); }
.tabs a:hover { color: var(--ui-text); text-decoration: none; }
.tabs-bar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 14px; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tabs-bar a { min-height: 40px; border-radius: 999px; border: 1px solid var(--ui-border-strong); background: #fff; color: #38445a; font-size: 14px; padding: 8px 15px; font-weight: 600; }
.tabs-bar a:hover { text-decoration: none; border-color: var(--ui-faint); }
.tabs-bar a.on { background: var(--ui-brand); border-color: var(--ui-brand); color: #fff; }
.pagination, .pager { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin: 18px 0 4px; }
.pagination a, .pagination span, .pager a, .pager span { min-height: 38px; padding: 7px 14px; display: inline-flex; align-items: center; border-radius: 8px; border: 1px solid var(--ui-border-strong); background: #fff; font-size: 13.5px; color: #38445a; }
.pagination .current { background: var(--ui-brand); border-color: var(--ui-brand); color: #fff; }

/* ---------- Alerts / notices / empty states ---------- */
.alert { border-radius: 10px; padding: 12px 16px; font-size: 14px; border-width: 1px; border-left-width: 4px; }
.alert-success { background: var(--ui-ok-bg); border-color: var(--ui-ok-line); color: #0f5132; }
.alert-danger, .alert-error { background: var(--ui-bad-bg); border-color: var(--ui-bad-line); color: #7a1c14; }
.alert-warning { background: var(--ui-warn-bg); border-color: var(--ui-warn-line); color: #6e4105; }
.alert-info { background: var(--ui-info-bg); border-color: var(--ui-info-line); color: #163f9c; }
.notice-box { border-radius: 10px; font-size: 13.5px; }
.empty-state, .zero { padding: 40px 20px; text-align: center; color: var(--ui-muted); }
.empty-state .ic { font-size: 30px; opacity: .75; }
.kv { font-size: 14px; gap: 10px 16px; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); }
.kv dd { overflow-wrap: anywhere; }
.timeline .dot { background: var(--ui-brand-soft); color: var(--ui-brand); }

/* ---------- Modals ---------- */
.modal { border-radius: 14px; width: min(560px, calc(100% - 24px)); }
.modal-head { padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-close { width: 40px; height: 40px; border-radius: 8px; }

/* ---------- Dashboard ---------- */
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.dash-hero h1 { font-size: 27px; font-weight: 750; margin: 0; }
.dash-hero p { margin: 4px 0 0; color: var(--ui-muted); font-size: 14.5px; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; align-items: start; }
.dash-col-4 { grid-column: span 4; } .dash-col-6 { grid-column: span 6; } .dash-col-8 { grid-column: span 8; } .dash-col-12 { grid-column: span 12; }
.dash-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 14px; grid-auto-flow: dense; margin-bottom: 6px; }
.dash-groups > .ui-section { margin: 0; grid-column: span var(--span, 1); }
.dash-groups .ui-kpis { grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }
.dash-groups .ui-kpi { padding: 15px 16px; }
.ui-kpi__value.is-money { font-size: 24px; }
.dash-mywork .ui-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-mywork-list { margin-top: 14px; border-top: 1px solid var(--ui-border); }

/* ---------- Certificate Desk (workstation) ---------- */
.desk-home { max-width: 1180px; margin: 0 auto; }
.desk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.desk-head h1 { font-size: 27px; font-weight: 750; margin: 0; }
.desk-head p { margin: 4px 0 0; color: var(--ui-muted); font-size: 14.5px; max-width: 60ch; }
.desk-cta { min-height: 52px; padding: 0 26px; font-size: 16px; border-radius: 12px; margin: 0; display: inline-flex; gap: 8px; }
.desk-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.desk-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.desk-toolbar .desk-search { position: relative; flex: 1 1 280px; }
.desk-toolbar .desk-search .ui-i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ui-faint); pointer-events: none; }
.desk-toolbar .desk-search input { width: 100%; min-height: 48px; padding-left: 42px; font-size: 16px; border-radius: 12px; }
.desk-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.desk-panel { margin-bottom: 0; }
.desk-panel .panel-head { padding: 14px 18px; }
.req-card { display: block; padding: 15px 18px; border-bottom: 1px solid var(--ui-border); color: inherit; }
.req-card:last-child { border-bottom: 0; }
.req-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.req-card__title { font-weight: 650; font-size: 15px; overflow-wrap: anywhere; }
.req-card__no { font-size: 12.5px; color: var(--ui-muted); white-space: nowrap; }
.req-card__meta { margin: 4px 0 0; font-size: 13.5px; color: var(--ui-muted); overflow-wrap: anywhere; }
.req-card__meta b { color: #38445a; font-weight: 600; }
.req-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.req-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.req-card__when { font-size: 12.5px; color: var(--ui-faint); }
.req-card.is-flagged { background: linear-gradient(90deg, var(--ui-warn-bg), #fff 42%); box-shadow: inset 4px 0 0 #e6a324; }
.coi-row { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--ui-border); }
.coi-row:last-child { border-bottom: 0; }
.coi-row__main { flex: 1 1 auto; min-width: 0; }
.coi-row__no { font-weight: 700; font-size: 14.5px; }
.coi-row__meta { font-size: 13.5px; color: var(--ui-muted); margin-top: 2px; overflow-wrap: anywhere; }
.coi-row__meta b { color: #38445a; font-weight: 600; }
.coi-row__when { font-size: 12.5px; color: var(--ui-faint); margin-top: 2px; }
.coi-row__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.desk-drafts { margin-bottom: 18px; }
.desk-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* wizard (also used full-width on phones) */
.desk { max-width: 760px; margin: 0 auto; }
.desk-top { padding: 4px 0 6px; }
.desk-item, .desk-card, .desk-summary { border-radius: 12px; border-color: var(--ui-border); }
.desk-item:hover { border-color: var(--ui-border-strong); text-decoration: none; }
.desk-item.on { border-color: var(--ui-info); background: var(--ui-info-bg); }
.desk-progress { height: 8px; background: #dfe5ee; }
.desk-progress div { background: var(--ui-brand); }
.desk-footer { border-top: 1px solid var(--ui-border); box-shadow: 0 -4px 16px rgba(16, 24, 40, .06); }

/* ---------- Client portal ---------- */
.client-shell { background: var(--ui-bg); min-height: 100vh; }
/* E-signature prepare screen (PDF field editor) */
.prep-grid { display: grid; grid-template-columns: 140px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.prep-thumbs, .prep-fields { max-height: 80vh; overflow: auto; }
.prep-viewer { max-height: 80vh; overflow: auto; text-align: center; background: #525659; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-group { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.radio-group label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; }
.signer-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.signer-row input { flex: 1 1 150px; min-width: 0; }
.signer-row input[data-f=role] { flex-basis: 180px; }
/* Standalone error pages (403/404/419/500) */
.err-body { margin: 0; min-height: 100vh; background: var(--ui-bg, #f4f6fa); }
.err-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; box-sizing: border-box; }
.err-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--ui-border); border-radius: 16px; box-shadow: var(--ui-shadow); padding: 32px 26px; text-align: center; }
.err-code { font-size: 54px; line-height: 1; font-weight: 800; letter-spacing: -1px; color: var(--ui-brand); margin-bottom: 10px; }
.err-card h1 { font-size: 22px; margin: 0 0 10px; }
.err-card p { color: var(--ui-muted); margin: 0 0 22px; line-height: 1.55; overflow-wrap: break-word; }
.err-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.err-actions .btn { min-height: 44px; flex: 1 1 160px; }
.panel-collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 48px; }
.panel-collapsible > summary::-webkit-details-marker { display: none; }
.panel-collapsible > summary::after { content: '+'; font-size: 20px; font-weight: 600; color: var(--ui-muted); margin-left: auto; }
.panel-collapsible[open] > summary::after { content: '\2212'; }
.panel-collapsible[open] > summary { border-bottom: 1px solid var(--ui-border); }
.panel-collapsible > summary:focus-visible { outline: 3px solid var(--ui-focus, #2563eb); outline-offset: -3px; }
.panel-hint { color: var(--ui-muted); font-size: 13px; font-weight: 400; flex: 1 1 260px; }
.panel-notice { border: 1px solid #d6a400; border-left-width: 4px; }
.split-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split-2 > * { min-width: 0; }
.client-nav { background: #0d2247; color: #fff; position: sticky; top: 0; z-index: 60; }
.client-nav-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 22px; }
.client-nav a { color: #fff; text-decoration: none; }
.client-brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.client-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.client-links a { padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; opacity: .92; }
.client-links a:hover, .client-links a.on { background: rgba(255, 255, 255, .14); opacity: 1; }
.client-menu-btn { display: none; background: none; border: 0; color: #fff; width: 44px; height: 44px; font-size: 22px; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer; }
.client-main { max-width: 1180px; margin: 0 auto; padding: 28px 22px 56px; }
.client-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.client-hero h1 { font-size: 26px; font-weight: 750; margin: 0; }
.client-muted { color: var(--ui-muted); }
.client-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.client-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.client-stat { display: block; background: #fff; border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); padding: 16px 18px; }
.client-stat strong { display: block; font-size: 28px; font-weight: 750; line-height: 1.1; }
.client-stat span { display: block; color: var(--ui-muted); font-size: 13px; margin-top: 3px; }

/* ---------- Sign-in ---------- */
.auth-card { border-radius: 16px; box-shadow: 0 30px 70px rgba(4, 12, 32, .4); }
.auth-card input { min-height: 46px; }
.auth-card .btn { min-height: 46px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .dash-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-groups > .ui-section { grid-column: span min(var(--span, 1), 2); }
  .dash-groups .ui-kpis { grid-template-columns: repeat(min(var(--cols, 1), 2), minmax(0, 1fr)); }
  .dash-mywork .ui-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .desk-columns { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1080px) {
  .dash-col-4, .dash-col-6, .dash-col-8 { grid-column: span 12; }
}
@media (max-width: 1200px) {
  .prep-grid { grid-template-columns: minmax(0, 1fr); }
  .prep-viewer { order: 1; max-height: none; }
  .prep-thumbs { order: 2; max-height: none; }
  .prep-thumbs #thumbs { display: flex; gap: 10px; overflow-x: auto; }
  .prep-thumbs #thumbs > div { flex: 0 0 auto; }
  .prep-fields { order: 3; max-height: none; }
}
@media (max-width: 1100px) {
  .split-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .signer-row input, .prep-fields input, #ocrPageInput { min-height: 44px; }
  .radio-group label { min-height: 44px; }
  .page-actions .btn { flex: 1 1 calc(50% - 10px); }
  .page-actions .btn-primary { flex-basis: 100%; }
  /* off-canvas navigation */
  .sidebar { transform: translateX(-102%); width: min(84vw, 320px); box-shadow: none; transition: transform .22s ease; z-index: 130; }
  .sidebar.open { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .35); }
  .sidebar-close { display: inline-flex; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 16, 36, .5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 120; }
  body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .main { margin-left: 0; }
  .mobile-toggle { display: inline-flex; }
  .topbar { padding: 0 10px 0 6px; gap: 6px; }
  .topbar .search-box { max-width: none; }
  .content { padding: 18px 16px 100px; }
  .bottom-nav a, .bottom-nav button { font-size: 11.5px; }
  .bottom-nav a.on { color: var(--ui-brand); }
  .bottom-nav a .ui-i, .bottom-nav button .ui-i { width: 22px; height: 22px; }
  .client-links { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: 8px; }
  .client-links.open { display: flex; }
  .client-nav-inner { flex-wrap: wrap; padding: 6px 14px; }
  .client-brand { flex: 1 1 0; min-height: 44px; font-size: 15px; }
  .client-menu-btn { display: inline-flex; flex: 0 0 auto; }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar .search-box { display: none; }
  .topbar-actions { margin-left: auto; }
  .user-chip .meta { display: none; }
  .user-chip { padding: 4px; }
  .page-head h1, .dash-hero h1, .desk-head h1, .client-hero h1 { font-size: 23px; }
  .page-actions, .page-head .actions, .head-actions { width: 100%; }
  .page-actions .btn, .page-head .actions .btn { flex: 1 1 auto; }
  .dash-groups { grid-template-columns: 1fr; gap: 20px; }
  .dash-groups > .ui-section { grid-column: 1; }
  .ui-kpis, .ui-kpis--compact, .dash-mywork .ui-kpis, .dash-groups .ui-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ui-kpis--3, .desk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ui-kpi { padding: 13px 12px; gap: 10px; }
  .ui-kpi__icon { width: 38px; height: 38px; font-size: 18px; border-radius: 10px; }
  .ui-kpi__value { font-size: 24px; }
  .ui-kpi__go { display: none; }
  .desk-kpis .ui-kpi { flex-direction: column; align-items: flex-start; text-align: left; padding: 12px 10px; gap: 6px; }
  .desk-kpis .ui-kpi__icon { display: none; }
  .desk-kpis .ui-kpi__value { font-size: 24px; }
  .desk-kpis .ui-kpi__label { font-size: 12px; }
  .desk-head { align-items: stretch; }
  .desk-cta { width: 100%; min-height: 58px; font-size: 17px; }
  .desk-head > div:last-child { width: 100%; }
  .desk-toolbar .btn { flex: 1 1 auto; }
  .req-card, .coi-row { padding: 14px 14px; }
  .coi-row__actions .btn { flex: 1 1 auto; min-height: 44px; }
  .req-card__foot .btn { flex: 1 1 100%; min-height: 46px; }
  .ui-row { padding: 12px 14px; gap: 12px; align-items: flex-start; }
  .ui-row__end { align-items: flex-end; }
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 14px 16px; }
  .filters input, .filters select, .filters form .btn { flex: 1 1 100%; width: 100%; max-width: none; }
  .filters > a.btn { flex: 0 0 auto; width: auto; min-height: 40px; padding: 8px 14px; }
  .filters input[type=text], .filters input[type=search] { max-width: none; }
  .tabs a { padding: 12px 13px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12.5px; }
  .modal-backdrop { align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .grid-5 { grid-template-columns: 1fr 1fr; }
  .pagination, .pager { justify-content: center; }
  .client-main { padding: 20px 14px 48px; }
  .client-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 20px; }
  /* stacked "record cards": the first text cell becomes the card title, empty cells are hidden, the tick box floats top-right */
  table.data tr { display: flex; flex-direction: column; position: relative; padding: 12px 14px; box-shadow: var(--ui-shadow); }
  table.data td { align-items: flex-start; padding: 7px 0; white-space: normal; }
  table.data td::before { flex: 0 0 36%; }
  table.data td > * { max-width: 62%; text-align: right; }
  table.data td > .btn, table.data td > form, table.data td > .badge { max-width: none; }
  table.data td { width: auto !important; min-width: 0; overflow-wrap: anywhere; }
  table.data td:last-child { white-space: normal; }
  table.data td.nw, table.data td.nw:last-child { white-space: nowrap; overflow-wrap: normal; }  /* views carry inline column widths meant for desktop tables */
  table.data td[data-empty] { display: none; }
  table.data td[data-label=""]::before, table.data td:not([data-label])::before { display: none; }
  table.data td.cell-title { order: -1; display: block; text-align: left; font-size: 15.5px; font-weight: 650; padding: 0 34px 9px 0; margin-bottom: 3px; border-bottom: 1px solid var(--ui-border); }
  table.data td.cell-title::before { display: none; }
  table.data td.cell-title > * { max-width: none; text-align: left; }
  table.data td.cell-title > div { font-weight: 500; margin-top: 2px; }
  /* full-width message rows ("No backups yet…", "No records") are not record cards: plain, centered, wrapping text */
  table.data td[colspan], table.data td[colspan].cell-title { display: block; text-align: center; font-size: 14px; font-weight: 400; padding: 22px 14px; margin: 0; border: 0; white-space: normal; overflow-wrap: break-word; }
  table.data td[colspan]::before { display: none; }
  table.data td[colspan] > * { max-width: none; text-align: center; }
  table.data td.cell-check { position: absolute; top: 10px; right: 10px; width: auto; padding: 0; border: 0; z-index: 1; display: block; }
  table.data td.cell-check::before { display: none; }
  table.data td.cell-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  table.data td.cell-actions > * { max-width: none; }
  table.data td.cell-actions::before { display: none; }
  .btn-sm { min-height: 42px; padding: 8px 14px; }
  .tabs a, .tabs-bar a { min-height: 44px; }
  .bulk-bar .btn { width: 100%; }
}
@media (min-width: 1700px) {
  .content { padding-left: 44px; padding-right: 44px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ==== 3.0.2: COI requests, email conversations, bulk actions ==== */
ul.ui-list, ol.ui-list { list-style: none; margin: 0; padding: 0; }
/* long, unbreakable values (e-mail addresses, subjects, holder names) must wrap instead of widening the page */
.grid > *, .grid-2 > *, .split-2 > * { min-width: 0; }
.kv dd, .kv dt, .panel-body { overflow-wrap: anywhere; }
.ui-kpis--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.badge-primary { background: var(--ui-brand); color: #fff; }
.chip-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: 11.5px; font-weight: 700; text-align: center; }
.btn-primary .chip-n { background: rgba(255,255,255,.25); }
.req-card__select { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; margin: -8px 2px 0 -12px; cursor: pointer; }
.req-card__select input { width: 22px; height: 22px; cursor: pointer; }
.req-card__conv { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; font-size: 12.5px; color: var(--ui-muted); }
.req-card.is-test { background: repeating-linear-gradient(135deg, #fff, #fff 12px, #fdf3f2 12px, #fdf3f2 24px); }
.req-card.is-selected { outline: 2px solid var(--ui-brand); outline-offset: -2px; }
.bulk-bar--sticky { position: sticky; top: 66px; z-index: 30; background: #fff; border: 1px solid var(--ui-border); border-radius: 12px; padding: 10px 14px; box-shadow: var(--ui-shadow); }
.bulk-bar__all { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 600; cursor: pointer; }
.bulk-bar__all input { width: 20px; height: 20px; }
.bulk-bar__count { font-weight: 600; color: var(--ui-muted); }
.bulk-bar__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bulk-bar--sticky .btn { width: auto; }
.pager__info { border: 0 !important; background: none !important; color: var(--ui-muted); }
.check-line { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; line-height: 1.4; cursor: pointer; }
.check-line input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.dup-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 10px 0; border-top: 1px solid var(--ui-border); }
.req-life__row { display: flex; gap: 12px 28px; flex-wrap: wrap; margin-bottom: 14px; }
.req-life__row > div { min-width: 150px; }
.req-life__actions .btn { min-height: 44px; }
.crumb { margin: 0 0 4px; font-size: 13px; }
.conv-title { overflow-wrap: anywhere; }
.conv { display: flex; flex-direction: column; gap: 14px; }
.conv-msg { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 14px; padding: 14px 16px; max-width: 940px; box-shadow: var(--ui-shadow); min-width: 0; }
.conv-msg--out { margin-left: 64px; background: var(--ui-info-bg); }
.conv-msg.is-unread { border-left: 4px solid #e6a324; }
.conv-msg__head { display: flex; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; align-items: baseline; }
.conv-msg__who { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.conv-msg__addr, .conv-msg__time { color: var(--ui-muted); font-size: 13px; }
.conv-msg__meta { margin: 8px 0 10px; display: grid; gap: 2px; font-size: 13px; }
.conv-msg__meta > div { display: flex; gap: 8px; }
.conv-msg__meta dt { flex: 0 0 62px; color: var(--ui-muted); }
.conv-msg__meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.conv-msg__body { overflow-wrap: anywhere; max-width: 100%; overflow-x: auto; }
.conv-msg__body img { max-width: 100%; height: auto; }
.conv-plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.conv-att { list-style: none; margin: 12px 0 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.conv-att__name { overflow-wrap: anywhere; max-width: min(60vw, 420px); }
.conv-decide { border-left: 4px solid #e6a324; margin-bottom: 14px; }
.conv-decide__form, .conv-decide__dismiss { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; margin-right: 8px; }
.conv-decide select { min-height: 44px; max-width: 100%; }
@media (max-width: 1200px) { .ui-kpis--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .ui-kpis--5, .ui-kpis--5.desk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ui-kpis--5 .ui-kpi:last-child { grid-column: 1 / -1; }
  .req-card__foot .btn { flex: 1 1 calc(50% - 8px); min-height: 46px; }
  .req-card__foot .btn-primary { flex-basis: 100%; }
  .bulk-bar--sticky { top: 60px; padding: 10px; }
  .bulk-bar__actions { margin-left: 0; width: 100%; }
  .bulk-bar__actions .btn { flex: 1 1 100%; min-height: 46px; }
  .conv-msg { padding: 12px; }
  .conv-msg--out { margin-left: 18px; }
  .conv-msg__meta dt { flex-basis: 52px; }
  .conv-att li, .conv-att .btn { width: 100%; }
  .dup-row .page-actions .btn { flex: 1 1 100%; min-height: 44px; }
  .conv-decide__form, .conv-decide__dismiss { display: flex; width: 100%; margin-right: 0; }
  .conv-decide__form .btn, .conv-decide__dismiss .btn, .conv-decide select { width: 100%; min-height: 46px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .sidebar-backdrop, .page-actions, .btn { display: none !important; }
  .main { margin: 0; } .content { padding: 0; }
  .panel, .ui-kpi { box-shadow: none; }
}

/* ---- 3.0.2.1: supplemental pages controls, cron health, cron instructions ---- */
.sync-health { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 12px; font-size: 13px; }
.sync-health .sub { min-width: 0; overflow-wrap: anywhere; }
.cron-mode { border: 1px solid var(--gray-200, #e2e8f0); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.cron-mode h4 { margin: 0 0 6px; font-size: 14px; }
.auto-cmd { display: block; overflow-wrap: anywhere; word-break: break-all; background: var(--gray-100, #f1f5f9); padding: 8px 10px; border-radius: 6px; user-select: all; }
.drv-list { max-height: 320px; overflow: auto; border: 1px solid var(--gray-200, #e2e8f0); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.drv-row label, .veh-row span, .drv-row .drv-meta { overflow-wrap: anywhere; min-width: 0; }
.drv-meta { color: var(--gray-500, #64748b); font-size: 12px; }
.veh-vin { display: block; color: var(--gray-500, #64748b); font-size: 11px; overflow-wrap: anywhere; }
.veh-row, .drv-row { align-items: flex-start; }
#supplementsPanel textarea { width: 100%; max-width: 100%; }
