/* ══════════════════════════════════════════════════════════════════════════════
   ITSM design system — "Ledger"
   Paper surfaces, ink text, one sea accent, hairline borders, no gradients/glow.
   Dense by design (13–14px type, 36px controls/rows). Tokens first; every component
   below reads tokens only, so a theme change is a change to :root.
   Contrast: all text pairs ≥ 4.5:1, control borders ≥ 3:1 (checked in the design review).
   ══════════════════════════════════════════════════════════════════════════════ */
:root {
    color-scheme: light;

    /* surfaces */
    --bg: #F3F1EC;
    --surface: #FFFFFF;
    --surface-2: #F8F7F3;
    --surface-3: #EBE8E0;
    --rail: #FBFAF7;

    /* lines */
    --border: #E2DFD6;
    --border-strong: #CBC7BB;
    --control-border: #8B877D;

    /* ink */
    --ink: #1B1A17;
    --ink-2: #44413A;
    --ink-3: #66625A;
    --ink-4: #8B877D;

    /* accent (sea) - the hue of the sea and sky in the sign-in photograph (hue ~198),
       and of the Owner Relations wordmark's dark ink, which sits in the same family. */
    --accent: #1F5B77;
    --accent-hover: #174659;
    --accent-ink: #FFFFFF;
    --accent-tint: #E4F0F5;
    --accent-tint-2: #CFE4EC;
    --accent-border: #9CC3D3;
    --focus: #1F5B77;
    --ring: 0 0 0 3px rgba(31, 91, 119, .20);

    /* status */
    --ok: #14603A;      --ok-tint: #E3F2E9;
    --warn: #8A5200;    --warn-tint: #FBEFD5;
    --danger: #A8201A;  --danger-tint: #FBE6E3;
    --info: #24527F;    --info-tint: #E3ECF6;
    --violet: #573A8A;  --violet-tint: #EDE7F6;

    /* status borders, solid danger buttons, and the few surfaces that are dark in both themes */
    --danger-border: #E7B9B4;  --warn-border: #EBCB93;  --info-border: #BFD3E8;  --ok-border: #A8D5BB;
    --danger-solid: #A8201A;   --danger-solid-hover: #8A1814;
    --hero-bg: #1B1A17;        /* the asset header panel: dark in light theme, a lifted dark in dark theme */
    --mark-bg: #F6E3A1;        /* search-hit highlight */

    /* type */
    --font: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

    /* shape, depth, motion */
    --r-sm: 4px;
    --r: 6px;
    --r-lg: 8px;
    --shadow-pop: 0 10px 28px rgba(27, 26, 23, .14), 0 1px 0 rgba(27, 26, 23, .04);
    --t: 140ms cubic-bezier(.2, 0, .2, 1);

    /* layout */
    --topbar-h: 52px;
    --rail-w: 236px;
}

/* ━━ RESET & BASE ━━ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent-tint-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1:focus, h1[tabindex="-1"]:focus { outline: none; }
a { color: var(--accent); }
code, kbd, pre, samp { font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ━━ SHELL ━━ */
.app-topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
    background: var(--surface); border-bottom: 1px solid var(--border);
    color: var(--ink);
    display: flex; align-items: center; gap: 8px; padding: 0 12px;
    z-index: 1000;
}
.topbar-menu-btn, .topbar-logout-btn {
    background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r); flex-shrink: 0;
    transition: background var(--t), color var(--t), border-color var(--t);
}
.topbar-menu-btn:hover, .topbar-logout-btn:hover { background: var(--surface-3); color: var(--ink); }
.topbar-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 15px; font-weight: 600; letter-spacing: -.005em; color: var(--ink); white-space: nowrap;
}
.topbar-title::before {
    content: ''; width: 22px; height: 22px; flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='6' fill='%231F5B77'/%3E%3Cg stroke='%23fff' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M7 8.5l5 3.5M17 8.5l-5 3.5M12 12v5.5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Ccircle cx='7' cy='8.5' r='2'/%3E%3Ccircle cx='17' cy='8.5' r='2'/%3E%3Ccircle cx='12' cy='17.5' r='2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.topbar-spacer { flex: 1; }
.topbar-user {
    font-size: 12.5px; font-weight: 500; color: var(--ink-2);
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 4px 10px; border-radius: var(--r);
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ── the account menu in the topbar ─────────────────────────────────────── */
.topbar-account { position: relative; display: flex; align-items: center; }
.topbar-user-btn {
    display: flex; align-items: center; gap: 8px; max-width: 230px;
    padding: 4px 8px 4px 4px; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.topbar-user-btn:hover { background: var(--surface-3); border-color: var(--ink-3); color: var(--ink); }
.topbar-user-mark {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
    color: var(--accent); background: var(--accent-tint); border: 1px solid var(--accent-border);
}
.topbar-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-chev { font-size: 16px !important; color: var(--ink-3); transition: transform var(--t); }
.topbar-user-chev.open { transform: rotate(180deg); }

.topbar-menu-veil { position: fixed; inset: 0; z-index: 40; background: transparent; }
.topbar-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 41; min-width: 232px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
    box-shadow: var(--shadow-lg, 0 10px 30px rgb(0 0 0 / .13)); overflow: hidden;
}
.topbar-menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.topbar-menu-who  { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-menu-mail { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); text-align: left; text-decoration: none;
    background: transparent; border: none; cursor: pointer; transition: background var(--t), color var(--t);
}
.topbar-menu-item:hover { background: var(--surface-2); color: var(--ink); }
.topbar-menu-item .material-icons { font-size: 17px; color: var(--ink-3); }
.topbar-menu-item:hover .material-icons { color: var(--accent); }

/* ── the Account page ───────────────────────────────────────────────────── */
.acct-details {
    display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; margin: 0; padding: 16px 18px;
    font-size: 13.5px;
}
.acct-details dt { color: var(--ink-3); font-weight: 500; }
.acct-details dd { margin: 0; color: var(--ink); }
.acct-note { margin: 0; padding: 0 18px 16px; font-size: 13px; color: var(--ink-3); line-height: 1.5; max-width: 70ch; }

.topbar-site {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-tint); border: 1px solid var(--accent-border);
    padding: 2px 8px; border-radius: var(--r-sm);
}
.topbar-link {
    color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-decoration: none;
    padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface);
    transition: background var(--t), border-color var(--t), color var(--t);
}
.topbar-link:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }

.topbar-search {
    display: flex; align-items: center; height: 34px; min-width: 220px; max-width: 340px; margin-right: 8px; padding: 0 10px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
    transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.topbar-search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); }
.topbar-search-icon { font-size: 18px !important; color: var(--ink-3); margin-right: 6px; flex-shrink: 0; }
.topbar-search-input { background: transparent; border: none; outline: none; color: var(--ink); font-size: 13px; font-family: inherit; width: 100%; min-width: 0; }
.topbar-search-input::placeholder { color: var(--ink-3); }

.app-body { display: flex; margin-top: var(--topbar-h); min-height: calc(100vh - var(--topbar-h)); }

/* ━━ SIDEBAR ━━ */
.app-sidebar {
    width: var(--rail-w); min-width: var(--rail-w); flex-shrink: 0;
    background: var(--rail); border-right: 1px solid var(--border);
    position: sticky; top: var(--topbar-h); align-self: flex-start; height: calc(100vh - var(--topbar-h));
    overflow-y: auto; overflow-x: hidden; padding-bottom: 24px;
    transition: width var(--t), min-width var(--t);
}
.app-sidebar.sidebar-closed { width: 0 !important; min-width: 0 !important; border-right: 0; }
.sidebar-backdrop { display: none; }
.sidebar-header {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-3); padding: 16px 18px 6px;
}

.nav-link {
    position: relative; display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 500; color: var(--ink-2);
    padding: 7px 10px; margin: 1px 8px; border-radius: var(--r);
    text-decoration: none; white-space: nowrap;
    transition: background var(--t), color var(--t);
}
.nav-link:hover { background: var(--surface-3); color: var(--ink); }
.nav-link.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nav-link.active::before {
    content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px;
    border-radius: 0 2px 2px 0; background: var(--accent);
}
.nav-link-icon { font-size: 18px !important; color: var(--ink-3); flex-shrink: 0; transition: color var(--t); }
.nav-link:hover .nav-link-icon { color: var(--ink); }
.nav-link.active .nav-link-icon { color: var(--accent); }

