/* =====================================================================
   Asset Intelligence Management — UI
   Brand colours derived from the Unified Software Hub mark.
   All spacing uses logical properties so Arabic (RTL) mirrors cleanly.
   ===================================================================== */

:root {
    --brand-navy: #0b1b3f;
    --brand-blue: #1677e6;
    --brand-cyan: #0ea5e9;
    --brand-teal: #22c3a6;
    --grad: linear-gradient(135deg, #1677e6 0%, #0ea5e9 55%, #22c3a6 100%);

    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --surface-3: #eef3f9;
    --border: #e3e9f2;
    --border-strong: #cfd9e6;
    --text: #0f1b33;
    --text-2: #4a5a75;
    --muted: #7a8aa3;
    --primary: #1677e6;
    --primary-ink: #ffffff;
    --primary-soft: #e6f0fd;
    --success: #12a37c;
    --success-soft: #e3f7f0;
    --warning: #d48806;
    --warning-soft: #fdf3dc;
    --danger: #e0394a;
    --danger-soft: #fde8ea;
    --info: #0c8bd6;
    --info-soft: #e2f3fc;
    --teal: #16a991;
    --teal-soft: #ddf6f1;
    --neutral-soft: #edf1f6;

    --sidebar-bg: #0b1b3f;
    --sidebar-text: #b8c5dd;
    --sidebar-active: rgba(255, 255, 255, .09);
    --sidebar-fg: #ffffff;
    --sidebar-muted: #5f7193;
    --sidebar-line: rgba(255, 255, 255, .06);
    --sidebar-thumb: rgba(255, 255, 255, .18);
    --sidebar-thumb-hover: rgba(255, 255, 255, .32);

    --radius: 14px;
    --radius-sm: 9px;
    --radius-ctl: 10px;
    --ctl-h: 38px;
    --card-pad: 18px;
    --hero-a: rgba(14, 165, 233, .45);
    --hero-b: rgba(34, 195, 166, .4);
    --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 4px 16px rgba(15, 27, 51, .05);
    --shadow-lg: 0 20px 60px rgba(9, 20, 45, .25);
    --font: "Alexandria", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-ar: "Alexandria", "Segoe UI", Tahoma, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    --sidebar-w: 256px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a1224;
        --surface: #111b31;
        --surface-2: #14203a;
        --surface-3: #1a2745;
        --border: #22304f;
        --border-strong: #2e3e62;
        --text: #e6ecf7;
        --text-2: #aab7cf;
        --muted: #7d8cab;
        --primary: #3b8ef0;
        --primary-soft: rgba(59, 142, 240, .16);
        --success-soft: rgba(18, 163, 124, .16);
        --warning-soft: rgba(212, 136, 6, .18);
        --danger-soft: rgba(224, 57, 74, .18);
        --info-soft: rgba(12, 139, 214, .18);
        --teal-soft: rgba(22, 169, 145, .18);
        --neutral-soft: rgba(255, 255, 255, .06);
        --sidebar-bg: #070e1d;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0a1224;
    --surface: #111b31;
    --surface-2: #14203a;
    --surface-3: #1a2745;
    --border: #22304f;
    --border-strong: #2e3e62;
    --text: #e6ecf7;
    --text-2: #aab7cf;
    --muted: #7d8cab;
    --primary: #3b8ef0;
    --primary-soft: rgba(59, 142, 240, .16);
    --success-soft: rgba(18, 163, 124, .16);
    --warning-soft: rgba(212, 136, 6, .18);
    --danger-soft: rgba(224, 57, 74, .18);
    --info-soft: rgba(12, 139, 214, .18);
    --teal-soft: rgba(22, 169, 145, .18);
    --neutral-soft: rgba(255, 255, 255, .06);
    --sidebar-bg: #070e1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 12px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body, :lang(ar) body { font-family: var(--font-ar); }
/* Browsers keep the viewport scrollbar on the right; scrolling the body instead puts it on the left in RTL. */
@media screen {
    html[dir="rtl"] { height: 100%; overflow: hidden; }
    html[dir="rtl"] body { height: 100%; overflow-y: auto; }
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 600; }
h4 { font-size: 11px; font-weight: 600; margin-block: 14px 8px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
small { font-size: 10px; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-xs { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 36px; height: 36px; }
.icon-title { width: 24px; height: 24px; color: var(--primary); vertical-align: -4px; }
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

.muted { color: var(--muted); }
.small { font-size: 10px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pre { white-space: pre-wrap; }
.grow { flex: 1; }
.mt { margin-top: 18px; }
.pad { padding: 12px 16px; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar-collapsed .shell { grid-template-columns: 72px 1fr; }
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    overflow-y: auto; overflow-x: hidden;
    border-inline-end: 1px solid rgba(255, 255, 255, .04);
    z-index: 30;
}
/* Keep wheel/touch scrolling inside the menu (no hand-off to the page at the top or bottom),
   and give it a slim scrollbar that blends with the dark sidebar. */
.sidebar {
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-thumb) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-thumb); border-radius: 8px; border: 2px solid var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--sidebar-thumb-hover); }
.sidebar:hover { scrollbar-color: var(--sidebar-thumb-hover) transparent; }
.sidebar::before {
    content: ""; position: absolute; inset-inline: 0; top: 0; height: 220px; pointer-events: none;
    background: radial-gradient(ellipse at 20% 0%, rgba(22, 119, 230, .35), transparent 70%);
}
/* Sidebar brand: logo on top, platform name below it in the interface language, both centred. */
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px 18px; color: var(--sidebar-fg); position: relative; text-align: center; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 60px; height: 60px; object-fit: contain; filter: drop-shadow(0 4px 14px rgba(14, 165, 233, .35)); }
.brand-text { display: flex; flex-direction: column; align-items: center; line-height: 1.3; min-width: 0; max-width: 100%; }
.brand-text strong { font-size: 14px; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.brand-text small { color: #7fd8ff; font-size: 9.5px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
[dir="rtl"] .brand-text small { letter-spacing: 0; text-transform: none; font-family: var(--font); }
.nav { padding: 6px 12px 16px; flex: 1; position: relative; }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 8.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--sidebar-muted); padding: 8px 12px 6px; white-space: nowrap; }
[dir="rtl"] .nav-label { letter-spacing: 0; font-size: 9.5px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-size: 12px; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-active); color: var(--sidebar-fg); text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(22, 119, 230, .35), rgba(34, 195, 166, .12)); color: var(--sidebar-fg); box-shadow: inset 3px 0 0 var(--brand-teal); }
[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 var(--brand-teal); background: linear-gradient(270deg, rgba(22, 119, 230, .35), rgba(34, 195, 166, .12)); }
.nav-item .icon { width: 19px; height: 19px; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid var(--sidebar-line); white-space: nowrap; color: var(--sidebar-muted); }
.sidebar-foot .muted { color: inherit; }
.sidebar-collapsed .brand-text, .sidebar-collapsed .nav-item span, .sidebar-collapsed .nav-label, .sidebar-collapsed .sidebar-foot { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar-collapsed .brand { padding-inline: 10px; }
.sidebar-collapsed .brand-mark { width: 40px; height: 40px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
    padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.smart-search {
    flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; gap: 10px; padding: 9px 14px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--muted);
    font: inherit; cursor: text; text-align: start; box-shadow: var(--shadow);
}
.smart-search .icon { color: var(--brand-cyan); }
.smart-search span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font-family: var(--mono); font-size: 9px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin-inline: auto; }

.icon-btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center; min-width: 38px; height: 38px; padding: 0 9px;
    border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font: inherit; font-weight: 600; font-size: 10px; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn.sm { min-width: 30px; height: 30px; padding: 0 6px; }
