/* ==========================================================================
   BIXmonitor — Design System
   "Control Room": dark-first operational UI with a light theme.
   Layers: tokens → base → shell → components → auth/public → utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
    color-scheme: dark;

    /* Brand */
    --accent: #19d3bb;
    --accent-strong: #5ff0dc;
    --accent-ink: #04211d;
    --accent-soft: rgba(25, 211, 187, 0.12);
    --accent-line: rgba(25, 211, 187, 0.32);

    /* Semantic */
    --success: #34d77f;
    --success-soft: rgba(52, 215, 127, 0.14);
    --warning: #ffb547;
    --warning-soft: rgba(255, 181, 71, 0.14);
    --danger: #ff6b81;
    --danger-soft: rgba(255, 107, 129, 0.14);
    --info: #7aaeff;
    --info-soft: rgba(122, 174, 255, 0.14);
    --neutral: #9fb1b6;
    --neutral-soft: rgba(159, 177, 182, 0.14);

    /* Surfaces */
    --bg: #0a0f12;
    --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(25, 211, 187, 0.09), transparent 60%),
               radial-gradient(900px 500px at -10% 110%, rgba(122, 174, 255, 0.06), transparent 60%);
    --surface: #10181c;
    --surface-2: #162126;
    --surface-3: #1c2a30;
    --sidebar-bg: #0c1316;
    --topbar-bg: rgba(10, 15, 18, 0.72);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --grid-line: rgba(255, 255, 255, 0.035);

    /* Text */
    --text: #e8f0f1;
    --text-2: #b3c2c6;
    --muted: #8a9ea3;
    --faint: #5f7378;

    /* Elevation */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-2: 0 18px 60px rgba(0, 0, 0, 0.45);
    --ring: 0 0 0 3px rgba(25, 211, 187, 0.28);

    /* Shape & motion */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --fast: 140ms var(--ease);
    --normal: 220ms var(--ease);

    /* Type */
    --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
    /* aliases used by later components (AI, board, ticker) */
    --font: var(--font-ui);
    --display: var(--font-display);
    --mono: var(--font-mono);
    --text-muted: var(--muted);
    --surface-1: var(--surface);
    --radius: var(--r-lg);

    /* Layout */
    --sidebar-w: 264px;
    --sidebar-rail: 76px;
    --topbar-h: 64px;
    --content-max: 1480px;
    --gutter: clamp(18px, 3vw, 40px);
}

[data-theme="light"] {
    color-scheme: light;

    --accent: #0ea896;
    --accent-strong: #0b8f80;
    --accent-ink: #ffffff;
    --accent-soft: rgba(14, 168, 150, 0.12);
    --accent-line: rgba(14, 168, 150, 0.35);

    --success: #1f9d5c;
    --success-soft: rgba(31, 157, 92, 0.12);
    --warning: #c47a00;
    --warning-soft: rgba(196, 122, 0, 0.12);
    --danger: #d8384f;
    --danger-soft: rgba(216, 56, 79, 0.12);
    --info: #2f6fd8;
    --info-soft: rgba(47, 111, 216, 0.12);
    --neutral: #5f7378;
    --neutral-soft: rgba(95, 115, 120, 0.12);

    --bg: #f3f6f7;
    --bg-glow: radial-gradient(1200px 600px at 85% -10%, rgba(14, 168, 150, 0.10), transparent 60%),
               radial-gradient(900px 500px at -10% 110%, rgba(47, 111, 216, 0.06), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f2f6f7;
    --surface-3: #e8eff1;
    --sidebar-bg: #0c1316;
    --topbar-bg: rgba(243, 246, 247, 0.78);
    --border: rgba(16, 26, 30, 0.10);
    --border-strong: rgba(16, 26, 30, 0.18);
    --grid-line: rgba(16, 26, 30, 0.05);

    --text: #101a1e;
    --text-2: #33454b;
    --muted: #5f7378;
    --faint: #8a9ea3;

    --shadow-1: 0 1px 2px rgba(16, 26, 30, 0.06), 0 8px 24px rgba(16, 26, 30, 0.06);
    --shadow-2: 0 18px 60px rgba(16, 26, 30, 0.14);
    --ring: 0 0 0 3px rgba(14, 168, 150, 0.30);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg-glow), var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--fast);
}

a:hover {
    color: var(--accent-strong);
}

code,
kbd,
pre,
.mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

code {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--accent-strong);
}

pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    line-height: 1.5;
}

kbd {
    padding: 2px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface-2);
    font-size: 11px;
}

svg.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--r-sm);
}

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    transition: grid-template-columns var(--normal);
}

.app-shell.is-collapsed {
    grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    color: #dfe9eb;
    z-index: 60;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(420px 220px at 20% -5%, rgba(25, 211, 187, 0.16), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: auto, 100% 28px, 28px 100%;
    mask-image: linear-gradient(to bottom, #000 0, #000 45%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 45%, transparent 100%);
    opacity: 0.9;
}

.sidebar > * {
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 16px;
    min-height: var(--topbar-h);
    color: inherit;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(25, 211, 187, 0.25), rgba(25, 211, 187, 0.05));
    border: 1px solid rgba(25, 211, 187, 0.35);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(25, 211, 187, 0.16);
    color: #19d3bb;
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #f2f8f8;
}

.brand-name em {
    font-style: normal;
    color: #19d3bb;
}

.brand-sub {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7f959a;
    margin-top: 4px;
}

.nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 12px 16px;
}

.nav-section {
    padding-top: 16px;
}

.nav-label {
    display: block;
    padding: 0 12px 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #61777c;
    white-space: nowrap;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: var(--r-md);
    color: #a9bcc0;
    font-weight: 500;
    font-size: 13.5px;
    white-space: nowrap;
    transition: background var(--fast), color var(--fast);
}

.nav-item .icon {
    width: 19px;
    height: 19px;
    color: #7f959a;
    transition: color var(--fast);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #eef5f5;
}

.nav-item:hover .icon {
    color: #c5d6d8;
}

.nav-item[aria-current="page"] {
    background: rgba(25, 211, 187, 0.11);
    color: #eafaf7;
}

.nav-item[aria-current="page"] .icon {
    color: #19d3bb;
}

.nav-item[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #19d3bb;
    box-shadow: 0 0 12px rgba(25, 211, 187, 0.8);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 12px;
    background: rgba(0, 0, 0, 0.18);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--r-md);
    min-width: 0;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #1c3a3d, #123033);
    border: 1px solid rgba(25, 211, 187, 0.35);
    color: #7ff0e0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.04em;
}

.avatar.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.user-meta {
    min-width: 0;
    line-height: 1.25;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: #eef5f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 11.5px;
    color: #7f959a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card .btn-icon {
    margin-left: auto;
    color: #8fa3a8;
}

.user-card .btn-icon:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.sidebar-collapse {
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 44px;
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    z-index: 61;
    padding: 0;
    display: grid;
    place-items: center;
}

.sidebar-collapse .icon {
    width: 14px;
    height: 14px;
    transition: transform var(--normal);
}

.is-collapsed .sidebar-collapse .icon {
    transform: rotate(180deg);
}

/* Collapsed rail */
.is-collapsed .brand-text,
.is-collapsed .nav-label,
.is-collapsed .nav-item > span:not(.icon),
.is-collapsed .user-meta,
.is-collapsed .user-card .btn-icon {
    display: none;
}

.is-collapsed .brand {
    justify-content: center;
    padding-inline: 0;
}

.is-collapsed .nav-item {
    justify-content: center;
    padding: 11px 0;
}

.is-collapsed .nav-section {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 8px;
}

.is-collapsed .user-card {
    justify-content: center;
    padding: 6px 0;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 var(--gutter);
    background: var(--topbar-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
}

.topbar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.topbar-title .crumbs {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar-title h1 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-spacer {
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
}

.clock .pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2.4s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 215, 127, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(52, 215, 127, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 215, 127, 0); }
}

.env-chip {
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid var(--border-strong);
    color: var(--muted);
    background: var(--surface);
}

.env-chip.is-production {
    color: var(--warning);
    border-color: rgba(255, 181, 71, 0.4);
    background: var(--warning-soft);
}

.btn.menu-toggle {
    display: none;
}

.page {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: clamp(22px, 3vw, 36px) var(--gutter) 64px;
    animation: rise 320ms var(--ease) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.page-header h1 {
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.page-header .lede {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 26px 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--normal);
}

/* --------------------------------------------------------------------------
   4. Components
   -------------------------------------------------------------------------- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text);
    background: var(--surface-2);
    transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast);
    -webkit-user-select: none;
    user-select: none;
}

.btn .icon {
    width: 16px;
    height: 16px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent-strong), var(--accent));
    color: var(--accent-ink);
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(25, 211, 187, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 10px 26px rgba(25, 211, 187, 0.3);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-3);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(255, 107, 129, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 107, 129, 0.22);
}

.btn-sm {
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: var(--r-sm);
}

.btn-lg {
    padding: 13px 22px;
    font-size: 15px;
    border-radius: 12px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--r-md);
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
}

.btn-icon:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-icon .icon {
    width: 18px;
    height: 18px;
}

/* Forms */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field label,
.field-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}

.field-hint {
    font-size: 12px;
    color: var(--muted);
}