/* legacy MudNavLink usage keeps the same look */
.mud-nav-link {
    display: flex !important; flex-direction: row !important; align-items: center !important; gap: 10px !important;
    font-size: 13px !important; font-weight: 500 !important; color: var(--ink-2) !important;
    padding: 7px 10px !important; margin: 1px 8px !important; min-height: 34px !important; border-radius: var(--r) !important;
    text-decoration: none !important; white-space: nowrap !important;
    transition: background var(--t), color var(--t) !important;
}
.mud-nav-link:hover { background: var(--surface-3) !important; color: var(--ink) !important; }
.mud-nav-link.active { background: var(--accent-tint) !important; color: var(--accent) !important; font-weight: 600 !important; }
.mud-nav-link .mud-icon-root { color: var(--ink-3) !important; width: 18px !important; height: 18px !important; }
.mud-nav-link .mud-icon-root path, .mud-nav-link .mud-svg-icon path { fill: var(--ink-3) !important; }
.mud-nav-link.active .mud-icon-root path, .mud-nav-link.active .mud-svg-icon path { fill: var(--accent) !important; }

.nav-label {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-3); padding: 12px 18px 4px; user-select: none;
}
.nav-label-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding-right: 14px; transition: color var(--t); }
.nav-label-toggle:hover { color: var(--ink); }
.nav-label-chevron { font-size: 16px !important; transition: transform var(--t); transform: rotate(0deg); }
.nav-label-chevron.open { transform: rotate(90deg); }

.nav-sub-link { padding-left: 28px !important; font-size: 12.5px !important; }
.nav-sub-link .nav-link-icon { font-size: 16px !important; }
.nav-sub-bullet { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; margin-right: -2px; }

.nav-group-label {
    font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-3); margin: 16px 12px 4px; padding-top: 14px; border-top: 1px solid var(--border);
}
.nav-module-title {
    display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
    margin: 8px 8px 2px; padding: 8px 10px; border-radius: var(--r);
    font-size: 13px; font-weight: 600; color: var(--ink);
    transition: background var(--t);
}
.nav-module-title:hover { background: var(--surface-3); }
.nav-module-title .nav-link-icon { color: var(--accent); }
.nav-module-title .nav-label-chevron { margin-left: auto; color: var(--ink-3); }
.nav-empty { margin: 14px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }

/* ━━ MAIN ━━ */
.app-main { flex: 1; min-width: 0; padding: 22px 28px 48px; background: var(--bg); }
.app-main > * { max-width: 1560px; margin-left: auto; margin-right: auto; }

/* ━━ ICON SIZES ━━ */
.mud-icon-root { font-size: 20px !important; width: 20px !important; height: 20px !important; line-height: 20px !important; }
.mud-icon-size-small  { font-size: 16px !important; width: 16px !important; height: 16px !important; }
.mud-icon-size-medium { font-size: 20px !important; width: 20px !important; height: 20px !important; }
.mud-icon-size-large  { font-size: 26px !important; width: 26px !important; height: 26px !important; }

/* ━━ MUDBLAZOR FORM INPUTS (colour only — never layout) ━━ */
fieldset.mud-notched-outline { border-color: var(--control-border) !important; border-radius: var(--r) !important; }
.mud-input.mud-input-outlined:focus-within fieldset.mud-notched-outline { border-color: var(--accent) !important; border-width: 2px !important; }
.mud-input.mud-input-outlined.mud-input-error fieldset.mud-notched-outline { border-color: var(--danger) !important; }
.mud-input-label-outlined { color: var(--ink-3) !important; }
.mud-input-label-outlined.mud-shrink { color: var(--accent) !important; }
.mud-input-root { font-size: 14px !important; color: var(--ink) !important; }
.mud-input-helper-text { font-size: 12px !important; }
.mud-input-adornment { background: transparent !important; }
.mud-input-adornment path { fill: var(--ink-3) !important; }

/* ━━ NATIVE FORM FIELDS ━━ */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 0 12px; height: 36px;
    border: 1px solid var(--control-border); border-radius: var(--r);
    font-size: 14px; color: var(--ink); background: var(--surface);
    font-family: inherit; outline: none;
    transition: border-color var(--t), box-shadow var(--t);
    appearance: none; -webkit-appearance: none;
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--ink-3); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.form-input:disabled, .form-select:disabled, .form-textarea:disabled { background: var(--surface-3); color: var(--ink-3); border-color: var(--border-strong); cursor: not-allowed; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-4); }
.form-select {
    cursor: pointer; padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%2366625A'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
}
.form-textarea { height: auto; min-height: 88px; padding: 8px 12px; resize: vertical; line-height: 1.55; }
.form-grid { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-full { grid-column: 1 / -1; }
@media (max-width: 800px) { .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr !important; } }
.form-error { font-size: 12px; color: var(--danger); margin-top: 2px; }
.form-hint  { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* tabs (native) */
.tab-nav { display: flex; border-bottom: 1px solid var(--border-strong); background: transparent; overflow-x: auto; gap: 2px; padding: 0 6px; }
.tab-btn {
    padding: 10px 14px; border: none; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-3);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; white-space: nowrap;
    display: flex; align-items: center; gap: 6px; transition: color var(--t), background var(--t), border-color var(--t);
}
.tab-btn:hover:not(.tab-btn-active) { color: var(--ink); background: var(--surface-3); }
.tab-btn-active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.tab-content { padding: 16px 20px; }

/* form footer + buttons */
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.form-btn-cancel {
    padding: 7px 16px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface);
    font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-family: inherit;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.form-btn-cancel:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.form-btn-primary {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 18px; border-radius: var(--r); border: 1px solid var(--accent);
    background: var(--accent); font-size: 13px; font-weight: 600; color: var(--accent-ink); cursor: pointer; font-family: inherit;
    transition: background var(--t), border-color var(--t);
}
.form-btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.form-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* toggle switch */
.toggle-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-switch input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 40px; height: 22px; background: var(--ink-4); border-radius: 11px; position: relative; transition: background var(--t); flex-shrink: 0; }
.toggle-track::after { content: ''; position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: left var(--t); }
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { left: 21px; }
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle-label-text { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.toggle-switch input:checked ~ .toggle-label-text { color: var(--accent); font-weight: 600; }

/* ━━ FILTER BAR ━━ */
.fb-field {
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 150px; height: 36px; padding: 0 10px; position: relative;
    background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r);
    transition: border-color var(--t), box-shadow var(--t);
}
.fb-field:hover { border-color: var(--ink-3); }
.fb-field:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.fb-input { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; color: var(--ink); font-family: inherit; }
.fb-input::placeholder { color: var(--ink-4); }
.fb-select { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; color: var(--ink); font-family: inherit; appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 4px; height: 100%; }
.fb-select option { color: var(--ink); background: var(--surface); }
.fb-chevron { font-size: 18px !important; color: var(--ink-3); pointer-events: none; flex-shrink: 0; }
.fb-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2);
    cursor: pointer; font-family: inherit; white-space: nowrap; transition: border-color var(--t), background var(--t), color var(--t);
}
.fb-btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.fb-btn-clear { color: var(--danger); border-color: var(--danger-border); }
.fb-btn-clear:hover { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }

/* ━━ MUDBLAZOR BUTTONS ━━ */
.mud-button-root { font-size: 13px !important; font-weight: 600 !important; border-radius: var(--r) !important; letter-spacing: 0 !important; text-transform: none !important; transition: background var(--t), border-color var(--t), color var(--t) !important; }
.mud-button-filled.mud-button-filled-primary { background: var(--accent) !important; box-shadow: none !important; color: var(--accent-ink) !important; }
.mud-button-filled.mud-button-filled-primary:hover { background: var(--accent-hover) !important; box-shadow: none !important; }
.mud-button-filled.mud-button-filled-secondary { background: var(--ink-2) !important; box-shadow: none !important; color: var(--surface) !important; }
.mud-button-outlined { border: 1px solid var(--border-strong) !important; color: var(--ink-2) !important; background: var(--surface) !important; }
.mud-button-outlined:hover { background: var(--surface-2) !important; border-color: var(--ink-3) !important; }
.mud-button-text { color: var(--accent) !important; }
.mud-button-root .mud-icon-root { font-size: 16px !important; width: 16px !important; height: 16px !important; }
.mud-button-root.mud-button-size-small { font-size: 12px !important; padding: 4px 12px !important; }

