/* Monochrome operations theme. DM Sans only. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../vendor/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../vendor/fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../vendor/fonts/dm-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../vendor/fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }

:root {
    --ink: #0a0a0a;
    --text: #1c1c1c;
    --muted: #6b6b6b;
    --faint: #9b9b9b;
    --line: #e6e6e6;
    --line-strong: #d3d3d3;
    --wash: #f6f6f6;
    --paper: #ffffff;
    --green: #0b7a4b;  --green-bg: #eaf8f1; --green-line: #bde6d0;
    --amber: #a45800;  --amber-bg: #fff7e0; --amber-line: #f2d78a;
    --red: #c4231a;    --red-bg: #fdeeed;   --red-line: #f2b8b3;
    --radius: 4px;
    --header-h: 72px;
    --sidebar-w: 272px;
    --bs-font-sans-serif: "DM Sans", sans-serif;
    --bs-body-font-family: "DM Sans", sans-serif;
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, button, input, select, textarea, .btn, .form-control, .form-select, .dropdown-menu, .modal-content, table {
    font-family: "DM Sans", sans-serif;
}
body { margin: 0; background: var(--paper); color: var(--text); font-size: 14px; line-height: 1.5; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-family: "DM Sans", sans-serif; color: var(--ink); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden-focusable:focus { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 14px; background: var(--ink); color: #fff; border-radius: var(--radius); }

/* ---------- Header ---------- */
.app-header { position: fixed; z-index: 40; inset: 0 0 auto 0; height: var(--header-h); display: flex; align-items: center; gap: 20px; padding: 0 28px 0 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius); background: var(--ink); color: #fff; }
.brand-mark svg { width: 20px; height: 20px; display: block; }
.brand-mark > span { font-size: 13px; font-weight: 600; letter-spacing: .02em; line-height: 1; }
.brand-mark.has-logo { background: transparent; padding: 0; overflow: hidden; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-aside .brand-mark.has-logo { background: #fff; padding: 3px; }
.brand-text strong { display: block; text-transform: uppercase; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 600; letter-spacing: .02em; color: var(--ink); line-height: 1.1; }
.brand-text small { display: block; text-transform: uppercase; margin-top: 3px; font-size: 10px; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); color: var(--text); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.header-search { position: relative; flex: 1 1 auto; max-width: 640px; margin-left: 6px; }
.header-search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 14px; pointer-events: none; }
.header-search input { width: 100%; height: 40px; padding: 0 56px 0 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); color: var(--ink); font-size: 14px; }
.header-search input::placeholder { color: var(--faint); }
.header-search input:focus { outline: 0; border-color: var(--ink); background: var(--paper); box-shadow: 0 0 0 3px rgba(10,10,10,.08); }
.header-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--paper); color: var(--muted); font: 500 11px "DM Sans", sans-serif; }
.header-end { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.icon-button { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font-size: 18px; cursor: pointer; }
.icon-button:hover { background: var(--wash); }
.icon-button .badge-count { position: absolute; top: 2px; right: 0; display: grid; place-items: center; box-sizing: border-box; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; border: 2px solid var(--paper); }
.header-divider { width: 1px; height: 30px; background: var(--line); }
.user-menu { display: flex; align-items: center; gap: 11px; padding: 4px 6px; border: 0; border-radius: var(--radius); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.user-menu:hover { background: var(--wash); }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.avatar-mini { width: 28px; height: 28px; font-size: 10px; background: var(--wash); color: var(--text); border: 1px solid var(--line); }
.user-menu-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.user-menu-text small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.user-menu > i { color: var(--muted); font-size: 12px; }
.sidebar-toggle { display: none; }

/* ---------- Sidebar ---------- */
.sidebar { position: fixed; z-index: 30; top: var(--header-h); bottom: 0; left: 0; display: flex; flex-direction: column; width: var(--sidebar-w); padding: 22px 14px 14px; background: var(--paper); border-right: 1px solid var(--line); overflow-y: auto; }
.nav-label { margin: 0; padding: 0 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.nav-label:not(:first-child) { margin-top: 26px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 13px; min-height: 42px; padding: 0 12px; border-radius: var(--radius); color: var(--text); font-size: 14px; font-weight: 400; }
.nav-link i { width: 20px; font-size: 17px; color: #3b3b3b; text-align: center; }
.nav-link:hover { background: var(--wash); color: var(--ink); }
.nav-link.active { background: var(--wash); color: var(--ink); font-weight: 600; }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 2px 2px 0; background: var(--ink); }
.nav-link.active i { color: var(--ink); }
.nav-count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.nav-alert { margin-left: auto; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 22px; }
.scope-box { margin: 8px 0 12px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 13px; font-weight: 600; color: var(--ink); }
.scope-box i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); flex: 0 0 auto; }
.scope-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot form { margin: 0; }
.nav-button { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.sidebar-scrim { display: none; }

/* ---------- Main ---------- */
.main-area { margin-left: var(--sidebar-w); padding-top: var(--header-h); min-height: 100vh; }
.page-container { max-width: 1480px; padding: 32px 36px 64px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-heading h1 { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 30px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
.page-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.title-tag { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--wash); color: var(--text); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.title-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* ---------- Buttons & forms ---------- */
.btn { --bs-btn-border-radius: var(--radius); --bs-btn-font-weight: 500; --bs-btn-font-size: 14px; --bs-btn-padding-x: 18px; --bs-btn-padding-y: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.3; box-shadow: none !important; }
.btn-sm { --bs-btn-font-size: 13px; --bs-btn-padding-x: 16px; --bs-btn-padding-y: 9px; }
.btn-xs { --bs-btn-font-size: 12px; --bs-btn-padding-x: 11px; --bs-btn-padding-y: 5px; }
.btn i { font-size: 1.05em; }
.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #2a2a2a; --bs-btn-hover-border-color: #2a2a2a; --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000; --bs-btn-disabled-bg: #777; --bs-btn-disabled-border-color: #777; }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-bg: var(--paper); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--wash); --bs-btn-hover-border-color: #b5b5b5; --bs-btn-active-bg: #ececec; --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #b5b5b5; }
.btn-success { --bs-btn-color: #fff; --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: #09663f; --bs-btn-hover-border-color: #09663f; --bs-btn-active-bg: #09663f; }
.btn-outline-danger { --bs-btn-color: var(--red); --bs-btn-border-color: var(--red-line); --bs-btn-hover-bg: var(--red); --bs-btn-hover-border-color: var(--red); --bs-btn-hover-color: #fff; }
.btn-link { --bs-btn-color: var(--muted); --bs-btn-hover-color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.form-label { margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 500; }
.form-control, .form-select { min-height: 42px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius); background-color: var(--paper); color: var(--ink); font-size: 14px; box-shadow: none; }
.form-control::placeholder { color: var(--faint); }
.form-control:focus, .form-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,.08); background-color: var(--paper); color: var(--ink); }
.form-control-sm { min-height: 38px; font-size: 13px; }
textarea.form-control { min-height: 0; }
.form-text { margin-top: 6px; color: var(--muted); font-size: 12px; }
.form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230a0a0a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
input[type="file"].form-control { padding: 7px 10px; }
input[type="file"].form-control::file-selector-button { margin-right: 12px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--wash); color: var(--ink); font: 500 12px "DM Sans", sans-serif; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 46px; }
.password-field button { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.password-field button:hover { background: var(--wash); color: var(--ink); }
.alert { --bs-alert-border-radius: var(--radius); display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--line-strong); border-left-width: 3px; background: var(--paper); color: var(--ink); font-size: 14px; }
.alert-success { border-color: var(--green-line); border-left-color: var(--green); background: var(--green-bg); }
.alert-danger { border-color: var(--red-line); border-left-color: var(--red); background: var(--red-bg); }
.alert-info { border-color: var(--line-strong); border-left-color: var(--ink); background: var(--wash); }
.alert .btn-close { margin-left: auto; padding: 14px; }
.dropdown-menu { --bs-dropdown-border-radius: var(--radius); --bs-dropdown-border-color: var(--line-strong); --bs-dropdown-link-active-bg: var(--ink); min-width: 210px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.08); font-size: 14px; }
.dropdown-item { border-radius: 3px; padding: 8px 12px; }
.dropdown-item:hover { background: var(--wash); color: var(--ink); }
.dropdown-item-text { padding: 8px 12px; color: var(--muted); font-size: 12px; }
.modal-content { border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0,0,0,.18); }
.modal-header { align-items: flex-start; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.modal-title { margin: 0; font-size: 20px; font-weight: 600; }
.modal-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--line); gap: 8px; }

