/* =========================================================================
   WKC Asset Hub - design system (sits on top of Bootstrap 5.3)
   ========================================================================= */
:root {
  --ink: #0e1726;
  --ink-2: #4a5567;
  --ink-3: #5d6878;
  --canvas: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --line: #e3e8ee;
  --line-2: #eef1f4;
  --brand: #0e7c6b;
  --brand-600: #0b6658;
  --brand-tint: #e5f3f0;
  --accent: #c2410c;
  --accent-tint: #fdeee6;
  --danger: #c62828;
  --shadow-1: 0 1px 2px rgba(14, 23, 38, .05);
  --shadow-2: 0 10px 30px rgba(14, 23, 38, .12);
  --radius: 10px;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --st-green: #16794a;  --st-green-bg: #e6f4ec;
  --st-blue: #1d5fc9;   --st-blue-bg: #e7effc;
  --st-violet: #6b3fc4; --st-violet-bg: #f0eafb;
  --st-amber: #9a6100;  --st-amber-bg: #fdf3dc;
  --st-orange: #b4470d; --st-orange-bg: #fdebe0;
  --st-red: #b42318;    --st-red-bg: #fde8e7;
  --st-slate: #475569;  --st-slate-bg: #edf0f4;
  --st-gray: #586271;   --st-gray-bg: #f1f2f4;

  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 14, 124, 107;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 14, 124, 107;
  --bs-link-hover-color: var(--brand-600);
  --bs-focus-ring-color: rgba(14, 124, 107, .35);
}

[data-bs-theme="dark"] {
  --ink: #e6eaf0;
  --ink-2: #a9b3c1;
  --ink-3: #8a95a5;
  --canvas: #0b1018;
  --surface: #121a25;
  --surface-2: #162130;
  --line: #223042;
  --line-2: #1b2736;
  --brand: #2bb39c;
  --brand-600: #3cc7af;
  --brand-tint: #13302c;
  --accent: #f08a4b;
  --accent-tint: #3a2214;
  --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
  --st-green: #5fd39a;  --st-green-bg: #12301f;
  --st-blue: #82abff;   --st-blue-bg: #14243f;
  --st-violet: #b99cf5; --st-violet-bg: #251a3d;
  --st-amber: #f2c25c;  --st-amber-bg: #33270b;
  --st-orange: #f59d6a; --st-orange-bg: #3a2010;
  --st-red: #ff8a80;    --st-red-bg: #3b1513;
  --st-slate: #a6b2c4;  --st-slate-bg: #1f2a38;
  --st-gray: #9aa3ae;   --st-gray-bg: #1d2531;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-primary-rgb: 43, 179, 156;
}

html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { font-size: 14px; line-height: 1.45; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.text-muted, .muted { color: var(--ink-3) !important; }
.text-2 { color: var(--ink-2); }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .92em; }
h1, .h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2, .h2 { font-size: 16px; font-weight: 650; margin: 0; }
h3, .h3 { font-size: 14px; font-weight: 650; margin: 0; }
:focus-visible { outline: 3px solid var(--brand) !important; outline-offset: 2px; box-shadow: none !important; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 12px; }