/* ━━ MUDBLAZOR TABS ━━ */
.mud-tabs .mud-tab-header { background: var(--surface-3) !important; border-radius: var(--r-lg) !important; padding: 3px !important; gap: 2px !important; }
.mud-tab { font-size: 13px !important; font-weight: 500 !important; border-radius: var(--r) !important; padding: 6px 16px !important; min-width: 80px !important; color: var(--ink-2) !important; text-transform: none !important; transition: background var(--t), color var(--t) !important; }
.mud-tab.mud-tab-active { background: var(--surface) !important; color: var(--accent) !important; font-weight: 600 !important; box-shadow: 0 1px 0 var(--border-strong) !important; }
.mud-tab-slider { display: none !important; }

/* ━━ CHIPS / ALERTS ━━ */
.mud-chip { font-size: 11.5px !important; font-weight: 600 !important; height: 22px !important; padding: 0 9px !important; border-radius: var(--r-sm) !important; letter-spacing: 0 !important; }
.mud-chip-content { font-size: 11.5px !important; line-height: 22px !important; }
.mud-alert { border-radius: var(--r) !important; border: none !important; font-size: 13px !important; padding: 10px 14px !important; }
.mud-alert-filled-info    { background: var(--info-tint) !important;   color: var(--info) !important;   border-left: 3px solid var(--info) !important; }
.mud-alert-filled-success { background: var(--ok-tint) !important;     color: var(--ok) !important;     border-left: 3px solid var(--ok) !important; }
.mud-alert-filled-warning { background: var(--warn-tint) !important;   color: var(--warn) !important;   border-left: 3px solid var(--warn) !important; }
.mud-alert-filled-error   { background: var(--danger-tint) !important; color: var(--danger) !important; border-left: 3px solid var(--danger) !important; }

/* ━━ MUDBLAZOR TABLES ━━ */
.mud-table { border-radius: var(--r-lg) !important; overflow: hidden !important; }
/* base grid layout (sites that do not load MudBlazor's own stylesheet still need it) */
.mud-table-container { overflow-x: auto; }
.mud-table-root { width: 100%; border-collapse: collapse; }
.mud-table-cell { text-align: left; }
.mud-table-head .mud-table-cell { white-space: nowrap; }
.mud-table-head .mud-table-cell,
.mud-data-grid .mud-table-head .mud-table-cell {
    font-family: var(--mono) !important; font-size: 10.5px !important; font-weight: 500 !important;
    text-transform: uppercase !important; letter-spacing: .06em !important;
    color: var(--ink-3) !important; background: var(--surface-2) !important;
    padding: 9px 14px !important; border-bottom: 1px solid var(--border-strong) !important;
}
.mud-table-cell, .mud-data-grid .mud-table-body .mud-table-cell {
    font-size: 13px !important; padding: 8px 14px !important; vertical-align: middle !important;
    color: var(--ink) !important; border-bottom: 1px solid var(--border) !important;
}
.mud-table-row:hover .mud-table-cell, .mud-data-grid .mud-table-body .mud-table-row:hover .mud-table-cell { background: var(--surface-2) !important; }
.mud-data-grid .mud-table-root { border-radius: 0 !important; box-shadow: none !important; }
.mud-data-grid-pager { display: none !important; }

/* ━━ PAPER / DIALOG / POPOVER ━━ */
.mud-paper { border-radius: var(--r-lg) !important; }
.mud-paper-outlined { border: 1px solid var(--border) !important; border-radius: var(--r-lg) !important; }
.mud-dialog { border-radius: 10px !important; overflow: hidden !important; box-shadow: var(--shadow-pop) !important; }
.mud-dialog-title { font-size: 16px !important; font-weight: 600 !important; padding: 18px 22px 12px !important; border-bottom: 1px solid var(--border) !important; color: var(--ink) !important; }
.mud-dialog-content { padding: 18px 22px !important; }
.mud-dialog-actions { padding: 12px 22px 16px !important; border-top: 1px solid var(--border) !important; gap: 8px !important; }
.mud-popover { border-radius: var(--r-lg) !important; box-shadow: var(--shadow-pop) !important; }
.mud-list-item { font-size: 13px !important; padding: 8px 14px !important; }
.mud-list-item:hover { background: var(--surface-2) !important; }
.mud-list-item.mud-selected { background: var(--accent-tint) !important; color: var(--accent) !important; font-weight: 600 !important; }
.mud-switch-track { border-radius: 20px !important; }

/* ━━ TYPOGRAPHY (Mud) ━━ */
.mud-typography-h4      { font-size: 1.5rem !important;  font-weight: 600 !important; color: var(--ink) !important; }
.mud-typography-h5      { font-size: 1.2rem !important;  font-weight: 600 !important; color: var(--ink) !important; }
.mud-typography-h6      { font-size: 1rem !important;    font-weight: 600 !important; color: var(--ink) !important; }
.mud-typography-body1   { font-size: 14px !important;    color: var(--ink) !important; }
.mud-typography-body2   { font-size: 13px !important;    color: var(--ink-2) !important; }
.mud-typography-caption { font-size: 12px !important;    color: var(--ink-3) !important; }

/* ━━ DASHBOARD CARDS ━━ */
.stat-card {
    position: relative; display: flex; flex-direction: column; gap: 4px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px;
}
.stat-card .stat-accent { display: none; }
.stat-card .stat-icon { display: none !important; }
.stat-card .stat-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stat-card .stat-value { font-family: var(--mono); font-size: 2rem; font-weight: 500; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-card .stat-sub { font-size: 12px; color: var(--ink-3); }

.dash-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 700px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
.cat-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    transition: border-color var(--t), background var(--t);
}
.cat-card:hover { background: var(--surface-2); border-color: var(--accent-border); }
.cat-card .cat-icon-wrap { width: 32px; height: 32px; border-radius: var(--r); background: var(--accent-tint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cat-card .cat-icon-wrap path { fill: var(--accent) !important; }
.cat-card .cat-count { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cat-card .cat-name  { font-size: 12px; color: var(--ink-3); }

.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; }
.section-card-title { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.action-btn {
    display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--r); cursor: pointer; width: 100%;
    font-size: 13px; font-weight: 600; margin-bottom: 8px; text-decoration: none; font-family: inherit;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.action-btn-primary { background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink); }
.action-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.action-btn-outline { background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-2); }
.action-btn-outline:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.action-btn .ab-icon { width: 26px; height: 26px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.action-btn-primary .ab-icon { background: rgba(255,255,255,.16); }
.action-btn-outline .ab-icon { background: var(--accent-tint); }
.action-btn .ab-icon svg { width: 16px !important; height: 16px !important; }
.action-btn-primary .ab-icon path { fill: var(--accent-ink) !important; }
.action-btn-outline .ab-icon path { fill: var(--accent) !important; }
.action-btn .material-icons { font-size: 17px; }

/* ━━ SCROLLBAR ━━ */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); background-clip: content-box; }

/* ━━ MISC ━━ */
#blazor-error-ui { display: none; }
.valid.modified:not([type=checkbox]) { outline: 1.5px solid var(--ok); }
.invalid { outline: 1.5px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ━━ SHARED PAGE PATTERNS ━━ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .kpi-grid { grid-template-columns: 1fr; } }

.page-hdr { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.page-hdr h1 { font-size: 22px; font-weight: 600; margin: 0 0 2px; line-height: 1.25; letter-spacing: -.015em; color: var(--ink); }
.page-hdr p { font-size: 13px; color: var(--ink-3); margin: 0; }
.page-hdr-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 12px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; overflow: visible !important; }
.filter-bar .fb-item { min-width: 160px; flex: 1; }
.filter-bar .fb-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: auto; }

