/* ═══════════════════════════════════════════════════════════════════════════
   Optimiser IT Asset Manager — design system & application shell
   Palette and shell follow the Optimiser platform (same as Release Builder):
   brand-blue gradient left rail, white top bar, Poppins, light surfaces.

   Load order: dashboard.css (module components) → features.css → app.css.
   Tokens keep the legacy variable names (--accent, --text-muted, …) because
   dashboard.js, the feature modules and component CSS all read them.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/poppins-700.woff2') format('woff2'); }

/* ── Tokens: light (default) ───────────────────────────────────────────────── */
:root,
[data-theme="light"] {
    color-scheme: light;

    /* Optimiser palette */
    --brand: #075da8;
    --brand-dark: #0a4d82;
    --brand-hover: #0069bd;
    --brand-soft: #d2effd;
    --brand-tint: #eaf5fb;
    --navy: #0e273a;
    --navy-700: #334554;
    --ink: #3a3b46;
    --muted: #858796;
    --line: #dddfeb;
    --line-soft: #eaecf4;
    --input-line: #d1d3e2;
    --focus: #64baff;
    --surface: #f8f9fc;
    --card: #ffffff;
    --purple: #66397c;
    --green: #0e8d5e;
    --amber: #e18700;
    --red: #e74a3b;
    --info: #36b9cc;

    /* Semantic status pairs */
    --ok-bg: #e3f5ee;      --ok-fg: #0b7a51;
    --warn-bg: #fdf1df;    --warn-fg: #a86400;
    --danger-bg: #fdeceb;  --danger-fg: #c0392b;
    --info-bg: #e2f6f9;    --info-fg: #1f8a9a;
    --neutral-bg: #eef0f5; --neutral-fg: #5a5c69;
    --brand-bg: #e6f1fa;   --brand-fg: #075da8;
    --purple-bg: #f1eaf5;  --purple-fg: #66397c;

    /* Legacy names consumed across the codebase */
    --bg-page: var(--surface);
    --bg-panel: var(--card);
    --bg-panel-solid: var(--card);
    --bg-muted: #f3f4f9;
    --text-primary: var(--ink);
    --text-secondary: #5a5c69;
    --text-muted: var(--muted);
    --accent: var(--brand);
    --accent-strong: var(--brand-dark);
    --accent-contrast: #ffffff;
    --accent-soft: rgba(7, 93, 168, 0.10);
    --border-soft: var(--line);
    --border: var(--line);
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.10);
    --shadow-soft: 0 1px 2px rgba(58, 59, 69, 0.06);
    --shadow-pop: 0 10px 30px rgba(14, 39, 58, 0.16);
    --focus-ring: 0 0 0 3px rgba(7, 93, 168, 0.25);
    --bg-subtle: var(--surface);
    --bg-hover: #f2f5fb;
    --hover-bg: var(--bg-hover);
    --bg-input: var(--card);
    --accent-rgb: 7, 93, 168;

    --font-body: 'Poppins', 'Nunito', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-display: var(--font-body);
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;

    --rail-w: 13.5rem;
    --rail-w-collapsed: 4rem;
    --topbar-h: 3.5rem;

    --rail-from: #075da8;
    --rail-to: #0a4d82;
    --topbar-bg: rgba(255, 255, 255, 0.92);
}

/* ── Tokens: dark ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    color-scheme: dark;

    --navy: #e6edf5;
    --navy-700: #c3cfdb;
    --ink: #d5dde6;
    --muted: #8d9bab;
    --line: #22354a;
    --line-soft: #1a2b3d;
    --input-line: #2c4258;
    --surface: #0b1724;
    --card: #10202f;
    --brand-tint: rgba(100, 186, 255, 0.10);
    --brand-soft: rgba(100, 186, 255, 0.18);

    --ok-bg: rgba(14, 141, 94, 0.20);    --ok-fg: #5fd3a5;
    --warn-bg: rgba(225, 135, 0, 0.20);  --warn-fg: #f5b759;
    --danger-bg: rgba(231, 74, 59, 0.20);--danger-fg: #f38b80;
    --info-bg: rgba(54, 185, 204, 0.18); --info-fg: #6ed3e2;
    --neutral-bg: rgba(141, 155, 171, 0.16); --neutral-fg: #b3bfcc;
    --brand-bg: rgba(100, 186, 255, 0.16); --brand-fg: #8ccaff;
    --purple-bg: rgba(160, 110, 190, 0.20); --purple-fg: #cfa6e6;

    --bg-muted: #152839;
    --text-secondary: #aab6c3;
    --accent: #3d9be0;
    --accent-strong: #64baff;
    --accent-soft: rgba(61, 155, 224, 0.16);
    --accent-rgb: 61, 155, 224;
    --bg-hover: rgba(100, 186, 255, 0.06);
    --shadow: 0 0.15rem 1.5rem rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);

    --rail-from: #0a3b66;
    --rail-to: #072a48;
    --topbar-bg: rgba(16, 32, 47, 0.92);
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { color: var(--navy); font-family: var(--font-body); font-weight: 600; line-height: 1.3; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }
a { color: var(--brand); }
code { font-family: var(--font-mono); font-size: 0.85em; }
::selection { background: rgba(7, 93, 168, 0.15); }
* { scrollbar-width: thin; scrollbar-color: #c3c9d6 transparent; }
[data-theme="dark"] * { scrollbar-color: #2c4258 transparent; }
[hidden] { display: none !important; }

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-color: var(--focus);
}

.muted { color: var(--muted); font-size: 0.86rem; }
.eyebrow {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
}
[data-theme="dark"] .eyebrow { color: var(--accent-strong); }

/* ═══════════════════════════════════════════════════════════════════════════
   SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.app-frame { display: flex; min-height: 100vh; }

/* ── Left rail ─────────────────────────────────────────────────────────────── */
.side-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--rail-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--rail-from), var(--rail-to));
    color: #fff;
    box-shadow: 0 0.15rem 0.75rem rgba(58, 59, 69, 0.15);
    transition: width 0.2s ease, transform 0.2s ease;
    z-index: 60;
}