.input,
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--faint);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}

input[readonly],
input[readonly]:focus {
    color: var(--text-2);
    background: var(--surface);
    border-style: dashed;
    box-shadow: none;
    cursor: default;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 32px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 6px;
}

.error-message {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

input.error,
select.error {
    border-color: var(--danger);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.card + .card {
    margin-top: 18px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 9px;
}

.card-header h2 .icon,
.card-header h3 .icon {
    color: var(--accent);
    width: 17px;
    height: 17px;
}

.card-header .sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--muted);
    font-family: var(--font-ui);
    font-weight: 400;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
}

/* Stat tiles */
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    --tone: var(--accent);
    --tone-soft: var(--accent-soft);
}

.stat-link { color: inherit; text-decoration: none; cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.stat-link:hover { border-color: var(--tone); transform: translateY(-1px); text-decoration: none; }
.stat-link:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }

.stat::after {
    content: "";
    position: absolute;
    inset: auto -40px -60px auto;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tone-soft), transparent 68%);
    pointer-events: none;
}

.stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--tone-soft);
    color: var(--tone);
    border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}

.stat-icon .icon {
    width: 22px;
    height: 22px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--muted);
}

.stat-meta {
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--tone);
    font-family: var(--font-mono);
}

.stat.tone-success { --tone: var(--success); --tone-soft: var(--success-soft); }
.stat.tone-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.stat.tone-danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft); }
.stat.tone-info    { --tone: var(--info);    --tone-soft: var(--info-soft); }

/* Health bar + ring */
.health {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 26px;
    align-items: center;
    padding: 22px 20px 26px;
}

.ring {
    --pct: 0;
    --tone: var(--success);
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%),
        conic-gradient(var(--tone) calc(var(--pct) * 1%), var(--surface-3) 0);
    display: grid;
    place-items: center;
}

.ring-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.ring-value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    margin-left: 1px;
}

.ring-label {
    position: absolute;
    bottom: -22px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10.5px;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.bar {
    display: flex;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-3);
    gap: 2px;
}

.bar-seg {
    height: 100%;
    min-width: 0;
    transition: width 600ms var(--ease);
}

.bar-seg.online  { background: var(--success); }
.bar-seg.offline { background: var(--warning); }
.bar-seg.error   { background: var(--danger); }
.bar-seg.pending { background: var(--neutral); }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-2);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-item .mono {
    color: var(--text);
    font-weight: 600;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--neutral);
}

.dot.online, .dot.success, .dot.completed, .dot.processed, .dot.active { background: var(--success); }
.dot.offline, .dot.warning, .dot.pending, .dot.inactive { background: var(--warning); }
.dot.error, .dot.danger, .dot.failed, .dot.suspended { background: var(--danger); }
.dot.running, .dot.info, .dot.local, .dot.entra_id { background: var(--info); }

/* Tables */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr {
    transition: background var(--fast);
}

.table tbody tr:hover {
    background: var(--accent-soft);
}

.table .primary {
    color: var(--text);
    font-weight: 600;
}

.table .num {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.table .mono {
    color: var(--text-2);
}

.table .actions {
    text-align: right;
    white-space: nowrap;
}

.table .actions .row-edit {
    text-align: left;
}

.table-empty td {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}

.table-empty:hover {
    background: transparent !important;
}

/* Inline edit inside table rows */
.row-edit {
    display: inline-block;
}

.row-edit[open] {
    display: block;
}

.row-edit summary {
    list-style: none;
    display: inline-flex;
    cursor: pointer;
}

.row-edit summary::-webkit-details-marker {
    display: none;
}

.row-edit[open] summary .btn {
    background: var(--surface-3);
    color: var(--text);
}

.row-edit form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    min-width: 320px;
}

.row-edit form > * {
    flex: 1 1 140px;
}

.row-edit form > .btn {
    flex: 0 0 auto;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 7px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--neutral);
    background: var(--neutral-soft);
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-success, .badge-online, .badge-completed, .badge-processed, .badge-active {
    color: var(--success);
    background: var(--success-soft);
}

.badge-warning, .badge-offline, .badge-pending, .badge-inactive {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge-danger, .badge-error, .badge-failed, .badge-suspended {
    color: var(--danger);
    background: var(--danger-soft);
}

.badge-info, .badge-running, .badge-local, .badge-entra_id {
    color: var(--info);
    background: var(--info-soft);
}

.badge-accent {
    color: var(--accent);
    background: var(--accent-soft);
}

.badge-running::before {
    animation: blink 1.2s infinite;
}

@keyframes blink {
    50% { opacity: 0.25; }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.tabs.tabs-vertical {
    flex-direction: column;
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
}

.tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
}

.tab .icon {
    width: 17px;
    height: 17px;
}

.tab:hover {
    color: var(--text);
    background: var(--surface-2);
}

.tab.active,
.tab[aria-selected="true"] {
    color: var(--text);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent-line);
}

.tab.active .icon,
.tab[aria-selected="true"] .icon {
    color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: rise 220ms var(--ease) both;
}

/* Alerts */
.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.5;
}

.alert .icon {
    margin-top: 2px;
    width: 17px;
    height: 17px;
}

.alert strong {
    color: var(--text);
}

.alert-info    { border-color: rgba(122, 174, 255, 0.35); background: var(--info-soft); }
.alert-info .icon { color: var(--info); }
.alert-success { border-color: rgba(52, 215, 127, 0.35); background: var(--success-soft); }
.alert-success .icon { color: var(--success); }
.alert-warning { border-color: rgba(255, 181, 71, 0.4); background: var(--warning-soft); }
.alert-warning .icon { color: var(--warning); }
.alert-danger  { border-color: rgba(255, 107, 129, 0.4); background: var(--danger-soft); }
.alert-danger .icon { color: var(--danger); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface);
    transition: background var(--fast), color var(--fast), border-color var(--fast);
}

.pagination a:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.pagination a.active {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: var(--accent);
}

.pagination span {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

/* Toasts (used by app.js showNotification) */
.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 40px));
}

.toast {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow-2);
    animation: rise 220ms var(--ease) both;
    --tone: var(--info);
}

.toast::before {
    content: "";
    width: 3px;
    align-self: stretch;
    border-radius: 3px;
    background: var(--tone);
}

.toast-success { --tone: var(--success); }
.toast-error   { --tone: var(--danger); }
.toast-warning { --tone: var(--warning); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-content strong {
    display: block;
    font-size: 13.5px;
}

.toast-content p {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 2px;
}

.toast-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
}

/* Empty state */
.empty {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 46px 20px;
    color: var(--muted);
}

.empty .icon {
    width: 34px;
    height: 34px;
    color: var(--faint);
    margin-bottom: 10px;
}

.empty strong {
    display: block;
    color: var(--text-2);
    font-weight: 600;
    margin-bottom: 4px;
}

/* Key / value list */
.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 22px;
    font-size: 13.5px;
}

.kv dt {
    color: var(--muted);
}

.kv dd {
    margin: 0;
    color: var(--text);
    font-family: var(--font-mono);
    word-break: break-all;
}

/* Steps (instructions) */
.steps {
    counter-reset: step;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.steps > li {
    position: relative;
    padding-left: 40px;
    font-size: 13.5px;
    color: var(--text-2);
}

.steps > li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
}

.steps > li strong {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.steps ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.steps li li {
    margin: 3px 0;
}

.endpoint {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.endpoint-head h4 {
    font-size: 14px;
}

.method {
    padding: 2px 8px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent-ink);
    background: var(--accent);
}

.method.post {
    background: var(--info);
    color: #fff;
}

.endpoint pre {
    background: var(--surface);
}

.endpoint p {
    font-size: 13px;
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   5. Auth & public layouts (no sidebar)
   -------------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px clamp(28px, 5vw, 72px);
    background: #0b1417;
    color: #e6f0f1;
    isolation: isolate;
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(700px 500px at 20% 15%, rgba(25, 211, 187, 0.22), transparent 60%),
        radial-gradient(600px 500px at 90% 90%, rgba(122, 174, 255, 0.16), transparent 60%),
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: auto, auto, 36px 36px, 36px 36px;
}

.auth-brand::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 520px;
    height: 520px;
    right: -180px;
    top: 40%;
    border-radius: 50%;
    border: 1px solid rgba(25, 211, 187, 0.2);
    box-shadow: inset 0 0 0 60px rgba(25, 211, 187, 0.03), 0 0 0 80px rgba(25, 211, 187, 0.025);
    animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
    to { transform: translateY(-30px) scale(1.04); }
}

.auth-brand .brand {
    padding: 0;
}

.auth-brand .brand .brand-name {
    font-size: 22px;
}

.auth-hero {
    max-width: 520px;
}

.auth-hero .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid rgba(25, 211, 187, 0.35);
    background: rgba(25, 211, 187, 0.1);
    color: #8ef2e3;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

.auth-hero h2 {
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #f4fafa;
}

.auth-hero h2 em {
    font-style: normal;
    color: #19d3bb;
}

.auth-hero p {
    margin-top: 16px;
    color: #a4b8bc;
    font-size: 15px;
    max-width: 440px;
}

.auth-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #c4d3d6;
    font-size: 12.5px;
}

.pill .icon {
    width: 14px;
    height: 14px;
    color: #19d3bb;
}