/* ---------- buttons & forms ---------- */
.btn { --bs-btn-border-radius: 8px; font-weight: 550; font-size: 14px; padding: .45rem .9rem; display: inline-flex; align-items: center; gap: .45rem; }
.btn-sm { padding: .3rem .65rem; font-size: 13px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #062620; --bs-btn-hover-color: #062620; --bs-btn-active-color: #062620; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-soft { background: var(--brand-tint); color: var(--brand); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand); color: #fff; }
.btn-danger-soft { background: var(--st-red-bg); color: var(--st-red); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-icon { width: 38px; height: 38px; padding: 0; justify-content: center; }
.form-label { font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 8px; border-color: var(--line); font-size: 14px; padding: .5rem .75rem; background-color: var(--surface); color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 124, 107, .18); }
.form-text { color: var(--ink-3); font-size: 12.5px; }
.req::after { content: " *"; color: var(--danger); }
.form-section { border-top: 1px solid var(--line-2); padding-top: 18px; margin-top: 18px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section > h2 { margin-bottom: 4px; }
.form-section > p { color: var(--ink-3); margin-bottom: 14px; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon > .form-control { padding-left: 34px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app.rail { --sidebar-w: 68px; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; z-index: 1030; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: var(--ink); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #0f9a84); display: grid; place-items: center; color: #fff; flex: none; }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0; }
.nav-section { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 14px 10px 6px; }
.side-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 520; margin: 1px 0; white-space: nowrap; }
.side-link .bi { font-size: 17px; width: 20px; text-align: center; color: var(--ink-3); }
.side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-link.active { background: var(--brand-tint); color: var(--brand); font-weight: 620; }
.side-link.active .bi { color: var(--brand); }
.side-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-link .count { margin-left: auto; font-size: 11.5px; font-weight: 650; background: var(--accent-tint); color: var(--accent); border-radius: 999px; padding: 1px 7px; }
/* footer stays pinned to the bottom of the sidebar, so the collapse / expand button is always reachable */
.sidebar-foot { margin-top: auto; position: sticky; bottom: -14px; margin-bottom: -14px; padding: 12px 10px 14px; background: var(--surface); border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }
.app.rail .sidebar .label, .app.rail .nav-section, .app.rail .brand span, .app.rail .side-link .count { display: none; }
.app.rail .sidebar-foot { padding-left: 0; padding-right: 0; text-align: center; }
.app.rail .sidebar-foot > .d-flex { display: none !important; }
.app.rail .rail-toggle { width: 100%; justify-content: center; }
.app.rail .side-link { justify-content: center; }
.app.rail .side-link.active::before { left: -12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 22px; background: color-mix(in srgb, var(--canvas) 86%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.search-box { flex: 1; max-width: 520px; position: relative; }
.search-box input { height: 38px; border-radius: 9px; background: var(--surface); padding-left: 36px; padding-right: 64px; }
.search-box .bi-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-box kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); box-shadow: none; padding: 1px 6px; }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); max-height: 420px; overflow-y: auto; z-index: 1050; padding: 6px; }
.search-results .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; color: var(--ink-3); padding: 8px 10px 4px; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.search-results a:hover, .search-results a.kb { background: var(--brand-tint); text-decoration: none; }
.search-results .sub { color: var(--ink-3); font-size: 12.5px; }
.scope-lens { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 560; max-width: 320px; }
.scope-lens .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-size: 12px; flex: none; }
.scope-lens .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-lens:hover { border-color: var(--brand); }
.scope-pop { width: 360px; padding: 16px; border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow-2); }
.scope-pop .grant { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; border-top: 1px dashed var(--line); }
.topbar .user-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px; border-radius: 999px; color: var(--ink); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.bell { position: relative; }
.bell .badge-dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.content { padding: 22px 26px 40px; width: 100%; max-width: 1480px; }

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }

/* ---------- cards ---------- */
.card-x { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-x > .hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-x > .bd { padding: 18px; }
.card-x > .bd.p0 { padding: 0; }
.card-x > .ft { padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); display: block; position: relative; }
a.kpi:hover { border-color: var(--brand); text-decoration: none; }
.kpi .lbl { font-size: 12.5px; color: var(--ink-3); font-weight: 560; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; line-height: 34px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi .meta { font-size: 12.5px; color: var(--ink-3); }
.kpi .ico { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }

/* Attention */
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.att { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
.att:hover { text-decoration: none; border-color: var(--ink-3); }
.att .ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; flex: none; background: var(--st-green-bg); color: var(--st-green); }
.att .n { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.att .t { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.att.warn { border-color: color-mix(in srgb, var(--st-amber) 35%, var(--line)); }
.att.warn .ic { background: var(--st-amber-bg); color: var(--st-amber); }
.att.bad { border-color: color-mix(in srgb, var(--st-red) 35%, var(--line)); }
.att.bad .ic { background: var(--st-red-bg); color: var(--st-red); }
.att.info .ic { background: var(--st-blue-bg); color: var(--st-blue); }

/* status badges (dot + label, never colour only) */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 20px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.status-green { background: var(--st-green-bg); color: var(--st-green); }
.status-blue { background: var(--st-blue-bg); color: var(--st-blue); }
.status-violet { background: var(--st-violet-bg); color: var(--st-violet); }
.status-amber { background: var(--st-amber-bg); color: var(--st-amber); }
.status-orange { background: var(--st-orange-bg); color: var(--st-orange); }
.status-red { background: var(--st-red-bg); color: var(--st-red); }
.status-slate { background: var(--st-slate-bg); color: var(--st-slate); }
.status-gray { background: var(--st-gray-bg); color: var(--st-gray); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 560; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.brand { background: var(--brand-tint); border-color: transparent; color: var(--brand); }
.chip.warn { background: var(--st-amber-bg); border-color: transparent; color: var(--st-amber); }
.chip.bad { background: var(--st-red-bg); border-color: transparent; color: var(--st-red); }
.chip a { color: inherit; }
.flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st-amber); margin-left: 4px; vertical-align: middle; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-3); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl th .sort-link { color: inherit; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.selected td { background: var(--brand-tint); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .w-check { width: 36px; }
.tbl .cell-main { font-weight: 600; color: var(--ink); }
.tbl .cell-sub { color: var(--ink-3); font-size: 12.5px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .col-asset { min-width: 270px; }
.thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); flex: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.toolbar .grow { flex: 1 1 260px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.filters .form-select, .filters .form-control { height: 34px; padding-top: .3rem; padding-bottom: .3rem; font-size: 13px; width: auto; max-width: 220px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; color: var(--ink-3); font-size: 13px; }
.pager .pagination { margin: 0; --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-border-radius: 8px; --bs-pagination-font-size: 13px; --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--line); }
.bulk-bar { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 8px 8px 16px; display: flex; gap: 6px; align-items: center; box-shadow: var(--shadow-2); z-index: 1040; transition: transform .18s ease-out; max-width: calc(100vw - 24px); flex-wrap: wrap; }
.bulk-bar.show { transform: translate(-50%, 0); }
.bulk-bar .btn { color: #fff; border-color: rgba(255, 255, 255, .2); background: transparent; }
.bulk-bar .btn:hover { background: rgba(255, 255, 255, .12); }
[data-bs-theme="dark"] .bulk-bar { background: #e6eaf0; color: #0e1726; }
[data-bs-theme="dark"] .bulk-bar .btn { color: #0e1726; border-color: rgba(0, 0, 0, .2); }

/* cards list (mobile replacement for tables) */
.rows-cards { display: none; }
.rcard { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.rcard:hover { text-decoration: none; background: var(--surface-2); }
.rcard .t { font-weight: 620; }
.rcard .s { color: var(--ink-3); font-size: 12.5px; }

/* ---------- detail ---------- */
.asset-hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.asset-photo { width: 96px; height: 96px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); object-fit: cover; display: grid; place-items: center; font-size: 34px; color: var(--ink-3); flex: none; }
.asset-hero .ids { color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.asset-hero .ids b { color: var(--ink-2); font-weight: 600; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 22px; margin: 0; }
.dl dt { font-size: 12px; color: var(--ink-3); font-weight: 560; margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 520; overflow-wrap: anywhere; }
.tabs-x { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; overflow-x: auto; overflow-y: hidden; }
.tabs-x a { padding: 9px 14px; color: var(--ink-3); font-weight: 580; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-x a:hover { color: var(--ink); text-decoration: none; }
.tabs-x a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs-x .cnt { font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; color: var(--ink-3); }
.review-banner { border: 1px solid color-mix(in srgb, var(--st-amber) 40%, var(--line)); background: var(--st-amber-bg); color: var(--ink); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; }
.review-banner .bi { color: var(--st-amber); font-size: 18px; }
.sens { display: inline-flex; gap: 8px; align-items: center; }
.sens code { color: var(--ink); background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 18px 46px; }
.timeline .tdot { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }
.timeline .tdot.brand { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
.timeline .tdot.blue { background: var(--st-blue-bg); color: var(--st-blue); border-color: transparent; }
.timeline .tdot.amber { background: var(--st-amber-bg); color: var(--st-amber); border-color: transparent; }
.timeline .tdot.red { background: var(--st-red-bg); color: var(--st-red); border-color: transparent; }
.timeline .tt { font-weight: 600; }
.timeline .tm { color: var(--ink-3); font-size: 12.5px; }
.timeline .td { color: var(--ink-2); font-size: 13px; margin-top: 2px; white-space: pre-line; }

/* bars (inline lists with bar) */
.barlist { list-style: none; padding: 0; margin: 0; }
.barlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 7px 0; font-size: 13px; }
.barlist .bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.barlist .bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.barlist .v { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.stackbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.stackbar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.chart-box { position: relative; height: 240px; }

/* empty state */
.empty { text-align: center; padding: 42px 20px; color: var(--ink-3); }
.empty .bi { font-size: 34px; color: var(--ink-3); display: block; margin-bottom: 8px; opacity: .7; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* stepper */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; counter-reset: s; }
.stepper span { counter-increment: s; font-size: 13px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.stepper span::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.stepper span.done::before { content: "✓"; background: var(--brand-tint); color: var(--brand); }
.stepper span.cur { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.stepper span.cur::before { background: var(--brand); color: #fff; }

/* scan */
.scan-stage { position: relative; background: #0b1018; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 60vh; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-stage .frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
.scan-stage .hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }
.scan-feed { list-style: none; padding: 0; margin: 0; }
.scan-feed li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.big-count { font-size: 40px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.result-sheet .actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.result-sheet .actions .btn { justify-content: center; padding: .7rem; }

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1090; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast-x { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; box-shadow: var(--shadow-2); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease-out; }
.toast-x.warning { border-left-color: var(--st-amber); }
.toast-x.error, .toast-x.danger { border-left-color: var(--danger); }
.toast-x.info { border-left-color: var(--st-blue); }
.toast-x.secret { border-left-color: var(--st-amber); max-width: 420px; user-select: all; }
.toast-x button { margin-left: auto; border: 0; background: none; color: var(--ink-3); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* guest pages */
.guest { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.guest .art { background: radial-gradient(1200px 600px at 10% 10%, #12a58c 0%, #0e7c6b 40%, #0a3f39 100%); color: #e9fbf7; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.guest .art h2 { font-size: 30px; line-height: 1.2; font-weight: 700; max-width: 460px; }
.guest .art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; max-width: 440px; }
.guest .art li { display: flex; gap: 10px; color: #c9f1e8; }
.guest .panel { display: grid; place-items: center; padding: 32px; background: var(--surface); }
.guest .panel-inner { width: 100%; max-width: 380px; }

/* collapsible filters (always open on desktop) */
.filters-det > summary { list-style: none; cursor: pointer; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.filters-det > summary::-webkit-details-marker { display: none; }
@media (min-width: 768px) { .filters-det > summary { display: none; } .filters-det:not([open]) > .filters { display: flex; } }

/* pickers */
.picker { position: relative; }
.picker-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); max-height: 320px; overflow-y: auto; z-index: 1060; padding: 6px; }
.picker-list a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.picker-list a:hover { background: var(--brand-tint); text-decoration: none; }
.picker-list .sub { color: var(--ink-3); font-size: 12.5px; }

/* misc */
.kbd-hint { font-size: 12px; color: var(--ink-3); }
.dropdown-menu { border-color: var(--line); border-radius: 10px; box-shadow: var(--shadow-2); font-size: 14px; padding: 6px; background: var(--surface); }
.dropdown-item { border-radius: 7px; padding: .45rem .7rem; display: flex; gap: 10px; align-items: center; color: var(--ink); }
.dropdown-item:active { background: var(--brand); }
.modal-content { border-radius: 14px; border-color: var(--line); background: var(--surface); }
.modal-header, .modal-footer { border-color: var(--line-2); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.list-plain > li:last-child { border-bottom: 0; }
.tree-indent { display: inline-block; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 18px; }
.pill-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.pill-tabs a { padding: 5px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 560; font-size: 13px; }
.pill-tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.pill-tabs a:hover { text-decoration: none; }
.pill-tabs .cnt { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* bottom navigation (mobile) */
.bottom-nav { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1199.98px) {
  .grid-main-side { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .app, .app.rail { grid-template-columns: 1fr; --sidebar-w: 270px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow-2); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1025; }
  .app.rail .sidebar .label, .app.rail .nav-section, .app.rail .brand span { display: initial; }
  .app.rail .sidebar-foot { padding: 12px 10px 14px; text-align: left; }
  .app.rail .sidebar-foot > .d-flex { display: flex !important; }
  .content { padding: 16px 16px 96px; }
  .topbar { padding: 0 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .guest { grid-template-columns: 1fr; }
  .guest .art { display: none; }
}
@media (max-width: 767.98px) {
  body { font-size: 15px; }
  .search-box, .topbar .hide-sm { display: none !important; }
  .topbar { gap: 8px; }
  .topbar .scope-lens { flex: 1 1 auto; min-width: 0; max-width: none; }
  .scope-lens { max-width: 150px; }
  .tbl-responsive { display: none; }
  .rows-cards { display: block; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); padding: 4px 0; min-height: 44px; justify-content: center; }
  .bottom-nav a .bi { font-size: 20px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav a.scan { color: #fff; }
  .bottom-nav a.scan .bi { width: 52px; height: 52px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; margin-top: -22px; box-shadow: var(--shadow-2); font-size: 22px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .bulk-bar { bottom: 84px; }
  .toasts { left: 12px; right: 12px; top: 70px; bottom: auto; max-width: none; }
  .kpi .val { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print (labels & reports) ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .toasts, .bulk-bar { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card-x { border: 0; box-shadow: none; }
  .tbl th { position: static; }
}
.labels { display: flex; flex-wrap: wrap; gap: 4mm; }
.tag-label { width: 50mm; height: 25mm; border: 1px dashed #c4ccd6; border-radius: 2mm; padding: 1.6mm; display: grid; grid-template-columns: 21mm 1fr; gap: 1.6mm; align-items: center; background: #fff; color: #000; overflow: hidden; page-break-inside: avoid; break-inside: avoid; }
.tag-label.s62 { width: 62mm; height: 29mm; grid-template-columns: 25mm 1fr; }
.tag-label.a4 { width: 63.5mm; height: 33.9mm; grid-template-columns: 27mm 1fr; }
.tag-label .qr svg, .tag-label .qr img, .tag-label .qr canvas { width: 100%; height: auto; display: block; }
.tag-label .ln { font: 700 8.5pt/1.15 var(--font); }
.tag-label .lc { font: 700 9.5pt/1.1 ui-monospace, Consolas, monospace; letter-spacing: .02em; }
.tag-label .lt { font: 500 6.5pt/1.2 var(--font); color: #333; }
.tag-label .lo { font: 600 6pt/1 var(--font); color: #555; text-transform: uppercase; letter-spacing: .05em; }
.tag-label .bc svg { width: 100%; height: 6mm; display: block; }
@media print {
  .labels { gap: 0; }
  .tag-label { border: 0; border-radius: 0; }
  @page { margin: 6mm; }
}