.rail-top {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 1rem;
}
.rail-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
}
.rail-toggle {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: background 0.15s;
}
.rail-toggle:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.rail-divider { margin: 0 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.15); }

.rail-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.6rem 0.75rem 1rem;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.rail-group { margin-bottom: 0.35rem; }
.rail-group-label {
    margin: 0;
    padding: 0.85rem 0.75rem 0.3rem;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

/* Nav links keep the .nav-chip class: dashboard.js and the feature modules
   bind to `.nav-chip[data-tab]` and toggle `.active` on it. */
.side-rail .nav-chip {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1px 0;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s, color 0.15s;
}
.side-rail .nav-chip:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.side-rail .nav-chip.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
}
.side-rail .nav-chip.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #fff;
}
.nav-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.92; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
    min-width: 1.35rem;
    padding: 0 0.4rem;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-align: center;
}
.nav-count.alert { background: #fff; color: var(--red); }

.rail-foot {
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}

/* Collapsed rail (desktop) */
.rail-collapsed .side-rail { width: var(--rail-w-collapsed); }
.rail-collapsed .rail-top { justify-content: center; padding: 0; }
.rail-collapsed .rail-title,
.rail-collapsed .nav-label,
.rail-collapsed .rail-foot { display: none; }
.rail-collapsed .rail-group-label {
    height: 0;
    padding: 0;
    margin: 0.5rem 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
}
.rail-collapsed .side-rail .nav-chip { justify-content: center; padding: 0.55rem 0; }
.rail-collapsed .nav-count {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 1rem;
    padding: 0 0.25rem;
    font-size: 0.6rem;
    line-height: 1rem;
}

/* ── Main column ───────────────────────────────────────────────────────────── */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}
.top-bar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.mobile-menu-btn { display: none; }
.brand-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-link img { height: 1.6rem; width: auto; display: block; }
[data-theme="dark"] .brand-link img { filter: brightness(0) invert(1); opacity: 0.9; }
.brand-name { font-size: 0.88rem; font-weight: 600; color: var(--navy); white-space: nowrap; }
.crumbs {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}
.crumbs::before { content: ''; width: 1px; height: 1.1rem; background: var(--line); margin-right: 0.35rem; }
.crumbs strong { color: var(--navy-700); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

.top-search {
    flex: 1;
    max-width: 26rem;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--input-line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
.top-search:hover { border-color: var(--brand); }
.top-search span { flex: 1; text-align: left; }
.top-search kbd {
    padding: 0 0.35rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 0.68rem;
}

.top-bar-right { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.icon-btn {
    width: 2.1rem;
    height: 2.1rem;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--navy); }
.icon-btn svg { width: 18px; height: 18px; }

.user-chip { display: flex; align-items: center; gap: 0.55rem; }
.user-avatar {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta #userName { font-size: 0.82rem; font-weight: 500; color: var(--navy-700); }
.role-badge {
    align-self: flex-start;
    margin-top: 2px;
    padding: 0 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--brand-bg);
    color: var(--brand-fg);
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: capitalize;
}
.role-badge[data-role="admin"] { background: var(--purple-bg); color: var(--purple-fg); }
.role-badge[data-role="viewer"] { background: var(--neutral-bg); color: var(--neutral-fg); }

.signout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
}
.signout-btn:hover { background: var(--bg-muted); color: var(--navy); }
.signout-btn svg { width: 16px; height: 16px; }

/* ── Workspace ─────────────────────────────────────────────────────────────── */
.workspace {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
    display: block;
}

.tab-panel { display: none; flex-direction: column; gap: 1rem; animation: panel-in 0.18s ease; }
.tab-panel.active { display: flex; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Page header — every tab opens with one */
.tab-panel > .panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    padding-bottom: 0.25rem;
}
.tab-panel > .panel-head h2 { margin: 0.15rem 0 0; font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.tab-panel > .panel-head .muted { margin: 0.2rem 0 0; max-width: 46rem; }
.panel-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; position: relative; }

/* ═══════════════════════════════════════════════════════════════════════════
   PRIMITIVES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.ghost-btn,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.95rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transform: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); transform: none; box-shadow: 0 2px 6px rgba(7, 93, 168, 0.25); }
.btn-secondary { background: var(--brand-tint); border-color: var(--brand-soft); color: var(--brand); }
.btn-secondary:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); transform: none; }
.ghost-btn { background: var(--card); border-color: var(--input-line); color: var(--navy-700); }
.ghost-btn:hover { background: var(--bg-muted); border-color: #b7bbcc; color: var(--navy); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #d13b2d; }
.btn-primary:disabled, .btn-secondary:disabled, .ghost-btn:disabled, .btn-danger:disabled,
.pagination-btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
[data-theme="dark"] .btn-secondary { color: var(--accent-strong); }
[data-theme="dark"] .ghost-btn:hover { border-color: var(--accent); }

/* Row-level icon/text buttons */
.action-row { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--navy-700);
    font-size: 0.76rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.action-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.action-btn.danger { border-color: #f3c6c1; color: var(--danger-fg); }
.action-btn.danger:hover { background: var(--danger-bg); border-color: var(--red); color: var(--red); }
[data-theme="dark"] .action-btn.danger { border-color: rgba(231, 74, 59, 0.4); }

.theme-toggle-btn { font-size: 1rem; }

/* ── Panels & cards ────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 1rem; }
.two-up { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-soft);
}
.panel > .panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.panel > .panel-head h4 { margin: 0.1rem 0 0; font-size: 0.95rem; }
.panel-link {
    border: 0;
    background: none;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.panel-link:hover { text-decoration: underline; }

/* ── KPI tiles (Release Builder stat tiles) ────────────────────────────────── */
.stats-cluster { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 0.75rem; }
.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: none;
    text-align: left;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow); border-color: #c9ccdb; }
.stat-card:focus-visible { border-color: var(--brand); }
.stat-bar { width: 6px; height: 2.4rem; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--brand); }
.stat-body { min-width: 0; display: flex; flex-direction: column; }
.stat-card h3 { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1; color: var(--navy); }
.stat-card p { margin: 0.35rem 0 0; font-size: 0.74rem; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card span.stat-sub { font-size: 0.68rem; color: var(--muted); opacity: 0.85; }
.tone-brand  .stat-bar { background: var(--brand); }
.tone-green  .stat-bar { background: var(--green); }
.tone-amber  .stat-bar { background: var(--amber); }
.tone-red    .stat-bar { background: var(--red); }
.tone-info   .stat-bar { background: var(--info); }
.tone-purple .stat-bar { background: var(--purple); }
.tone-slate  .stat-bar { background: #a3a6b4; }

/* ── Overview: needs-attention queue ───────────────────────────────────────── */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.attention-list { display: flex; flex-direction: column; }
.attention-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.25rem;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.12s;
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: var(--surface); }
.attention-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--neutral-bg);
    color: var(--neutral-fg);
}
.attention-icon svg { width: 16px; height: 16px; }
.attention-item.sev-danger .attention-icon { background: var(--danger-bg); color: var(--danger-fg); }
.attention-item.sev-warn   .attention-icon { background: var(--warn-bg);   color: var(--warn-fg); }
.attention-item.sev-info   .attention-icon { background: var(--info-bg);   color: var(--info-fg); }
.attention-text { flex: 1; min-width: 0; }
.attention-text strong { display: block; font-size: 0.84rem; font-weight: 500; color: var(--navy); }
.attention-text small { color: var(--muted); font-size: 0.74rem; }
.attention-count { font-size: 1.05rem; font-weight: 700; color: var(--navy); min-width: 2rem; text-align: right; }
.attention-item.is-zero { opacity: 0.55; }
.attention-item.is-zero .attention-icon { background: var(--ok-bg); color: var(--ok-fg); }
.attention-all-clear { padding: 1.2rem; text-align: center; color: var(--ok-fg); font-size: 0.86rem; }