.bell .dot { position: absolute; top: 3px; inset-inline-end: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 9px; display: grid; place-items: center; border: 2px solid var(--bg); }
.theme-dark { display: none; }
:root[data-theme="dark"] .theme-dark { display: inline; }
:root[data-theme="dark"] .theme-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-dark { display: inline; }
    :root:not([data-theme="light"]) .theme-light { display: none; }
}
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; font: inherit; color: var(--text); text-align: start; }
[dir="rtl"] .user-chip { padding: 4px 4px 4px 10px; }
.user-chip span:last-child { display: flex; flex-direction: column; line-height: 1.15; font-weight: 600; font-size: 11px; }
.user-chip small { color: var(--muted); font-weight: 500; font-size: 9px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 11px; flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); inset-inline-start: 0; min-width: 180px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50;
}
.dropdown-menu.end { inset-inline-start: auto; inset-inline-end: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: start;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-menu a.active { color: var(--primary); font-weight: 600; }
.dropdown-menu form { margin: 0; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; }
.page-actions select { max-width: 100%; }
.back-link { display: inline-block; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.asset-title { display: flex; align-items: center; gap: 14px; }
.asset-title small { font-size: 12px; font-weight: 500; margin-inline-start: 6px; }
.title-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.title-icon .icon { width: 24px; height: 24px; }
.title-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--ctl-h); padding: 0 15px; border-radius: var(--radius-ctl);
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 11.5px; cursor: pointer; white-space: nowrap; transition: transform .05s, box-shadow .15s, background .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(22, 119, 230, .25); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(22, 119, 230, .35); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 10.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: 11px; cursor: pointer; font-weight: 500; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--card-pad); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3, .card-title { display: flex; align-items: center; gap: 8px; }
.card-title { margin-bottom: 14px; }
.card-head .icon, .card-title .icon { color: var(--primary); }
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.narrow { max-width: 720px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 4px; color: var(--text); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(15, 27, 51, .08); }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px; flex: none; }
.tone-blue { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-teal { background: var(--teal-soft); color: var(--teal); }
.tone-neutral { background: var(--neutral-soft); color: var(--text-2); }
.kpi-label { font-size: 10.5px; color: var(--text-2); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi-value small { font-size: 11px; color: var(--muted); font-weight: 500; }
.kpi-sub { font-size: 10px; color: var(--muted); }
.meter { display: block; height: 6px; background: var(--surface-3); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; border-radius: 6px; }
.bg-success { background: var(--success); }
.bg-warning { background: var(--warning); }
.bg-danger { background: var(--danger); }
.bg-teal { background: var(--grad); }
.bg-neutral { background: var(--muted); }

.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini-kpis .card { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.mini-kpis .card span { font-size: 10px; color: var(--muted); }
.mini-kpis .card strong { font-size: 20px; font-weight: 700; }
.mini-kpis a.card:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- Insights ---------- */
.insight-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.insight { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); border-inline-start: 4px solid var(--muted); }
.insight p { color: var(--text-2); font-size: 11px; margin-top: 2px; }
.insight-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--neutral-soft); color: var(--text-2); flex: none; }
.sev-critical { border-inline-start-color: var(--danger); }
.sev-critical .insight-icon { background: var(--danger-soft); color: var(--danger); }
.sev-high { border-inline-start-color: #f06f2b; }
.sev-high .insight-icon { background: #fdebe1; color: #e2622a; }
:root[data-theme="dark"] .sev-high .insight-icon { background: rgba(240, 111, 43, .18); }
.sev-medium { border-inline-start-color: var(--warning); }
.sev-medium .insight-icon { background: var(--warning-soft); color: var(--warning); }
.sev-low { border-inline-start-color: var(--info); }
.sev-low .insight-icon { background: var(--info-soft); color: var(--info); }
.sev-info { border-inline-start-color: var(--success); }
.sev-info .insight-icon { background: var(--success-soft); color: var(--success); }
.insight-list.large .insight { padding: 16px 18px; }
.sev-tag { display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-inline-end: 8px; }
.sev-card { border-top: 3px solid var(--muted); }
.sev-card.sev-critical { border-top-color: var(--danger); }
.sev-card.sev-high { border-top-color: #f06f2b; }
.sev-card.sev-medium { border-top-color: var(--warning); }
.sev-card.sev-low { border-top-color: var(--info); }
.sev-card.sev-info { border-top-color: var(--success); }

/* ---------- Lists & feed ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.list li:last-child { border-bottom: 0; }
.list.compact li { padding: 7px 0; }
.list-main { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.list-main:hover { text-decoration: none; }
.list-main > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.list-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-icon, .cell-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 7px 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); margin-top: 7px; flex: none; }
.feed div { display: flex; flex-direction: column; min-width: 0; }
.feed small { color: var(--muted); }

/* ---------- Badges & pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 9.5px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
a.badge:hover { text-decoration: none; filter: brightness(.95); }
.risk-pill { display: inline-block; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 10px; }
.risk-low { background: var(--success-soft); color: var(--success); }
.risk-mid { background: var(--warning-soft); color: var(--warning); }
.risk-high { background: var(--danger-soft); color: var(--danger); }
.risk-low-text { color: var(--success); }
.risk-mid-text { color: var(--warning); }
.risk-high-text { color: var(--danger); }
.health { display: inline-flex; align-items: center; gap: 8px; min-width: 96px; }
.health-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 6px; overflow: hidden; min-width: 54px; }
.health-bar > span { display: block; height: 100%; border-radius: 6px; }
.health b { font-size: 10.5px; min-width: 22px; text-align: end; }
.health-success .health-bar > span { background: var(--success); }
.health-warning .health-bar > span { background: var(--warning); }
.health-danger .health-bar > span { background: var(--danger); }
.health-neutral .health-bar > span { background: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: 10.5px; border: 1px solid var(--border); white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; }
.chip:hover { text-decoration: none; border-color: var(--border-strong); }
.chip.found { background: var(--success-soft); color: var(--success); text-decoration: line-through; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 9px; font-weight: 700; text-align: center; }

/* ---------- Forms ---------- */
input, select, textarea {
    font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-ctl);
    padding: 8px 11px; height: var(--ctl-h); min-width: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; resize: vertical; border-radius: var(--radius-sm); }
input[type="checkbox"], input[type="radio"] { height: auto; width: 16px; height: 16px; accent-color: var(--primary); padding: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 10.5px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; }
.field-help { color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; cursor: pointer; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.inline-form input { flex: 1; min-width: 180px; }
.tiny-input { width: 64px; height: 30px; padding: 4px 8px; font-size: 10px; }
.tiny-input.wide { width: 140px; }
.inline-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.actions { text-align: end; white-space: nowrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type="search"] { flex: 1; min-width: 220px; }
.filters select { max-width: 200px; }
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.table-filter { width: 220px; }

.smartbar {
    display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin-bottom: 14px; border-radius: 14px;
    background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; box-shadow: var(--shadow); flex-wrap: wrap;
}
[dir="rtl"] .smartbar { padding: 8px 14px 8px 8px; }
.smartbar > .icon { color: var(--brand-cyan); }
.smartbar input { flex: 1; border: 0; box-shadow: none !important; padding-inline: 0; background: transparent; min-width: 200px; }
.smartbar-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.smartbar-chips .chip { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 600; }

.bulkbar { position: sticky; top: 70px; z-index: 10; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--brand-navy); color: #fff; box-shadow: var(--shadow-lg); }
.bulkbar select { height: 30px; padding: 2px 8px; font-size: 10.5px; }

.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.seg a { padding: 6px 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.seg button { padding: 6px 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 11px; }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Settings */
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit input { flex: 1; min-width: 0; }
.input-unit em { font-style: normal; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.color-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-pick input[type="color"] { width: 46px; height: 34px; padding: 3px; cursor: pointer; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 12px; color: var(--sidebar-fg);
    background: radial-gradient(ellipse at 15% 0%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 70%), var(--sidebar-bg); }
.brand-preview { flex-direction: column; text-align: center; }
.brand-preview .brand-mark { width: 60px; height: 60px; object-fit: contain; }
.brand-preview .brand-text small { text-transform: none; letter-spacing: 0; }
.preview-actions { display: flex; align-items: center; gap: 10px; }
.preview-actions .badge { background: var(--primary-soft); color: var(--primary); }
.logo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.logo-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; min-width: 0; }
.logo-box { width: 100%; height: 96px; display: grid; place-items: center; border-radius: 10px; margin-bottom: 4px;
    background: repeating-conic-gradient(var(--surface-3) 0% 25%, var(--surface) 0% 50%) 0 0 / 16px 16px; }
.logo-box img { max-width: 80%; max-height: 76px; object-fit: contain; }
.logo-favicon img { width: 32px; height: 32px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.login-message { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--text-2); font-size: 11px; white-space: pre-line; }
.login-message .icon { color: var(--info); flex: none; }
@media (max-width: 760px) { .logo-grid { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 9.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
[dir="rtl"] .table th { letter-spacing: 0; font-size: 10px; }
.table th a { color: inherit; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
/* A cell whose text sets its own direction (dir=auto) still lines up with its header: English text in an Arabic table aligns right too. */
[dir="rtl"] .table td[dir="auto"]:not(.center) { text-align: right; }
[dir="ltr"] .table td[dir="auto"]:not(.center) { text-align: left; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table td.mono, .table strong.mono { white-space: nowrap; }
.w-check { width: 36px; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.cell-main:hover { text-decoration: none; }
.cell-main > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cell-main small { color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }

/* ---------- Asset detail ---------- */
.asset-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 18px; margin-bottom: 18px; }
.hero-health { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; }
.factor-list { list-style: none; margin: 0; padding: 0; }
.factor-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 11px; }
.factor-list b { color: var(--danger); }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; }
.stat-label { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-label .icon { width: 15px; height: 15px; }
.stat strong { font-size: 17px; font-weight: 700; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0; }
.spec { padding: 9px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.spec dt { font-size: 9.5px; color: var(--muted); }
.spec dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border: 1px dashed var(--danger); border-radius: var(--radius); background: var(--danger-soft); }

.tabs { margin-bottom: 18px; }
.tab-list { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-list button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab-list button:hover { color: var(--text); }
.tab-list button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li > div { display: flex; flex-direction: column; padding-top: 5px; min-width: 0; }
.timeline small { color: var(--muted); }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--info); position: relative; z-index: 1; }
.tl-icon .icon { width: 15px; height: 15px; }
.tl-success .tl-icon { background: var(--success-soft); color: var(--success); }
.tl-warning .tl-icon { background: var(--warning-soft); color: var(--warning); }
.tl-danger .tl-icon { background: var(--danger-soft); color: var(--danger); }
.tl-neutral .tl-icon { background: var(--neutral-soft); color: var(--text-2); }
.timeline.compact li { padding-bottom: 12px; }

/* ---------- Charts & graph ---------- */
.chart { width: 100%; min-height: 180px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-2); font-family: inherit; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 10px; color: var(--text-2); }
.chart .legend a { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.chart .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart-tip { position: absolute; pointer-events: none; background: var(--brand-navy); color: #fff; padding: 5px 9px; border-radius: 7px; font-size: 10px; white-space: nowrap; transform: translate(-50%, -120%); z-index: 5; }
.gauge { min-height: 150px; }
.graph { width: 100%; border-radius: 12px; background: radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 22px 22px, var(--surface-2); position: relative; overflow: hidden; touch-action: none; }
.graph svg { width: 100%; height: 100%; display: block; cursor: grab; }
.graph svg:active { cursor: grabbing; }
.graph .node circle { stroke: var(--surface); stroke-width: 3; cursor: pointer; }
.graph .node text { font-size: 9px; fill: var(--text); font-family: var(--mono); pointer-events: none; paint-order: stroke; stroke: var(--surface-2); stroke-width: 3px; }
.graph .node.dim { opacity: .25; }
.graph .edge { stroke-width: 1.6; fill: none; }
.graph .edge.dim { opacity: .12; }
.graph .edge.depends_on, .lg-depends { stroke: #1677e6; background: #1677e6; }
.graph .edge.connected_to, .lg-connected { stroke: #7a8aa3; background: #7a8aa3; }
.graph .edge.hosts, .lg-hosts { stroke: #22c3a6; background: #22c3a6; }
.graph .edge.part_of { stroke: #9b6bf2; }
.graph .edge.backup_of, .lg-backup { stroke: #d48806; background: #d48806; stroke-dasharray: 5 4; }
.graph .edge.impact { stroke: var(--danger) !important; stroke-width: 2.6; opacity: 1; }
.graph .node.impact circle { stroke: var(--danger); stroke-width: 4; }
.graph-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 10px; margin-bottom: 12px; }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.graph-card { padding-bottom: 12px; }
.graph-tip { position: absolute; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 12px; font-size: 10px; pointer-events: none; z-index: 5; max-width: 260px; }
.graph-tip strong { display: block; font-family: var(--mono); }

/* ---------- Licenses ---------- */
.license-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.license-card { display: flex; flex-direction: column; gap: 12px; color: var(--text); transition: transform .15s; }
.license-card:hover { text-decoration: none; transform: translateY(-2px); }
.license-head { display: flex; gap: 12px; align-items: center; }
.license-head > div { display: flex; flex-direction: column; min-width: 0; }
.license-head .kpi-icon { margin: 0; }
.license-usage { display: flex; justify-content: space-between; font-size: 11px; }
.license-usage b { font-size: 16px; }
.license-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* ---------- Callouts, flash, empty ---------- */
.callout { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.callout > div { flex: 1; }
.callout .icon { width: 22px; height: 22px; }
.callout-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.callout-warning > .icon { color: var(--warning); }
.callout-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.callout-success > .icon { color: var(--success); }
.callout-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.callout-danger > .icon { color: var(--danger); }
.callout-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); align-items: flex-start; }
.callout-info > .icon { color: var(--info); }
.flash { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; border: 1px solid; animation: fade .25s ease; }
.flash span { flex: 1; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.flash-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.flash-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; opacity: .7; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; color: var(--muted); text-align: center; }
.empty-state .icon { width: 32px; height: 32px; color: var(--success); }
.empty-state.small { padding: 22px 10px; }
.error-page { min-height: 60vh; }
.error-code { font-size: 70px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.code-block { display: block; padding: 12px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); font-family: var(--mono); font-size: 10px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; direction: ltr; text-align: left; }
.copyable { cursor: copy; }
.steps { padding-inline-start: 20px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Modal & palette ---------- */
.modal { border: 0; border-radius: 18px; padding: 24px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(7, 14, 29, .55); backdrop-filter: blur(3px); }
.modal h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.modal h3 .icon { color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 6px; }

.palette { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(7, 14, 29, .55); backdrop-filter: blur(4px); }
.palette-panel { position: relative; width: min(680px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); animation: pop .16s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.98) translateY(-6px); } to { opacity: 1; transform: none; } }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--brand-cyan); width: 22px; height: 22px; }
.palette-input input { flex: 1; border: 0; box-shadow: none !important; font-size: 14px; padding: 0; background: transparent; height: 32px; }
.palette-body { max-height: 56vh; overflow-y: auto; padding: 8px; }
.palette-foot { padding: 10px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pal-section { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.pal-item:hover, .pal-item.active { background: var(--primary-soft); text-decoration: none; }
.pal-item > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pal-item small { color: var(--muted); }
.pal-item .list-icon { width: 30px; height: 30px; }
.pal-nlq { padding: 12px; margin: 4px; border-radius: 12px; background: linear-gradient(135deg, var(--primary-soft), var(--teal-soft)); }
.pal-nlq .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.pal-nlq .chip { background: var(--surface); }
.pal-empty { padding: 18px; color: var(--muted); text-align: center; }

/* ---------- Audits / scanner ---------- */
.scanner-view { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #0b1426; display: grid; place-items: center; margin-bottom: 12px; }
.scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 18%; border: 2px solid rgba(34, 195, 166, .9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; display: none; }
.scanner.live .scanner-frame { display: block; }
.scanner.live [data-start-camera] { display: none; }
.scan-manual { display: flex; gap: 8px; margin-bottom: 8px; }
.scan-manual input { flex: 1; font-family: var(--mono); }
.scan-toast { padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 11px; margin-top: 8px; }
.scan-toast.found { background: var(--success-soft); color: var(--success); }
.scan-toast.misplaced, .scan-toast.unexpected, .scan-toast.duplicate { background: var(--warning-soft); color: var(--warning); }
.scan-toast.error { background: var(--danger-soft); color: var(--danger); }
.tag-cloud { display: flex; gap: 8px; flex-wrap: wrap; }
tr.flash-row td { animation: flashrow 1.2s ease; }
@keyframes flashrow { from { background: var(--success-soft); } to { background: transparent; } }

/* ---------- Misc components ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; position: relative; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .icon { color: var(--primary); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; height: 100%; }
.import-result { margin-top: 18px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.mini-stats div { padding: 12px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; }
.mini-stats strong { font-size: 22px; }
.mini-stats span { font-size: 10px; color: var(--muted); }
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-picker label { cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; width: 0; height: 0; }
.icon-picker span { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--text-2); }
.icon-picker input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.roles-help { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.roles-help .card { padding: 14px; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; align-items: flex-start; gap: 14px; padding: 14px 6px; border-bottom: 1px solid var(--border); }
.notif-list li > div { flex: 1; min-width: 0; }
.notif-list li.unread { background: var(--primary-soft); border-radius: 10px; padding-inline: 12px; }
.payload summary { cursor: pointer; color: var(--primary); font-size: 10px; margin-top: 4px; }
.payload pre { font-size: 9px; background: var(--surface-3); padding: 8px; border-radius: 8px; max-width: 520px; overflow: auto; direction: ltr; text-align: left; }
.report-desc { margin: -4px 0 16px; max-width: 900px; }

/* ---------- Login ---------- */
body.guest { background: var(--bg); }
.login { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-hero { position: relative; overflow: hidden; background: radial-gradient(circle at 15% 10%, var(--hero-a), transparent 45%), radial-gradient(circle at 90% 90%, var(--hero-b), transparent 45%), var(--brand-navy); color: #dbe6fb; display: flex; align-items: center; padding: 60px; }
.login-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .08) 1px, transparent 0) 0 0 / 26px 26px; pointer-events: none; }
.login-hero-inner { position: relative; z-index: 1; max-width: 520px; }
.login-mark { width: 120px; filter: drop-shadow(0 18px 40px rgba(14, 165, 233, .45)); margin-bottom: 24px; }
.login-hero h1 { color: #fff; font-size: 32px; letter-spacing: -.02em; }
.ar-name { display: inline-block; font-family: var(--font-ar); font-size: 20px; color: #7fd8ff; margin-top: 6px; font-weight: 600; }
.login-points { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.login-points .icon { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #7fd8ff; }
.login-form-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.login-langs { position: absolute; top: 20px; inset-inline-end: 24px; display: flex; gap: 4px; }
.login-langs a { padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.login-langs a.active { background: var(--primary-soft); color: var(--primary); }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-logo { width: 190px; margin-bottom: 8px; }
:root[data-theme="dark"] .login-logo { filter: brightness(1.6) saturate(1.1); }
.login-card h2 { font-size: 22px; }
.hint { font-size: 10.5px; color: var(--text-2); background: var(--info-soft); padding: 10px 12px; border-radius: 10px; }
.hint code { background: var(--surface); padding: 1px 5px; border-radius: 5px; }
.login-foot { position: absolute; bottom: 18px; }

/* ---------- Labels (print) ---------- */
.print-body { background: #fff; color: #0f1b33; }
.print-toolbar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid #e3e9f2; position: sticky; top: 0; background: #fff; }
.print-toolbar .btn { margin-inline-start: auto; }
.labels { display: grid; grid-template-columns: repeat(auto-fill, 66mm); gap: 4mm; padding: 8mm; justify-content: center; }
.label { width: 66mm; height: 32mm; border: 1px solid #cfd9e6; border-radius: 3mm; padding: 2.5mm; display: flex; gap: 2.5mm; align-items: center; break-inside: avoid; background: #fff; overflow: hidden; }
.label-qr { width: 26mm; height: 26mm; flex: none; }
.label-qr svg, .label-qr img { width: 100%; height: 100%; display: block; }
.label-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; position: relative; flex: 1; padding-inline-end: 7mm; }
.label-text strong { font-size: 11pt; color: #0b1b3f; }
.label-text span { font-size: 7.5pt; color: #27364f; }
.label-text small { font-size: 6.5pt; color: #5d6b82; font-family: var(--mono); }
.label-text .label-org { font-family: var(--font); color: #1677e6; margin-top: 1mm; font-weight: 600; }
.label-logo { width: 6mm; position: absolute; inset-inline-end: 0; top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 .span-2 { grid-column: 1 / -1; }
    .asset-hero { grid-template-columns: 1fr; }
    .roles-help { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hide-md { display: none; }
}
@media (max-width: 860px) {
    .shell, .sidebar-collapsed .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar-open .sidebar { transform: none !important; }
    .sidebar-collapsed .brand-text, .sidebar-collapsed .nav-item span, .sidebar-collapsed .nav-label { display: revert; }
    .topbar { padding: 10px 16px; }
    .content { padding: 18px 16px 50px; }
    .grid-2, .grid-3, .form-grid, .fields { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-health { grid-template-columns: 1fr; }
    .login { grid-template-columns: 1fr; }
    .login-hero { padding: 36px 24px; }
    .login-points { display: none; }
    .smart-search kbd { display: none; }
}
@media (max-width: 560px) {
    .hide-sm { display: none !important; }
    .hero-stats { grid-template-columns: 1fr 1fr; }
    .specs { grid-template-columns: 1fr; }
    h1 { font-size: 18px; }
    .roles-help { grid-template-columns: 1fr; }
}

/* Toolbars & small helpers */
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar .seg { margin-bottom: 12px; }
.search-form { margin-top: 0; margin-bottom: 12px; }
.search-form input { min-width: 0; width: min(280px, 100%); }
.specs.single { grid-template-columns: 1fr; }
.stock-cell { min-width: 150px; }
.stock-cell .meter { max-width: 160px; }

/* Radio cards (disposal sanitisation, stock modes) */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.radio-card { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 12px 12px 36px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; background: var(--surface); }
[dir="rtl"] .radio-card { padding: 12px 36px 12px 12px; }
.radio-card input, .field .radio-card input { position: absolute; inset-inline-start: 12px; top: 14px; width: 16px; height: 16px; margin: 0; }
.radio-card strong { font-size: 11.5px; }
.radio-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* Disposal pre-flight checklist */
.checks-title { margin: 18px 0 8px; font-size: 11.5px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 9px; font-size: 11px; background: var(--surface-2); }
.checklist li .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.checklist li.ok .icon { color: var(--success); }
.checklist li.warn { background: var(--warning-soft); }
.checklist li.warn .icon { color: var(--warning); }
.checklist li.danger { background: var(--danger-soft); }
.checklist li.danger .icon { color: var(--danger); }

/* Attachments */
.photo-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px dashed var(--border); }
.photo-strip a { flex: none; }
.photo-strip img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }

/* Disposal certificate (printable, always light) */
.certificate { max-width: 210mm; margin: 24px auto; padding: 14mm 14mm 10mm; background: #fff; color: #0f1b33; border: 1px solid #e3e9f2; border-radius: 6px; box-shadow: 0 10px 40px rgba(15, 27, 51, .08); }
.cert-head { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; border-bottom: 3px solid var(--brand-blue); }
.cert-logo { height: 54px; width: auto; }
.cert-head h1 { margin: 0; font-size: 18px; }
.cert-head p { margin: 2px 0 0; color: #5d6b82; font-size: 11px; }
.cert-no { margin-inline-start: auto; text-align: end; display: flex; flex-direction: column; }
.cert-no small { color: #5d6b82; font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; }
.cert-no strong { font-size: 15px; color: var(--brand-blue); }
.cert-statement { margin: 18px 0; font-size: 12px; line-height: 1.7; }
.cert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.cert-grid h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #4a5a75; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid #e3e9f2; }
[dir="rtl"] .cert-grid h2, [dir="rtl"] .cert-no small { letter-spacing: 0; }
.cert-grid dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 0; font-size: 11px; }
.cert-grid dt { color: #5d6b82; }
.cert-grid dd { margin: 0; font-weight: 500; }
.cert-wide { grid-column: 1 / -1; }
[dir="rtl"] .cert-grid dd { text-align: right; }
.print-flash { margin: 12px 20px 0; }
.cert-notes { font-size: 10.5px; color: #4a5a75; white-space: pre-line; margin: 8px 0 0; }
.cert-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 34px 0 22px; }
.cert-signs div { display: flex; flex-direction: column; gap: 4px; padding-top: 30px; border-bottom: 1px solid #0f1b33; font-size: 11px; }
.cert-signs span { color: #5d6b82; font-size: 9.5px; order: 2; padding: 4px 0; }
.cert-signs strong { order: 1; }
.cert-foot { display: flex; align-items: center; gap: 16px; padding-top: 14px; border-top: 1px solid #e3e9f2; }
.cert-qr { width: 26mm; height: 26mm; flex: none; }
.cert-qr svg, .cert-qr img { width: 100%; height: 100%; display: block; }
.cert-foot p { margin: 0 0 4px; }
.cert-integrity { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 11px; }
.cert-integrity.ok { color: #12a37c; }
.cert-integrity.bad { color: #e0394a; }
.cert-hash { font-size: 9px; overflow-wrap: anywhere; color: #4a5a75; direction: ltr; display: block; text-align: start; }
@media (max-width: 640px) {
    .certificate { margin: 0; padding: 18px 16px; border: 0; box-shadow: none; }
    .cert-head { flex-wrap: wrap; }
    .cert-grid, .cert-signs { grid-template-columns: 1fr; }
}

/* Work orders: badges and SLA */
.row-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-inline-start: 6px; vertical-align: middle; }
.row-badges a.badge:hover { text-decoration: none; filter: brightness(.95); }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.sla-ok { background: var(--success-soft); color: var(--success); }
.sla-warning { background: var(--warning-soft); color: var(--warning); }
.sla-breached, .sla-missed { background: var(--danger-soft); color: var(--danger); }
.sla-met { background: var(--neutral-soft); color: var(--text-2); }
.span-all { grid-column: 1 / -1; }
.modal-wide { width: min(760px, calc(100vw - 32px)); }

/* Public pages (fault report, second factor) */
.public-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; background: radial-gradient(circle at 10% 0%, var(--primary-soft), transparent 50%), var(--bg); }
.public-page .login-langs { position: static; }
.public-card { width: min(460px, 100%); }
.public-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.public-brand img { width: 30px; height: 30px; object-fit: contain; }
.report-asset { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin: 8px 0 14px; }
.report-asset strong { display: block; }
.report-asset small { color: var(--muted); }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.thanks-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto; background: var(--success-soft); color: var(--success); }
.thanks-icon .icon { width: 28px; height: 28px; }
.text-center { text-align: center; }
.report-ref { font-size: 13px; margin: 14px 0; }
.otp-input { font-family: var(--mono); font-size: 18px; letter-spacing: .25em; text-align: center; }

/* Onboarding kits */
.kit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
.kit-qty { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 11px; }
.kit-qty span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.kit-qty input { width: 64px; height: 30px; }
.kit-items { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.kit-items li { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.kit-items li small { margin-inline-start: auto; }
.kit-card .license-foot { justify-content: space-between; }
.kit-picker { margin: 0 0 16px; }
.kit-picker select { width: auto; min-width: 200px; }
.cert-banner { display: flex; align-items: center; gap: 8px; margin: 16px 0; padding: 10px 14px; border-radius: 8px; font-weight: 600; font-size: 12px; }
.cert-banner.ok { background: #e3f7f0; color: #0e7f60; }
.cert-banner.bad { background: #fdf3dc; color: #a46a04; }
.cert-list { margin: 0; padding-inline-start: 18px; font-size: 11px; line-height: 1.8; }
.cert-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.cert-table th, .cert-table td { text-align: start; padding: 5px 6px; border-bottom: 1px solid #e3e9f2; }
.cert-table th { color: #5d6b82; font-weight: 600; }

/* End-of-support radar */
.eos-timeline { display: flex; flex-direction: column; gap: 12px; }
.eos-rule { padding: 14px 16px; border-inline-start: 4px solid var(--border-strong); }
.eos-rule.eos-expired { border-inline-start-color: var(--danger); }
.eos-rule.eos-soon { border-inline-start-color: var(--warning); }
.eos-rule.eos-year { border-inline-start-color: var(--info); }
.eos-rule.eos-ok { border-inline-start-color: var(--success); }
.eos-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eos-head .kpi-icon { margin: 0; }
.eos-head > div:nth-child(2) { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.eos-date { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.eos-count { font-size: 20px; min-width: 36px; text-align: center; }
.eos-assets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Compliance */
.compliance-score { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.compliance-score .gauge { max-width: 220px; margin: 0 auto; }

/* Two-factor enrolment */
.twofa { margin-top: 18px; }
.twofa .card-title { display: flex; align-items: center; gap: 8px; }
.twofa-setup { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.twofa-qr { width: 150px; height: 150px; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid var(--border); }
.recovery-codes { columns: 2; white-space: pre; direction: ltr; text-align: left; }

/* Rack elevation */
.rack-wrap { display: flex; justify-content: center; }
.rack { position: relative; display: grid; grid-template-rows: repeat(var(--rack-u), 20px); width: min(320px, 100%); padding: 10px 10px 10px 34px; background: #1b2638; border-radius: 10px; border: 3px solid #2e3e5c; }
[dir="rtl"] .rack { padding: 10px 34px 10px 10px; }
.rack-slot { grid-column: 1; border-bottom: 1px dashed rgba(255, 255, 255, .07); position: relative; }
.rack-slot.free { background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(255, 255, 255, .025) 8px 16px); }
.rack-u { position: absolute; inset-inline-start: -28px; top: 3px; font: 9px var(--mono); color: #7d8cab; width: 22px; text-align: end; }
.rack-device { grid-column: 1; z-index: 1; margin: 1px 0; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 4px; overflow: hidden; font-size: 10px; color: #fff; background: linear-gradient(180deg, #33476b, #26375a); border: 1px solid #4a6290; white-space: nowrap; }
.rack-device:hover { text-decoration: none; border-color: #8fb3ff; }
.rack-device small { color: #b8c5dd; overflow: hidden; text-overflow: ellipsis; }
.rack-device.dev-net { background: linear-gradient(180deg, #1d5f63, #15494c); border-color: #2c8a8f; }
.rack-device.dev-sto { background: linear-gradient(180deg, #4b3a75, #3a2c5c); border-color: #6c55a8; }
.rack-device.dev-ups { background: linear-gradient(180deg, #6a5317, #523f10); border-color: #a07c21; }
.rack-device.health-danger { box-shadow: inset 4px 0 0 var(--danger); }
.rack-device.health-warning { box-shadow: inset 4px 0 0 var(--warning); }

/* Floor plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; color: var(--text); }
.plan-card:hover { text-decoration: none; border-color: var(--border-strong); }
.plan-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.plan-card div { display: flex; flex-direction: column; }
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.plan-layout[data-editable="0"] { grid-template-columns: 1fr; }
.plan-canvas { position: relative; width: 100%; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--border); touch-action: none; }
.plan-canvas.drop { outline: 3px dashed var(--primary); outline-offset: -3px; }
.plan-canvas img { width: 100%; height: 100%; display: block; user-select: none; }
.plan-pin { position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 4px; padding: 3px 7px 3px 5px; border-radius: 999px; background: var(--surface); color: var(--text); border: 2px solid var(--primary); box-shadow: 0 4px 12px rgba(15, 27, 51, .25); font-size: 10px; cursor: grab; white-space: nowrap; z-index: 2; }
.plan-pin::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 8px; height: 8px; background: inherit; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: translateX(-50%) rotate(45deg); }
.plan-pin:hover { text-decoration: none; z-index: 3; }
.plan-pin.health-danger { border-color: var(--danger); }
.plan-pin.health-danger::after { border-color: var(--danger); }
.plan-pin.health-warning { border-color: var(--warning); }
.plan-pin.health-warning::after { border-color: var(--warning); }
.plan-pin .pin-label small { display: none; color: var(--muted); margin-inline-start: 4px; }
.plan-pin:hover .pin-label small { display: inline; }
.plan-pin.hit { background: var(--primary); color: #fff; z-index: 4; transform: translate(-50%, -100%) scale(1.15); }
.plan-pin.dim { opacity: .25; }
.plan-pin.removing { opacity: .4; border-style: dashed; }
.plan-side { max-height: 70vh; overflow-y: auto; }
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.plan-list li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); font-size: 10.5px; cursor: grab; background: var(--surface-2); }
.plan-list li small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-search { width: 220px; }

/* Knowledge base */
.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-card { display: flex; gap: 14px; align-items: flex-start; color: var(--text); }
.kb-card:hover { text-decoration: none; border-color: var(--border-strong); }
.kb-card .kpi-icon { margin: 0; }
.kb-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kb-card p { margin: 4px 0 0; color: var(--text-2); }
.kb-solution { font-size: 12.5px; line-height: 1.75; }

@media (max-width: 900px) {
    .plan-layout { grid-template-columns: 1fr; }
    .plan-side { max-height: none; }
}

/* Offline audits */
.offline-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; margin-bottom: 12px; font-size: 11px; font-weight: 600; }
.offline-status.warning { background: var(--warning-soft); color: var(--warning); }
.offline-status.info { background: var(--info-soft); color: var(--info); }
.offline-status.error { background: var(--danger-soft); color: var(--danger); }
.offline-status .btn { margin-inline-start: auto; }
.offline-hint { margin: 8px 0 0; }
.scan-toast.queued { background: var(--info-soft); color: var(--info); }
.chip.queued { background: var(--info-soft); color: var(--info); text-decoration: none; border-style: dashed; }

/* Sign-in: single sign-on */
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10.5px; margin: 6px 0; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sso-btn { gap: 10px; }
.sso-btn .icon { width: 18px; height: 18px; }

/* Custody receipts & signature pad */
.custody-sign { max-width: 900px; }
.custody-sign.public-card.wide { width: min(900px, 100%); }
.custody-title { margin: 0 0 14px; font-size: 16px; }
.custody-terms { font-size: 11px; line-height: 1.8; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.certificate .custody-terms { background: #f8fafd; border-color: #e3e9f2; color: #27364f; }
.sign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 18px 0 12px; }
.sign-box { position: relative; display: flex; flex-direction: column; gap: 8px; }
.sign-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sign-canvas { width: 100%; height: 170px; border: 2px dashed var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sign-box.signed .sign-canvas { border-style: solid; border-color: var(--primary); }
.sign-hint { position: absolute; top: 50%; left: 0; right: 0; text-align: center; color: #9aa7bd; font-size: 11px; pointer-events: none; transform: translateY(-50%); }
.sign-box.signed .sign-hint { display: none; }
.remote-sign { display: flex; gap: 16px; align-items: center; max-width: 900px; margin-top: 16px; flex-wrap: wrap; }
.remote-sign > div:last-child { flex: 1; min-width: 220px; }
.remote-sign h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.sig-img { height: 70px; width: auto; max-width: 100%; object-fit: contain; align-self: flex-start; }
/* Custody receipt: roomier rows, centred items table and a centred pair of signatures */
.custody-doc { gap: 22px 28px; margin-top: 22px; }
.custody-doc h2 { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 10px; padding-bottom: 6px; }
.custody-doc h2 .icon { width: 14px; height: 14px; color: var(--brand-blue); }
.custody-box { background: #f8fafd; border: 1px solid #e3e9f2; border-radius: 10px; padding: 12px 14px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.custody-sign .custody-box { background: var(--surface-2); border-color: var(--border); }
.custody-doc dl { gap: 10px 18px; font-size: 11.5px; line-height: 1.5; }
.custody-items { border: 1px solid #e3e9f2; border-radius: 8px; overflow: hidden; border-collapse: separate; border-spacing: 0; }
.custody-items th, .custody-items td { text-align: center; vertical-align: middle; padding: 10px 8px; line-height: 1.5; }
.custody-items thead th { background: #f1f5fb; border-bottom: 1px solid #e3e9f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.custody-items tbody tr:last-child td { border-bottom: 0; }
.custody-items td small { margin-top: 2px; font-size: 9.5px; }
.custody-sign .custody-items thead th { background: var(--surface-2); }
.custody-licenses { margin: 10px 0 0; }
.custody-doc .custody-terms { line-height: 2.1; padding: 14px 18px; font-size: 11.5px; }
.custody-signs { grid-template-columns: repeat(2, minmax(0, 230px)); justify-content: center; gap: 48px; margin: 40px auto 28px; }
.custody-signs > div { align-items: center; text-align: center; gap: 6px; padding-top: 0; border-bottom: 0; }
.custody-signs span, .custody-signs strong, .custody-signs small { order: 0; }
.custody-signs span { padding: 0; font-size: 10.5px; font-weight: 600; color: #4a5a75; }
.custody-signs .sig-area { width: 100%; height: 76px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #0f1b33; padding: 0 0 4px; }
.custody-signs .sig-img { height: 70px; align-self: center; }
.custody-signs strong { font-size: 11.5px; margin-top: 4px; }
.custody-signs small { font-size: 9.5px; }
.custody-signs .delivered-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-bottom: 14px; border-radius: 50%; background: #e3f7f0; color: #12a37c; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.custody-signs .delivered-mark .icon { width: 18px; height: 18px; }
.custody-delivered-note { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 12px; }
.custody-delivered-note .icon { flex: none; width: 15px; height: 15px; color: var(--success); margin-top: 2px; }
@media (max-width: 640px) { .custody-signs { grid-template-columns: minmax(0, 260px); gap: 28px; } }
.thanks-icon.warn { background: var(--warning-soft); color: var(--warning); }

/* Device telemetry */
.spark { display: block; overflow: visible; }
.tele-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tele-item { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.tele-item > span:first-child { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-2); font-weight: 600; }
.tele-item strong { font-size: 20px; }

/* Smart redistribution */
.swap-list { display: flex; flex-direction: column; gap: 12px; }
.swap-card { display: flex; flex-direction: column; gap: 12px; }
.swap-person { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swap-person > div { display: flex; flex-direction: column; }
.swap-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.swap-device { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); color: var(--text); min-width: 0; }
.swap-device:hover { text-decoration: none; border-color: var(--border-strong); }
.swap-device > small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
[dir="rtl"] .swap-device > small { text-transform: none; letter-spacing: 0; }
.swap-device.out { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.swap-device.in { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.swap-arrow { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); }
.swap-arrow .icon { width: 22px; height: 22px; }
[dir="rtl"] .swap-arrow .icon { transform: scaleX(-1); }
.swap-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Employee portal */
.portal { min-height: 100vh; background: radial-gradient(circle at 10% 0%, var(--primary-soft), transparent 45%), var(--bg); }
.portal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.portal-user { display: flex; align-items: center; gap: 10px; }
.portal-user > span:not(.avatar) { display: flex; flex-direction: column; line-height: 1.25; }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.portal-main h1 { margin: 0; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 16px; }
.portal-attn { margin-top: 16px; border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
/* The tag is what an employee reads out to support: wrap it rather than cut it. */
.portal-devices li { flex-wrap: wrap; }
.portal-devices .list-main { min-width: min(100%, 220px); }
.portal-devices .mono { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; text-align: start; }
/* Portal as an app: slim top bar; the navigation sits under it on wide screens and at the bottom of phones. */
.portal-app .portal-bar { position: sticky; top: 0; z-index: 30; padding: 10px 16px; flex-wrap: nowrap; }
.portal-app .public-brand { min-width: 0; color: inherit; text-decoration: none; }
.portal-app .public-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-app .portal-user { gap: 6px; flex: none; }
.dropdown-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.portal-nav { display: flex; justify-content: center; gap: 4px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 57px; z-index: 29; }
.portal-nav a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-ctl); color: var(--text-2); font-weight: 600; text-decoration: none; }
.portal-nav a:hover { background: var(--surface-3); }
.portal-nav a.active { background: var(--primary-soft); color: var(--primary); }
.portal-nav-icon { position: relative; display: inline-flex; }
.portal-nav-icon .icon { width: 18px; height: 18px; }
.dot-count { position: absolute; top: -6px; inset-inline-end: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 700; line-height: 16px; text-align: center; }
.portal-app .portal-main { padding-top: 20px; }
.portal-hero { margin-bottom: 4px; }
.portal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.portal-head h1 { display: flex; align-items: center; gap: 8px; }
.portal-section-title { font-size: 13px; margin: 18px 0 10px; color: var(--text-2); }
.portal-go { color: var(--muted); font-size: 18px; flex: none; }
[dir="ltr"] .portal-go { transform: scaleX(-1); }

/* Home: big actions, then three numbers. */
.portal-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 16px 0; }
.portal-action { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--text); font: inherit; text-align: start; text-decoration: none; cursor: pointer; transition: border-color .15s, transform .15s; }
.portal-action:hover { border-color: var(--primary); transform: translateY(-1px); }
.portal-action small { color: var(--muted); }
.portal-action-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 6px; }
.portal-action-icon .icon { width: 22px; height: 22px; }
.portal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.portal-stats > * { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text); text-decoration: none; min-width: 0; }
.portal-stats span { color: var(--text-2); font-size: 11px; }
.portal-stats strong { font-size: 20px; }
.portal-stats small { color: var(--muted); }
.portal-stats .warn { background: var(--warning-soft); }

/* Devices */
.portal-device-list { display: grid; gap: 10px; }
.portal-device { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; padding: 14px; }
.portal-device:hover { border-color: var(--primary); }
.portal-device-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.portal-device-icon.lg { width: 56px; height: 56px; }
.portal-device-icon.lg .icon { width: 28px; height: 28px; }
.portal-device-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.portal-device-text .mono { overflow-wrap: anywhere; white-space: normal; }
.portal-device-tags { display: flex; align-items: center; gap: 8px; flex: none; }
.portal-device-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.portal-device-hero > div:nth-child(2) { flex: 1; min-width: 200px; }
.portal-device-hero h1 { font-size: 18px; }
.portal-device-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.portal-specs dt { color: var(--muted); }
.portal-specs dd { margin: 0; overflow-wrap: anywhere; }
.meter > span.ok { background: var(--success); }
.meter > span.mid { background: var(--warning); }
.meter > span.bad { background: var(--danger); }

/* Service catalogue (portal) and its staff editor. */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.service-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); font: inherit; color: var(--text); text-align: center; cursor: pointer; transition: border-color .15s, transform .15s; }
.service-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.service-pic, .catalog-pic { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); overflow: hidden; margin-bottom: 4px; }
.service-pic img, .catalog-pic img { width: 100%; height: 100%; object-fit: cover; }
.service-pic .icon, .catalog-pic .icon { width: 40px; height: 40px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.catalog-item { display: flex; flex-direction: column; gap: 8px; }
.catalog-item.is-off { opacity: .6; }
.catalog-body { display: flex; flex-direction: column; gap: 3px; flex: 1; }

/* Knowledge base */
.portal-search { max-width: none; margin-bottom: 6px; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; }
.kb-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; padding: 14px; }
.kb-card:hover { border-color: var(--primary); }
.kb-article h1 { font-size: 18px; }
.kb-article h3 { margin: 16px 0 6px; font-size: 13px; }
.kb-solution { line-height: 1.8; }
.kb-feedback { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kb-feedback p { margin: 0; display: flex; align-items: center; gap: 6px; }

/* Portal, second round: bell, install banner, ticket progress, conversation, notices. */
.icon-btn.bell { position: relative; }
.icon-btn.bell .dot-count { top: -2px; inset-inline-end: -2px; }
.icon-btn.bell.active { color: var(--primary); }
.dropdown-menu button[data-install] { color: var(--primary); }
.portal-install { display: flex; align-items: center; gap: 12px; width: 100%; margin: 14px 0 0; padding: 12px 14px; border-style: dashed; border-color: var(--primary); background: var(--primary-soft); font: inherit; color: var(--text); text-align: start; cursor: pointer; }
.portal-install[hidden] { display: none; }
.portal-install > span:last-child { display: flex; flex-direction: column; }
.portal-install .portal-action-icon { margin: 0; background: var(--surface); }
.install-steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; }
.progress-line { list-style: none; margin: 0; padding: 0; }
.progress-line li { display: flex; gap: 12px; padding-bottom: 18px; position: relative; color: var(--muted); }
.progress-line li::before { content: ""; position: absolute; inset-inline-start: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--border); }
.progress-line li:last-child { padding-bottom: 0; }
.progress-line li:last-child::before { display: none; }
.progress-line li.done { color: var(--text); }
.progress-line li.done::before { background: var(--success); }
.progress-dot { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); color: #fff; }
.progress-dot .icon { width: 14px; height: 14px; }
.progress-line li.done .progress-dot { background: var(--success); border-color: var(--success); }
.progress-line li.cancelled .progress-dot { background: var(--muted); border-color: var(--muted); }
.chat-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.chat-list > li { display: flex; }
.chat-list > li.from-me, #conversation .chat-list > li.from-staff { justify-content: flex-end; }
.chat-bubble { max-width: min(85%, 460px); padding: 8px 12px; border-radius: 14px; background: var(--surface-3); }
.from-me .chat-bubble, #conversation .from-staff .chat-bubble { background: var(--primary-soft); }
.chat-bubble p { margin: 2px 0 0; overflow-wrap: anywhere; }
.chat-who { color: var(--muted); font-size: 10px; }
.chat-photo { display: block; margin-top: 6px; }
.chat-photo img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; object-fit: cover; }
.chat-form { display: flex; flex-direction: column; gap: 8px; }
.chat-form textarea { width: 100%; }
.chat-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-attach { cursor: pointer; max-width: 60%; overflow: hidden; }
.chat-attach [data-file-name] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-request { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--warning-soft); }
.reschedule summary { list-style: none; display: inline-flex; }
.reschedule summary::-webkit-details-marker { display: none; }
.notice-list li.unread strong { color: var(--primary); }
.portal-offline { margin-top: 40px; }
.portal-offline img { border-radius: 12px; }
/* Portal, third round: device confirmation, team, hand-back and loss details. */
.attest-item { display: flex; flex-direction: column; gap: 10px; }
.attest-device { display: flex; align-items: center; gap: 12px; }
.attest-device > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.attest-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.attest-choice { position: relative; cursor: pointer; }
.attest-choice input { position: absolute; opacity: 0; inset: 0; }
.attest-choice span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-ctl); text-align: center; font-weight: 600; font-size: 11px; }
.attest-choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.attest-choice.ok input:checked + span { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.attest-choice.issue input:checked + span { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.attest-choice.missing input:checked + span { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.team-approval { flex-wrap: wrap; }
.team-approval .list-main { min-width: min(100%, 260px); }
.team-decide { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.team-decide input { min-width: 180px; flex: 1; }
.team-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.request-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.request-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-grid .stat > span { font-size: 10px; color: var(--muted); }
@media (max-width: 768px) {
    .portal-nav { position: fixed; top: auto; bottom: 0; inset-inline: 0; justify-content: space-around; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-bottom: 0; border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15, 27, 51, .06); }
    .portal-nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10px; font-weight: 600; text-align: center; background: none !important; }
    .portal-nav a.active .portal-nav-icon { background: var(--primary-soft); border-radius: 999px; padding: 2px 14px; }
    .portal-nav-icon .icon { width: 20px; height: 20px; }
    .portal-nav.six a { font-size: 9px; }
    .portal-nav.six a.active .portal-nav-icon { padding: 2px 10px; }
    .portal-app { padding-bottom: 72px; }
    body.guest:has(.portal-nav) .site-footer { padding-bottom: 80px; }
    .portal-app .portal-main { padding: 14px 12px 24px; }
    .portal-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .portal-action { padding: 12px; }
    .portal-action small { display: none; }
    .portal-action:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .portal-stats { gap: 8px; }
    .portal-stats > * { padding: 10px; }
    .portal-stats strong { font-size: 17px; }
    .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-device-buttons, .portal-device-buttons .btn { width: 100%; }
    .portal-device-buttons .btn { justify-content: center; }
}
@media (max-width: 640px) {
    .swap-pair { grid-template-columns: 1fr; }
    .swap-arrow { flex-direction: row; justify-content: center; }
    .swap-arrow .icon { transform: rotate(90deg); }
}
@media print {
    .no-print, .sidebar, .topbar, .page-actions, .seg, .print-toolbar { display: none !important; }
    .shell { display: block; }
    .content { padding: 0; }
    .card { box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
    .labels { padding: 0; }
    .certificate { margin: 0; border: 0; box-shadow: none; max-width: none; padding: 0; }
    .cert-banner { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    @page { margin: 8mm; }
}

/* ---------- Maintenance windows ---------- */
.flip-rtl { display: inline-block; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 9.5px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { min-height: 92px; padding: 6px; border-radius: 10px; background: var(--surface-2, var(--surface-3)); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: transparent; border-style: dashed; opacity: .4; }
.cal-day.past { opacity: .72; }
.cal-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-num { font-size: 10px; font-weight: 700; color: var(--text-2); }
.cal-day.today .cal-num { color: var(--primary); }
.cal-ev { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; font-size: 9.5px; line-height: 1.5; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-ev span { overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { text-decoration: none; filter: brightness(.96); }
.cal-ev.ev-info { background: var(--info-soft); color: var(--info); }
.cal-ev.ev-warning { background: var(--warning-soft); color: var(--warning); }
.cal-ev.ev-success { background: var(--success-soft); color: var(--success); }
.cal-ev.ev-neutral { background: var(--neutral-soft); color: var(--text-2); }
.cal-ev.ev-danger { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.cal-ev.ev-work { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-2); }
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.cal-legend .cal-ev { display: inline-flex; }
.conflict-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.conflict { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.conflict > .icon { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.conflict > div { flex: 1; min-width: 0; }
.conflict p { margin: 2px 0 4px; color: var(--text-2); }
.conflict-danger { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.conflict-danger > .icon { color: var(--danger); }
.conflict-warning { border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: var(--warning-soft); }
.conflict-warning > .icon { color: var(--warning); }
.impact-details { margin-top: 6px; }
.impact-details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.pick-box { max-height: 430px; overflow-y: auto; overscroll-behavior: contain; }
.check-cell { width: 34px; }
.accept-box { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warning-soft); color: var(--text); }
.window-desc { margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); white-space: normal; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 11px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Anomalies ---------- */
.mini-kpis a.card.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.anomaly-list { display: flex; flex-direction: column; gap: 10px; }
.anomaly { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; border-inline-start: 4px solid var(--info); }
.anomaly-danger { border-inline-start-color: var(--danger); }
.anomaly-warning { border-inline-start-color: var(--warning); }
.anomaly-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.anomaly-danger .anomaly-icon { background: var(--danger-soft); color: var(--danger); }
.anomaly-warning .anomaly-icon { background: var(--warning-soft); color: var(--warning); }
.anomaly-main { flex: 1; min-width: min(100%, 260px); }
.anomaly-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.anomaly-main p { margin: 4px 0; color: var(--text-2); }
.anomaly-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 760px) {
    .cal { gap: 2px; }
    .cal-day { min-height: 58px; padding: 3px; }
    .cal-ev { padding: 1px 3px; font-size: 8.5px; }
    .anomaly-actions { width: 100%; }
}
@media (max-width: 1280px) {
    .cal-day .cal-ev .icon, .cal-day .cal-ev b { display: none; }
    .cal-ev { padding: 2px 4px; }
}

/* ---------- Asset list ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.count-primary { background: var(--primary); color: #fff; }
.grid-shell { position: relative; }
.grid-shell.is-loading [data-part="results"] { opacity: .55; transition: opacity .15s; pointer-events: none; }
.grid-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.grid-toolbar select { max-width: 180px; }
.grid-search { flex: 1 1 260px; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.grid-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.grid-search .icon { color: var(--muted); flex: none; }
.grid-search input { flex: 1; border: 0; background: transparent; box-shadow: none !important; padding: 0; height: 100%; min-width: 0; }
.grid-display { display: flex; gap: 6px; align-items: center; margin-inline-start: auto; flex-wrap: wrap; }
.seg.seg-icons { margin: 0; padding: 3px; }
.seg.seg-icons a { padding: 5px 9px; }
.btn-icon { padding: 0 9px; min-width: 38px; justify-content: center; }
.btn-icon.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.col-menu { min-width: 210px; padding: 10px 12px; display: none; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; inset-inline-start: auto; inset-inline-end: 0; }
.dropdown.open .col-menu { display: flex; }
.col-menu .check { padding: 3px 0; }

.preset-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: thin; }
.preset { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 10.5px; font-weight: 600; white-space: nowrap; cursor: pointer; font-family: inherit; }
.preset:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.preset.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.preset.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.preset.add { border-style: dashed; color: var(--primary); }
.preset.saved { padding-inline-end: 4px; }
.preset.saved a { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.preset.saved a:hover { text-decoration: none; }
.preset.saved form { margin: 0; display: inline-flex; }
.preset-x { border: 0; background: transparent; color: inherit; opacity: .55; padding: 2px; border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center; }
.preset-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.preset-x .icon { width: 12px; height: 12px; }

.grid-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 14px; }
.kpi-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); min-width: 0; }
.kpi-tile span { font-size: 9.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-tile strong { font-size: 18px; font-weight: 700; line-height: 1.3; }
a.kpi-tile:hover { text-decoration: none; border-color: var(--primary); }

.bulkbar .bulk-count { display: inline-flex; gap: 5px; align-items: baseline; }
.bulkbar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.bulkbar .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.bulk-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .25); }
.bulk-fields { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bulk-fields input { height: 30px; font-size: 10.5px; min-width: 180px; }
.bulk-clear { margin-inline-start: auto; }

/* The list scrolls with the page; on wide screens the header stays pinned under the top bar (and the bulk bar). */
.grid-scroll { overflow-x: auto; }
@media (min-width: 1100px) {
    .grid-scroll, .grid-card, details.grid-group { overflow: visible; }
    .grid-table thead th { position: sticky; top: var(--grid-sticky, 64px); z-index: 3; }
    .grid-card .grid-table thead th:first-child { border-start-start-radius: var(--radius); }
    .grid-card .grid-table thead th:last-child { border-start-end-radius: var(--radius); }
}
.grid-table th a { display: inline-flex; gap: 4px; align-items: center; justify-content: center; }
/* Column titles and values are centred; the name (icon + two lines) stays aligned to the start. */
.grid-table th, .grid-table td { text-align: center; }
.grid-table td.col-name { text-align: start; }
.grid-table .w-actions { text-align: center; }
.sort-mark { font-size: 8px; color: var(--primary); }
.grid-table tbody tr[data-row] { cursor: pointer; }
.grid-table tr.is-selected td { background: var(--primary-soft); }
.grid-table tr.kb-active td { box-shadow: inset 0 1px 0 var(--primary), inset 0 -1px 0 var(--primary); }
.grid-table tr.is-previewed td { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.density-compact .grid-table td { padding: 6px 12px; }
.density-compact .grid-table .cell-icon { width: 26px; height: 26px; }
.density-compact .grid-table .cell-main small { display: none; }
.w-actions { width: 1%; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 2px; }

.asset-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.asset-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); cursor: pointer; min-width: 0; transition: border-color .12s, transform .12s; }
.asset-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.asset-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.asset-card.kb-active, .asset-card.is-previewed { border-color: var(--primary); }
.asset-card header { display: flex; align-items: center; gap: 8px; }
.asset-card header .badge { margin-inline-start: auto; }
.asset-card header .cell-icon { width: 28px; height: 28px; }
.asset-card-body { display: flex; gap: 12px; align-items: center; min-width: 0; }
.asset-card-body > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.asset-card-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.asset-card-meta { margin: 0; display: grid; gap: 4px; font-size: 10.5px; }
.asset-card-meta > div { display: flex; gap: 8px; align-items: center; min-width: 0; }
.asset-card-meta dt { color: var(--muted); display: flex; }
.asset-card-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card footer { border-top: 1px dashed var(--border); padding-top: 8px; display: flex; justify-content: flex-end; }

.ring { position: relative; width: var(--ring, 52px); height: var(--ring, 52px); flex: none; display: inline-grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
[dir="rtl"] .ring svg { transform: rotate(-90deg) scaleY(-1); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-fg { stroke-linecap: round; transition: stroke-dasharray .4s; }
.ring-success .ring-fg { stroke: var(--success); }
.ring-warning .ring-fg { stroke: var(--warning); }
.ring-danger .ring-fg { stroke: var(--danger); }
.ring-neutral .ring-fg { stroke: var(--muted); }
.ring b { font-size: calc(var(--ring, 52px) * .3); font-weight: 700; }

.grid-group { padding: 0; margin-bottom: 12px; overflow: hidden; }
.grid-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; list-style: none; }
.grid-group > summary::-webkit-details-marker { display: none; }
.grid-group-title { display: inline-flex; align-items: center; gap: 8px; }
.grid-group .chev { transition: transform .15s; }
.grid-group:not([open]) .chev { transform: rotate(-90deg); }
[dir="rtl"] .grid-group:not([open]) .chev { transform: rotate(90deg); }
.grid-group-stats { display: inline-flex; gap: 10px; align-items: center; }
.grid-group .grid-scroll { border-top: 1px solid var(--border); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(7, 14, 29, .35); }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 61; width: min(400px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.open, [dir="rtl"] .drawer.open { transform: none; }
.drawer-preview { width: min(460px, 100vw); }
.drawer > div, .drawer-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; display: flex; gap: 8px; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.drawer-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.drawer-loading { padding: 40px 20px; text-align: center; color: var(--muted); }
.facet-group > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.facets { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.facet { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 11px; }
.facet:hover { background: var(--surface-2); }
.facet.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.facet span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet em { font-style: normal; font-size: 9.5px; color: var(--muted); }
.range-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 10.5px; }
.range-row > span:first-child { flex: 0 0 96px; color: var(--text-2); }
.range-row input { min-width: 0; flex: 1; }
.range-row.tight { margin: 0; }
.facet-group .field { margin-top: 8px; }

.pv-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-title > div { display: flex; flex-direction: column; min-width: 0; }
.pv-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-hero { display: flex; gap: 16px; align-items: center; }
.pv-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-specs { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.pv-specs > div { min-width: 0; }
.pv-specs dt { font-size: 9.5px; color: var(--muted); }
.pv-specs dd { margin: 0; font-size: 11px; overflow-wrap: anywhere; }
.pv-section h4 { margin: 0 0 6px; display: flex; gap: 6px; align-items: center; }
.pv-tele { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pv-tele > div { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); }
.pv-tele span { font-size: 9.5px; color: var(--muted); }
.pv-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-timeline li { display: flex; gap: 8px; align-items: flex-start; font-size: 10.5px; }
.pv-timeline li > .icon { margin-top: 2px; color: var(--muted); flex: none; }
.pv-timeline li.tone-warning > .icon { color: var(--warning); }
.pv-timeline li.tone-danger > .icon { color: var(--danger); }
.pv-timeline li.tone-success > .icon { color: var(--success); }
.pv-timeline li > div { display: flex; flex-direction: column; min-width: 0; }

@media (max-width: 760px) {
    .grid-toolbar select { flex: 1 1 30%; max-width: none; }
    .grid-display { margin-inline-start: 0; width: 100%; justify-content: space-between; }
    .drawer, .drawer-preview { width: 100vw; }
    .pv-specs { grid-template-columns: 1fr; }
    .asset-cards { grid-template-columns: 1fr; }
    .bulk-clear { margin-inline-start: 0; }
    /* Headline figures become a swipeable strip instead of a tall block. */
    .grid-kpis { display: flex; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .grid-kpis .kpi-tile { flex: 0 0 132px; }
}

[data-grid-bulk] .bulkbar { top: var(--grid-topbar, 64px); }

/* ---------- Monitoring ---------- */
.count-danger { background: var(--danger); color: #fff; }
.state-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.state-up { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.state-down { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); animation: pulse-down 1.6s ease-in-out infinite; }
@keyframes pulse-down { 50% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .state-down { animation: none; } }
tr.row-down td { background: color-mix(in srgb, var(--danger) 6%, transparent); }
.strip-cell { min-width: 150px; }
.uptime-strip { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.uptime-strip span { height: 100%; }
.uptime-strip .seg-up { background: var(--success); }
.uptime-strip .seg-down { background: var(--danger); }
.uptime-strip .seg-unknown { background: var(--surface-3); }

.printer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.printer-card { display: flex; flex-direction: column; gap: 10px; }
.printer-card header { display: flex; gap: 10px; align-items: center; }
.printer-card header > div { display: flex; flex-direction: column; min-width: 0; }
.printer-card footer { border-top: 1px dashed var(--border); padding-top: 8px; }
.supply-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.supply-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: 10.5px; }
.supply-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supply-bar { grid-column: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.supply-bar > span { display: block; height: 100%; border-radius: 4px; background: #475569; }
.supply-bar > span.unknown { background: repeating-linear-gradient(45deg, var(--surface-3), var(--surface-3) 4px, var(--border) 4px, var(--border) 8px); }
.supply-cyan > span { background: #06b6d4; } .supply-magenta > span { background: #d946ef; } .supply-yellow > span { background: #eab308; } .supply-black > span { background: #1f2937; }
[data-theme="dark"] .supply-black > span { background: #94a3b8; }
.supply-list b { grid-row: 1 / span 2; grid-column: 2; font-size: 12px; }
.supply-list a { grid-column: 1 / -1; }

/* ---------- Field mode & work orders ---------- */
.field-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.field-head h1 { margin: 0; }
.field-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.field-stats > div { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.field-stats strong { font-size: 24px; line-height: 1.1; }
.field-stats span { font-size: 10px; color: var(--muted); }
.field-stats .late strong { color: var(--danger); }
.field-scan { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.btn-lg { height: 52px; font-size: 14px; border-radius: 14px; justify-content: center; }
.field-lookup { display: flex; gap: 6px; }
.field-lookup input { flex: 1; min-width: 0; }
.field-camera { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.field-camera video { width: 100%; max-height: 52vh; object-fit: cover; display: block; }
.field-camera .btn { position: absolute; top: 10px; inset-inline-end: 10px; background: rgba(255, 255, 255, .9); }
.field-h { font-size: 13px; display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.field-list { display: flex; flex-direction: column; gap: 8px; }
.field-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); }
.field-card:hover { text-decoration: none; border-color: var(--border-strong); }
.field-card.late { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.field-prio { width: 4px; align-self: stretch; border-radius: 4px; background: var(--muted); flex: none; }
.prio-critical { background: var(--danger); } .prio-high { background: var(--warning); } .prio-medium { background: var(--info); }
.field-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.field-card-body strong { font-size: 12px; }
.field-card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chev-end { transform: rotate(-90deg); color: var(--muted); flex: none; }
[dir="rtl"] .chev-end { transform: rotate(90deg); }
.wo-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 0; }
.wo-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.wo-asset { display: flex; align-items: center; gap: 12px; color: var(--text); }
.wo-asset:hover { text-decoration: none; border-color: var(--border-strong); }
.wo-asset > div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.wo-actions { display: flex; flex-direction: column; gap: 8px; }
.wo-actions form { margin: 0; }
.wo-complete > summary { list-style: none; cursor: pointer; }
.wo-complete > summary::-webkit-details-marker { display: none; }
.wo-complete[open] > summary { margin-bottom: 10px; }
.wo-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.photo-row img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.photo-add label { width: 74px; height: 74px; border-radius: 10px; border: 2px dashed var(--border-strong); display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.photo-add label:hover { color: var(--primary); border-color: var(--primary); }
.wo-parts select { flex: 1; min-width: 0; }
.wo-signature { max-width: 100%; height: 110px; display: block; background: #fff; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 6px; }
form.queued { opacity: .75; }
.queued-note { color: var(--info); margin: 6px 0 0; }

/* ---------- Comments & mentions ---------- */
.comment-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment-list > li { display: flex; gap: 10px; align-items: flex-start; }
.comment-list p { margin: 3px 0 0; overflow-wrap: anywhere; }
.comment-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); border-radius: 5px; padding: 0 3px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.mention-wrap { position: relative; width: 100%; }
.mention-wrap textarea { width: 100%; }
.mention-menu { position: absolute; z-index: 20; inset-inline-start: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.mention-menu li { padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 11px; }
.mention-menu li.active, .mention-menu li:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- Branch scope (users) ---------- */
.scope-pick > summary { cursor: pointer; color: var(--text-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-menu { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }
.scope-menu.inline { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
.scope-field { border: 0; padding: 0; margin: 0; }
.scope-field legend { font-size: 10.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }

/* ---------- Warranty claims ---------- */
.rma-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; flex-wrap: wrap; counter-reset: s; }
.rma-steps li { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 600; }
.rma-steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 9.5px; }
.rma-steps li.done { background: var(--primary-soft); color: var(--primary); }
.rma-steps li.done span { background: var(--primary); color: #fff; }
.rma-steps li.current { box-shadow: inset 0 0 0 2px var(--primary); }
.rma-pack h2 { font-size: 12px; margin: 18px 0 6px; color: #4a5a75; text-transform: uppercase; letter-spacing: .05em; }
[dir="rtl"] .rma-pack h2 { letter-spacing: 0; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.doc-table th, .doc-table td { border: 1px solid #e3e9f2; padding: 6px 8px; text-align: start; vertical-align: top; }
.doc-table th { background: #f4f7fb; color: #4a5a75; font-weight: 600; width: 18%; }
.pack-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.pack-photos img { width: 150px; height: 112px; object-fit: cover; border: 1px solid #e3e9f2; border-radius: 6px; }
.doc-foot { margin-top: 22px; padding-top: 8px; border-top: 1px solid #e3e9f2; }

/* ---------- Report builder ---------- */
.rb-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.rb-form select, .rb-form input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.rb-group { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rb-group legend { font-size: 10.5px; font-weight: 700; color: var(--text-2); padding: 0 4px; display: flex; gap: 6px; align-items: center; }
.rb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.rb-result { min-width: 0; }

@media (max-width: 900px) {
    .wo-layout, .rb-layout { grid-template-columns: 1fr; }
    .wo-photos { grid-template-columns: 1fr; }
}

/* Two-line cell (e.g. model with the manufacturer below). */
.cell-stack { display: flex; flex-direction: column; line-height: 1.35; }
.cell-stack small { font-size: 9.5px; }
.grid-table .col-serial { white-space: nowrap; }
.grid-table .cell-main { min-width: 170px; }
.grid-table .col-model { min-width: 110px; }
.grid-scroll.is-wide { overflow-x: auto !important; }
.grid-scroll.is-wide .grid-table thead th { position: relative; top: 0; }

/* Asset table: one line per cell; a table wider than its card scrolls sideways inside it. */
.grid-table th, .grid-table td, .grid-table .cell-main strong, .grid-table .cell-main small, .grid-table .cell-stack > * { white-space: nowrap; }

/* Export menu */
.export-menu .dropdown-menu { min-width: 250px; }
.export-menu .dropdown-menu a { display: flex; gap: 10px; align-items: center; }
.export-menu .dropdown-menu a > span { display: flex; flex-direction: column; }
.export-menu .dropdown-menu small { font-size: 9.5px; }
.bulk-export { display: inline-flex; gap: 4px; align-items: center; }

/* ---------- Footer ---------- */
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--text-2); }
.footer-app { max-width: 1480px; width: 100%; margin: auto auto 0; padding: 16px 28px 22px; border-top: 1px solid var(--border); }
.footer-guest { max-width: 1040px; margin: 0 auto; padding: 18px 16px 26px; border-top: 1px solid var(--border); }
.footer-login { position: absolute; bottom: 16px; inset-inline: 24px; justify-content: center; flex-direction: column; gap: 10px; }
.footer-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.footer-brand img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.footer-brand > span { display: flex; flex-direction: column; line-height: 1.45; }
.footer-brand small { font-size: 9.5px; }
.footer-login .footer-brand img { display: none; }
.footer-social { display: flex; gap: 6px; flex-wrap: wrap; }
.footer-social a { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); transition: color .15s, background .15s, border-color .15s, transform .15s; }
.footer-social a:hover { text-decoration: none; transform: translateY(-2px); color: #fff; border-color: transparent; }
.footer-social .social-icon { width: 15px; height: 15px; }
.footer-social .social-website:hover { background: var(--primary); }
.footer-social .social-email:hover { background: #475569; }
.footer-social .social-whatsapp:hover { background: #25d366; }
.footer-social .social-x:hover { background: #000; }
.footer-social .social-linkedin:hover { background: #0a66c2; }
.footer-social .social-instagram:hover { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.footer-social .social-youtube:hover { background: #ff0000; }
.footer-social .social-tiktok:hover { background: #010101; }
.footer-social .social-facebook:hover { background: #1877f2; }
@media (prefers-reduced-motion: reduce) { .footer-social a:hover { transform: none; } }
@media print { .site-footer { display: none; } }
@media (max-width: 640px) {
    .footer-app, .footer-guest { justify-content: center; text-align: center; padding-inline: 16px; }
    .footer-brand { justify-content: center; }
    .footer-login { position: static; margin-top: 24px; }
}

/* ---------- Dashboard ---------- */
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.bg-primary { background: var(--primary); }
.text-body { color: var(--text) !important; }
.seg.seg-sm { margin: 0; padding: 3px; }
.seg.seg-sm button { border: 0; background: transparent; padding: 5px 10px; border-radius: 8px; color: var(--text-2); font: inherit; font-weight: 600; font-size: 10.5px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.seg.seg-sm button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: stretch; margin-bottom: 16px; }
.dash-hero-main { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; }
.dash-hero-main h1 { margin: 2px 0 6px; }
.dash-hero-main p { margin: 0; }
.dash-summary .badge { font-size: 11px; padding: 4px 12px; }
.dash-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dash-filter { display: inline-flex; align-items: center; gap: 6px; padding-inline-start: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); }
.dash-filter select { border: 0; background: transparent; box-shadow: none !important; min-width: 150px; }
.dash-score { display: flex; gap: 16px; align-items: center; padding: 18px 22px; border-radius: var(--radius); color: var(--text); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 320px; }
.dash-score:hover { text-decoration: none; border-color: var(--border-strong); }
.dash-score > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-score strong { font-size: 13px; }
.score-band { font-weight: 700; font-size: 11px; }
.score-excellent .score-band { color: var(--success); } .score-good .score-band { color: var(--info); }
.score-fair .score-band { color: var(--warning); } .score-poor .score-band { color: var(--danger); }
.score-parts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 10px; }
.score-parts li { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }

.dash-editbar { position: sticky; top: var(--grid-topbar, 64px); z-index: 12; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px; background: var(--brand-navy); color: #fff; box-shadow: var(--shadow-lg); }
.dash-editbar > span { flex: 1; display: flex; gap: 8px; align-items: center; font-size: 11px; }
.dash-editbar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.dash-editbar .btn-ghost:hover { background: rgba(255, 255, 255, .12); }

.dash-widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; grid-auto-flow: row dense; }
.dash-widget { grid-column: span 12; min-width: 0; }
.dw-attention { grid-column: span 7; }
.dw-live { grid-column: span 5; }
.dw-watchlist, .dw-activity { grid-column: span 6; }
.dash-card { margin: 0; height: 100%; }
.dash-widget-edit { display: none; }
.dash-editing .dash-widget { outline: 2px dashed var(--border-strong); outline-offset: 4px; border-radius: var(--radius); cursor: grab; }
.dash-editing .dash-widget[data-hidden] { opacity: .45; }
.dash-editing .dash-widget.dragging { opacity: .35; }
.dash-editing .dash-widget-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 10px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 11px; }
.dash-widget-edit strong { flex: 1; }
.dash-widget-edit .btn { padding-block: 2px; }
.drag-handle { display: inline-flex; cursor: grab; }

.attention-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attention-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.attention-list .att-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--info-soft); color: var(--info); }
.attention-list .att-danger .att-icon { background: var(--danger-soft); color: var(--danger); }
.attention-list .att-warning .att-icon { background: var(--warning-soft); color: var(--warning); }
.attention-list li.att-danger { border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.att-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-text strong { font-size: 11.5px; font-weight: 600; }
.att-text small { color: var(--muted); font-size: 9.5px; }

.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.dash-kpi { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); min-width: 0; }
.dash-kpi:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.dash-kpi-top { display: flex; align-items: center; gap: 10px; }
.dash-kpi .kpi-icon { width: 32px; height: 32px; }
.dash-kpi .kpi-value { font-size: 24px; line-height: 1.1; }
.dash-kpi-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; min-height: 22px; }
.delta { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.delta-up-good { background: var(--success-soft); color: var(--success); }
.delta-up-bad { background: var(--danger-soft); color: var(--danger); }
.delta-flat { color: var(--muted); }
.spark svg { display: block; }

.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.live-tile { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); min-width: 0; }
a.live-tile:hover { text-decoration: none; background: var(--surface-3); }
.live-label { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.live-tile > strong { font-size: 20px; }
.live-tile > strong small { font-size: 11px; color: var(--muted); font-weight: 500; }
.sla-stack { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.sla-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--text-2); }
.sla-legend span { display: inline-flex; align-items: center; gap: 4px; }
.sla-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tech-load { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; }
.tech-load li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: 8px; align-items: center; }
.tech-load a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tech-load .meter { margin: 0; height: 6px; }
.live-window { font-size: 10.5px; display: flex; gap: 6px; min-width: 0; }
.live-window span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dash-tabs-head { flex-wrap: wrap; }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.chart-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-grid h4, [data-panel] > h4 { margin: 0 0 8px; font-size: 11px; color: var(--text-2); }
.eos-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; color: var(--text); }
.eos-tiles:hover { text-decoration: none; }
.eos-tile { display: flex; flex-direction: column; padding: 16px; border-radius: 12px; font-size: 10.5px; }
.eos-tile strong { font-size: 26px; }
.eos-tile.danger { background: var(--danger-soft); color: var(--danger); }
.eos-tile.warning { background: var(--warning-soft); color: var(--warning); }

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.site-card { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.site-card:hover { text-decoration: none; border-color: var(--primary); }
.site-card.site-down { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.site-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.site-head > span:not(.ring) { display: flex; flex-direction: column; min-width: 0; }
.site-stats { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.site-stats > div { display: flex; flex-direction: column; justify-content: space-between; gap: 2px; }
.site-stats dt { font-size: 9px; color: var(--muted); line-height: 1.3; }
.site-stats dd { margin: 0; font-weight: 700; font-size: 13px; }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { display: flex; flex-direction: column; gap: 4px; min-height: 110px; padding: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.week-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.week-day.empty { opacity: .7; }
.week-date { font-weight: 700; font-size: 10.5px; color: var(--text-2); }
.week-day.today .week-date { color: var(--primary); }
.week-ev { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: 9.5px; color: var(--text); background: var(--surface); min-width: 0; }
.week-ev:hover { text-decoration: none; }
.week-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-ev.ev-window { background: var(--info-soft); color: var(--info); }
.week-ev.ev-work { background: var(--surface); border: 1px dashed var(--border-strong); }
.week-ev.ev-warranty { background: var(--warning-soft); color: var(--warning); }
.week-ev.ev-license { background: var(--danger-soft); color: var(--danger); }

.activity-list li { align-items: flex-start; }
.activity-list li > span { min-width: 0; }

@media (max-width: 1200px) {
    .dw-attention, .dw-live { grid-column: span 12; }
    .chart-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .dash-hero { grid-template-columns: 1fr; }
    .dash-score { min-width: 0; }
    .dw-watchlist, .dw-activity { grid-column: span 12; }
    .chart-grid, .chart-grid.two { grid-template-columns: 1fr; }
    .week-strip { grid-template-columns: 1fr; }
    .week-day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .week-date { min-width: 70px; }
}
@media (max-width: 640px) {
    .live-grid { grid-template-columns: 1fr; }
    .dash-kpis { grid-template-columns: 1fr 1fr; }
    .dash-kpi .kpi-value { font-size: 20px; }
    .dash-filter { flex: 1; }
    .dash-filter select { min-width: 0; width: 100%; }
}

/* ---------- Operations wall screen ---------- */
body.noc { background: #070d1c; color: #e6edf8; min-height: 100vh; padding: 22px 28px; font-size: 15px; }
.noc-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.noc-brand { display: flex; align-items: center; gap: 12px; flex: 1; }
.noc-brand div { display: flex; flex-direction: column; }
.noc-brand strong { font-size: 20px; }
.noc-brand span { color: #8ea2c4; font-size: 13px; }
.noc-clock { font-size: 40px; font-weight: 800; letter-spacing: .02em; }
.noc-full { background: transparent; border: 1px solid #23324f; color: #c9d6ec; border-radius: 10px; padding: 8px 14px; display: inline-flex; gap: 8px; align-items: center; font: inherit; font-size: 12px; cursor: pointer; }
.noc-grid { display: grid; grid-template-columns: 280px 1fr 1fr; grid-auto-rows: minmax(150px, auto); gap: 18px; }
.noc-panel { background: #0d1630; border: 1px solid #1c2a48; border-radius: 18px; padding: 20px 22px; }
.noc-panel h2 { margin: 0 0 14px; font-size: 16px; display: flex; gap: 10px; align-items: center; color: #c9d6ec; }
.noc-panel h2 small { color: #8ea2c4; font-weight: 500; }
.noc-score { grid-row: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.noc-score strong { font-size: 18px; }
.noc-score span { font-size: 16px; font-weight: 700; }
.noc-score .ring b { color: #fff; }
.noc-score .ring-bg { stroke: #1c2a48; }
.noc-kpis { grid-column: span 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.noc-kpis div { display: flex; flex-direction: column; gap: 6px; }
.noc-kpis span { color: #8ea2c4; font-size: 13px; }
.noc-kpis strong { font-size: 40px; font-weight: 800; }
.noc-attention ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.noc-attention li { display: flex; gap: 12px; align-items: center; font-size: 15px; padding: 10px 12px; border-radius: 12px; background: #111d3b; }
.noc-attention li.att-danger { border-inline-start: 5px solid #ef4444; }
.noc-attention li.att-warning { border-inline-start: 5px solid #f59e0b; }
.noc-attention li.att-info { border-inline-start: 5px solid #3b82f6; }
.noc-attention .icon { width: 22px; height: 22px; flex: none; }
.noc-ok { color: #34d399; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.noc-muted { color: #8ea2c4; }
.noc-down { display: flex; flex-wrap: wrap; gap: 10px; }
.noc-down > span { background: #3b0f17; color: #fecaca; border-radius: 10px; padding: 8px 12px; font-size: 16px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.noc-sla-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.noc-sla-row div { display: flex; flex-direction: column; align-items: center; padding: 12px; border-radius: 14px; background: #111d3b; }
.noc-sla-row strong { font-size: 40px; font-weight: 800; }
.noc-sla-row .tone-danger { color: #f87171; } .noc-sla-row .tone-warning { color: #fbbf24; } .noc-sla-row .tone-success { color: #34d399; }
.noc-windows p { margin: 0 0 8px; font-size: 15px; }
.noc-conflict { color: #fca5a5; }
.noc-foot { margin-top: 18px; color: #5f739a; font-size: 12px; text-align: center; }
@media (max-width: 1100px) { .noc-grid { grid-template-columns: 1fr 1fr; } .noc-kpis { grid-column: span 2; } .noc-score { grid-row: auto; } }
@media (max-width: 700px) { body.noc { padding: 14px; } .noc-grid { grid-template-columns: 1fr; } .noc-kpis { grid-column: auto; grid-template-columns: 1fr 1fr; } .noc-clock { font-size: 26px; } }

/* ---- Security posture, software, webhooks, loans, consumables, assistant ---- */
.btn-xs { height: 24px; padding: 0 8px; font-size: 10px; border-radius: 7px; gap: 4px; }
.card-pad { padding: 12px 18px 16px; margin: 0; }
.stack-sm > * + * { margin-top: 6px; }
.sw-match { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; width: 100%; }
.sw-match > span { grid-column: 1 / -1; }
.sw-match input { min-width: 0; }
.score-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 24px; padding: 0 8px; border-radius: 999px; font-weight: 700; font-size: 11px; }
.sec-controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0 0; }
.sec-controls div { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); font-size: 10.5px; }
.sec-controls .icon { width: 15px; height: 15px; flex: none; }
.sec-controls .ok { color: var(--success); } .sec-controls .bad { color: var(--danger); } .sec-controls .na { color: var(--muted); }
.kb-suggest { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.kb-suggest[hidden] { display: none; }
.kb-suggest h4 { margin: 0 0 6px; font-size: 11px; display: flex; gap: 6px; align-items: center; color: var(--primary); }
.kb-suggest details { border-top: 1px solid var(--border); padding: 6px 0; }
.kb-suggest details:first-of-type { border-top: 0; }
.kb-suggest summary { cursor: pointer; font-weight: 600; font-size: 11px; }
.kb-suggest .solution { white-space: pre-line; font-size: 11px; margin: 6px 0; }
.stars { display: inline-flex; gap: 4px; direction: ltr; }
.stars label { cursor: pointer; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars span { font-size: 26px; line-height: 1; color: var(--border-strong); transition: color .15s; }
.stars:has(input:checked) span { color: #f5b301; }
.stars label:has(input:checked) ~ label span { color: var(--border-strong); }
.stars:hover span { color: #f5b301; }
.stars label:hover ~ label span { color: var(--border-strong); }
.stars-static { color: #f5b301; letter-spacing: 1px; white-space: nowrap; }
.loan-cal { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 10px; }
.loan-cal .lc-head, .loan-cal .lc-row { display: contents; }
.loan-cal .lc-name { padding: 8px 10px; border-top: 1px solid var(--border); background: var(--surface); position: sticky; inset-inline-start: 0; }
.loan-cal .lc-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(22px, 1fr); border-top: 1px solid var(--border); position: relative; }
.loan-cal .lc-days span { border-inline-start: 1px solid var(--border); text-align: center; padding: 6px 0; color: var(--muted); }
.loan-cal .lc-days span.we { background: var(--surface-3); }
.loan-cal .lc-days span.today { color: var(--primary); font-weight: 700; }
.loan-cal .lc-bar { position: absolute; top: 5px; bottom: 5px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 600; padding: 0 6px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-decoration: none; }
.loan-cal .lc-bar.st-checked_out { background: var(--success-soft); color: var(--success); }
.loan-cal .lc-bar.st-requested { background: var(--warning-soft); color: var(--warning); }
.loan-cal .lc-bar.late { background: var(--danger-soft); color: var(--danger); }
.loan-cal-wrap { overflow-x: auto; }
.loan-cal-wrap .loan-cal { min-width: 760px; }
.qty-pill { font-weight: 700; }
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 340px; }
.chat-log { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: min(760px, 92%); padding: 10px 14px; border-radius: 14px; line-height: 1.7; font-size: 11.5px; white-space: pre-line; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-end-end-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: var(--surface-3); border-end-start-radius: 4px; }
.chat-msg.error { align-self: center; background: var(--danger-soft); color: var(--danger); }
.chat-msg a { color: inherit; text-decoration: underline; }
.chat-action { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface); white-space: normal; }
.chat-action .inline-actions { margin-top: 8px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 44px; }
.chat-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-hints button { cursor: pointer; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: aim-blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aim-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.label-scan { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 12px; margin-bottom: 16px; }
.label-scan input[type=file] { display: none; }
.label-scan .muted { flex: 1; min-width: 180px; }
.field.ai-filled input, .field.ai-filled select { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
/* Searchable pick list (manufacturer and model on the asset form) */
.field.combo { position: relative; }
.combo-list { position: absolute; inset-inline: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.combo-list li:hover, .combo-list li.active { background: var(--primary-soft); }
.combo-list .combo-add { color: var(--primary); font-weight: 600; }
.combo-list .combo-empty { color: var(--muted); cursor: default; background: none; }
.field.combo input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--danger); }
.rr-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 90px; }
.rr-bar i { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.rr-bar i.warn { background: var(--warning); } .rr-bar i.bad { background: var(--danger); }
.secret-once { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret-once code { font-size: 11px; word-break: break-all; }
@media (max-width: 640px) {
    .chat-msg { max-width: 100%; }
    .loan-cal { grid-template-columns: 110px 1fr; }
}
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; }
.check-grid .check { align-items: flex-start; }
.public-card .stars { align-self: center; justify-content: center; }
.public-card .stars span { font-size: 34px; }
.loan-cal .lc-bar { display: block; line-height: 22px; text-overflow: ellipsis; top: 4px; bottom: auto; }

/* ---- License bar, license page, installation wizard ---- */
.license-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 11.5px; font-weight: 600; }
.license-bar .icon { width: 18px; height: 18px; flex: none; }
.license-bar a { margin-inline-start: auto; font-weight: 700; white-space: nowrap; }
.license-trial { background: var(--primary-soft); color: var(--primary); }
.license-soon { background: var(--warning-soft); color: var(--warning); }
.license-locked { background: var(--danger-soft); color: var(--danger); }
.install-page { padding: 24px 16px; }
.install-card { width: min(720px, 100%); padding: 24px; margin: 0 auto; }
.install-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.install-langs { display: flex; gap: 10px; }
.install-steps { margin-bottom: 18px; }
.install-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.install-card h2 { margin: 0; }
.install-card [hidden] { display: none; }
@media (max-width: 640px) { .install-card { padding: 16px; } .install-steps li { font-size: 0; } .install-steps li span { font-size: 11px; } }
/* A help note right after a card or a grid of cards needs breathing room. */
.card + p.small.muted, .grid + p.small.muted, .card + p.muted.small { margin-top: 14px; }

/* ---- Help center ---- */
.help-q { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.8px solid currentColor; font-weight: 800; font-size: 12px; line-height: 1; }
.help-search { display: flex; align-items: center; gap: 10px; padding: 10px 16px; margin-bottom: 18px; }
.help-search .icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
.help-search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 13px; padding: 6px 0; outline: none; color: var(--text); }
.help-group h2 { font-size: 14px; margin: 22px 0 10px; color: var(--text-2); }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.help-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; color: var(--text); }
.help-card:hover { text-decoration: none; border-color: var(--border-strong); }
.help-card strong { display: block; margin-bottom: 2px; }
.help-card small { display: block; line-height: 1.6; }
.help-results { display: flex; flex-direction: column; gap: 10px; }
.help-hit { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; color: var(--text); }
.help-hit:hover { text-decoration: none; border-color: var(--primary); }
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-nav { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 1px; font-size: 11px; }
.help-nav a { padding: 5px 10px; border-radius: 8px; color: var(--text-2); }
.help-nav a:hover { text-decoration: none; background: var(--surface-3); color: var(--text); }
.help-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.help-nav .help-home { font-weight: 700; color: var(--text); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.help-nav-group { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 10px 4px; font-weight: 700; }
.help-article { padding: 26px 30px 22px; min-width: 0; }
.help-head h1 { margin: 6px 0; }
.help-summary { font-size: 13px; color: var(--text-2); margin: 0 0 12px; line-height: 1.8; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); margin: 16px 0 6px; font-size: 11px; }
.help-toc strong { width: 100%; font-size: 10px; color: var(--muted); }
.help-body { font-size: 12.5px; line-height: 1.95; max-width: 860px; }
.help-body h2 { font-size: 15.5px; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.help-body h2:first-child { border-top: 0; padding-top: 0; }
.help-body p { margin: 8px 0; }
.help-body code { background: var(--surface-3); border-radius: 5px; padding: 1px 6px; font-size: .92em; }
.help-steps, .help-list { margin: 8px 0; padding-inline-start: 22px; }
.help-steps li, .help-list li { margin: 5px 0; }
.help-steps li::marker { font-weight: 700; color: var(--primary); }
.help-fields { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 0; margin: 10px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.help-fields dt, .help-fields dd { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); }
.help-fields dt { font-weight: 700; background: var(--surface-2); }
.help-fields dt:first-of-type, .help-fields dt:first-of-type + dd { border-top: 0; }
.help-note { margin: 12px 0; }
.help-faq details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; margin: 8px 0; }
.help-faq summary { cursor: pointer; font-weight: 700; }
.help-faq p { margin: 8px 0 2px; }
.help-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11.5px; font-weight: 600; }
.help-print { max-width: 820px; margin: 0 auto; padding: 20px; font-size: 12px; line-height: 1.8; }
.help-print-cover { text-align: center; padding: 30px 0; }
.help-print-toc { text-align: start; columns: 2; font-size: 11px; }
.help-print-section { break-before: page; }
.help-print-section > h1 { border-bottom: 2px solid var(--primary); padding-bottom: 6px; }
@media (max-width: 960px) { .help-layout { grid-template-columns: 1fr; } .help-nav { position: static; max-height: 260px; } .help-article { padding: 18px 16px; } }
@media (max-width: 560px) { .help-fields { grid-template-columns: 1fr; } .help-fields dd { border-top: 0; padding-top: 0; } }
@media print { .help-nav, .help-pager, .help-head .inline-actions, .help-toc { display: none !important; } .help-layout { display: block; } .help-article { box-shadow: none; border: 0; } }

/* Read-only values the platform calculates (e.g. book value) */
.field input.is-computed { background: var(--surface-2); color: var(--muted); cursor: default; }
.field input.is-computed:focus { box-shadow: none; outline: none; }

/* ---------- Sign-in page designs (Settings › Identity) ---------- */
.login-split_reverse { grid-template-columns: 1fr 1.05fr; }
.login-split_reverse .login-hero { order: 2; }
.login-bg-solid .login-hero { background: var(--brand-navy); }
.login-bg-solid .login-hero::after { display: none; }
.login-bg-image .login-hero, .login-centered.login-bg-image {
    background: linear-gradient(rgba(5, 10, 22, var(--login-overlay, .45)), rgba(5, 10, 22, var(--login-overlay, .45))), var(--login-image) center / cover no-repeat, var(--brand-navy);
}
.login-bg-image .login-hero::after { display: none; }
.login-headline { color: #fff; font-size: 15px; font-weight: 500; margin: 14px 0 0; max-width: 460px; }
.login-centered { display: grid; grid-template-columns: 1fr; place-items: center; padding: 32px 16px; position: relative;
    background: radial-gradient(circle at 15% 10%, var(--hero-a), transparent 45%), radial-gradient(circle at 90% 90%, var(--hero-b), transparent 45%), var(--brand-navy); }
.login-centered.login-bg-solid { background: var(--brand-navy); }
.login-centered .login-hero { display: none; }
.login-centered .login-form-wrap { width: min(460px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 56px 32px 40px; }
.login-centered .login-langs { top: 14px; inset-inline-end: 16px; }
.login-centered .login-foot { position: static; margin-top: 18px; }
.login-logo.has-dark.theme-dark { display: none; }
:root[data-theme="dark"] .login-logo.has-dark { filter: none; }
:root[data-theme="dark"] .login-logo.has-dark.theme-dark { display: block; }
:root[data-theme="dark"] .login-logo.has-dark.theme-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-logo.has-dark { filter: none; }
    :root:not([data-theme="light"]) .login-logo.has-dark.theme-dark { display: block; }
    :root:not([data-theme="light"]) .login-logo.has-dark.theme-light { display: none; }
}
@media (max-width: 900px) {
    .login-split_reverse { grid-template-columns: 1fr; }
    .login-split_reverse .login-hero { order: 0; }
}

/* ---------- Themes engine (identity page) ---------- */
.theme-section { margin-bottom: 16px; }
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.theme-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-swatches { display: grid; grid-template-columns: 1fr 2fr 2fr; height: 54px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.theme-swatches > span { display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.theme-swatches i { display: block; flex: 1; height: 10px; border-radius: 3px; }
.theme-meta { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.theme-actions { display: flex; align-items: center; gap: 4px; margin-top: auto; }
.theme-actions form:first-child { margin-inline-end: auto; }
.theme-builder { margin-bottom: 16px; }
.theme-builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.theme-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.theme-colors .color-pick code { font-size: 11px; color: var(--muted); }
.theme-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-checks .badge { font-weight: 500; }
.seg-sm { margin: 0; align-self: flex-start; }
.seg-sm button { border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.theme-preview-wrap { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 8px; }
.theme-preview-head { display: flex; align-items: baseline; gap: 8px; }
.theme-preview { display: grid; grid-template-columns: 132px 1fr; min-height: 300px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-family: var(--font); font-size: 11px; color-scheme: light; }
.theme-preview.is-dark { color-scheme: dark; }
.tp-side { background: var(--sidebar-bg); color: var(--sidebar-text); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.tp-side img { width: 28px; height: 28px; margin: 0 6px 10px; }
.tp-nav { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); white-space: nowrap; overflow: hidden; }
.tp-nav .icon { width: 14px; height: 14px; }
.tp-nav.active { background: var(--sidebar-active); color: var(--sidebar-fg); }
.tp-main { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tp-top { display: flex; }
.tp-search { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 30px; flex: 1; border: 1px solid var(--border); border-radius: var(--radius-ctl); background: var(--surface); color: var(--muted); }
.tp-search .icon { width: 13px; height: 13px; }
.tp-hero { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--grad); color: var(--primary-ink); }
.tp-hero span { font-size: 22px; font-weight: 700; }
.tp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--card-pad); display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.tp-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.tp-badge { padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tp-input { height: var(--ctl-h); border-radius: var(--radius-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; }
.tp-text { margin: 0; color: var(--text-2); }
.tp-text a { color: var(--primary); font-weight: 600; }
.tp-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 14px; border-radius: var(--radius-ctl); background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.tp-btn .icon { width: 13px; height: 13px; }
.tp-btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-strong); }
.mail-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 12px 0 8px; background: #fff; color: #0f1b33; }
.mail-preview-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.mail-preview-head img { height: 22px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px 4px; }
.mail-preview-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mail-preview-body p { margin: 0; color: #4a5a75; }
.mail-preview-btn { padding: 6px 12px; border-radius: 6px; background: var(--primary); color: var(--primary-ink); font-weight: 600; }
.mail-preview.plain .mail-preview-head { background: #fff; color: #0f1b33; border-bottom: 1px solid #e3e9f2; }
.login-design { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.login-bg-slot { align-items: flex-start; text-align: start; }
.login-mini { position: sticky; top: 76px; display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.login-mini-hero { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 16px;
    background: radial-gradient(circle at 15% 10%, var(--hero-a), transparent 45%), radial-gradient(circle at 90% 90%, var(--hero-b), transparent 45%), var(--brand-navy); }
.login-mini-hero img { width: 34px; }
.login-mini-hero i { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .35); width: 70%; }
.login-mini-hero i + i { width: 50%; }
.login-mini-form { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 18px; background: var(--surface); }
.login-mini-form img { width: 70px; margin-bottom: 4px; }
.login-mini-form i { display: block; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); }
.login-mini-form b { display: block; height: 16px; border-radius: 4px; background: var(--primary); }
.login-mini[data-bg="solid"] .login-mini-hero { background: var(--brand-navy); }
.login-mini[data-bg="image"] .login-mini-hero { background: linear-gradient(rgba(5, 10, 22, var(--mini-overlay)), rgba(5, 10, 22, var(--mini-overlay))), var(--mini-image) center / cover, var(--brand-navy); }
.login-mini[data-layout="split_reverse"] .login-mini-hero { order: 2; }
.login-mini[data-layout="centered"] { grid-template-columns: 1fr; place-items: center; background: radial-gradient(circle at 15% 10%, var(--hero-a), transparent 45%), var(--brand-navy); }
.login-mini[data-layout="centered"][data-bg="image"] { background: linear-gradient(rgba(5, 10, 22, var(--mini-overlay)), rgba(5, 10, 22, var(--mini-overlay))), var(--mini-image) center / cover, var(--brand-navy); }
.login-mini[data-layout="centered"][data-bg="solid"] { background: var(--brand-navy); }
.login-mini[data-layout="centered"] .login-mini-hero { display: none; }
.login-mini[data-layout="centered"] .login-mini-form { width: 55%; border-radius: 8px; padding: 14px; }
@media (max-width: 900px) {
    .theme-builder-grid, .login-design { grid-template-columns: 1fr; }
    .theme-preview-wrap, .login-mini { position: static; }
}
@media (max-width: 560px) {
    .theme-colors { grid-template-columns: 1fr; }
    .theme-preview { grid-template-columns: 1fr; }
    .tp-side { flex-direction: row; overflow-x: auto; padding: 8px; }
    .tp-side img { display: none; }
}
/* Dependency map legend: "is part of" relation (same colour as .graph .edge.part_of) */
.lg-partof { background: #9b6bf2; }

/* Helper C — floor plans: tap-to-place (a device tapped in the list waits for a tap on the drawing). */
.plan-list li[data-asset] { cursor: pointer; }
.plan-list li.armed { border-color: var(--primary); background: var(--primary); color: #fff; }
.plan-list li.armed small { color: inherit; opacity: .85; }
.plan-canvas.arming { outline: 3px dashed var(--primary); outline-offset: -3px; cursor: crosshair; }

/* Helper C — RMA close-out choice (radio list inside a field). */
fieldset.field { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }


/* ---------- Updates (Settings › Updates) ---------- */
.update-new { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.update-notes { white-space: normal; font-size: 12px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 260px; overflow: auto; width: 100%; }
.update-go { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0 12px; }
.maintenance-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--bg); color: var(--text); font-family: var(--font); }
.maintenance-page .card { max-width: 420px; }


/* Plan comparison: the customer's own plan stands out */
.plan-table th.plan-current, .plan-table td.plan-current { background: var(--primary-soft); }
.plan-table th.plan-current { color: var(--primary); }

/* ── Automations (/admin/automations) ─────────────────────────────────── */
.auto-rules tr.is-off td { opacity: .62; }
.auto-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.auto-tags .chip { padding: 2px 8px; font-size: 9.5px; }
.auto-switch { position: relative; width: 38px; height: 22px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-3); cursor: pointer; padding: 0; flex: none; transition: background .15s; }
.auto-switch span { position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: inset-inline-start .15s; }
.auto-switch.on { background: var(--success); border-color: var(--success); }
.auto-switch.on span { inset-inline-start: 18px; }
.auto-switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.auto-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.auto-template { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.auto-template > div { flex: 1; min-width: 0; }
.auto-template-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); flex: none; }
.auto-safety { margin: 14px 0 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; }
.auto-outcome { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; }
.auto-outcome li { display: flex; gap: 6px; align-items: baseline; overflow-wrap: anywhere; }
.auto-outcome li .icon { flex: none; align-self: center; }
.auto-outcome li.ok .icon { color: var(--success); }
.auto-outcome li.fail { color: var(--danger); }
.auto-outcome li.skip { color: var(--muted); }
.auto-runs td { vertical-align: top; }

.auto-builder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.auto-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.auto-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.auto-step .card-title { margin-bottom: 12px; }
.auto-step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--primary-ink, #fff); font-size: 11px; font-weight: 700; flex: none; }
.auto-enabled { align-self: end; padding-bottom: 6px; }
.auto-params { margin-top: 12px; }
.auto-checks { display: flex; flex-direction: column; gap: 6px; max-height: 168px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.auto-checks .check { align-items: flex-start; }
.auto-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.auto-action { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.auto-action-head { display: flex; align-items: flex-end; gap: 10px; }
.auto-action-no { display: inline-grid; place-items: center; width: 24px; height: var(--ctl-h, 38px); font-weight: 700; color: var(--primary); flex: none; }
.auto-action-type { flex: 1; }
.auto-channels { margin-top: 6px; }
.auto-savebar { display: flex; justify-content: flex-end; gap: 10px; }
.auto-placeholders { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.auto-placeholders .chip { cursor: pointer; font-family: var(--mono); font-size: 10px; }
.auto-ph-list { margin-top: 12px; }
.auto-ph-list summary { cursor: pointer; color: var(--muted); }
.auto-result-head { margin: 10px 0 6px; }
.auto-errors { margin: 0; padding-inline-start: 18px; font-size: 11px; }
.auto-preview { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.auto-preview > li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.auto-preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 600; }
.auto-preview-head small { margin-inline-start: auto; font-weight: 400; }

@media (max-width: 1080px) {
    .auto-builder { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .auto-builder .fields { grid-template-columns: minmax(0, 1fr); }
    .auto-builder .span-2 { grid-column: auto; }
    .auto-templates { grid-template-columns: minmax(0, 1fr); }
    .auto-template { flex-wrap: wrap; }
    .auto-action { padding: 10px; }
}

/* Helper H — asset merge (assets/merge.php, Data quality tab) */
.merge-col { text-align: end; white-space: nowrap; }
.merge-table th[scope="row"] { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.merge-table thead th { vertical-align: top; min-width: 180px; }
.merge-pick { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-weight: 400; text-transform: none; letter-spacing: 0; }
.merge-pick > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; white-space: normal; }
.merge-pick a { font-weight: 700; }
.merge-pick .badge { align-self: flex-start; margin-top: 4px; }
.merge-pick .merge-drop { display: none; }
.merge-pick:not(:has(input:checked)) .merge-keep { display: none; }
.merge-pick:not(:has(input:checked)) .merge-drop { display: inline-flex; }
.merge-cell .check { align-items: flex-start; font-size: inherit; overflow-wrap: anywhere; }
.merge-cell:has(input:checked) { background: var(--primary-soft); }
.merge-same { color: var(--text-2); }
.merge-form > .callout, .merge-form > .form-actions { margin-top: 14px; }
@media (max-width: 640px) {
    .merge-table thead th { min-width: 140px; }
}

/* Helper H — NFC tags (ts/nfc.ts, assets/_nfc.php, scanner cards, labels page) */
.nfc-write { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nfc-status { font-weight: 600; }
.nfc-status[data-tone="ok"] { color: var(--success); }
.nfc-status[data-tone="error"] { color: var(--danger); }
.nfc-status[data-tone="info"] { color: var(--info); }
.nfc-hint { display: inline-flex; align-items: center; gap: 6px; }
.nfc-hint .icon { width: 14px; height: 14px; flex: none; }
.scanner .nfc-tap { width: 100%; justify-content: center; margin-bottom: 8px; }
.nfc-tap.active { background: var(--info-soft); color: var(--info); border-color: var(--info); }
.label-cell { display: flex; flex-direction: column; gap: 2mm; }
.label-cell .nfc-write { justify-content: center; }

/* Helper I — WhatsApp settings card */
.wa-checks { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.wa-checks li { display: flex; align-items: center; gap: 8px; }
.wa-setup .kv dd { min-width: 0; overflow-wrap: anywhere; }
.wa-setup .kv .code-block { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 600px) { .wa-setup .kv { grid-template-columns: 1fr; } }

/* Helper J — Finance page (/finance) */
.fin-table .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-table tfoot th { border-top: 1px solid var(--border); font-weight: 700; }
.fin-basis { display: block; margin-top: 4px; font-size: 10.5px; }
.fin-hints { margin: -6px 0 14px; display: flex; flex-direction: column; gap: 4px; }
.fin-hints p { margin: 0; display: flex; align-items: center; gap: 6px; }
.fin-whatif { display: flex; flex-direction: column; gap: 12px; }
.fin-whatif-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; }
.fin-exclude { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fin-exclude legend { padding: 0; margin-bottom: 6px; }
.fin-whatif .inline-actions { justify-content: flex-start; }

.fin-method p { margin: 0 0 4px; max-width: 900px; }
.fin-export .form-grid { gap: 12px 18px; }

.fin-input { width: 100%; min-width: 90px; max-width: 180px; height: var(--ctl-h); }
.fin-page > .card, .fin-page > form.card { margin-bottom: 18px; }
@media (max-width: 640px) {
    .fin-export .form-grid { grid-template-columns: 1fr; }
    .fin-input { max-width: none; }
}
@media print {
    .fin-whatif .inline-actions, .fin-export button { display: none; }
}

/* Helper K — procurement: line editor, receiving, purchase order document, asset card */
.table .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.proc-subnav { margin-bottom: 16px; }
.proc-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.proc-fieldset legend { padding: 0; margin-bottom: 8px; font-size: 10.5px; font-weight: 600; color: var(--text-2); }
.proc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }

/* Request and order lines */
.proc-lines td { vertical-align: top; }
.proc-lines input, .proc-lines select { width: 100%; min-width: 0; height: var(--ctl-h); }
.proc-lines td:nth-child(2) { min-width: 150px; }
.proc-lines td:nth-child(3) { min-width: 180px; }
.proc-lines.is-order td:nth-child(4), .proc-lines.is-order td:nth-child(5) { min-width: 110px; }
.proc-lines .num-input { width: 86px; min-width: 70px; }
.proc-lines tr[data-kind="asset"] .only-consumable, .proc-lines tr[data-kind="consumable"] .only-asset { display: none; }
.proc-lines tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.proc-lines [data-line-total] { padding-top: 14px; }
.proc-lines-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

/* Phones: each line becomes a small card, labelled from data-label */
@media (max-width: 760px) {
    .proc-lines-wrap { overflow: visible; }
    .proc-lines thead { display: none; }
    .proc-lines, .proc-lines tbody, .proc-lines tfoot { display: block; width: 100%; }
    .proc-lines tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); position: relative; }
    .proc-lines tbody td { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; min-width: 0 !important; }
    .proc-lines tbody td[data-label]::before { content: attr(data-label); font-size: 9.5px; font-weight: 600; color: var(--muted); }
    .proc-lines tbody td:nth-child(2), .proc-lines tbody td:nth-child(3) { grid-column: 1 / -1; }
    .proc-lines tbody td:last-child { position: absolute; inset-inline-end: 6px; top: 6px; }
    .proc-lines tbody td[data-line-total] { padding-top: 0; text-align: start; }
    .proc-lines .num-input { width: 100%; }
    .proc-lines tfoot tr { display: flex; justify-content: space-between; gap: 12px; }
    .proc-lines tfoot td { padding: 4px 0; }
    .proc-lines tfoot td:empty { display: none; }
}

/* Sending and receiving */
.proc-send-form { margin-top: 4px; }
.proc-send-form input { max-width: 340px; }
.proc-send-more { justify-content: flex-start; flex-wrap: wrap; margin-top: 10px; }
.proc-receive-line .card-head h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.proc-receive-line .inline-form { margin-top: 0; flex-wrap: nowrap; }
.proc-receive-line .inline-form input { flex: 0 0 96px; min-width: 0; }
.proc-receive-line textarea { min-height: 72px; }

/* Asset page card */
.proc-asset-contracts { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.proc-asset-contracts li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.proc-asset-contracts li .badge { margin-inline-start: auto; }
.proc-asset-contracts li .block { flex-basis: 100%; }

/* Purchase order document (printable, always light like the certificates) */
.po-doc .po-parties { margin-bottom: 18px; }
.po-table { margin: 6px 0 16px; }
.po-table .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.po-table th:first-child, .po-table td:first-child { width: 24px; color: #5d6b82; }
.po-table small { color: #5d6b82; }
.po-table tfoot td { border-bottom: 0; padding-top: 3px; padding-bottom: 3px; }
.po-table tfoot tr:first-child td { padding-top: 10px; border-top: 1px solid #e3e9f2; }
.po-table .po-grand td { font-weight: 700; font-size: 12.5px; color: var(--brand-blue); border-top: 2px solid #0f1b33; }
.po-terms { margin: 10px 0; }
.po-terms h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #4a5a75; margin: 0 0 4px; }
[dir="rtl"] .po-terms h2 { letter-spacing: 0; }
.po-foot { justify-content: center; text-align: center; color: #5d6b82; }
@media print { .po-table .po-grand td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Settings: home of cards, then one section at a time ---------- */
.settings-home { display: flex; flex-direction: column; gap: 22px; }
.settings-search { display: flex; align-items: center; gap: 8px; max-width: 420px; padding: 0 12px; height: var(--ctl-h); border: 1px solid var(--border-strong); border-radius: var(--radius-ctl); background: var(--surface); color: var(--muted); }
.settings-search input { border: 0; background: transparent; box-shadow: none !important; height: 100%; padding: 0; flex: 1; min-width: 0; }
.settings-group h2 { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 0 0 10px; }
.settings-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.settings-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .1s; min-width: 0; }
.settings-card:hover { border-color: var(--primary); text-decoration: none; }
.settings-card:active { transform: scale(.99); }
.settings-card-icon { flex: none; width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.settings-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.settings-card-text strong { font-size: 13px; }
.settings-card-text small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.settings-card-go { color: var(--muted); font-size: 18px; flex: none; }
[dir="ltr"] .settings-card-go { transform: scaleX(-1); }
.settings-switch select { height: var(--ctl-h); min-width: 190px; }
@media (max-width: 560px) {
    .settings-cards { grid-template-columns: 1fr; }
    .settings-switch select { min-width: 0; width: 100%; }
}

/* Roles and permissions */
.roles-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.roles-list { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.roles-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.roles-list a:hover { background: var(--surface-3); }
.roles-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.roles-list a > span:first-child { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.roles-list p { margin: 8px 4px 0; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.perm-group legend { font-weight: 700; padding: 0 6px; }
.roles-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.roles-footer { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
    .roles-layout { grid-template-columns: 1fr; }
    .form-grid.three { grid-template-columns: 1fr; }
}
/* Forgot password link under the password field */
.login-forgot { display: block; text-align: end; margin: -6px 0 12px; }

/* ---------- Service desk tickets ---------- */
#timeline .chat-list > li.from-staff { justify-content: flex-end; }
#timeline .from-staff .chat-bubble { background: var(--primary-soft); }
#timeline .chat-bubble.chat-note { background: var(--warning-soft, var(--surface-3)); border: 1px dashed var(--border); }
.chat-list > li.chat-event { display: block; padding: 2px 4px; }
.chat-list > li.chat-event .block { display: block; margin-top: 2px; color: var(--text); }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.chat-file { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, var(--surface-3)); }

/* ---------- Service desk: catalogue designer, approvals, ticket rules (ITSM) ---------- */
.builder { display: flex; flex-direction: column; gap: 10px; }
.builder-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2, var(--surface)); }
.builder-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.builder-tools { display: flex; gap: 4px; }
.level-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.level-row select { flex: 1; min-width: 140px; }
.level-row .builder-tools, .level-row > [data-remove] { margin-inline-start: auto; }
.level-n { font-weight: 700; font-size: 11px; color: var(--text-2); min-width: 64px; }
.member-picks { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.member-picks legend { padding: 0 6px; color: var(--muted); }
.field-error { color: var(--danger); }
.wf-stage { background: var(--surface); }
.wf-stage-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.wf-stage-head input { flex: 1; min-width: 0; }
.wf-tasks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.wf-task { background: var(--surface-3); }
.wf-cond { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.wf-cond select, .wf-cond input { flex: 1; min-width: 120px; }
.wf-preview { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.wf-col { display: flex; flex-direction: column; gap: 6px; min-width: 150px; max-width: 220px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); flex: none; }
.wf-col-head { font-weight: 700; font-size: 11px; color: var(--text-2); }
.wf-start, .wf-end { justify-content: center; min-width: 90px; font-weight: 600; font-size: 11px; text-align: center; background: var(--success-soft); color: var(--success); }
.wf-start { background: var(--primary-soft); color: var(--primary); }
.wf-arrow { align-self: center; color: var(--muted); font-size: 18px; flex: none; }
[dir="rtl"] .wf-arrow { transform: scaleX(-1); }
.wf-chip { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 8px; background: var(--surface-3); font-size: 11px; }
.wf-chip small { color: var(--muted); font-size: 10px; }
.wf-chip .wf-if { color: var(--warning); }
.wf-chip .wf-act { color: var(--primary); }
.rule-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.rule-card:hover { text-decoration: none; border-color: var(--border-strong); }
.rule-card.is-off { opacity: .6; }
.rule-card p { margin: 0; }
.rule-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-form .level-row [data-slot] { flex: 2; min-width: 160px; display: flex; }
.rule-form .level-row [data-slot] > * { width: 100%; }
.approval-public h2 { font-size: 17px; margin: 4px 0 6px; }
.approval-public .inline-actions { justify-content: flex-end; }
.approval-public { text-align: start; }

/* Service desk intelligence: triage suggestion, feature chips */
.chip-row { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.ai-suggest { padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.ai-suggest .kv { margin: 6px 0; }

/* Problem categories: admin list with 90-day usage, portal picker */
.issuecat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.issuecat-usage { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.usage-bar { display: inline-block; width: 80px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.inline-edit { position: relative; }
.inline-edit[open] > summary { background: var(--primary-soft); }
.inline-edit > form:first-of-type { margin-top: 8px; }
.inline-edit[open] { flex-basis: 100%; }
td .inline-edit[open], .card-head .inline-edit[open] { position: absolute; inset-inline-end: 12px; z-index: 5; width: min(340px, calc(100vw - 48px)); padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 12%); }
.card-head { position: relative; }
.issuecat-add { margin-top: 10px; }
.issuecat-add > form { margin-top: 10px; }
.issuecat-how { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.issue-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.issue-pick .radio-card { padding: 10px 10px 10px 32px; }
[dir="rtl"] .issue-pick .radio-card { padding: 10px 32px 10px 10px; }
@media (max-width: 900px) {
    .issuecat-layout { grid-template-columns: 1fr; }
}

/* Service desk set-up: readiness steps, team cards, routing flow, working week */
.sd-start { margin-bottom: 18px; }
.sd-start-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; cursor: pointer; list-style: none; }
.sd-start-head::-webkit-details-marker { display: none; }
.sd-start-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.sd-start-title .icon { color: var(--primary); }
.sd-start-meter { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.sd-start > p { margin: 10px 0 12px; }
.sd-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.sd-steps li { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, var(--surface)); }
.sd-steps li.done { opacity: .75; }
.sd-step-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 11px; background: var(--surface-3); color: var(--text-2); }
.sd-steps li.done .sd-step-mark { background: var(--success); color: #fff; }
.sd-step-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tab-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.tab-intro p { margin: 0; color: var(--text-2); max-width: 760px; line-height: 1.7; }
.sd-gap { margin-top: 16px; }
.sd-templates { display: grid; gap: 12px; margin-bottom: 16px; }
.sd-templates p { margin: 4px 0 0; }
.sd-template-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sd-template { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; }
.sd-template span { display: flex; flex-direction: column; gap: 2px; }
.sd-template:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.team-card { display: flex; flex-direction: column; gap: 10px; }
.team-card header { display: flex; align-items: flex-start; gap: 10px; }
.team-card header > div { flex: 1; min-width: 0; }
.team-card h3 { margin: 0; font-size: 14px; }
.team-badge { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.team-facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 11px; align-items: center; }
.team-facts dt { color: var(--muted); }
.team-facts dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.avatar-row { display: inline-flex; align-items: center; }
.avatar-row .avatar { width: 26px; height: 26px; font-size: 10px; border: 2px solid var(--surface); margin-inline-end: -6px; }
.avatar-row .small { margin-inline-start: 10px; }
.team-card footer { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; }
.sd-flow { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sd-flow li { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--surface-3); font-size: 11px; font-weight: 600; }
.sd-flow li .icon { color: var(--primary); }
.sd-flow li + li::before { content: '←'; margin-inline-end: 6px; color: var(--muted); font-weight: 400; }
[dir="ltr"] .sd-flow li + li::before { content: '→'; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.week-grid > div { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 10px; background: var(--primary-soft); text-align: center; }
.week-grid > div.off { background: var(--surface-3); color: var(--muted); }
.week-grid span { font-size: 11px; color: var(--text-2); }
.week-grid strong { font-size: 11.5px; }
.sd-inline-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 900px) {
    .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sd-inline-form { grid-template-columns: 1fr; }
    .tab-intro { flex-direction: column; }
}
.sd-row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.vip-badge { margin-inline-start: 6px; font-size: 9.5px; letter-spacing: .04em; font-weight: 800; vertical-align: middle; }
.vip-vip { background: #fff4d6; color: #8a5a00; border: 1px solid #f1d38a; }
.vip-vvip { background: linear-gradient(135deg, #3b2a00, #8a6400); color: #ffe7a3; border: 1px solid #b8892a; }
.vip-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.vip-titles { margin-top: 6px; }
.vip-titles summary { cursor: pointer; }
.vip-note { padding: 0 18px 16px; margin: 0; }
@media (max-width: 1000px) { .vip-layout { grid-template-columns: 1fr; } }
/* Job grades and approved devices */
.grade-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.grade-card header > div { flex: 1; min-width: 0; }
.grade-card h3 { margin: 0; font-size: 14px; }
.grade-order { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 11px; }
.chip-warn { border-color: var(--warning); }
.approved-table .center, .approved-table th.center { text-align: center; width: 90px; }
.approved-table input[type="checkbox"] { width: 18px; height: 18px; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg, var(--surface)) 40%); display: flex; justify-content: flex-end; }
.model-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.model-pick .radio-card small { color: var(--muted); }
.model-card { gap: 4px; }
.model-card img { width: 100%; height: 90px; object-fit: contain; border-radius: 8px; background: var(--surface-2); margin-bottom: 4px; }
.model-card .badge { align-self: flex-start; margin-top: 4px; }
.model-specs { line-height: 1.5; }
.replace-note { margin: -4px 0 0; }
.vip-try { margin-top: 0; padding-top: 0; border-top: 0; grid-template-columns: minmax(0, 1fr) auto; }
.outage-note { margin: 0 0 14px; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); display: grid; gap: 8px; }
.outage-note p { margin: 0; }
.outage-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dup-note, .suggest-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); }
/* Job grades page: room between the parts */
.vip-intro { padding: 16px 18px; margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.vip-intro .sd-flow { margin-bottom: 12px; }
.vip-intro p { margin: 0; line-height: 1.8; }
.vip-page { gap: 22px; }
.vip-page > .stack { gap: 22px; }
.vip-page .card-title { margin-bottom: 16px; }
.vip-page .card p.small { line-height: 1.8; margin: 4px 0 14px; }
.vip-page .card .fields { gap: 20px 18px; }
.vip-page .field small { display: block; margin-top: 6px; line-height: 1.6; }
.vip-page .check { margin: 4px 0 2px; font-size: 12px; }
.vip-page .grade-card header { margin-bottom: 14px; }
.vip-page .grade-card .chip-row { gap: 8px; }
.vip-page .chip-row { gap: 8px; margin-top: 6px; }
.vip-page .vip-try { margin-top: 2px; }
.vip-page .vip-note { padding: 14px 18px 18px; line-height: 1.8; }
.vip-page .table-card .card-head { padding: 18px 18px 6px; }
.approved-help { margin: 0 0 20px; line-height: 1.8; }

/* Saved / error messages: a box floating over the top of the page, taking no room in it */
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1200; display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toasts:empty { display: none; }
.toasts .flash { margin: 0; pointer-events: auto; background: var(--surface); box-shadow: 0 10px 30px rgb(0 0 0 / 14%); animation: toast-in .25s ease; transition: opacity .3s, transform .3s; }
.toasts .flash-success { background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.toasts .flash-error { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.toasts .flash-warning { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.toasts .flash-info { background: color-mix(in srgb, var(--info) 10%, var(--surface)); }
.toasts .flash.leaving { opacity: 0; transform: translateY(-10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* Roles page: sections, permission cards with a count, roomy items */
.role-section { display: flex; flex-direction: column; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.role-section:last-of-type { border-bottom: 0; padding-bottom: 0; }
.role-section .card-title { margin-bottom: 4px; }
.role-section .form-grid { gap: 16px; }
.role-note { margin: 0; line-height: 1.8; display: flex; gap: 6px; align-items: flex-start; }
.perm-groups { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); grid-auto-rows: 1fr; gap: 16px; align-items: stretch; }
.perm-groups > .perm-group { height: 100%; box-sizing: border-box; }
.perm-group { padding: 0 14px 12px; gap: 2px; border-radius: var(--radius); background: var(--surface); }
.perm-group legend { float: inline-start; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 2px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 13px; }
.perm-group legend + * { clear: both; }
.perm-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer; }
.perm-item:hover { background: var(--surface-2); }
.perm-item input { margin-top: 3px; width: 16px; height: 16px; flex: none; }
.perm-item > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.perm-item strong { font-size: 12px; font-weight: 600; }
.perm-item small { color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.perm-item:has(input:disabled) { cursor: default; }
.roles-actions { padding-top: 6px; }

/* Executive report shown inside the platform: the A4 document sits in a frame that scrolls sideways on narrow screens */
.exec-actions form { margin: 0; }
.exec-actions select { min-width: 150px; }
.exec-frame { border-radius: 14px; background: #eef1f6; border: 1px solid var(--border); padding: 18px 12px; }
@media (max-width: 640px) { .exec-frame { padding: 8px 0; border-radius: 10px; } }
.exec-frame iframe { display: block; width: 100%; max-width: calc(210mm + 24px); min-height: 60vh; margin: 0 auto; border: 0; background: transparent; }
/* Custody receipt: remove an item added by mistake (unsigned receipts, staff only) */
.custody-remove { display: inline-block; margin-inline-start: 6px; vertical-align: middle; }
.custody-remove .icon-btn { width: 22px; height: 22px; }
.custody-license { white-space: nowrap; }

/* Copy that is not the live platform (config app.env): a strip on every page */
.env-strip { position: sticky; top: 0; z-index: 1000; padding: 4px 12px; text-align: center; font-size: 11.5px; color: #fff; background: #b45309; letter-spacing: .02em; }
.env-strip.env-demo { background: #6d28d9; }
@media print { .env-strip { display: none; } }
.env-strip form { display: inline; margin-inline-start: 10px; }
.env-strip button { font: inherit; font-weight: 600; color: #fff; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .45); border-radius: 6px; padding: 1px 10px; cursor: pointer; }
.demo-login { border: 1px dashed #8b5cf6; background: color-mix(in srgb, #8b5cf6 8%, transparent); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 12.5px; }
.demo-login strong { display: flex; align-items: center; gap: 6px; color: #6d28d9; }
.demo-login p { margin: 4px 0 8px; color: var(--muted); }
.demo-login dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.demo-login dt { color: var(--muted); }
.demo-login dd { margin: 0; font-weight: 600; }

/* VIP page: the people table */
.vip-people th, .vip-people td { vertical-align: middle; padding-top: 14px; padding-bottom: 14px; }
.vip-people th:first-child, .vip-people td:first-child { width: 34%; }
.vip-person { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vip-person .vip-badge { margin: 0; }
.vip-people td small.block { margin-top: 4px; }

/* New user: the locations a user is limited to, as a grid of even boxes */
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 6px 0 8px; }
.scope-option { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 12.5px; cursor: pointer; min-width: 0; }
.scope-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-option input { margin: 0; flex: none; width: auto; height: auto; }
.scope-option:hover { border-color: var(--border-strong); }
.scope-option:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.scope-field.span-2 legend { margin-bottom: 2px; }