.page-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.page-card-body { padding: 20px; }
.card-hdr { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.card-hdr-title { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }

/* status badges: flat tint + dark text */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.badge-active      { background: var(--ok-tint);     color: var(--ok); }
.badge-inactive    { background: var(--surface-3);   color: var(--ink-2); }
.badge-maintenance { background: var(--warn-tint);   color: var(--warn); }
.badge-decomm      { background: var(--danger-tint); color: var(--danger); }
.badge-planned     { background: var(--info-tint);   color: var(--info); }
.badge-prod        { background: var(--danger-tint); color: var(--danger); }
.badge-staging     { background: var(--warn-tint);   color: var(--warn); }
.badge-dev         { background: var(--info-tint);   color: var(--info); }
.badge-test        { background: var(--violet-tint); color: var(--violet); }
.badge-default     { background: var(--surface-3);   color: var(--ink-2); }
.badge-role-super  { background: var(--ink);         color: var(--surface); }
.badge-role-admin  { background: var(--accent-tint); color: var(--accent); }
.badge-role-mgr    { background: var(--info-tint);   color: var(--info); }
.badge-role-dev    { background: var(--warn-tint);   color: var(--warn); }
.badge-role-ro     { background: var(--surface-3);   color: var(--ink-2); }

/* detail + relationship + data tables */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table tr { border-bottom: 1px solid var(--border); }
.detail-table tr:last-child { border-bottom: none; }
.detail-table tr:hover td { background: var(--surface-2); }
.detail-table td { padding: 9px 14px; vertical-align: baseline; }
.detail-table td:first-child { font-family: var(--mono); font-weight: 500; color: var(--ink-3); width: 36%; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.detail-table td:last-child { color: var(--ink); word-break: break-word; }
.detail-notes { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 0 var(--r) var(--r) 0; padding: 12px 16px; margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; }
.detail-notes-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }

.rel-table, .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rel-table thead tr, .data-table thead tr { background: var(--surface-2); border-bottom: 1px solid var(--border-strong); }
.rel-table thead th, .data-table th { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 9px 14px; text-align: left; white-space: nowrap; }
.rel-table tbody td, .data-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rel-table tbody tr:hover td, .data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.rel-table a, .table-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.rel-table a:hover, .table-link:hover { text-decoration: underline; }

/* asset hero: flat warm-ink panel (white text inside) */
.asset-hdr { background: var(--hero-bg); border-radius: var(--r-lg); padding: 22px 26px; margin-bottom: 18px; color: #fff; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.asset-hdr-icon { width: 50px; height: 50px; border-radius: var(--r-lg); background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.asset-hdr-icon path, .asset-hdr-icon svg path { fill: #fff !important; }
.asset-hdr-icon svg { width: 26px !important; height: 26px !important; }
.asset-hdr h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; color: #fff; letter-spacing: -.01em; }
.asset-hdr p { font-size: 13px; opacity: .78; margin: 0; color: #fff; }
.asset-hdr-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.back-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 4px 10px; cursor: pointer; text-decoration: none; transition: background var(--t), border-color var(--t); }
.back-pill:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }

/* custom data-grid pager */
.custom-pager { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); flex-wrap: wrap; }
.cp-label { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.cp-count { font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cp-spacer { flex: 1; }
.cp-nav { display: flex; gap: 4px; align-items: center; }
.cp-nav .icon-btn:disabled { opacity: .35; cursor: default; pointer-events: none; }

/* access denied (inline, inside pages) + error pages + empty states */
.access-denied { text-align: center; padding: 56px 20px; }
.access-denied h2 { font-size: 18px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
.access-denied p { font-size: 14px; color: var(--ink-3); margin: 0; }
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 72px 20px; text-align: center; gap: 8px; }
.error-page-code { font-family: var(--mono); font-size: 88px; font-weight: 500; color: var(--border-strong); line-height: 1; margin-bottom: 8px; letter-spacing: -.04em; }
.error-page-title { font-size: 22px; font-weight: 600; color: var(--ink); margin: 0; }
.error-page-msg { font-size: 14px; color: var(--ink-3); margin: 0 0 16px; }
.error-request-id { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.empty-state { text-align: center; padding: 32px 24px; color: var(--ink-3); }
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.empty-state-sub { font-size: 13px; }

/* Older pages use emoji as icons in these placeholders; they are replaced by one neutral line icon, no markup change needed. */
.empty-state-icon, .ad-icon, .su-head-icon {
    font-size: 0 !important; line-height: 0 !important; width: 44px; height: 44px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--ink-3);
}
.empty-state-icon::before, .ad-icon::before, .su-head-icon::before {
    content: ''; width: 22px; height: 22px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H4.99C3.88 3 3.01 3.89 3.01 5L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2zm0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19v10z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3H4.99C3.88 3 3.01 3.89 3.01 5L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2zm0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19v10z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* config sections */
.cfg-section { border-radius: var(--r-lg); border: 1px solid var(--border); padding: 18px 20px; margin-bottom: 14px; background: var(--surface); }
.cfg-section-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.cfg-section-title .cs-icon { width: 28px; height: 28px; border-radius: var(--r); background: var(--accent-tint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cfg-section-title .cs-icon path { fill: var(--accent) !important; }
.cfg-section-title .cs-icon svg { width: 14px !important; height: 14px !important; }
.cfg-section-icon { font-size: 18px; color: var(--accent); }
.cfg-toggle { margin-left: auto; }
.cfg-actions { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.cfg-info-box { display: flex; align-items: flex-start; gap: 10px; background: var(--info-tint); border: 1px solid var(--info-border); border-radius: var(--r); padding: 11px 14px; margin-bottom: 16px; font-size: 13px; color: var(--info); line-height: 1.5; }
.cfg-warn-box { display: flex; align-items: flex-start; gap: 10px; background: var(--warn-tint); border: 1px solid var(--warn-border); border-radius: var(--r); padding: 11px 14px; margin-top: 12px; font-size: 13px; color: var(--warn); line-height: 1.5; }

/* map */
.legend-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px 16px; margin-bottom: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.legend-swatch { width: 14px; height: 14px; border-radius: var(--r-sm); flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(27,26,23,.15); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-title { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; flex-shrink: 0; }
.map-canvas-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; height: calc(100vh - 310px); min-height: 480px; }
.map-info-panel { position: absolute; bottom: 14px; left: 14px; width: 260px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 14px; z-index: 10; }
.map-info-name { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.map-info-detail { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.map-zoom-controls { position: absolute; top: 12px; right: 12px; z-index: 10; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-radius: var(--r-lg); padding: 4px; border: 1px solid var(--border-strong); }
.map-zoom-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r); border: none; background: transparent; color: var(--ink-2); cursor: pointer; transition: background var(--t), color var(--t); }
.map-zoom-btn:hover { background: var(--surface-3); color: var(--ink); }
.map-zoom-btn .material-icons { font-size: 18px; }
.map-zoom-divider { height: 1px; background: var(--border); margin: 2px 0; }
.map-hint { position: absolute; bottom: 12px; right: 12px; z-index: 10; font-size: 11.5px; color: var(--ink-3); background: var(--surface); padding: 4px 10px; border-radius: var(--r); border: 1px solid var(--border); }
.map-hint kbd { display: inline-block; padding: 0 5px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 10.5px; color: var(--ink-2); }

/* detail page */
.detail-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .detail-layout { grid-template-columns: 1fr; } }
.detail-sidebar { display: flex; flex-direction: column; gap: 14px; }
.conn-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.conn-item:last-child { border-bottom: none; }
.conn-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.conn-dot-out { background: var(--accent); }
.conn-dot-in { background: var(--info); }
.conn-link { font-size: 13px; color: var(--accent); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.conn-link:hover { text-decoration: underline; }
.conn-link-in { color: var(--info); }
.conn-type { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; flex-shrink: 0; }
.rel-section-hdr { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; padding: 4px 0; }
.diff-old { font-size: 12px; color: var(--danger); text-decoration: line-through; background: var(--danger-tint); padding: 1px 6px; border-radius: var(--r-sm); }
.diff-new { font-size: 12px; color: var(--ok); font-weight: 600; background: var(--ok-tint); padding: 1px 6px; border-radius: var(--r-sm); }
.text-muted { color: var(--ink-3); }

/* ━━ BUTTONS ━━ */
.btn-primary {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--r); border: 1px solid var(--accent);
    background: var(--accent); font-size: 13px; font-weight: 600; color: var(--accent-ink) !important; cursor: pointer; font-family: inherit;
    text-decoration: none !important; white-space: nowrap; transition: background var(--t), border-color var(--t);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink) !important; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary-sm { padding: 4px 11px !important; font-size: 12px !important; }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: var(--r); border: 1px solid var(--border-strong);
    font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); cursor: pointer; font-family: inherit;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.btn-ghost-white { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r); border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); font-size: 13px; font-weight: 600; color: #fff !important; cursor: pointer; font-family: inherit; text-decoration: none !important; white-space: nowrap; transition: background var(--t), border-color var(--t); }
.btn-ghost-white:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.7); }
.btn-scan { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: var(--r); border: 1px solid #6FD3A1; background: rgba(111,211,161,.16); font-size: 13px; font-weight: 600; color: #fff !important; cursor: pointer; font-family: inherit; white-space: nowrap; transition: background var(--t); }
.btn-scan:hover:not(:disabled) { background: rgba(111,211,161,.3); }
.btn-scan:disabled, .btn-scan-busy { opacity: .7; cursor: not-allowed; }
.btn-danger { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--r); border: 1px solid var(--danger-solid); background: var(--danger-solid); font-size: 13px; font-weight: 600; color: #fff; cursor: pointer; font-family: inherit; transition: background var(--t); }
.btn-danger:hover { background: var(--danger-solid-hover); border-color: var(--danger-solid-hover); }
.btn-add-inline { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 5px 12px; border-radius: var(--r); border: 1px dashed var(--control-border); font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: transparent; cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t); }
.btn-add-inline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }

/* icon buttons (table actions) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; padding: 0; flex-shrink: 0; text-decoration: none !important; transition: background var(--t), border-color var(--t), color var(--t); }
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.icon-btn-danger { border-color: var(--danger-border) !important; color: var(--danger) !important; }
.icon-btn-danger:hover { border-color: var(--danger) !important; background: var(--danger-tint) !important; color: var(--danger) !important; }
.icon-btn-success { border-color: var(--ok-border) !important; color: var(--ok) !important; }
.icon-btn-success:hover { border-color: var(--ok) !important; background: var(--ok-tint) !important; }
.icon-btn .material-icons { font-size: 16px; line-height: 1; }

/* compact select (inline in tables) */
.form-select-sm {
    height: 32px; padding: 0 28px 0 10px; border-radius: var(--r); border: 1px solid var(--control-border); font-size: 12.5px; font-weight: 500; color: var(--ink);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%2366625A'/%3E%3C/svg%3E") no-repeat right 6px center / 16px;
    font-family: inherit; outline: none; cursor: pointer; appearance: none; -webkit-appearance: none; transition: border-color var(--t), box-shadow var(--t); min-width: 130px;
}
.form-select-sm:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* ━━ MODALS ━━ */
.modal-overlay { position: fixed; inset: 0; background: rgba(27,26,23,.5); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal-box { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-pop); width: 460px; max-width: 100%; overflow: hidden; animation: modal-in 160ms cubic-bezier(.2,0,.2,1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-hdr { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-hdr-title { font-size: 15px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.modal-close-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--r); border: none; background: transparent; color: var(--ink-3); cursor: pointer; padding: 0; transition: background var(--t), color var(--t); }
.modal-close-btn:hover { background: var(--surface-3); color: var(--ink); }
.modal-close-btn .material-icons { font-size: 18px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-box-sm { width: 380px; }
.modal-danger-icon { width: 42px; height: 42px; border-radius: var(--r-lg); background: var(--danger-tint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-bottom: 10px; }
.modal-danger-icon .material-icons { font-size: 22px; color: var(--danger); }

/* ━━ MULTI-SELECT (filter bar) ━━ */
.ms-wrap { position: relative; flex: 1; min-width: 160px; }
.ms-trigger { display: flex; align-items: center; gap: 6px; width: 100%; height: 36px; padding: 0 8px 0 12px; background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r); font-size: 13px; color: var(--ink); font-family: inherit; cursor: pointer; white-space: nowrap; transition: border-color var(--t), box-shadow var(--t); }
.ms-trigger:hover { border-color: var(--ink-3); }
.ms-open .ms-trigger { border-color: var(--accent); box-shadow: var(--ring); }
.ms-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.ms-chevron { font-size: 18px !important; color: var(--ink-3); flex-shrink: 0; transition: transform var(--t); }
.ms-open .ms-chevron { transform: rotate(180deg); color: var(--accent); }
.ms-panel { position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: 300; padding: 4px 0; animation: ms-drop 120ms ease; }
@keyframes ms-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ms-option { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--ink); transition: background var(--t); user-select: none; }
.ms-option:hover { background: var(--surface-2); }
.ms-checked { color: var(--accent); font-weight: 600; background: var(--accent-tint); }
.ms-checked:hover { background: var(--accent-tint-2); }
.ms-chk { font-size: 18px !important; color: var(--ink-4); flex-shrink: 0; }
.ms-checked .ms-chk { color: var(--accent); }
.ms-cat-ico { font-size: 15px !important; color: var(--ink-3); flex-shrink: 0; }
.ms-checked .ms-cat-ico { color: var(--accent); }
.ms-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ms-dot-green { background: var(--ok); }
.ms-dot-amber { background: var(--warn); }
.ms-dot-red   { background: var(--danger); }
.ms-dot-blue  { background: var(--info); }
.ms-dot-gray  { background: var(--ink-4); }
.ms-footer { border-top: 1px solid var(--border); padding: 6px 10px; }
.ms-clear-btn { background: none; border: none; font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer; font-family: inherit; padding: 2px 4px; border-radius: var(--r-sm); transition: color var(--t), background var(--t); }
.ms-clear-btn:hover { color: var(--danger); background: var(--danger-tint); }
.ms-backdrop { position: fixed; inset: 0; z-index: 299; cursor: default; }

/* ━━ GLOBAL SEARCH PAGE ━━ */
.search-page-bar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--r-lg); padding: 5px 10px; margin-bottom: 18px; transition: border-color var(--t), box-shadow var(--t); }
.search-page-bar:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.search-page-icon { color: var(--ink-3); font-size: 20px !important; flex-shrink: 0; }
.search-page-input { flex: 1; border: none; outline: none; font-size: 15px; font-family: inherit; color: var(--ink); background: transparent; }
.search-page-input::placeholder { color: var(--ink-4); }
.search-page-clear { background: none; border: none; cursor: pointer; padding: 2px; color: var(--ink-3); display: flex; align-items: center; border-radius: var(--r-sm); transition: color var(--t); }
.search-page-clear:hover { color: var(--ink); }
.search-page-btn { height: 30px; padding: 0 14px; font-size: 13px; flex-shrink: 0; }
.search-summary { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.search-elapsed { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.search-empty { text-align: center; padding: 56px 0; }
.search-hint { padding: 14px 0 28px; }
.search-hint-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 600px) { .search-hint-grid { grid-template-columns: 1fr; } }
.search-hint-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.search-hint-card .material-icons { font-size: 24px !important; margin-bottom: 4px; color: var(--accent); }
.search-hint-card > div:nth-child(2) { font-size: 13px; font-weight: 600; color: var(--ink); }
.search-hint-card > div:nth-child(3) { font-size: 12px; color: var(--ink-3); }
.search-group { margin-bottom: 22px; }
.search-group-hdr { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 0 4px 8px; border-bottom: 1px solid var(--border-strong); margin-bottom: 4px; }
.search-group-count { margin-left: auto; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 600; border-radius: var(--r-sm); padding: 0 7px; height: 18px; line-height: 18px; }
.search-group-body { display: flex; flex-direction: column; }
.search-result-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: var(--r); text-decoration: none; color: inherit; transition: background var(--t); }
.search-result-row:hover { background: var(--surface-3); }
.srr-icon { width: 32px; height: 32px; border-radius: var(--r); background: var(--accent-tint); display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.srr-body { flex: 1; min-width: 0; }
.srr-title { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srr-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.srr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.srr-when { font-size: 11px; color: var(--ink-3); white-space: nowrap; font-family: var(--mono); }
mark.search-mark { background: var(--mark-bg); color: var(--ink); border-radius: 2px; padding: 0 1px; }

/* ━━ CSV IMPORT ━━ */
.csv-steps { display: flex; align-items: center; margin-bottom: 24px; }
.csv-step { display: flex; align-items: center; gap: 8px; }
.csv-step-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--ink-3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; font-family: var(--mono); transition: background var(--t), color var(--t); }
.csv-step.active .csv-step-dot { background: var(--accent); color: var(--accent-ink); }
.csv-step.done .csv-step-dot { background: var(--ok); color: var(--surface); }
.csv-step-label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.csv-step.active .csv-step-label { color: var(--accent); }
.csv-step.done .csv-step-label { color: var(--ok); }
.csv-step-line { flex: 1; height: 2px; background: var(--border-strong); margin: 0 8px; min-width: 24px; transition: background var(--t); }
.csv-step-line.done { background: var(--ok); }
.csv-upload-zone { border: 1.5px dashed var(--control-border); border-radius: var(--r-lg); padding: 36px 24px; text-align: center; background: var(--surface-2); transition: border-color var(--t), background var(--t); cursor: default; }
.csv-upload-zone.dragging { border-color: var(--accent); background: var(--accent-tint); }
.csv-error-box { display: flex; align-items: center; gap: 8px; background: var(--danger-tint); border: 1px solid var(--danger-border); border-radius: var(--r); padding: 10px 14px; font-size: 13px; color: var(--danger); }
.csv-map-table { width: 100%; border-collapse: collapse; }
.csv-map-table th { text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 0 12px 8px; border-bottom: 1px solid var(--border-strong); }
.csv-map-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.csv-map-table tr:last-child td { border-bottom: none; }
.csv-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.csv-preview-table th { background: var(--surface-2); padding: 7px 12px; text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.csv-preview-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--ink); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csv-preview-table tr:last-child td { border-bottom: none; }
.csv-preview-table tr:hover td { background: var(--surface-2); }
.csv-result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 500px) { .csv-result-grid { grid-template-columns: repeat(2, 1fr); } }
.csv-result-tile { border-radius: var(--r-lg); padding: 14px; text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid transparent; }
.csv-result-tile .material-icons { font-size: 22px !important; }
.csv-result-num { font-family: var(--mono); font-size: 24px; font-weight: 500; line-height: 1; }
.csv-result-tile.green { background: var(--ok-tint); color: var(--ok); }
.csv-result-tile.blue  { background: var(--info-tint); color: var(--info); }
.csv-result-tile.gray  { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.csv-result-tile.red   { background: var(--danger-tint); color: var(--danger); }

/* ━━ RISK MANAGEMENT ━━ */
.rm-levels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 0; }
@media (max-width: 900px) { .rm-levels-grid { grid-template-columns: 1fr; } }
.rm-levels-grid .page-card { padding: 18px; }
.rm-level-badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 10px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600; white-space: nowrap; }
.rm-color-swatch { display: inline-block; width: 16px; height: 16px; border-radius: var(--r-sm); vertical-align: middle; }
.rm-matrix-card { padding: 18px 22px; overflow: visible; }
.risk-matrix-table { border-collapse: separate; border-spacing: 0; width: 100%; margin-top: 4px; }
.risk-matrix-table th { padding: 10px 16px; text-align: center; }
.risk-matrix-table td { padding: 10px 12px; }
.rm-axis-label { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); background: transparent; min-width: 160px; }
.rm-col-header { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-3); border-radius: var(--r); }
.rm-row-header { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; padding-right: 20px; }
.rm-cell { min-width: 160px; transition: background var(--t); border-radius: var(--r); padding: 8px 10px; }
.rm-cell-select { width: 100%; border: 1px solid var(--control-border); border-radius: var(--r); padding: 6px 10px; font-size: 13px; background: var(--surface); cursor: pointer; font-weight: 500; font-family: inherit; }
.rm-cell-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.risk-summary-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.risk-summary-chip { display: flex; flex-direction: column; align-items: center; padding: 8px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); gap: 2px; min-width: 80px; }
.risk-summary-count { font-family: var(--mono); font-size: 22px; font-weight: 500; line-height: 1; }
.risk-summary-label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