/* Fleet composition bar */
.fleet-bar { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--bg-muted); margin: 0.25rem 0 0.85rem; }
.fleet-bar span { display: block; height: 100%; }
.fleet-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.45rem 1rem; }
.fleet-legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--muted); border: 0; background: none; padding: 0.2rem 0; cursor: pointer; text-align: left; }
.fleet-legend-item:hover { color: var(--navy); }
.fleet-legend-item i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.fleet-legend-item b { margin-left: auto; color: var(--navy); font-weight: 600; }

/* ── Hardware lifecycle strip ──────────────────────────────────────────────── */
.lifecycle-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; }
.lifecycle-stage {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lifecycle-stage:hover { box-shadow: var(--shadow); }
.lifecycle-stage.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: var(--brand-tint); }
.lifecycle-stage .stat-bar { height: 1.9rem; width: 5px; }
.lifecycle-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.lifecycle-body strong { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.lifecycle-body span { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .lifecycle-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── Filter / control bar ──────────────────────────────────────────────────── */
.control-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
}
.control-bar.compact { padding: 0; border: 0; background: transparent; }
.control-bar .field { min-width: 150px; flex: 0 1 190px; }
.control-bar .field:first-child { flex: 1 1 260px; }
.control-bar .field label { font-size: 0.7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.table-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin: 0 !important; }

/* ── Form fields ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field label { font-size: 0.78rem; font-weight: 500; color: var(--navy-700); }
.field p { margin: 0; color: var(--ink); }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
.field select,
.field textarea,
.modal-card input[type="text"],
.modal-card input[type="email"],
.modal-card input[type="number"],
.modal-card input[type="date"],
.modal-card input[type="datetime-local"],
.modal-card input[type="password"],
.modal-card input[type="search"],
.modal-card input[type="url"],
.modal-card select,
.modal-card textarea {
    width: 100%;
    padding: 0.48rem 0.7rem;
    border: 1px solid var(--input-line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    font-size: 0.84rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea, .modal-card textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field select, .modal-card select {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23858796' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
}
.field select[multiple], .modal-card select[multiple] { background-image: none; padding-right: 0.7rem; }
.field input:focus, .field select:focus, .field textarea:focus,
.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: var(--focus-ring);
}
.field input::placeholder, .field textarea::placeholder, .modal-card input::placeholder, .modal-card textarea::placeholder { color: #a7a9b7; }
.field input:disabled, .field select:disabled, .field textarea:disabled,
.field input[readonly], .modal-card input[readonly] { background: var(--bg-muted) !important; color: var(--muted); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* Search inputs get a leading glass icon */
.control-bar input[type="search"] {
    padding-left: 2rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23a3a6b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.65rem center;
}

/* ── Quick filters & active filter chips ───────────────────────────────────── */
.artifact-quick-filters { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; margin: 0; }
.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--card);
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-toggle-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.filter-toggle-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.artifact-result-count { margin-left: auto; font-size: 0.78rem; color: var(--muted); }
.active-filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem 0.18rem 0.7rem;
    border: 1px solid var(--brand-soft);
    border-radius: var(--radius-pill);
    background: var(--brand-tint);
    color: var(--brand);
    font-size: 0.74rem;
    font-weight: 500;
}
[data-theme="dark"] .filter-chip { color: var(--accent-strong); }