.auth-foot {
    font-size: 12px;
    color: #61777c;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 40px clamp(20px, 5vw, 64px);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-card .lede {
    margin-top: 6px;
    color: var(--muted);
    margin-bottom: 26px;
}

.auth-card form {
    display: grid;
    gap: 16px;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--faint);
    font-size: 11.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-help {
    margin-top: 26px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}

.ms-logo {
    width: 16px;
    height: 16px;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5px;
}

.ms-logo i {
    display: block;
}

.ms-logo i:nth-child(1) { background: #f25022; }
.ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; }
.ms-logo i:nth-child(4) { background: #ffb900; }

/* Public landing */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px var(--gutter);
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.landing-nav .brand {
    padding: 0;
    min-height: 0;
    color: var(--text);
}

.landing-nav .brand-name {
    color: var(--text);
}

.landing-nav .brand-sub {
    color: var(--muted);
}

.landing-hero {
    position: relative;
    text-align: center;
    padding: clamp(60px, 10vw, 120px) var(--gutter) clamp(40px, 6vw, 70px);
    max-width: 860px;
    margin: 0 auto;
}

.landing-hero .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

.landing-hero h1 {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.035em;
}

.landing-hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.landing-hero p {
    margin: 18px auto 0;
    max-width: 560px;
    font-size: 16px;
    color: var(--muted);
}

.landing-cta {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px var(--gutter) 80px;
}

.feature {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    transition: transform var(--normal), border-color var(--normal);
}

.feature:hover {
    transform: translateY(-3px);
    border-color: var(--accent-line);
}

.feature .stat-icon {
    margin-bottom: 14px;
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.feature p {
    font-size: 13.5px;
    color: var(--muted);
}

.landing-foot {
    margin-top: auto;
    padding: 20px var(--gutter);
    text-align: center;
    font-size: 12px;
    color: var(--faint);
    border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   6. Utilities
   -------------------------------------------------------------------------- */
.muted   { color: var(--muted); }
.faint   { color: var(--faint); }
.text-2  { color: var(--text-2); }
.strong  { font-weight: 600; color: var(--text); }
.small   { font-size: 12.5px; }
.tiny    { font-size: 11.5px; }
.right   { text-align: right; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.flex    { display: flex; align-items: center; gap: 10px; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; }
.stack   { display: grid; gap: 14px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 26px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Theme toggle shows the icon of the theme you would switch to */
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Settings: sticky vertical tabs beside the content */
.settings-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

/* Cards laid out in a grid must not inherit the stacked-card spacing */
.card-grid > .card + .card {
    margin-top: 0;
}

/* Empty-state rows inside tables */
.table-empty td .icon {
    width: 30px;
    height: 30px;
    color: var(--faint);
    margin-bottom: 8px;
}

.table-empty td strong {
    display: block;
    color: var(--text-2);
    margin-bottom: 4px;
}

/* Input group: input + trailing button sharing one outline */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group > * {
    border-radius: 0;
}

.input-group > :first-child {
    border-radius: var(--r-md) 0 0 var(--r-md);
}

.input-group > :last-child {
    border-radius: 0 var(--r-md) var(--r-md) 0;
}

.input-group > * + * {
    margin-left: -1px;
}

.input-group > .btn {
    flex: 0 0 auto;
    padding-inline: 12px;
}

.input-group > .btn:hover {
    transform: none;
}

/* Stat-icon used outside a stat tile falls back to the accent tone */
.feature .stat-icon {
    --tone: var(--accent);
    --tone-soft: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   7. Notifications: bell, panel, toasts, centre page
   -------------------------------------------------------------------------- */
.bell-wrap {
    position: relative;
}

.bell.has-unread {
    color: var(--text);
}

.bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg);
}

.nav-count {
    margin-left: auto;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.bell-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(380px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    z-index: 120;
    overflow: hidden;
    animation: rise 160ms var(--ease) both;
}

.bell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.bell-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(420px, 60vh);
    overflow-y: auto;
}

.bell-empty {
    padding: 28px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.bell-item + .bell-item {
    border-top: 1px solid var(--border);
}

.bell-item-body {
    display: flex;
    gap: 10px;
    padding: 11px 14px;
    color: inherit;
    cursor: pointer;
    transition: background var(--fast);
}

.bell-item-body:hover {
    background: var(--surface-2);
    color: inherit;
}

.bell-item.is-unread .bell-item-body {
    background: var(--accent-soft);
}

.bell-item.is-unread .bell-item-body:hover {
    background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-2));
}

.bell-dot {
    margin-top: 6px;
}

.bell-text {
    min-width: 0;
    flex: 1;
}

.bell-text strong {
    display: block;
    font-size: 13px;
    color: var(--text);
}

.bell-text p {
    font-size: 12.5px;
    color: var(--text-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bell-time {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.bell-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 600;
}

.bell-foot a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Toasts sit under the bell; collapsed = one line, expanded = full text */
.toast-stack {
    top: calc(var(--topbar-h) + 10px);
    right: 20px;
    bottom: auto;
    align-items: flex-end;
}

.layout-bare .toast-stack {
    top: 20px;
}

.toast {
    width: min(380px, calc(100vw - 40px));
    cursor: pointer;
    transition: transform var(--fast), opacity var(--fast);
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
}

.toast-content p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.is-expanded {
    cursor: default;
}

.toast.is-expanded .toast-content p {
    white-space: normal;
    overflow: visible;
}

.toast-link {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
}

.toast.is-expanded .toast-link {
    display: inline-block;
}

/* Button spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
    vertical-align: -2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.is-loading {
    opacity: 0.8;
    cursor: progress;
}

/* Notification centre page */
.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notif {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    --tone: var(--info);
}

.notif:last-child {
    border-bottom: 0;
}

.notif-success { --tone: var(--success); }
.notif-warning { --tone: var(--warning); }
.notif-danger  { --tone: var(--danger); }

.notif.is-unread {
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 var(--tone);
}

.notif-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tone) 14%, transparent);
    color: var(--tone);
}

.notif-body {
    min-width: 0;
    flex: 1;
}

.notif-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
}

.notif-message {
    margin-top: 3px;
    color: var(--text-2);
    font-size: 13.5px;
}

.notif-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.linklike {
    border: 0;
    padding: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.linklike:hover {
    color: var(--accent-strong);
}

.tab .dot {
    margin-left: auto;
}

/* Link to the mobile shell, shown only where the drawer layout applies */
.switch-view {
    display: none;
    padding: 8px 12px 2px;
    font-size: 12px;
    color: #7f959a;
}

.switch-view:hover {
    color: #19d3bb;
}

/* --------------------------------------------------------------------------
   8. Managed systems: navigation group, PBX tiles, meters, sparklines
   -------------------------------------------------------------------------- */
.nav-sub {
    margin: 2px 0 6px 19px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-sub-item {
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 500;
}

.nav-sub-item[aria-current="page"]::before {
    display: none;
}

.is-collapsed .nav-sub {
    display: none;
}

.pbx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 14px;
}

.pbx-tile {
    display: block;
    color: inherit;
    padding: 16px 18px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--neutral);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    transition: transform var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.pbx-tile:hover {
    color: inherit;
    transform: translateY(-2px);
    border-color: var(--accent-line);
    border-top-color: var(--tone, var(--neutral));
    box-shadow: var(--shadow-2);
}

.pbx-tile.st-online   { --tone: var(--success); border-top-color: var(--success); }
.pbx-tile.st-degraded { --tone: var(--warning); border-top-color: var(--warning); }
.pbx-tile.st-offline,
.pbx-tile.st-error    { --tone: var(--danger);  border-top-color: var(--danger); }

.pbx-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.pbx-head .dot {
    margin-top: 6px;
}

.pbx-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15.5px;
    color: var(--text);
}

.pbx-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}

.pbx-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 14px;
    margin-top: 14px;
}

.pbx-metric-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.pbx-metric-value {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.pbx-metric-value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    margin-left: 1px;
}

.text-warning { color: var(--warning); }

.meter {
    height: 5px;
    border-radius: 3px;
    background: var(--surface-3);
    margin-top: 6px;
    overflow: hidden;
}

.meter i {
    display: block;
    height: 100%;
    background: var(--success);
    transition: width 400ms var(--ease);
}

.meter.warn i { background: var(--warning); }
.meter.crit i { background: var(--danger); }

.pbx-msg {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pbx-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 64px;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--muted);
}

.spark {
    width: 120px;
    height: 32px;
    display: block;
}

.spark-wide {
    width: 100%;
    height: 64px;
}

.spark-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
}

.spark-area {
    fill: var(--accent-soft);
}

.spark-empty line {
    stroke: var(--border-strong);
    stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke;
}