/* ━━ DASHBOARD MODULE TILES ━━ */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 22px; }
.module-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); transition: border-color var(--t), background var(--t); }
.module-tile:hover { border-color: var(--accent-border); background: var(--surface-2); }
.module-tile-icon { font-size: 22px; color: var(--accent); background: var(--accent-tint); border-radius: var(--r); padding: 8px; }
.module-tile-body { display: flex; flex-direction: column; min-width: 0; }
.module-tile-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.module-tile-group { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* ━━ RESPONSIVE SHELL ━━ */
@media (max-width: 900px) {
    .app-main { padding: 16px 16px 40px; }
    .tab-content { padding: 14px; }
    .tab-nav { padding: 0; }
    .form-actions { padding: 12px 14px; }
    .app-sidebar {
        position: fixed; top: var(--topbar-h); left: 0; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); width: 268px; min-width: 268px; z-index: 950;
        transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--shadow-pop);
    }
    .app-sidebar.sidebar-closed { width: 268px !important; min-width: 268px !important; border-right: 1px solid var(--border); }
    .app-sidebar.sidebar-open { transform: none; }
    .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(27,26,23,.4); z-index: 940; }
    .topbar-search { min-width: 0; flex: 1; max-width: none; }
}
@media (max-width: 800px) {
    /* older pages lay out cards with inline grids that have no small-screen fallback */
    [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
    .app-main > * { min-width: 0; }
    /* wide tables scroll inside their card instead of widening the page */
    .page-card, .section-card { overflow-x: auto; }
}
@media (max-width: 640px) {
    .topbar-user, .topbar-link, .topbar-user-name { display: none; }
    .page-hdr h1 { font-size: 20px; }
}

/* ━━ LEGACY INLINE COLOURS ━━
   Older pages style some elements inline with the previous palette. These rules remap those exact
   values to the tokens (and lift #94A3B8 text, which is below 4.5:1) without editing the pages.
   New code should use the tokens directly (var(--accent), var(--ink-3), ...). */
[style*="color:#94A3B8" i], [style*="color: #94A3B8" i], [style*="color:#64748B" i], [style*="color: #64748B" i], [style*="color:#9CA3AF" i], [style*="color: #9CA3AF" i] { color: var(--ink-3) !important; }
[style*="color:#475569" i], [style*="color: #475569" i], [style*="color:#334155" i], [style*="color: #334155" i], [style*="color:#374151" i] { color: var(--ink-2) !important; }
[style*="color:#0F172A" i], [style*="color: #0F172A" i], [style*="color:#111827" i] { color: var(--ink) !important; }
[style*="color:#2563EB" i], [style*="color: #2563EB" i], [style*="color:#1D4ED8" i], [style*="color: #1D4ED8" i], [style*="color:#3B82F6" i] { color: var(--accent) !important; }
[style*="background:#EEF2FF" i], [style*="background:#EFF6FF" i], [style*="background: #EFF6FF" i] { background: var(--accent-tint) !important; }
[style*="accent-color:#2563EB" i], [style*="accent-color: #2563EB" i] { accent-color: var(--accent) !important; }
[style*="background:#2563EB" i], [style*="background: #2563EB" i], [style*="linear-gradient(135deg,#2563EB" i], [style*="linear-gradient(90deg,#2563EB" i] { background: var(--accent) !important; }
[style*="linear-gradient(145deg, #0F172A" i] { background: var(--hero-bg) !important; }
[style*="border-color: #2563EB" i], [style*="border-color:#2563EB" i] { border-color: var(--accent) !important; }

/* ━━ SEMANTIC DATA COLOURS (status / environment) ━━
   Pages colour charts and chips with fixed hex values from code. Fills get muted chart tones; text uses the
   dark status colours so labels stay above 4.5:1 on their tinted chips. */
:root { --chart-ok: #2F8F5B; --chart-warn: #C47F17; --chart-danger: #C4493F; --chart-info: #3F72A8; --chart-violet: #7A5BB5; --chart-gray: #8B877D; --chart-slate: #6B6A66; }
[fill="#22C55E" i] { fill: var(--chart-ok); }      [style*="background:#22C55E" i] { background: var(--chart-ok) !important; }      [style*="color:#22C55E" i] { color: var(--ok) !important; }
[fill="#F59E0B" i] { fill: var(--chart-warn); }    [style*="background:#F59E0B" i] { background: var(--chart-warn) !important; }    [style*="color:#F59E0B" i] { color: var(--warn) !important; }
[fill="#EF4444" i] { fill: var(--chart-danger); }  [style*="background:#EF4444" i] { background: var(--chart-danger) !important; }  [style*="color:#EF4444" i] { color: var(--danger) !important; }
[fill="#2563EB" i] { fill: var(--chart-info); }    [style*="background:#2563EB" i] { background: var(--chart-info) !important; }
[fill="#8B5CF6" i] { fill: var(--chart-violet); }  [style*="background:#8B5CF6" i] { background: var(--chart-violet) !important; }  [style*="color:#8B5CF6" i] { color: var(--violet) !important; }
[fill="#94A3B8" i] { fill: var(--chart-gray); }    [style*="background:#94A3B8" i] { background: var(--chart-gray) !important; }
[fill="#64748B" i] { fill: var(--chart-slate); }   [style*="background:#64748B" i] { background: var(--chart-slate) !important; }


/* ===== CHARTS (shared by every module's dashboard widgets) ===== */
.chart-empty { color: var(--ink-3); font-size: 13px; padding: 16px 0; text-align: center; }
.donut { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.donut-svg { width: 168px; height: 168px; }
.donut-total { font-family: var(--mono); font-size: 30px; font-weight: 500; fill: var(--ink); font-variant-numeric: tabular-nums; }
.donut-caption { font-size: 11px; fill: var(--ink-3); }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend strong { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.chart-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(72px, 36%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-weight: 500; }
.bar-track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; min-width: 3px; }
.bar-value { font-family: var(--mono); font-weight: 500; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat-tile { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface-2); }
.stat-tile-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.stat-tile-value { font-family: var(--mono); font-size: 1.75rem; font-weight: 500; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-tile-sub { font-size: 12px; color: var(--ink-3); }
.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.widget-list li:last-child { border-bottom: none; }
.widget-list .wl-main { min-width: 0; }
.widget-list .wl-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-list .wl-sub { font-size: 12px; color: var(--ink-3); }
.widget-list .wl-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* ===== DASHBOARD (shortcuts + customisable widget grid) ===== */
.dash-section-title { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 24px; }
.shortcut { position: relative; display: flex; }
.shortcut-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600; transition: border-color var(--t), background var(--t); }
.shortcut-link:hover { border-color: var(--accent-border); background: var(--surface-2); }
.shortcut-icon { font-size: 20px !important; color: var(--accent); background: var(--accent-tint); border-radius: var(--r); padding: 6px; flex-shrink: 0; }
.shortcut-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shortcut-remove { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: background var(--t), color var(--t), border-color var(--t); }
.shortcut-remove:hover { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.shortcut-remove .material-icons { font-size: 14px; }
.shortcut-add { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 10px 14px; border: 1.5px dashed var(--control-border); border-radius: var(--r-lg); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: border-color var(--t), color var(--t), background var(--t); }
.shortcut-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }

.dash-widgets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dash-widget { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.dash-widget.size-1 { grid-column: span 2; }
.dash-widget.size-2 { grid-column: span 3; }
.dash-widget.size-3 { grid-column: span 6; }
.dash-widgets.is-editing .dash-widget { border-style: dashed; border-color: var(--control-border); }
.dash-widget-hdr { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.dash-widget-hdr .material-icons { font-size: 17px !important; color: var(--accent); }
.dash-widget-hdr h2 { margin: 0; flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-widget-tools { display: flex; gap: 2px; flex-shrink: 0; }
.dash-tool { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 4px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-2); font-family: var(--mono); font-size: 11px; font-weight: 600; cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t); }
.dash-tool:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); border-color: var(--border-strong); }
.dash-tool:disabled { opacity: .35; cursor: default; }
.dash-tool .material-icons { font-size: 17px; }
.dash-widget-body { padding: 14px 16px 16px; min-width: 0; }

.dash-add-panel { margin-top: 18px; background: var(--surface); border: 1.5px dashed var(--control-border); border-radius: var(--r-lg); padding: 14px 18px; }
.dash-add-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dash-add-item:last-child { border-bottom: none; }
.dash-add-item .material-icons { color: var(--accent); background: var(--accent-tint); border-radius: var(--r); padding: 6px; font-size: 20px !important; }
.dash-add-text { flex: 1; min-width: 0; }
.dash-add-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.dash-add-sub { font-size: 12.5px; color: var(--ink-3); }
.dash-note { font-size: 13px; color: var(--ink-3); margin: 0 0 16px; }

.pin-list { max-height: 52vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.pin-group { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 4px; }
.pin-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r); }
.pin-row:hover { background: var(--surface-2); }
.pin-row .material-icons { font-size: 18px !important; color: var(--ink-3); }
.pin-row-title { flex: 1; font-size: 13.5px; color: var(--ink); }
.pin-row-sub { font-size: 12px; color: var(--ink-3); }

@media (max-width: 1100px) { .dash-widget.size-1 { grid-column: span 3; } }
@media (max-width: 800px)  { .dash-widget.size-1, .dash-widget.size-2, .dash-widget.size-3 { grid-column: span 6; } }


/* ===== DARK THEME =====
   The same system with the tokens swapped: warm near-black "ink" surfaces, light ink text, a lifted pine accent.
   Selected by <html data-theme="dark">, which a script in <head> sets before first paint (saved choice, else the OS setting).
   Contrast (checked offline and re-checked in the browser): text >= 4.5:1, control borders >= 3:1. */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #12110F;
    --surface: #1B1A17;
    --surface-2: #22211D;
    --surface-3: #2D2B26;
    --rail: #171613;

    --border: #2F2D28;
    --border-strong: #46433B;
    --control-border: #8B877D;

    --ink: #EDEAE2;
    --ink-2: #CFCBC0;
    --ink-3: #A8A498;
    --ink-4: #9A968B;

    --accent: #5FB6D4;
    --accent-hover: #7ACBE2;
    --accent-ink: #06202B;
    --accent-tint: #163039;
    --accent-tint-2: #1C3C47;
    --accent-border: #2C5A6A;
    --focus: #7ACBE2;
    --ring: 0 0 0 3px rgba(122, 203, 226, .30);

    --ok: #5DC38A;      --ok-tint: #15291E;
    --warn: #E0A33A;    --warn-tint: #2C2310;
    --danger: #F08074;  --danger-tint: #301917;
    --info: #7FB0E6;    --info-tint: #16263A;
    --violet: #B79BEA;  --violet-tint: #241B38;

    --danger-border: #6B2E29;  --warn-border: #6B5320;  --info-border: #2D4D70;  --ok-border: #2C5E43;
    --danger-solid: #C4382F;   --danger-solid-hover: #D9534A;
    --hero-bg: #2B2A25;
    --mark-bg: #5A4A12;

    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .04);

    --chart-ok: #4FBF83; --chart-warn: #D9A03A; --chart-danger: #E5675B; --chart-info: #6FA3DB;
    --chart-violet: #A98BE0; --chart-gray: #8B877D; --chart-slate: #A8A69E;

    /* MudBlazor reads its own palette variables; point the ones the app uses at the tokens */
    --mud-palette-primary: #5FB6D4;  --mud-palette-primary-text: #06202B;
    --mud-palette-primary-darken: #7ACBE2;  --mud-palette-primary-lighten: #7ACBE2;
    --mud-palette-primary-hover: rgba(95, 182, 212, .14);  --mud-palette-primary-rgb: 95, 182, 212;
    --mud-palette-surface: #1B1A17;  --mud-palette-background: #12110F;  --mud-palette-background-gray: #2D2B26;
    --mud-palette-drawer-background: #171613;  --mud-palette-drawer-text: #CFCBC0;  --mud-palette-drawer-icon: #A8A498;
    --mud-palette-appbar-background: #1B1A17;  --mud-palette-appbar-text: #EDEAE2;
    --mud-palette-text-primary: #EDEAE2;  --mud-palette-text-secondary: #CFCBC0;  --mud-palette-text-disabled: #8B877D;
    --mud-palette-text-primary-rgb: 237, 234, 226;
    --mud-palette-action-default: #A8A498;  --mud-palette-action-default-hover: rgba(237, 234, 226, .08);
    --mud-palette-action-disabled: #46433B;  --mud-palette-action-disabled-background: #2D2B26;
    --mud-palette-divider: #2F2D28;  --mud-palette-divider-light: #2D2B26;  --mud-palette-divider-rgb: 47, 45, 40;
    --mud-palette-lines-default: #2F2D28;  --mud-palette-lines-inputs: #8B877D;
    --mud-palette-table-lines: #2F2D28;  --mud-palette-table-hover: #22211D;  --mud-palette-table-striped: #22211D;
    --mud-palette-success: #5DC38A;  --mud-palette-success-text: #0C1A14;
    --mud-palette-warning: #E0A33A;  --mud-palette-warning-text: #0C1A14;
    --mud-palette-error: #F08074;    --mud-palette-error-text: #0C1A14;
    --mud-palette-info: #7FB0E6;     --mud-palette-info-text: #0C1A14;
    --mud-palette-overlay-dark: rgba(0, 0, 0, .6);  --mud-palette-overlay-light: rgba(0, 0, 0, .4);
    --mud-palette-skeleton: rgba(255, 255, 255, .08);
}