/* ---------- KPI cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-bottom: 28px; }
.stat-card { min-height: 156px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.stat-label { display: flex; align-items: center; justify-content: space-between; color: var(--text); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.stat-value { margin-top: 18px; color: var(--ink); font-size: 40px; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.stat-value small { margin-left: 4px; color: var(--muted); font-size: 16px; font-weight: 500; letter-spacing: 0; }
.stat-foot { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.stat-foot .good { color: var(--green); font-weight: 500; }
.stat-card.is-alert .stat-value, .stat-card.is-alert .stat-foot { color: var(--red); }
.stat-card.is-alert .stat-foot { font-weight: 500; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- Panels ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 24px; }
.panel:last-child { margin-bottom: 0; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 28px 18px; }
.panel-title { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.panel-subtitle { margin-top: 3px; color: var(--muted); font-size: 13px; }
.panel-body { padding: 4px 28px 28px; }
.panel-header + .panel-body { padding-top: 18px; border-top: 1px solid var(--line); }
.section-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-strong); }
.section-link:hover { text-decoration-color: var(--ink); }
.count-tag { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--red-line); background: var(--red-bg); color: var(--red); font-size: 12px; font-weight: 600; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; color: var(--muted); font-size: 14px; text-align: center; }
.empty-state i { font-size: 22px; color: var(--faint); }

/* ---------- Dashboard ---------- */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr); gap: 24px; margin-bottom: 24px; align-items: start; }
.dashboard-lower { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dashboard-grid .panel, .dashboard-lower .panel { margin-bottom: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.sw-1 { background: var(--ink); } .sw-2 { background: #6e6e6e; } .sw-3 { background: #b4b4b4; } .sw-4 { background: #dedede; border: 1px solid #c9c9c9; }
.stack-block + .stack-block { margin-top: 28px; }
.stack-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.stack-head strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.stack-bar { display: flex; height: 8px; overflow: hidden; border-radius: 4px; background: var(--wash); border: 1px solid var(--line); }
.stack-bar span { display: block; height: 100%; min-width: 3px; }
.stack-bar span + span { margin-left: 2px; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.metric-label { color: var(--text); font-size: 13px; }
.metric-value { margin-top: 6px; color: var(--ink); font-size: 30px; font-weight: 500; line-height: 1.15; letter-spacing: -.02em; }
.metric-value small { margin-left: 4px; color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.metric-note { margin-top: 4px; color: var(--muted); font-size: 13px; }
.alert-card { display: block; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.alert-card:hover { border-color: var(--ink); }
.alert-card + .alert-card { margin-top: 12px; }
.alert-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.alert-card-top strong { color: var(--ink); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.alert-card-top span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.alert-card-top span.tone-red { color: var(--red); font-weight: 600; }
.alert-card-top span.tone-amber { color: var(--amber); font-weight: 600; }
.alert-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.alert-panel-foot { margin-top: 16px; }
.alert-panel-foot .btn { width: 100%; }

/* ---------- Tabs & filters ---------- */
.tab-bar { display: flex; gap: 6px; padding: 0 28px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar a { position: relative; flex: 0 0 auto; padding: 16px 14px 15px; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.tab-bar a:hover { color: var(--ink); }
.tab-bar a.active { color: var(--ink); font-weight: 600; }
.tab-bar a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 28px; }
.toolbar-form { display: flex; flex-wrap: wrap; flex: 1 1 320px; max-width: 520px; gap: 10px; margin: 0; }
.search-field { position: relative; flex: 1; }
.search-field i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 14px; }
.search-field input { width: 100%; height: 40px; padding: 0 14px 0 38px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--wash); font-size: 14px; color: var(--ink); }
.search-field input:focus { outline: 0; border-color: var(--ink); background: var(--paper); box-shadow: 0 0 0 3px rgba(10,10,10,.08); }
.toolbar-note { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.panel > .table-wrap:last-child { border-bottom: 0; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: #fafafa; margin: 0; width: 100%; font-size: 14px; }
.table > :not(caption) > * > * { padding: 18px 20px; border-bottom-width: 1px; vertical-align: middle; background-color: var(--bs-table-bg); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > :not(caption) > *:first-child > * { border-top: 0; }
.table thead th { padding-top: 15px; padding-bottom: 15px; background: var(--wash); color: var(--text); font-size: 11.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table th:first-child, .table td:first-child { padding-left: 28px; }
.table th:last-child, .table td:last-child { padding-right: 28px; }
.table tbody tr:hover > td { background: #fafafa; }
.record-title { display: block; color: var(--ink); font-size: 15px; font-weight: 500; line-height: 1.35; }
.record-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; letter-spacing: .01em; }
a.table-title-link { display: block; color: var(--ink); font-size: 15px; font-weight: 500; line-height: 1.35; }
a.table-title-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.small-muted { color: var(--muted); font-size: 13px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.row-action { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); color: var(--text); }
.row-action:hover { background: var(--wash); color: var(--ink); }
.col-end { text-align: right; width: 1%; white-space: nowrap; }
.expiry-soon { color: var(--red); font-weight: 600; }
.audit-action { display: inline-block; padding: 2px 9px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--wash); font-size: 12px; font-weight: 500; text-transform: capitalize; }
.share-cell { display: flex; align-items: center; gap: 12px; min-width: 130px; }
.share-track { flex: 1; height: 6px; border-radius: 3px; background: var(--wash); border: 1px solid var(--line); overflow: hidden; }
.share-track span { display: block; height: 100%; background: var(--ink); }
.share-cell small { color: var(--muted); font-size: 12px; width: 34px; text-align: right; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--wash); color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 1.3; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.pill-green { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.pill-green::before { background: var(--green); }
.pill-amber { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber); }
.pill-amber::before { background: #e08a00; }
.pill-red { border-color: var(--red-line); background: var(--red-bg); color: var(--red); }
.pill-red::before { background: var(--red); }
.pill-gray::before { background: #7a7a7a; }

/* Distinct colours per entity / workflow status (pill-status-*) */
.pill[class*="pill-status-"] { border-width: 1px; }
.pill-status-available { border-color: #93c5fd; background: #eff6ff; color: #1d4ed8; }
.pill-status-available::before { background: #2563eb; }
.pill-status-assigned { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.pill-status-assigned::before { background: var(--green); }
.pill-status-allocated { border-color: #c4b5fd; background: #f5f3ff; color: #6d28d9; }
.pill-status-allocated::before { background: #7c3aed; }
.pill-status-maintenance, .pill-status-in-maintenance { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber); }
.pill-status-maintenance::before, .pill-status-in-maintenance::before { background: #e08a00; }
.pill-status-damaged { border-color: var(--red-line); background: var(--red-bg); color: var(--red); }
.pill-status-damaged::before { background: var(--red); }
.pill-status-missing { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.pill-status-missing::before { background: #dc2626; }
.pill-status-retired, .pill-status-disposed, .pill-status-fully-depreciated { border-color: var(--line-strong); background: var(--wash); color: var(--muted); }
.pill-status-active { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.pill-status-active::before { background: var(--green); }
.pill-status-service-due { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.pill-status-service-due::before { background: #d97706; }
.pill-status-accident { border-color: var(--red-line); background: var(--red-bg); color: var(--red); }
.pill-status-completed, .pill-status-approved, .pill-status-received, .pill-status-repaired, .pill-status-closed { border-color: var(--green-line); background: var(--green-bg); color: var(--green); }
.pill-status-pending, .pill-status-pending-approval, .pill-status-scheduled, .pill-status-in-progress, .pill-status-requested, .pill-status-reported, .pill-status-under-review, .pill-status-ordered, .pill-status-partially-received, .pill-status-draft { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber); }
.pill-status-rejected, .pill-status-cancelled, .pill-status-overdue { border-color: var(--red-line); background: var(--red-bg); color: var(--red); }
.pill-status-unknown { border-color: var(--line-strong); background: var(--wash); color: var(--muted); }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager-links { display: flex; align-items: center; gap: 8px; }
.pager-links a, .pager-links span { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 500; }
.pager-links a:hover { background: var(--wash); }
.pager-links .current { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.pager-links .disabled { color: var(--faint); border-color: var(--line); background: var(--wash); }
.pager-links .gap { border: 0; background: transparent; min-width: 20px; padding: 0; color: var(--faint); }

/* ---------- Forms layout ---------- */
.form-panel .panel-body { padding-top: 24px; }
.form-section-title { margin: 0 0 16px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.form-section-title:first-child { padding-top: 0; border-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-tip { display: flex; gap: 9px; margin-bottom: 18px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); color: var(--text); font-size: 13px; }
.form-tip i { margin-top: 2px; color: var(--ink); }
.operations-layout { display: grid; grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); gap: 24px; align-items: start; }
.operations-layout .panel { margin-bottom: 0; }
.operations-form .panel-body { padding-top: 22px; }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.scan-layout .panel { margin-bottom: 0; }
#qr-reader { overflow: hidden; border: 1px solid var(--line-strong) !important; border-radius: var(--radius); }
#qr-reader button { margin: 6px 4px; padding: 8px 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: #fff; font: 500 13px "DM Sans", sans-serif; cursor: pointer; }
#qr-reader a { color: var(--ink); }
#qr-reader select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 13px "DM Sans", sans-serif; }
.scan-message { margin: 16px 0; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--wash); font-size: 13px; }
.scan-tip { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---------- Detail pages ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.detail-grid > div > .panel, .detail-grid > aside > .panel { margin-bottom: 24px; }
.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 28px; }
.detail-ident { display: flex; align-items: center; gap: 16px; }
.detail-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--ink); color: #fff; font-size: 22px; }
.detail-ident h2 { margin: 0; font-size: 20px; font-weight: 600; }
.detail-ident small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.detail-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.detail-field { padding: 18px 28px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.detail-field:nth-child(3n) { border-right: 0; }
.detail-field:nth-last-child(-n+1) { border-bottom: 0; }
.detail-field span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.detail-field strong { display: block; margin-top: 5px; color: var(--ink); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.timeline { position: relative; margin-left: 5px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.timeline-item { position: relative; padding: 0 0 20px 28px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.timeline-item strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.timeline-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.qr-card { padding: 24px 28px; text-align: center; }
.qr-card .panel-title { text-align: left; }
.qr-card .panel-subtitle { text-align: left; }
.qr-canvas { display: grid; place-items: center; margin: 20px auto 12px; width: 220px; height: 220px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.qr-canvas-lg { width: 300px; height: 300px; }
.qr-canvas canvas { max-width: 100%; height: auto !important; }
.scan-hub-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 28px; border-top: 1px solid var(--line); }
.label-public-page { margin: 0; min-height: 100vh; display: grid; place-items: center; background: var(--paper, #fff); }
.label-public { margin: 0; padding: 24px; text-align: center; }
.label-public-code { margin: 0; font-size: clamp(28px, 6vw, 40px); font-weight: 700; letter-spacing: .06em; color: var(--ink); }
.label-public-code-muted { font-size: clamp(18px, 4vw, 24px); font-weight: 600; color: var(--muted); }
.depreciation-chart-wrap { margin-top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised, #fafafa); }
.depreciation-chart { width: 100%; max-width: 640px; height: auto; display: block; }
.depreciation-summary { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.qr-label { color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.barcode-svg { display: block; max-width: 100%; height: 56px; margin: 12px auto 0; }
.footer-note { margin-top: 12px; color: var(--muted); font-size: 12px; }
.document-upload-form { margin-bottom: 16px; }
.document-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.document-row:hover strong { text-decoration: underline; }
.document-icon { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--wash); }
.document-row strong { display: block; color: var(--ink); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.document-row small { display: block; color: var(--muted); font-size: 12px; }
.document-download { margin-left: auto; color: var(--muted); }
.compact-record { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.compact-record:first-child { border-top: 0; padding-top: 0; }
.compact-record-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.compact-record strong { display: block; color: var(--ink); font-size: 14px; font-weight: 500; }
.compact-record small { display: block; color: var(--muted); font-size: 12.5px; }
.quick-actions { display: grid; gap: 10px; }
.quick-actions a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 500; }
.quick-actions a:hover { border-color: var(--ink); background: var(--wash); }
.role-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.role-info { display: flex; gap: 14px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); }
.role-info i { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 16px; }
.role-info strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.role-info small { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.report-disclaimer { margin-top: 20px; color: var(--muted); font-size: 13px; }
.month-input { width: 170px; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; background: var(--paper); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, 1fr); min-height: 100vh; }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 56px; background: var(--ink); color: #fff; overflow: hidden; }
.auth-aside .brand-mark { background: #fff; color: var(--ink); }
.auth-aside .brand-text strong { color: #fff; }
.auth-aside .brand-text small { color: #9a9a9a; }
.auth-aside h2 { max-width: 15ch; margin: 0 0 18px; color: #fff; font-size: 46px; font-weight: 500; line-height: 1.08; letter-spacing: -.03em; }
.auth-aside p { max-width: 44ch; margin: 0; color: #b3b3b3; font-size: 16px; line-height: 1.55; }
.auth-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #2c2c2c; }
.auth-facts div { padding: 18px 0 0; }
.auth-facts div:nth-child(odd) { padding-right: 24px; }
.auth-facts strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.auth-facts span { display: block; margin-top: 3px; color: #8d8d8d; font-size: 13px; line-height: 1.4; }
.auth-grid-lines { position: absolute; inset: 0; pointer-events: none; opacity: .5; background-image: linear-gradient(#1b1b1b 1px, transparent 1px), linear-gradient(90deg, #1b1b1b 1px, transparent 1px); background-size: 56px 56px; mask-image: linear-gradient(135deg, transparent 20%, #000 100%); -webkit-mask-image: linear-gradient(135deg, transparent 20%, #000 100%); }
.auth-aside > :not(.auth-grid-lines) { position: relative; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 408px; }
.auth-card .brand { display: none; margin-bottom: 36px; }
.auth-card h1 { margin: 0 0 8px; font-size: 32px; font-weight: 500; letter-spacing: -.025em; line-height: 1.15; }
.auth-intro { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
.auth-form .form-control { min-height: 46px; }
.auth-form .btn { width: 100%; min-height: 46px; margin-top: 26px; font-size: 15px; }
.auth-form .field + .field { margin-top: 18px; }
.auth-footnote { display: flex; align-items: center; gap: 8px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---------- Error pages ---------- */
.error-page { display: grid; place-items: center; min-height: 100vh; padding: 28px; background: var(--paper); }
.error-card { width: 100%; max-width: 520px; padding: 40px; border: 1px solid var(--line); border-radius: var(--radius); }
.error-code { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.error-card h1 { margin: 12px 0 10px; font-size: 32px; font-weight: 500; letter-spacing: -.02em; }
.error-card p { margin: 0 0 26px; color: var(--muted); font-size: 15px; }

/* ---------- Responsive ---------- */
@media (max-width: 1199.98px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .dashboard-grid, .dashboard-lower, .detail-grid, .scan-layout { grid-template-columns: 1fr; }
    .operations-layout { grid-template-columns: 1fr; }
    .role-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .status-chip { display: none; }
}
@media (max-width: 991.98px) {
    .sidebar-toggle { display: inline-grid; }
    .app-header { gap: 10px; padding: 0 14px; }
    .brand-text small, .user-menu-text, .user-menu > i, .header-divider { display: none; }
    .header-search { max-width: none; margin-left: 0; }
    .header-search kbd { display: none; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: min(300px, 86vw); box-shadow: none; }
    .sidebar.is-open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.2); }
    .nav-link.active::before { left: -14px; }
    .sidebar-scrim.is-open { display: block; position: fixed; z-index: 25; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.35); }
    .main-area { margin-left: 0; }
    .page-container { padding: 24px 18px 48px; }
    .page-heading { flex-direction: column; align-items: flex-start; }
    .page-heading h1 { font-size: 26px; }
    .detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-field:nth-child(3n) { border-right: 1px solid var(--line); }
    .detail-field:nth-child(2n) { border-right: 0; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-card .brand { display: flex; }
}
@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 0; padding: 18px 20px; }
    .stat-value { font-size: 34px; margin-top: 12px; }
    .metric-row { grid-template-columns: 1fr; gap: 18px; }
    .role-info-grid { grid-template-columns: 1fr; }
    .detail-fields { grid-template-columns: 1fr; }
    .detail-field { border-right: 0 !important; }
    .panel-header, .toolbar, .pager, .tab-bar { padding-left: 18px; padding-right: 18px; }
    .panel-body { padding-left: 18px; padding-right: 18px; }
    .table th:first-child, .table td:first-child { padding-left: 18px; }
    .table th:last-child, .table td:last-child { padding-right: 18px; }
    .detail-hero { flex-direction: column; align-items: flex-start; }
    .auth-main { align-items: flex-start; padding-top: 48px; }
    .page-heading-actions { width: 100%; }
    .page-heading-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Print: label sheet & reports ---------- */
@media print {
    .app-header, .sidebar, .sidebar-scrim, .page-heading-actions, .toolbar, .tab-bar, .pager, .alert { display: none !important; }
    .main-area { margin: 0; padding: 0; }
    .page-container { max-width: none; padding: 0; }
    .page-heading { margin: 0 0 16px; padding: 0 0 12px; }
    .panel, .stat-card { break-inside: avoid; }
    body.print-label * { visibility: hidden; }
    body.print-label .qr-card, body.print-label .qr-card * { visibility: visible; }
    body.print-label .qr-card { position: absolute; left: 0; top: 0; width: 80mm; border: 1px solid #000; }
    body.print-label .qr-card .panel-subtitle { display: none; }
}

/* ---------- Label sheets ---------- */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.label-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); break-inside: avoid; background: #fff; }
.label-card canvas { width: 96px !important; height: 96px !important; flex: 0 0 auto; }
.label-text { min-width: 0; }
.label-text strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.label-text span { display: block; margin: 2px 0 6px; color: var(--muted); font-size: 12px; }
.label-barcode { display: block; max-width: 100%; height: 40px; }
@media print { body.print-labels .label-grid { grid-template-columns: repeat(2, 1fr); gap: 6mm; } body.print-labels .label-card { border: 1px solid #000; } }

/* ---------- Signature and photos ---------- */
.signature-pad { display: block; width: 100%; max-width: 640px; height: 180px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }
.signature-img { display: block; max-width: 360px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); }
.photo-gallery-item { margin: 0; }
.photo-gallery-item figcaption { margin-top: 4px; font-size: 11px; line-height: 1.3; }
.table-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); vertical-align: middle; }
.table-thumb-placeholder { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 16px; }
@media print { body.print-form .detail-grid { grid-template-columns: 1fr 1fr; } body.print-form aside .panel:not(:first-child) { display: none; } }

a.stat-card { display: block; color: inherit; }
a.stat-card:hover { border-color: var(--ink); }
a.role-info { color: inherit; }
a.role-info:hover { border-color: var(--ink); }
.compact-record { color: inherit; }
a.compact-record:hover strong { text-decoration: underline; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,10,.08); }
.form-check-label { font-size: 14px; }
code { font-family: "DM Sans", sans-serif; color: var(--ink); background: var(--wash); padding: 2px 6px; border-radius: 3px; letter-spacing: .02em; }

/* Let grid children shrink so wide tables scroll inside their panel instead of widening the page. */
.detail-grid > *, .dashboard-grid > *, .dashboard-lower > *, .operations-layout > *, .scan-layout > *, .stat-grid > * { min-width: 0; }

.roles-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.roles-layout .panel { margin-bottom: 0; }
@media (max-width: 991.98px) { .roles-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 575.98px) { .toolbar-form > select, .toolbar-form > input, .toolbar-form > div, .toolbar-form > .search-field { flex: 1 1 100%; max-width: none !important; } }