/* Summary chips row (infra / ssl) — rendered as compact stat pills */
.mini-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--muted);
    font-size: 0.76rem;
}
.chip strong { color: var(--navy); font-size: 0.9rem; font-weight: 700; }
.mini-stats .chip[data-field="online"] strong,
.mini-stats .chip[data-field="ok"] strong { color: var(--green); }
.mini-stats .chip[data-field="offline"] strong,
.mini-stats .chip[data-field="critical"] strong,
.mini-stats .chip[data-field="expired"] strong { color: var(--red); }
.mini-stats .chip[data-field="maintenance"] strong,
.mini-stats .chip[data-field="warning"] strong { color: var(--amber); }
.mini-stats .chip[data-field="info"] strong { color: var(--info); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: var(--shadow-soft);
}
.table-wrapper table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 0.83rem; }
.table-wrapper thead { background: var(--surface); }
.table-wrapper th {
    position: sticky;
    top: 0;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.table-wrapper td {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    text-align: left;
    vertical-align: middle;
}
.table-wrapper tbody tr { transition: background 0.12s; }
.table-wrapper tbody tr:hover { background: #f6f8fd; }
.table-wrapper tbody tr:last-child td { border-bottom: 0; }
[data-theme="dark"] .table-wrapper tbody tr:hover { background: rgba(100, 186, 255, 0.05); }
.table-wrapper td strong { color: var(--navy); font-weight: 600; }
.table-wrapper td .muted { font-size: 0.76rem; }

.loading-block { padding: 2.25rem 1rem; text-align: center; color: var(--muted); font-size: 0.84rem; }
td.loading-block { background: var(--card); }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: -0.35rem;
    padding: 0.2rem 0.1rem;
    border: 0;
    background: none;
}
.pagination-info { flex: 1; text-align: center; font-size: 0.78rem; color: var(--muted); }
.pagination-btn { padding: 0.32rem 0.85rem; font-size: 0.78rem; }

/* ── Status pills, tags ────────────────────────────────────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.12rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
    background: var(--neutral-bg);
    color: var(--neutral-fg);
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.status-pill.active { background: var(--ok-bg); color: var(--ok-fg); }
.status-pill.inactive { background: var(--danger-bg); color: var(--danger-fg); }
.stacked-status { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: capitalize;
}
.tag.role-admin { background: var(--purple-bg); border-color: transparent; color: var(--purple-fg); }
.tag.role-it_staff { background: var(--brand-bg); border-color: transparent; color: var(--brand-fg); }
.tag.role-viewer { background: var(--neutral-bg); border-color: transparent; color: var(--neutral-fg); }

/* ── Overview lists ────────────────────────────────────────────────────────── */
.timeline, .system-stack, .infra-alerts { display: flex; flex-direction: column; gap: 0; }
.timeline .event { display: flex; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); }
.timeline .event:last-child { border-bottom: 0; }
.timeline .event p { margin: 0; font-size: 0.82rem; }
.timeline .event p strong { color: var(--navy); font-weight: 500; }
.timeline .event .muted { font-size: 0.74rem; }
.event-dot { width: 8px; height: 8px; margin-top: 0.4rem; flex-shrink: 0; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

.system-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    background: none;
}
.system-chip:last-child { border-bottom: 0; }
.system-chip strong { display: block; font-size: 0.84rem; font-weight: 500; color: var(--navy); }
.system-chip span { font-size: 0.74rem; color: var(--muted); }