/* the logo mark keeps its shape and takes the lifted accent */
html[data-theme="dark"] .topbar-title::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='6' fill='%235FB6D4'/%3E%3Cg stroke='%2306202B' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M7 8.5l5 3.5M17 8.5l-5 3.5M12 12v5.5'/%3E%3C/g%3E%3Cg fill='%2306202B'%3E%3Ccircle cx='7' cy='8.5' r='2'/%3E%3Ccircle cx='17' cy='8.5' r='2'/%3E%3Ccircle cx='12' cy='17.5' r='2'/%3E%3C/g%3E%3C/svg%3E");
}

/* theme switch in the top bar */
.topbar-theme-btn {
    background: transparent; border: 1px solid transparent; color: var(--ink-2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--r); flex-shrink: 0;
    transition: background var(--t), color var(--t), border-color var(--t);
}
.topbar-theme-btn:hover { background: var(--surface-3); color: var(--ink); }

/* ----- legacy inline colours, remapped in dark only -----
   Older module pages still carry literal light-theme hex values in style attributes. In dark they would show as
   bright blocks, so each family is pointed at the matching token. Order matters: generic rules first, tints after. */
html[data-theme="dark"] [style*="background:#fff" i], html[data-theme="dark"] [style*="background: #fff" i],
html[data-theme="dark"] [style*="background:white" i], html[data-theme="dark"] [style*="background: white" i],
html[data-theme="dark"] [style*="background-color:#fff" i], html[data-theme="dark"] [style*="background-color: #fff" i] { background: var(--surface) !important; }
html[data-theme="dark"] [style*="background:#F8FAFC" i], html[data-theme="dark"] [style*="background: #F8FAFC" i],
html[data-theme="dark"] [style*="background:#F9FAFB" i], html[data-theme="dark"] [style*="background:#FAFAFA" i] { background: var(--surface-2) !important; }
html[data-theme="dark"] [style*="background:#F1F5F9" i], html[data-theme="dark"] [style*="background: #F1F5F9" i],
html[data-theme="dark"] [style*="background:#F3F4F6" i], html[data-theme="dark"] [style*="background:#E2E8F0" i],
html[data-theme="dark"] [style*="background: #E2E8F0" i] { background: var(--surface-3) !important; }
html[data-theme="dark"] [style*="background:#EFF6FF" i], html[data-theme="dark"] [style*="background: #EFF6FF" i],
html[data-theme="dark"] [style*="background:#DBEAFE" i], html[data-theme="dark"] [style*="background:#EEF2FF" i],
html[data-theme="dark"] [style*="background:#E0E7FF" i] { background: var(--accent-tint) !important; }
html[data-theme="dark"] [style*="background:#FEF2F2" i], html[data-theme="dark"] [style*="background:#FEE2E2" i],
html[data-theme="dark"] [style*="background: #FEE2E2" i], html[data-theme="dark"] [style*="background:#FECACA" i] { background: var(--danger-tint) !important; }
html[data-theme="dark"] [style*="background:#FFFBEB" i], html[data-theme="dark"] [style*="background:#FEF3C7" i],
html[data-theme="dark"] [style*="background: #FEF3C7" i], html[data-theme="dark"] [style*="background:#FDE68A" i] { background: var(--warn-tint) !important; }
html[data-theme="dark"] [style*="background:#F0FDF4" i], html[data-theme="dark"] [style*="background:#DCFCE7" i],
html[data-theme="dark"] [style*="background: #DCFCE7" i], html[data-theme="dark"] [style*="background:#BBF7D0" i] { background: var(--ok-tint) !important; }
html[data-theme="dark"] [style*="background:#EDE9FE" i], html[data-theme="dark"] [style*="background:#F5F3FF" i] { background: var(--violet-tint) !important; }