.chart-row + .chart-row {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.chart-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.kv-dense {
    font-size: 12.5px;
    gap: 6px 18px;
}

.raw-card summary {
    cursor: pointer;
    list-style: none;
}

.raw-card summary::-webkit-details-marker {
    display: none;
}

.btn-danger-text {
    color: var(--danger);
}

.btn-danger-text:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.page-header h1 .dot {
    width: 12px;
    height: 12px;
}

.auth-mode {
    padding: 14px 16px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.auth-mode .check .badge {
    margin-left: 6px;
}

/* The hidden attribute must win over component display rules */
[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   9. PBX configuration explorer
   -------------------------------------------------------------------------- */
.cfg-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.cfg-nav {
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
    max-height: calc(100vh - var(--topbar-h) - 40px);
    display: flex;
    flex-direction: column;
}

.cfg-nav-head {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.cfg-nav-list {
    overflow-y: auto;
    padding: 6px;
}

.cfg-group {
    padding: 12px 10px 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.cfg-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.cfg-item small {
    margin-left: auto;
    font-size: 10.5px;
}

.cfg-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.cfg-item.is-active {
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--accent-line);
}

.cfg-action span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
}

.cfg-actions summary {
    cursor: pointer;
    list-style: none;
}

.cfg-actions summary::-webkit-details-marker {
    display: none;
}

.cfg-toolbar h2 {
    min-width: 0;
}

.cfg-row {
    cursor: pointer;
}

.cfg-row:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.cfg-table td {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cfg-fields {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cfg-json {
    width: 100%;
    font-size: 12.5px;
    line-height: 1.45;
}

.cfg-raw-out {
    max-height: 480px;
    overflow: auto;
    font-size: 12px;
}

.pagination a.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

textarea.error {
    border-color: var(--danger);
}

/* Search-everything filter boxes and collapsible cards */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.filter-box {
    max-width: 460px;
}

.card-header .filter-box {
    width: 320px;
}

.collapsible > summary {
    cursor: pointer;
    list-style: none;
}

.collapsible > summary::-webkit-details-marker {
    display: none;
}

.collapsible:not([open]) > summary {
    border-bottom: 0;
}

.collapsible[open] .collapsible-hint::after {
    content: "";
}

.collapsible[open] > summary .collapsible-hint {
    visibility: hidden;
}

.btn-gear {
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
}

.filter-bar {
    margin: 22px 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
}

.filter-bar .filter-box {
    max-width: 520px;
}

.filter-bar .icon {
    color: var(--muted);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 16px;
}

/* Directory group search results */
.entra-results {
    display: grid;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
}

.entra-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}

.entra-row.is-imported {
    opacity: 0.7;
}

/* Toggle switch (boolean settings) */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text);
    -webkit-user-select: none;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .track {
    position: relative;
    width: 40px;
    height: 22px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    transition: background var(--fast), border-color var(--fast);
}

.switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform var(--fast), background var(--fast);
}

.switch input:checked + .track {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .track::after {
    background: var(--accent-ink);
    transform: translateX(18px);
}

.switch input:focus-visible + .track {
    box-shadow: var(--ring);
}

.switch input:disabled + .track {
    opacity: 0.5;
}

.switch .switch-state {
    font-size: 12px;
    color: var(--muted);
    min-width: 24px;
}

/* Configuration editor groups */
.cfg-section {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px 16px;
    margin: 0;
    min-width: 0;
}

.cfg-section + .cfg-section {
    margin-top: 14px;
}

.cfg-section > legend {
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.cfg-section .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.cfg-section.is-other {
    border-style: dashed;
}

.cfg-sub {
    grid-column: 1 / -1;
    border: 1px dashed var(--border);
    border-radius: var(--r-sm);
    padding: 10px 12px 12px;
}

.cfg-sub > .field-label {
    display: block;
    margin-bottom: 8px;
}

.cfg-hint {
    font-size: 11.5px;
    color: var(--muted);
}

.cfg-select-col {
    width: 34px;
}

.cfg-bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--accent-soft);
    font-size: 13px;
}

.cfg-bulk-panel .form-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 2fr);
    align-items: end;
}

.cfg-results {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
    font-size: 12.5px;
}

.cfg-results li {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

/* Live tile refresh feedback */
.pbx-tile.is-polling {
    position: relative;
    opacity: 0.75;
}

.pbx-tile.is-polling::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 12px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.pbx-tile.just-updated {
    animation: tile-flash 900ms var(--ease);
}

@keyframes tile-flash {
    0% { box-shadow: 0 0 0 2px var(--accent); }
    100% { box-shadow: var(--shadow-1); }
}

/* Sortable / filterable tables */
.table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.table th[data-sort]::after {
    content: "\2195";
    margin-left: 6px;
    opacity: 0.35;
    font-size: 10px;
}

.table th[data-sort].is-asc::after { content: "\2191"; opacity: 1; color: var(--accent); }
.table th[data-sort].is-desc::after { content: "\2193"; opacity: 1; color: var(--accent); }

.table .filter-row th {
    padding: 6px 10px;
    background: var(--surface-1);
    text-transform: none;
    letter-spacing: 0;
}

.table .filter-row input,
.table .filter-row select {
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 6px 8px;
    font-size: 12px;
}

.manage-bulk-bar .btn { white-space: nowrap; }


/* PBX detail: "what needs attention" boxes */
.issue-grid {
    display: grid;
    gap: 14px;
    margin-top: 10px;
}

.issue-box {
    border-left: 3px solid var(--warning);
}

.issue-box.tone-danger { border-left-color: var(--danger); }
.issue-box.tone-success { border-left-color: var(--success); }

.issue-box .actions .btn { margin-left: 4px; }
.issue-box .actions { white-space: nowrap; text-align: right; }

.stat.stat-backup { align-items: flex-start; }
.stat .stat-action { margin-left: auto; flex: none; }
.stat.stat-backup .stat-meta { margin-top: 3px; }

/* Metric boxes: at most 4 per row, more room for text */
@media (max-width: 1280px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .stats { grid-template-columns: minmax(0, 1fr); } }
.stat .stat-value { font-size: 30px; }
.stat.stat-backup .stat-value { font-size: 20px; }

.pbx-issues { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.issues-auto { margin-left: 10px; font-size: 12px; }
.issue-box td .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.issue-box td .dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.18); }
.issue-box td .dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 69, 58, 0.18); }
.issue-box td .dot.unknown { background: var(--muted); }

.pbx-issues { min-height: 30px; align-items: center; }