.infra-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid #f6d0cc;
    border-left: 3px solid var(--red);
    border-radius: var(--radius);
    background: var(--danger-bg);
}
.infra-alert:last-child { margin-bottom: 0; }
.infra-alert strong { display: block; font-size: 0.86rem; color: var(--navy); }
.infra-alert .muted { margin: 0.15rem 0 0; font-size: 0.76rem; }
[data-theme="dark"] .infra-alert { border-color: rgba(231, 74, 59, 0.35); border-left-color: var(--red); }

/* ── Access cards (employee access modal) ──────────────────────────────────── */
.access-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}
.access-card-head { width: 100%; display: flex; justify-content: space-between; gap: 1rem; }
.access-card .status-block { text-align: right; }
.access-meta { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem 1rem; }
.access-meta .eyebrow { color: var(--muted); font-size: 0.62rem; }

/* ── Banners, guidance ─────────────────────────────────────────────────────── */
.info-banner {
    padding: 0.65rem 0.9rem;
    margin: 0;
    border: 1px solid var(--brand-soft);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    background: var(--brand-tint);
    color: var(--navy-700);
    font-size: 0.82rem;
}
.import-guidance {
    padding: 0.85rem 1rem;
    border: 1px dashed var(--input-line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.import-guidance code,
.import-example {
    display: block;
    margin-top: 0.6rem;
    padding: 0.6rem 0.8rem;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--brand-dark);
    font-family: var(--font-mono);
    font-size: 0.76rem;
}
[data-theme="dark"] .import-guidance code, [data-theme="dark"] .import-example { color: var(--accent-strong); }
[data-role-required][hidden] { display: none !important; }

/* ── Toasts ────────────────────────────────────────────────────────────────── */
.toast-stack {
    position: fixed;
    top: calc(var(--topbar-h) + 0.75rem);
    right: 1.25rem;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(360px, calc(100vw - 2rem));
}
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    font-size: 0.84rem;
    box-shadow: var(--shadow-pop);
    animation: toast-in 0.2s ease;
}
.toast span { flex: 1; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast button { border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ── Loading overlay ───────────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 252, 0.6);
    backdrop-filter: blur(2px);
}
[data-theme="dark"] .loading-overlay { background: rgba(11, 23, 36, 0.6); }
.loading-overlay.show { display: flex; }
.overlay-card {
    padding: 1.25rem 1.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: var(--shadow-pop);
    text-align: center;
    color: var(--muted);
    font-size: 0.84rem;
}
.overlay-card p { margin: 0; }
.spinner {
    width: 30px;
    height: 30px;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-layer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 1rem;
    overflow-y: auto;
    background: rgba(14, 39, 58, 0.45);
    backdrop-filter: blur(3px);
    animation: fade-in 0.15s ease;
}
[data-theme="dark"] .modal-layer { background: rgba(3, 8, 14, 0.7); }
.modal-card {
    position: relative;
    width: min(760px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-pop);
    animation: modal-in 0.18s ease;
}
/* Rich detail views get more room */
.modal-card:has(.hw-ticket-panel-head),
.modal-card:has(.hw-profile-header),
.modal-card:has(.hw-import-table),
.modal-card:has(.view-body),
.modal-card:has(.act-feed),
.modal-card:has(.cred-modal) { width: min(980px, 100%); }
.modal-card > h3:first-child,
.modal-card form > h3:first-child { margin: 0 0 0.25rem; font-size: 1.1rem; font-weight: 600; color: var(--navy); }
.modal-card h3 { font-family: var(--font-body); }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem 1rem; margin-top: 1rem; }
.modal-grid .field input, .modal-grid .field select, .modal-grid .field textarea { width: 100%; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 1.25rem -1.5rem -1.4rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--line-soft);
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    position: sticky;
    bottom: -1.4rem;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