html[data-theme="dark"] [style*="#E2E8F0" i], html[data-theme="dark"] [style*="#E5E7EB" i] { border-color: var(--border) !important; }
html[data-theme="dark"] [style*="#CBD5E1" i], html[data-theme="dark"] [style*="#D1D5DB" i] { border-color: var(--border-strong) !important; }
html[data-theme="dark"] [style*="border:1px solid #FECACA" i], html[data-theme="dark"] [style*="border: 1px solid #FECACA" i] { border-color: var(--danger-border) !important; }
html[data-theme="dark"] [style*="border:1px solid #FDE68A" i], html[data-theme="dark"] [style*="border: 1px solid #FDE68A" i] { border-color: var(--warn-border) !important; }
html[data-theme="dark"] [style*="border:1px solid #BBF7D0" i], html[data-theme="dark"] [style*="border: 1px solid #BBF7D0" i] { border-color: var(--ok-border) !important; }

html[data-theme="dark"] [style*="color:#6B7280" i], html[data-theme="dark"] [style*="color: #6B7280" i] { color: var(--ink-3) !important; }
html[data-theme="dark"] [style*="color:#CBD5E1" i], html[data-theme="dark"] [style*="color:#D1D5DB" i] { color: var(--ink-4) !important; }
html[data-theme="dark"] [style*="color:#1E293B" i] { color: var(--ink) !important; }
html[data-theme="dark"] [style*="color:#DC2626" i], html[data-theme="dark"] [style*="color:#B91C1C" i],
html[data-theme="dark"] [style*="color:#991B1B" i], html[data-theme="dark"] [style*="color: #DC2626" i] { color: var(--danger) !important; }
html[data-theme="dark"] [style*="color:#16A34A" i], html[data-theme="dark"] [style*="color:#15803D" i],
html[data-theme="dark"] [style*="color:#166534" i], html[data-theme="dark"] [style*="color: #16A34A" i] { color: var(--ok) !important; }
html[data-theme="dark"] [style*="color:#B45309" i], html[data-theme="dark"] [style*="color:#92400E" i],
html[data-theme="dark"] [style*="color:#D97706" i], html[data-theme="dark"] [style*="color: #B45309" i] { color: var(--warn) !important; }
html[data-theme="dark"] [style*="color:#7C3AED" i] { color: var(--violet) !important; }

/* a filled accent surface carries dark ink in dark mode, so legacy "white on blue" must flip with it */
html[data-theme="dark"] [style*="2563EB" i][style*="color:#fff" i], html[data-theme="dark"] [style*="2563EB" i][style*="color: #fff" i],
html[data-theme="dark"] [style*="2563EB" i][style*="color:white" i] { color: var(--accent-ink) !important; }
.topbar-theme-btn .theme-icon-to-light { display: none; }
html[data-theme="dark"] .topbar-theme-btn .theme-icon-to-dark { display: none; }
html[data-theme="dark"] .topbar-theme-btn .theme-icon-to-light { display: inline-block; }
/* white icon glyphs on a filled accent button flip to the button ink in dark */
html[data-theme="dark"] .action-btn-primary .material-icons, html[data-theme="dark"] .btn-primary .material-icons { color: var(--accent-ink) !important; }