/* Extensions & phones box */
.ext-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.ext-legend .dot, .table td .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.ext-legend .dot.online, .table td .dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.18); }
.ext-legend .dot.outdated, .table td .dot.outdated { background: var(--warning); box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.2); }
.ext-legend .dot.offline, .table td .dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 69, 58, 0.18); }
.ext-legend .dot.unknown, .table td .dot.unknown { background: var(--muted); opacity: 0.6; }
.table tr.is-muted td { opacity: 0.55; }
/* Tags, mute menu, service rows */
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; }
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 180px; padding: 6px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow-2); display: grid; gap: 2px; }
details.menu .menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; background: transparent; border: 0; color: var(--text); font: inherit; cursor: pointer; }
details.menu .menu-item:hover { background: var(--surface-2); }
details.menu .menu-item-accent { color: var(--accent); font-weight: 600; }
.is-muted-btn { opacity: 0.85; }
/* Inventory / history */
.inventory-tabs { flex-wrap: wrap; margin-bottom: 14px; }
.inventory-tabs .tab { text-decoration: none; }
.table tr.row-warning td { background: rgba(255, 181, 71, 0.06); }
.table tr.row-danger td { background: rgba(255, 69, 58, 0.07); }
.history-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.fleet-trend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.table td .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.tool-output { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12.5px; max-height: 420px; overflow: auto; }
.tool-output table { font-size: 12px; }
.tf-qr { padding: 12px; background: #fff; border-radius: 12px; display: inline-block; }
.btn-block { display: block; width: 100%; }

.table-compact thead th { white-space: normal; font-size: 10px; letter-spacing: 0.04em; line-height: 1.25; max-width: 96px; vertical-align: bottom; }
.table-compact td { padding: 8px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.tabs.inventory-tabs { flex-wrap: wrap; overflow: visible; white-space: normal; }
.tabs.inventory-tabs .tab { white-space: nowrap; }
.badge-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.badge-btn[disabled] { cursor: default; opacity: 1; }
.table td .tiny.mono { word-break: break-all; }

/* --------------------------------------------------------------------------
   9b. Tile footer: fixed slots (sparkline · maintenance · freshness)
   -------------------------------------------------------------------------- */
.pbx-foot-spark { display: flex; min-width: 0; }
.pbx-foot-maint { display: flex; justify-content: flex-end; min-width: 132px; }
.pbx-foot-maint .badge { white-space: nowrap; }
.badge-ghost { opacity: 0.55; }
.fresh {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.fresh i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7c80;
    flex: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}
.fresh-success i { background: #19d3bb; box-shadow: 0 0 0 2px rgba(25, 211, 187, 0.18); }
.fresh-warning i { background: #f3b53f; box-shadow: 0 0 0 2px rgba(243, 181, 63, 0.18); }
.fresh-danger i { background: #f25f5c; box-shadow: 0 0 0 2px rgba(242, 95, 92, 0.2); }

/* --------------------------------------------------------------------------
   9c. Collapsible navigation group
   -------------------------------------------------------------------------- */
.nav-group-row { position: relative; }
.nav-group-row .nav-group-head { padding-right: 36px; }
.nav-group-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #7f959a;
    cursor: pointer;
}
.nav-group-toggle:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-group-toggle .icon { width: 14px; height: 14px; transition: transform var(--normal); }
.nav-group.is-open .nav-group-toggle .icon { transform: rotate(90deg); }
.nav-group .nav-sub { display: none; }
.nav-group.is-open .nav-sub { display: block; }
.is-collapsed .nav-group-toggle { display: none; }

/* --------------------------------------------------------------------------
   9d. Live Board (console page)
   -------------------------------------------------------------------------- */
.qr-block { display: flex; flex-direction: column; gap: 8px; min-width: 190px; max-width: 260px; }
.qr-block .qr { width: 160px; height: 160px; padding: 8px; background: #fff; border-radius: 10px; }
.qr-block .qr img, .qr-block .qr canvas { display: block; width: 144px; height: 144px; }
.board-preview { aspect-ratio: 16 / 9; background: #06090c; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.board-preview iframe { width: 200%; height: 200%; border: 0; transform: scale(0.5); transform-origin: 0 0; pointer-events: none; }
.table .row-danger td:first-child { box-shadow: inset 3px 0 0 #f25f5c; }
.table .row-warning td:first-child { box-shadow: inset 3px 0 0 #f3b53f; }

/* --------------------------------------------------------------------------
   9e. Live Board (TV page, bare layout)
   -------------------------------------------------------------------------- */
.layout-bare:has(.tv) { background: #06090c; }
.tv { min-height: 100vh; display: flex; flex-direction: column; padding: 2vh 2.5vw; gap: 2vh; color: #e6eef0; background: #06090c; font-family: var(--font); }
.tv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tv-brand { display: flex; align-items: baseline; gap: 18px; }
.tv-brand .brand-name { font-family: var(--display); font-size: clamp(22px, 2.6vw, 40px); font-weight: 700; letter-spacing: -0.02em; }
.tv-brand .brand-name em { font-style: normal; color: #19d3bb; }
.tv-scope { font-size: clamp(14px, 1.4vw, 22px); color: #8fa3a8; }
.tv-clock { font-family: var(--mono); font-size: clamp(22px, 2.6vw, 42px); color: #cfe0e3; font-variant-numeric: tabular-nums; }
.tv-summary { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1vw; }
.tv-summary.tv-summary-many { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tv-stat { background: #0d1418; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 1.4vh 1vw; display: flex; flex-direction: column; gap: 4px; }
.tv-stat b { font-family: var(--display); font-size: clamp(26px, 3.4vw, 56px); line-height: 1; font-weight: 700; }
.tv-stat b small { font-size: 0.45em; color: #8fa3a8; font-weight: 500; }
.tv-stat span { font-size: clamp(11px, 1vw, 16px); color: #8fa3a8; text-transform: uppercase; letter-spacing: 0.06em; }
.tv-stat.tone-success b { color: #19d3bb; }
.tv-stat.tone-warning b { color: #f3b53f; }
.tv-stat.tone-danger b { color: #f25f5c; }
.tv-issues { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 1.2vw; align-content: start; }
.tv-issue { border-radius: 16px; padding: 1.6vh 1.4vw; background: #0d1418; border: 1px solid rgba(255, 255, 255, 0.06); border-left: 8px solid #6b7c80; display: flex; flex-direction: column; gap: 10px; }
.tv-issue.tone-danger { border-left-color: #f25f5c; background: linear-gradient(90deg, rgba(242, 95, 92, 0.14), rgba(13, 20, 24, 0.6) 60%); }
.tv-issue.tone-warning { border-left-color: #f3b53f; background: linear-gradient(90deg, rgba(243, 181, 63, 0.12), rgba(13, 20, 24, 0.6) 60%); }
.tv-issue.is-muted { opacity: 0.55; }
.tv-issue-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.tv-issue-head h3 { margin: 0; font-family: var(--display); font-size: clamp(20px, 2vw, 34px); font-weight: 700; min-width: 0; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tv-dot { width: 14px; height: 14px; border-radius: 50%; background: #6b7c80; flex: none; }
.tone-danger .tv-dot { background: #f25f5c; box-shadow: 0 0 0 6px rgba(242, 95, 92, 0.25); animation: tv-pulse 1.6s ease-in-out infinite; }
.tone-warning .tv-dot { background: #f3b53f; box-shadow: 0 0 0 6px rgba(243, 181, 63, 0.2); }
@keyframes tv-pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(242, 95, 92, 0.25); } 50% { box-shadow: 0 0 0 10px rgba(242, 95, 92, 0.08); } }
.tv-module { color: #8fa3a8; font-size: clamp(12px, 1.1vw, 18px); margin-top: -2px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tv-module-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tv-status { white-space: nowrap; flex: none; font-family: var(--mono); font-weight: 700; font-size: clamp(11px, 0.9vw, 15px); letter-spacing: 0.08em; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); }
.tone-danger .tv-status { color: #ff8a87; background: rgba(242, 95, 92, 0.18); }
.tone-warning .tv-status { color: #ffd077; background: rgba(243, 181, 63, 0.16); }
.tv-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-badge { font-size: clamp(11px, 1vw, 16px); font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: #dbe6e8; }
.tv-badge.tone-danger { background: rgba(242, 95, 92, 0.22); color: #ffb3b1; }
.tv-badge.tone-warning { background: rgba(243, 181, 63, 0.2); color: #ffe0a3; }
.tv-badge.tone-neutral { background: rgba(255, 255, 255, 0.08); color: #a9bbc0; }
.tv-msg { font-size: clamp(12px, 1.1vw, 18px); color: #c5d3d6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tv-meta { font-family: var(--mono); font-size: clamp(11px, 0.95vw, 15px); color: #8fa3a8; }
.tv-allclear { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12vh 0; color: #8fa3a8; }
.tv-allclear .tv-check { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 56px; color: #06090c; background: #19d3bb; box-shadow: 0 0 0 16px rgba(25, 211, 187, 0.12); }
.tv-allclear h2 { margin: 12px 0 0; color: #e6eef0; font-family: var(--display); font-size: clamp(24px, 3vw, 48px); }
.tv-foot { display: flex; justify-content: space-between; gap: 16px; font-family: var(--mono); font-size: clamp(11px, 1vw, 16px); color: #8fa3a8; }
.tv.is-stale .tv-foot [data-tv-updated] { color: #f25f5c; }
@media (max-width: 1100px) { .tv-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }.tv-issues.is-dense { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 0.8vw; }
.tv-issues.is-dense .tv-issue { padding: 1vh 1vw; gap: 6px; border-left-width: 6px; }
.tv-issues.is-dense .tv-issue-head h3 { font-size: clamp(16px, 1.4vw, 24px); }
.tv-issues.is-dense .tv-msg { -webkit-line-clamp: 1; }
.tv-issues.is-dense .tv-module { font-size: clamp(11px, 0.9vw, 14px); }
.tv-issues.is-dense .tv-status { font-size: clamp(10px, 0.75vw, 12px); padding: 1px 6px; }

/* --------------------------------------------------------------------------
   10. AI Work chat and AI settings
   -------------------------------------------------------------------------- */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.ai-side { display: flex; flex-direction: column; gap: 20px; }
.ai-chat-card { display: flex; flex-direction: column; min-height: 640px; }
.ai-toolbar { gap: 12px; flex-wrap: wrap; }
.ai-toolbar .field { margin: 0; min-width: 220px; flex: 1; }
.ai-toolbar .field label { font-size: 11px; }
.ai-chat { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; max-height: 70vh; }
.ai-msg { display: flex; gap: 10px; max-width: 92%; }
.ai-msg-user { align-self: flex-end; }
.ai-msg-body { background: var(--surface-2, rgba(255, 255, 255, 0.04)); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.ai-msg-user .ai-msg-body { background: var(--accent-soft, rgba(25, 211, 187, 0.12)); border-color: rgba(25, 211, 187, 0.35); white-space: pre-wrap; }
.ai-msg-system .ai-msg-body { background: transparent; border-style: dashed; }
.ai-msg-error .ai-msg-body { border-color: rgba(242, 95, 92, 0.5); background: var(--danger-soft); }
.ai-msg-body p { margin: 0 0 8px; }
.ai-msg-body p:last-child { margin-bottom: 0; }
.ai-msg-body ul { margin: 6px 0 0; padding-left: 18px; }
.ai-msg-meta { margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: #19d3bb; color: #19d3bb; }
.ai-compose { display: flex; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.ai-compose textarea { flex: 1; resize: vertical; min-height: 56px; }
.ai-plan { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ai-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: rgba(255, 255, 255, 0.03); font-weight: 600; font-size: 13px; }
.ai-action { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: start; }
.ai-action.is-problem { background: var(--danger-soft); }
.ai-action.is-done { background: var(--success-soft); }
.ai-action.is-failed { background: var(--danger-soft); }
.ai-action-label { font-weight: 600; font-size: 13px; }
.ai-action-before { font-size: 12px; color: var(--text-muted); }
.ai-action-reason { font-size: 12px; color: var(--text-muted); font-style: italic; }
.ai-action-problem { font-size: 12px; color: #ff8a87; font-weight: 600; }
.ai-action-result { font-size: 12px; margin-top: 4px; font-family: var(--mono); }
.ai-plan-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ai-group { padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ai-group:first-child { border-top: 0; padding-top: 0; }
.ai-group-name { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.ai-group-hours { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }
.ai-budget strong { letter-spacing: 0.04em; }
.ai-budget.alert-danger { font-size: 15px; border-width: 2px; animation: ai-blink 1.4s ease-in-out 3; }
@keyframes ai-blink { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px rgba(242, 95, 92, 0.35); } }
.ai-provider { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-provider .field { margin: 0; }
[data-ai-models] input, [data-ai-models] select { width: 100%; min-width: 0; padding: 5px 8px; font-size: 12px; }
[data-ai-models] input.right { text-align: right; }
[data-ai-models] td { vertical-align: middle; }
@media (max-width: 1100px) { .ai-layout { grid-template-columns: minmax(0, 1fr); } }[data-ai-models] select { min-width: 96px; }
.ai-announce { margin-top: 8px; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-announce-text { width: 100%; font-size: 13px; resize: vertical; }
.ai-announce audio { width: 100%; height: 34px; }

/* --------------------------------------------------------------------------
   11. Roles permission editor, error pages
   -------------------------------------------------------------------------- */
.role-perms td { padding-top: 0; border-top: 0; }
.role-perms details summary { cursor: pointer; color: var(--text-muted); padding: 4px 0 8px; list-style: none; display: flex; align-items: center; gap: 6px; }
.role-perms details summary::-webkit-details-marker { display: none; }
.role-perms details[open] summary { color: var(--text); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; padding: 6px 0 10px; }
.perm-group-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 6px; }
.perm { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; font-size: 13px; white-space: normal; }
.perm code { margin-left: 4px; }
.perm-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.error-page { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.error-card { text-align: center; max-width: 560px; padding: 36px 32px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); position: relative; overflow: hidden; }
.error-code { position: absolute; right: 18px; top: 4px; font-family: var(--display); font-size: 120px; font-weight: 700; color: rgba(255, 255, 255, 0.04); line-height: 1; pointer-events: none; }
.error-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--danger-soft); color: #f25f5c; }
.error-icon .icon { width: 30px; height: 30px; }
.error-card h1 { margin: 0 0 6px; font-family: var(--display); font-size: 28px; }
.error-card .lede { margin: 0; }
.error-detail { text-align: left; margin-top: 14px; font-size: 12px; white-space: pre-wrap; background: rgba(0, 0, 0, 0.25); padding: 10px 12px; border-radius: 8px; }

/* --------------------------------------------------------------------------
   12. Account gear, sub-menu icons, collapsed rail with sub icons
   -------------------------------------------------------------------------- */
.user-card .btn-icon.user-gear { margin-left: auto; }
.user-card .btn-icon.user-gear + .btn-icon { margin-left: 0; }
.user-card .btn-icon.user-gear:hover, .user-card .btn-icon.user-gear[aria-current="page"] { color: #19d3bb; background: rgba(25, 211, 187, 0.12); }
.nav-sub-item .icon { width: 15px; height: 15px; opacity: 0.75; }
.nav-sub-item[aria-current="page"] .icon { opacity: 1; }
.is-collapsed .nav-group .nav-sub { display: block; margin: 0; padding: 0; border-left: 0; }
.is-collapsed .nav-group:not(.is-open) .nav-sub { display: none; }
.is-collapsed .nav-sub-item { padding: 7px 0; justify-content: center; }
.is-collapsed .nav-sub-item .icon { width: 14px; height: 14px; }
.is-collapsed .nav-group-row .nav-group-head { padding-right: 0; }
.is-collapsed .user-card .user-gear { display: inline-flex; margin: 0; }
.is-collapsed .user-card { flex-direction: column; gap: 6px; }
.tf-actions form { display: inline; }

/* AI Work: context boxes on top, chat full width */
.ai-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.ai-top .card-body, .ai-top .table-wrap { max-height: 360px; overflow: auto; }
.ai-layout { grid-template-columns: minmax(0, 1fr); }
.ai-chat-card { min-height: 520px; }
.ai-chat { max-height: 60vh; }
.ai-msg { max-width: 100%; }
.ai-prompt { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.ai-prompt .btn-icon.btn-sm { width: 26px; height: 26px; font-size: 11px; }
.ai-prompt audio { display: block; width: 100%; height: 30px; margin-top: 4px; }
.ai-group-prompt { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (max-width: 1100px) { .ai-top { grid-template-columns: minmax(0, 1fr); } }.ai-budget { margin-bottom: 20px; }

/* AI Work: PBX bar, equal boxes, aligned toolbar, help popover */
.ai-pbxbar { display: flex; align-items: flex-end; gap: 16px; padding: 14px 18px; margin-bottom: 20px; flex-wrap: wrap; }
.ai-pbxbar .field { margin: 0; flex: 1; min-width: 260px; max-width: 520px; }
.ai-pbxbar > .small { padding-bottom: 10px; }
.ai-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
.ai-box { display: flex; flex-direction: column; height: 400px; min-height: 0; }
.ai-box .card-header { flex: none; }
.ai-box .card-body, .ai-box .table-wrap { flex: 1; min-height: 0; max-height: none; overflow: auto; }
.ai-box .card-body { padding-top: 6px; }
.ai-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ai-toolbar .ai-model-field { flex: 1; min-width: 260px; margin: 0; }
.ai-toolbar-actions { display: flex; align-items: center; gap: 8px; height: 40px; }
.ai-toolbar-actions .btn { height: 40px; }
.ai-toolbar-actions .btn-icon { width: 40px; }
.ai-help { position: relative; }
.ai-help-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(560px, 80vw); padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 6px; }
.ai-help-item { text-align: left; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.ai-help-item:hover { border-color: #19d3bb; color: #19d3bb; }
@media (max-width: 1100px) { .ai-top { grid-template-columns: minmax(0, 1fr); } .ai-box { height: auto; max-height: 400px; } }.ai-top > .card + .card, .ai-layout > .card + .card, .ai-top > .card, .ai-pbxbar + .ai-top { margin-top: 0; }
.ai-layout > .card + .card { margin-top: 0; }

/* AI Work: payload / answer inspector */
.ai-msg { position: relative; align-items: flex-start; }
.ai-inspect { flex: none; margin-top: 4px; width: 30px; height: 26px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text-muted); font-family: var(--mono); font-size: 11px; cursor: pointer; }
.ai-inspect:hover { color: #19d3bb; border-color: #19d3bb; }
.ai-msg-user .ai-inspect { order: -1; }
.ai-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ai-modal[hidden] { display: none; }
.ai-modal-box { width: min(1100px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-2); overflow: hidden; }
.ai-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ai-modal-pre { margin: 0; padding: 14px 16px; overflow: auto; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* Inventory header tools: search + count on one line, selection bar beneath, right-aligned */
.inv-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.inv-bulk { padding: 6px 10px; border: 0; border-radius: 8px; }
.inv-tools > .flex.wrap { flex-wrap: nowrap; }

/* Live Board: activity ticker + full-screen button */
.tv { height: 100vh; min-height: 0; box-sizing: border-box; }
.tv-issues { flex: 1; min-height: 0; overflow: auto; }
.tv-head-right { display: flex; align-items: center; gap: 14px; }
.tv-fs { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); color: #8fa3a8; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.tv-fs:hover { color: #19d3bb; border-color: #19d3bb; }
.tv-fs svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tv.is-fullscreen .tv-fs { color: #19d3bb; }
.tv-ticker { flex: none; position: relative; height: 24vh; min-height: 140px; max-height: 75vh; display: flex; flex-direction: column; border: 1px solid rgba(25, 211, 187, 0.18); border-radius: 12px; background: linear-gradient(180deg, rgba(6, 12, 15, 0.9), rgba(3, 7, 9, 0.95)); box-shadow: inset 0 0 40px rgba(25, 211, 187, 0.04); font-family: var(--mono); overflow: hidden; }
.tv-ticker-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; border-bottom: 1px solid rgba(25, 211, 187, 0.15); font-size: clamp(11px, 0.9vw, 14px); letter-spacing: 0.14em; color: #19d3bb; }
.tv-ticker-meta { color: #55707a; letter-spacing: 0.06em; text-transform: uppercase; }
.tv-live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #19d3bb; margin-right: 8px; vertical-align: middle; box-shadow: 0 0 8px #19d3bb; animation: tk-pulse 1.2s ease-in-out infinite; }
@keyframes tk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
/* Scroll box: the inner list gets margin-top:auto so a short list sits at the bottom, while a long list overflows downwards and can be scrolled to its end (a flex-end column cannot: its overflow goes upwards and is unreachable). */
.tv-ticker-lines { flex: 1; min-height: 0; overflow: hidden; padding: 4px 14px; display: flex; flex-direction: column; -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%); mask-image: linear-gradient(180deg, transparent, #000 18%); }
.tv-ticker-scroll { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.tk-line, .tv-ticker-cursor { display: grid; grid-template-columns: 9ch 6ch minmax(0, 1fr); gap: 12px; align-items: baseline; font-size: clamp(11px, 0.95vw, 15px); line-height: 1.45; color: #b9c9cc; white-space: nowrap; overflow: hidden; }
.tk-line.is-new { animation: tk-in 0.6s ease-out; background: linear-gradient(90deg, rgba(25, 211, 187, 0.12), transparent 70%); }
@keyframes tk-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.tk-time { color: #55707a; }
.tk-kind { color: #7ff0e0; letter-spacing: 0.1em; font-weight: 700; }
.tk-line.tk-bad .tk-kind { color: #ff8a87; }
.tk-line.tk-warn .tk-kind { color: #ffd077; }
.tk-text { overflow: hidden; text-overflow: ellipsis; }
.tk-name { color: #e6eef0; font-weight: 700; }
.tk-ok { color: #19d3bb; font-weight: 700; }
.tk-warn { color: #f3b53f; font-weight: 700; }
.tk-bad { color: #f25f5c; font-weight: 700; }
.tk-info { color: #7aaeff; font-weight: 700; }
.tk-num { color: #cfe0e3; }
.tk-dim { color: #7f959a; }
.tk-sep { color: #3c5057; }
.tv-ticker-cursor { padding: 4px 14px 8px; border-top: 1px dashed rgba(255, 255, 255, 0.06); color: #7f959a; }
.tk-caret { display: inline-block; margin-left: 4px; color: #19d3bb; animation: tk-pulse 1s steps(2, start) infinite; }
/* resize grip on the top edge: drag to resize, double-click to reset (height persisted in localStorage bix.board.ticker) */
.tv-ticker-grip { position: absolute; top: -6px; left: 0; right: 0; height: 12px; cursor: ns-resize; z-index: 2; display: flex; justify-content: center; align-items: center; touch-action: none; }
.tv-ticker-grip span { width: 56px; height: 5px; border-radius: 3px; background: rgba(25, 211, 187, 0.35); transition: background 0.15s, width 0.15s; }
.tv-ticker-grip:hover span, .tv-ticker.is-resizing .tv-ticker-grip span { background: #19d3bb; width: 80px; box-shadow: 0 0 8px rgba(25, 211, 187, 0.6); }
.tv-ticker.is-resizing { transition: none; user-select: none; }
@media (max-width: 1100px) { .tv-ticker { height: 30vh; } }
/* Live Board on a phone (opened from the token link) */
@media (max-width: 640px) {
    .tv { padding: 10px 12px; gap: 10px; }
    .tv-head { flex-wrap: wrap; gap: 8px; }
    .tv-brand { gap: 10px; flex-wrap: wrap; }
    .tv-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tv-stat b { font-size: 26px; }
    .tv-issues, .tv-issues.is-dense { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .tv-issue { padding: 10px 12px; }
    .tv-issue-head h3 { font-size: 18px; }
    .tv-ticker { height: 28vh; min-height: 120px; }
    .tv-foot { flex-wrap: wrap; gap: 6px; font-size: 12px; }
}

/* Inventory → Resources: 0-100 % gauges with the value inside; the fill turns amber at the warning threshold and red from 95 % */
.gauge {
    position: relative;
    height: 22px;
    min-width: 110px;
    border-radius: 6px;
    background: var(--surface-3);
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
}
.gauge i {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    border-radius: 6px 0 0 6px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--success) 70%, #0a3d2a), var(--success));
    transition: width .4s ease;
}
.gauge.warn i { background: linear-gradient(90deg, var(--success) 0%, var(--warning) 100%); }
.gauge.crit i { background: linear-gradient(90deg, var(--warning) 0%, var(--danger) 70%, #ff2d55 100%); }
.gauge b {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, .35);
    pointer-events: none;
}
.gauge span {
    position: relative;
    color: #fff;
    text-shadow: 0 0 3px rgba(0, 0, 0, .55);
}
[data-theme="light"] .gauge span { color: #0f172a; text-shadow: 0 0 3px rgba(255, 255, 255, .7); }
.gauge.crit span { color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .6); }
/* Resources tab: every cell top-aligned so the three gauges sit on one line whatever their sub text; gauge cells follow the left-aligned headers */
[data-inv-tab="resources"] td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
[data-inv-tab="resources"] td.num { text-align: left; }
[data-inv-tab="resources"] td .gauge { width: 150px; max-width: 100%; margin: 0; }
[data-inv-tab="resources"] td .gauge + .tiny { margin-top: 3px; width: 150px; max-width: 100%; text-align: right; }
.layout-mobile [data-inv-tab="resources"] td.num { text-align: right; }
.layout-mobile [data-inv-tab="resources"] td .gauge { width: 100%; }
.layout-mobile [data-inv-tab="resources"] td .gauge + .tiny { width: auto; }

/* Servers → Hardware Monitor */
.hw-tile .hw-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
/* Server tiles (2026-09-11): every head has the same three lines (name, model · serial, customer · location) clamped to
   one line each, and a fixed-width right column, so HPE and Lenovo tiles align whatever the length of the texts */
.hw-tile .pbx-head { align-items: flex-start; min-height: 78px; }
.hw-tile .pbx-head .grow { min-width: 0; }
.hw-tile .pbx-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-tile .hw-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.hw-tile .hw-tile-right { flex: 0 0 auto; width: 118px; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.hw-tile .hw-tile-right .badge { white-space: nowrap; }
.hw-tile .pbx-issues { min-height: 30px; }
.hw-subsystems { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 18px; }
.hw-subsystems > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hw-issues-card.is-danger { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 25%, transparent); }
.hw-issues-card.is-warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); }
.hw-issues-card.is-ok .card-header h2 { color: var(--success); }
.hw-scroll { max-height: 420px; overflow-y: auto; }
.hw-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table td .gauge { min-width: 90px; }
.layout-mobile .hw-tile .hw-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.layout-mobile .hw-subsystems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Trunks: DID popover, per-trunk monitoring switch, muted rows */
.did-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: middle; }
.did-info { width: 24px; height: 24px; padding: 0; }
.did-info .icon { width: 14px; height: 14px; }
.pop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; max-width: min(520px, 80vw); padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2); }
.did-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto; }
.did-list span { padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.did-list span.is-main { border-color: var(--accent); color: var(--accent); }
tr.is-muted-trunk td { opacity: 0.55; }
tr.is-muted-trunk td.actions { opacity: 1; }
.switch.switch-sm .track { width: 34px; height: 18px; }
.switch.switch-sm .track::after { width: 12px; height: 12px; }
.switch.switch-sm input:checked + .track::after { transform: translateX(16px); }
.layout-mobile .pop { left: auto; right: 0; }
/* Component monitoring: switch + lock */
.mon-cell { display: inline-flex; align-items: center; gap: 8px; }
.mon-lock { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; padding: 0; }
.mon-lock .icon { width: 14px; height: 14px; }
.mon-lock.is-open { color: var(--success); }
.mon-lock.is-locked { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 50%, var(--border)); background: color-mix(in srgb, var(--warning) 12%, var(--surface-2)); }
.mon-lock:hover { filter: brightness(1.15); }
[data-calls-live-toggle] .tv-live-dot { margin-right: 6px; }

/* Backup Manager → Data Cove */
.bk-bar { display: inline-flex; gap: 2px; align-items: center; vertical-align: middle; }
.bk-bar .bk-day { display: inline-block; width: 5px; height: 14px; border-radius: 2px; background: var(--neutral); opacity: 0.35; }
.bk-bar .bk-day.ok { background: var(--success); opacity: 1; }
.bk-bar .bk-day.warn { background: var(--warning); opacity: 1; }
.bk-bar .bk-day.bad { background: var(--danger); opacity: 1; }
.bk-bar .bk-day.run { background: var(--info, #3b82f6); opacity: 1; }
.bk-bar.bk-bar-lg { gap: 4px; width: 100%; }
.bk-bar.bk-bar-lg .bk-day { flex: 1 1 0; height: 34px; border-radius: 4px; }
.bk-day.bk-legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; background: var(--neutral); opacity: 0.35; }
.bk-day.bk-legend.ok { background: var(--success); opacity: 1; } .bk-day.bk-legend.warn { background: var(--warning); opacity: 1; } .bk-day.bk-legend.bad { background: var(--danger); opacity: 1; } .bk-day.bk-legend.run { background: var(--info, #3b82f6); opacity: 1; }
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv-grid dt { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; align-self: center; }
.kv-grid dd { margin: 0; font-size: 13px; }
.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issue-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.layout-mobile .kv-grid { grid-template-columns: 1fr; gap: 2px 0; } .layout-mobile .kv-grid dd { margin-bottom: 8px; }
.layout-mobile .bk-bar.bk-bar-lg .bk-day { height: 22px; }
a.btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* Printing Monitor */
.pr-supply { display: grid; grid-template-columns: minmax(60px, 1fr) 90px 38px; gap: 6px; align-items: center; font-size: 12px; margin: 2px 0; }
.pr-supply-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-supply-track { display: block; height: 8px; border-radius: 4px; background: rgba(128,128,128,0.25); overflow: hidden; }
.pr-supply-fill { display: block; height: 100%; border-radius: 4px; background: var(--success); }
.pr-supply-fill.tone-warning { background: var(--warning); }
.pr-supply-fill.tone-danger { background: var(--danger); }
.pr-supply-pct { text-align: right; font-size: 11px; }
/* Printing Monitor · supply orders (v2.15) */
details.pr-order-ship { position: relative; display: inline-block; }
details.pr-order-ship > summary { list-style: none; cursor: pointer; }
details.pr-order-ship > summary::-webkit-details-marker { display: none; }
details.pr-order-ship[open] > form { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; padding: 10px; border-radius: 12px; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow-2); }
details.pr-order-ship input[type="text"], details.pr-order-ship input[type="number"] { width: 100%; }
/* Roles editor: access level per section (v2.16) */
.level-table th.center, .level-table td.center { text-align: center; }
.level-pick { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 28px; border-radius: 8px; cursor: pointer; }
.level-pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.level-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(128,128,128,.5); background: transparent; transition: transform .15s, background .15s; }
.level-pick input:checked + .level-dot { transform: scale(1.25); border-color: transparent; }
.level-pick input:checked + .level-dot.level-none { background: #8a94a6; }
.level-pick input:checked + .level-dot.level-view { background: #4dabf7; }
.level-pick input:checked + .level-dot.level-operate { background: var(--accent); }
.level-pick input:checked + .level-dot.level-manage { background: #40c057; }
.level-pick:hover .level-dot { transform: scale(1.15); }
.level-pick.is-disabled { opacity: .3; cursor: not-allowed; }
.level-pick input:focus-visible + .level-dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.finetune-row td { padding-top: 0; background: rgba(128,128,128,.05); }
.finetune { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 24px; padding: 8px 0 12px; }
.role-card .card-footer { border-top: 1px solid var(--border); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 6px; }
.preset { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface-1); }
.preset:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.preset input { margin-top: 4px; }
.preset-body { display: flex; flex-direction: column; gap: 4px; }
.preset-levels { display: flex; flex-wrap: wrap; gap: 3px; }
.preset-levels .badge { font-size: 9px; padding: 1px 5px; }
.rights-matrix th.center, .rights-matrix td.center { text-align: center; }
/* Global Outlook */
.overview-grid .pbx-name .icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.activity-feed { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; font-size: 13px; }
.activity-line { display: grid; grid-template-columns: 60px 52px 1fr; gap: 8px; align-items: baseline; }
.activity-kind { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; font-weight: 700; color: var(--accent); }
.activity-line.lvl-bad .activity-kind { color: #f25f5c; }
.activity-line.lvl-warn .activity-kind { color: #f3b53f; }
.activity-line .tk-name { font-weight: 600; }
.activity-line .tk-bad { color: #f25f5c; } .activity-line .tk-warn { color: #f3b53f; } .activity-line .tk-ok { color: #40c057; } .activity-line .tk-dim { color: var(--text-muted); } .activity-line .tk-num { font-family: var(--mono); }

/* Settings (2026-09-11): two menu groups and product tiles per integration */
.settings-nav-title { padding: 12px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.settings-nav-title + .tab { margin-top: 2px; }
.tabs.tabs-vertical a.tab { text-decoration: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; font: inherit; cursor: pointer; transition: border-color var(--fast), transform var(--fast), box-shadow var(--fast); position: relative; }
.tile:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 10px 26px rgba(0,0,0,.18); }
.tile-logo { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.tile-logo svg { width: 30px; height: 30px; }
.tile-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tile-name { display: block; font-weight: 700; font-size: 14px; line-height: 1.2; }
.tile-vendor { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-status { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; margin-top: 2px; color: var(--muted); white-space: nowrap; }
.tile-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); box-shadow: 0 0 0 3px var(--neutral-soft); }
.tile-status.is-active { color: var(--success); }
.tile-status.is-active::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.tile-status.is-configured { color: var(--warning); }
.tile-status.is-configured::before { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.tile-status.is-error { color: var(--danger); }
.tile-status.is-error::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.tile-chevron { color: var(--muted); flex: 0 0 auto; transition: transform var(--fast); }
.tile.active .tile-chevron { transform: rotate(90deg); color: var(--accent); }
[data-tile-panel][hidden] { display: none !important; }
.tile-return { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tile-return-name { font-weight: 700; font-size: 15px; }

/* Administrative lock on late payments (2026-09-11): the service tiles of a locked customer are greyed out and inert */
.pbx-tile.tile-locked {
    position: relative;
    pointer-events: none;
    cursor: not-allowed;
    border-top-color: var(--danger);
}
.pbx-tile.tile-locked > *:not(.tile-lock) {
    opacity: 0.28;
    filter: grayscale(1);
}
.pbx-tile .tile-lock {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.25;
    letter-spacing: 0.01em;
    color: var(--danger);
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.08));
    border-radius: var(--r-lg);
}
.pbx-tile .tile-lock .icon { width: 44px; height: 44px; flex: 0 0 auto; stroke-width: 2.2; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); }

/* worker "updates held" state (2026-09-11) */
.btn.btn-warning { background: var(--warning-soft, rgba(255, 180, 0, 0.18)); color: var(--warning); border-color: var(--warning); }

/* hardware tile, right column: status / vendor / connection stacked with even spacing (2026-09-11) */
.hw-tile .hw-tile-right { gap: 5px; }
.hw-tile .hw-tile-right .hw-tile-vendor { margin-top: 1px; }
.hw-tile .hw-tile-right .badge-neutral { opacity: 0.85; }

/* row-count badge next to a filter box: a little air between them (2026-09-11) */
.filter-box + [data-filter-count], [data-filter-count] { margin-left: 12px; }
select + [data-filter-count] { margin-left: 4px; }

/* printing statistics: daily prints bar chart (2026-09-11) */
.print-chart { width: 100%; height: 170px; display: block; }
.print-chart-grid { stroke: var(--border); stroke-width: 1; }
.print-chart-axis { fill: var(--text-muted, #8a94a6); font-size: 10px; font-family: var(--font-mono, monospace); }
.print-chart-total { fill: var(--accent); opacity: 0.85; }
.print-chart-mono { fill: #8a94a6; opacity: 0.85; }
.print-chart-color { fill: var(--accent); opacity: 0.9; }
.print-chart-empty { fill: var(--border); }
.print-chart g:hover rect { opacity: 1; }
.print-legend { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; }
.print-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* printers table: supplies without a level folded under a "+ N without level" line (2026-09-11) */
details.pr-unknown > summary { cursor: pointer; list-style: none; margin-top: 2px; }
details.pr-unknown > summary::-webkit-details-marker { display: none; }
details.pr-unknown[open] > summary { color: var(--text); }

/* green S on a toner with a spare on site (2026-09-11) */
.badge.pr-spare-mark { padding: 0 5px; font-size: 10px; font-weight: 700; line-height: 14px; letter-spacing: 0.02em; }

/* ETCD hover popover with the 30-day supply trend (2026-09-11) */
.etcd-hover { position: relative; cursor: help; }
.etcd-hover .etcd-pop { display: none; position: absolute; left: 0; top: 100%; z-index: 30; width: 260px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.etcd-hover:hover .etcd-pop, .etcd-hover:focus-within .etcd-pop { display: block; }
.print-trend { width: 100%; height: 80px; display: block; }

/* printers table: compact address column, S slot on every supply (2026-09-11) */
.table td.pr-addr { font-size: 11.5px; line-height: 1.3; white-space: nowrap; max-width: 128px; padding-right: 8px; }
.table td.pr-addr .pr-mac { font-size: 10px; letter-spacing: 0; }
.badge.pr-spare-mark { display: inline-block; min-width: 18px; text-align: center; }
.badge.pr-spare-mark.is-off { background: transparent; color: var(--text-muted, #8a94a6); border: 1px solid var(--border-strong); opacity: 0.55; }

/* trends dialog (2026-09-11): chart icon next to the ETCD, three 30-day charts */
.btn-trend { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 18px; margin-left: 4px; padding: 0; border: 1px solid var(--border-strong); border-radius: 5px; background: transparent; color: var(--accent); cursor: pointer; vertical-align: middle; }
.btn-trend:hover { background: var(--surface-3); }
.btn-trend .icon { width: 12px; height: 12px; }
.print-trends { display: flex; flex-direction: column; gap: 18px; padding: 14px 16px; overflow: auto; }
.print-trends .print-trend { height: 110px; }
.print-trends .print-chart { height: 100px; }
.print-trends section { padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2, rgba(255,255,255,0.02)); }
.print-trends section .print-trend, .print-trends section .print-chart { border: 1px solid var(--border); border-radius: 6px; padding: 4px; box-sizing: border-box; background: rgba(0,0,0,0.12); }

/* searchable combo over a <select> (2026-09-11): the select is hidden, the input filters its options */
.combo { position: relative; display: block; width: 100%; }
.combo .combo-select { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; left: 0; top: 0; }
.combo .combo-input { width: 100%; }
.combo .combo-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; max-height: 260px; overflow: auto; margin-top: 2px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.combo .combo-item { padding: 6px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo .combo-item:hover, .combo .combo-item.is-active { background: var(--surface-3); }
.combo .combo-item.is-selected { color: var(--accent); }
select[data-autosubmit] + .combo-input, .toolbar .combo { min-width: 200px; }

/* sub-tabs inside a card (Active / Archive) (2026-09-11) */
.subtabs { display: flex; gap: 6px; }
.subtabs .tab { background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; color: var(--text-muted, #8a94a6); cursor: pointer; font-size: 13px; }
.subtabs .tab.active { color: var(--text); border-color: var(--accent); background: var(--surface-3); }

/* Demo site banner (2026-09-11) */
.demo-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem;
    background: var(--warning-soft);
    color: var(--text);
    border-bottom: 1px solid var(--warning);
    font-size: 0.9rem;
}
.demo-banner .icon { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; }