/* Dropdown surfaces shared by several modules */
.col-picker-dropdown,
.action-more-dropdown,
.views-menu,
.hw-emp-list,
.hw-ticket-asset-suggestions {
    background: var(--card) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-pop) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODULE TOUCH-UPS — bring component CSS onto the new palette
   ═══════════════════════════════════════════════════════════════════════════ */
.hw-asset-tag, .hw-ticket-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brand);
}
[data-theme="dark"] .hw-asset-tag, [data-theme="dark"] .hw-ticket-num { color: var(--accent-strong); }

/* Status / priority / type badges share one shape and the semantic tokens */
.hw-type-badge, .hw-status-badge, .hw-priority-badge, .hw-ticket-status, .hw-condition-badge {
    padding: 0.12rem 0.55rem;
    border: 0;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.hw-type-badge {
    background: var(--surface) !important;
    color: var(--text-secondary) !important;
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: 0.66rem;
}
.hw-status-active, .hw-ticket-status-resolved, .hw-priority-low { background: var(--ok-bg); color: var(--ok-fg); }
.hw-status-spare, .hw-ticket-status-open { background: var(--brand-bg); color: var(--brand-fg); }
.hw-status-in_repair, .hw-ticket-status-in_progress, .hw-priority-high { background: var(--warn-bg); color: var(--warn-fg); }
.hw-ticket-status-on_hold, .hw-priority-medium { background: var(--info-bg); color: var(--info-fg); }
.hw-status-retired, .hw-status-disposed, .hw-ticket-status-closed, .hw-ticket-status-cancelled { background: var(--neutral-bg); color: var(--neutral-fg); }
.hw-status-lost, .hw-priority-critical { background: var(--danger-bg); color: var(--danger-fg); }
.hw-priority-critical { box-shadow: inset 0 0 0 1px rgba(231, 74, 59, 0.35); border: 0; }
.expiry-badge { padding: 0.12rem 0.55rem; border: 0; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 600; }
.expiry-badge.expired { background: var(--danger-bg); color: var(--danger-fg); border: 0; }
.expiry-badge.expiring-soon { background: var(--warn-bg); color: var(--warn-fg); border: 0; }
.expiry-badge.valid { background: var(--neutral-bg); color: var(--neutral-fg); border: 0; }
.hw-row-critical td:first-child { box-shadow: inset 3px 0 0 var(--red); border-left: 0; }

/* Charts (features/charts.js) */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.chart-card { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-soft); }
.chart-card h4 { margin: 0 0 0.85rem; font-size: 0.82rem; font-weight: 600; color: var(--navy); text-transform: none; letter-spacing: 0; }
.chart-bar-track { background: var(--bg-muted); height: 9px; }
.chart-bar-label { font-size: 0.74rem; width: 104px; }
.chart-bar-value { font-size: 0.76rem; color: var(--navy); }

/* Ticket workspace (features/hwTickets.js) */
.hwt-chip { border-radius: var(--radius-pill); background: var(--card); border-color: var(--line); font-size: 0.76rem; }
.hwt-chip.active { background: var(--brand); border-color: var(--brand); }
.hwt-view-toggle { border-color: var(--input-line); border-radius: var(--radius); background: var(--card); }
.hwt-view-toggle button.active { background: var(--brand); }
.hwt-col { background: var(--surface); border-color: var(--line); border-radius: var(--radius-lg); }
.hwt-card { background: var(--card); border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.hwt-col-body.drop-hover { background: var(--brand-tint); outline-color: var(--brand); }

/* Command palette */
.cmdk-overlay { background: rgba(14, 39, 58, 0.45); backdrop-filter: blur(3px); }
.cmdk-panel { background: var(--card); border-color: var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.cmdk-item:hover, .cmdk-item.active, .views-item:hover { background: var(--brand-tint); }

/* Bulk action bar */
.bulk-bar { background: var(--navy) !important; color: #fff; border-color: transparent !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-pop) !important; }
.bulk-bar .bulk-bar-count { color: #fff; }
.bulk-bar .bulk-clear { color: rgba(255, 255, 255, 0.7); }
.bulk-bar .ghost-btn { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.bulk-bar .ghost-btn:hover { background: rgba(255, 255, 255, 0.2); }
[data-theme="dark"] .bulk-bar { background: #1d3a55 !important; }

kbd.kbd { background: var(--surface); border-color: var(--line); color: var(--navy-700); }

/* Rail scrim for the mobile drawer */
.rail-scrim { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
    .overview-grid { grid-template-columns: 1fr; }
    .top-search { max-width: 16rem; }
}

@media (max-width: 900px) {
    .side-rail {
        position: fixed;
        left: 0;
        top: 0;
        width: var(--rail-w) !important;
        transform: translateX(-100%);
    }
    .rail-collapsed .side-rail .nav-label, .rail-collapsed .rail-title, .rail-collapsed .rail-foot { display: initial; }
    .rail-open .side-rail { transform: none; }
    .rail-open .rail-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(14, 39, 58, 0.4); }
    .rail-toggle-desktop { display: none !important; }
    .mobile-menu-btn { display: inline-grid; }
    .brand-name, .crumbs, .user-meta, .signout-btn span { display: none; }
    .top-search { max-width: none; }
    .top-search span, .top-search kbd { display: none; }
    .top-search { flex: 0 0 auto; padding: 0.4rem; border: 0; background: transparent; }
    .workspace { padding: 1rem 1rem 3rem; }
    .control-bar .field, .control-bar .field:first-child { flex: 1 1 100%; }
    .modal-card { padding: 1.1rem 1rem; }
    .modal-actions { margin: 1rem -1rem -1.1rem; padding: 0.75rem 1rem; bottom: -1.1rem; }
}

@media (max-width: 560px) {
    .stats-cluster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tab-panel > .panel-head { align-items: flex-start; }
    .panel-actions { justify-content: flex-start; }
    .two-up { grid-template-columns: 1fr; }
}

@media print {
    .side-rail, .top-bar, .panel-actions, .control-bar, .pagination-bar, .toast-stack { display: none !important; }
    body { background: #fff; }
    .workspace { padding: 0; max-width: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRODUCTION INFRA (features/prodInfra.js)
   ═══════════════════════════════════════════════════════════════════════════ */
.restricted-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid rgba(102, 57, 124, 0.25);
    border-left: 3px solid var(--purple);
    border-radius: var(--radius);
    background: var(--purple-bg);
    color: var(--navy-700);
    font-size: 0.8rem;
}
.restricted-banner svg { flex-shrink: 0; margin-top: 2px; color: var(--purple-fg); }
.restricted-banner strong { color: var(--purple-fg); }

.prod-kind-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.pi-kind-tile {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--card); text-align: left; cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.pi-kind-tile:hover { box-shadow: var(--shadow); }
.pi-kind-tile.active { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 1px var(--brand) inset; }
.pi-kind-icon { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: var(--radius); background: var(--brand-bg); color: var(--brand-fg); flex-shrink: 0; }
.pi-kind-tile strong { display: block; font-size: 1.15rem; line-height: 1.1; color: var(--navy); }
.pi-kind-tile small { font-size: 0.72rem; color: var(--muted); }

.prod-attention { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pi-att {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--line); border-radius: var(--radius-pill);
    background: var(--card); color: var(--text-secondary); font-size: 0.76rem; cursor: pointer;
}
.pi-att strong { font-size: 0.86rem; color: var(--navy); }
.pi-att.tone-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger-fg); }
.pi-att.tone-danger strong { color: var(--danger-fg); }
.pi-att.tone-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn-fg); }
.pi-att.tone-warn strong { color: var(--warn-fg); }
.pi-att.is-zero { opacity: 0.6; }
.pi-att:disabled { cursor: default; }

.pi-pill { display: inline-flex; align-items: center; padding: 0.12rem 0.55rem; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.pi-pill.tone-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pi-pill.tone-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pi-pill.tone-danger { background: var(--danger-bg); color: var(--danger-fg); }
.pi-pill.tone-info { background: var(--info-bg); color: var(--info-fg); }
.pi-pill.tone-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.pi-kind { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.76rem; color: var(--text-secondary); white-space: nowrap; }
.pi-name { padding: 0; border: 0; background: none; color: var(--navy); font-weight: 600; font-size: 0.84rem; text-align: left; cursor: pointer; }
.pi-name:hover { color: var(--brand); text-decoration: underline; }
.pi-sub { font-family: var(--font-mono); font-size: 0.72rem !important; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-links { display: flex; flex-wrap: wrap; gap: 0.25rem; max-width: 220px; }
.pi-link-chip { padding: 0.05rem 0.45rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--brand); font-family: var(--font-mono); font-size: 0.68rem; cursor: pointer; }
.pi-link-chip:hover { border-color: var(--brand); }
.pi-health { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.pi-health i { width: 8px; height: 8px; border-radius: 50%; background: #b7b9c6; }
.pi-health-up { color: var(--ok-fg); } .pi-health-up i { background: var(--green); box-shadow: 0 0 0 3px var(--ok-bg); }
.pi-health-down { color: var(--danger-fg); font-weight: 600; } .pi-health-down i { background: var(--red); box-shadow: 0 0 0 3px var(--danger-bg); }
.pi-overdue { color: var(--warn-fg); font-weight: 600; font-size: 0.76rem; }
.pi-secret-count { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.4rem; border-radius: var(--radius-sm); background: var(--purple-bg); color: var(--purple-fg); font-size: 0.7rem; font-weight: 600; }
.pi-row-critical td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* Form */
.modal-card:has(.pi-form), .modal-card:has(.pi-detail) { width: min(1000px, 100%); }
.pi-kind-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; margin: 0.75rem 0 0.25rem; }
.pi-kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.pi-kind-option span {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius);
    font-size: 0.82rem; font-weight: 500; color: var(--navy-700); cursor: pointer;
}
.pi-kind-option input:checked + span { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.pi-kind-option input:focus-visible + span { box-shadow: var(--focus-ring); }
.pi-group { margin: 1rem 0 0; padding: 0; border: 0; }
.pi-group legend { padding: 0 0 0.1rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.pi-group .modal-grid { margin-top: 0.5rem; }
.pi-wide { grid-column: 1 / -1; }
.pi-link-picker { border: 1px solid var(--input-line); border-radius: var(--radius); padding: 0.5rem; background: var(--card); }
.pi-link-search { margin-bottom: 0.4rem; }
.pi-link-list { max-height: 170px; overflow-y: auto; display: grid; gap: 2px; }
.pi-link-list label { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.35rem; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 400; color: var(--ink); cursor: pointer; }
.pi-link-list label:hover { background: var(--surface); }
.pi-mono { font-family: var(--font-mono) !important; }

/* Detail */
.pi-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pi-detail-head h3 { margin: 0.2rem 0 0.4rem; font-size: 1.25rem; }
.pi-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pi-desc { margin: 0.75rem 0 0; color: var(--text-secondary); font-size: 0.84rem; }
.pi-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.9rem 0 0; }
.pi-actions .pi-danger { color: var(--danger-fg); }
.pi-actions .pi-danger:hover { border-color: var(--red); background: var(--danger-bg); }
.pi-reviewed { margin-left: auto; font-size: 0.74rem; }
.pi-tabs { display: flex; gap: 0.2rem; margin: 1rem 0 0.9rem; border-bottom: 1px solid var(--line); }
.pi-tabs button { padding: 0.5rem 0.8rem; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: 0.82rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.pi-tabs button:hover { color: var(--navy); }
.pi-tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.pi-tab-n { padding: 0 0.4rem; border-radius: var(--radius-pill); background: var(--bg-muted); font-size: 0.66rem; }
.pi-kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.1rem 1.5rem; margin: 0; }
.pi-kv { padding: 0.45rem 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.pi-kv dt { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pi-kv dd { margin: 0.1rem 0 0; font-size: 0.84rem; color: var(--ink); overflow-wrap: anywhere; }
.pi-h5, .pi-topo-col h5, .pi-secret-form h5 { margin: 1rem 0 0.4rem; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.pi-notes { margin: 0; white-space: pre-wrap; font-size: 0.84rem; }
.pi-impact { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-fg); font-size: 0.82rem; }
.pi-topo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.pi-topo-col h5 { margin-top: 0; }
.pi-topo-item {
    width: 100%; display: flex; align-items: center; gap: 0.55rem;
    margin-bottom: 0.4rem; padding: 0.5rem 0.6rem;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
    text-align: left; cursor: pointer;
}
.pi-topo-item:hover { border-color: var(--brand); }
.pi-topo-item > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pi-topo-item strong { font-size: 0.82rem; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-topo-item small { font-size: 0.7rem; }

/* Secrets */
.pi-secret-hint { margin: 0 0 0.75rem; font-size: 0.78rem; }
.pi-secrets { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.pi-secret {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.8rem; border: 1px solid var(--line); border-left: 3px solid var(--purple);
    border-radius: var(--radius); background: var(--card);
}
.pi-secret-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; font-size: 0.8rem; }
.pi-secret-meta strong { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--navy); font-size: 0.86rem; }
.pi-secret-meta code { font-size: 0.76rem; }
.pi-secret-value code {
    display: block; padding: 0.35rem 0.55rem; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--line);
    font-size: 0.78rem; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 8rem; overflow-y: auto;
}
.pi-secret-form { margin-top: 0.75rem; padding: 0.85rem 1rem; border: 1px dashed var(--input-line); border-radius: var(--radius); background: var(--surface); }
.pi-secret-form h5 { margin-top: 0; }
.pi-warn { border-left-color: var(--amber) !important; background: var(--warn-bg) !important; }
.pi-unlock-layer { z-index: 10020; align-items: center; }
.pi-unlock { width: min(420px, 100%); }
.pi-unlock h3 { display: flex; align-items: center; gap: 0.5rem; }

@media (max-width: 900px) {
    .pi-topo { grid-template-columns: 1fr; }
    .pi-secret { grid-template-columns: 1fr; }
    .pi-reviewed { margin-left: 0; width: 100%; }
}
.pi-code-input { text-align: center; font-family: var(--font-mono) !important; font-size: 1.35rem !important; font-weight: 600; letter-spacing: 0.5em; padding-left: 1.2rem !important; }
.pi-code-hint { font-size: 0.74rem; margin: 0.4rem 0 0; }
.pi-unlock form > p { margin: 0 0 0.75rem; }
