/* ==========================================================================
   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;

    /* 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);
}

.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(auto-fit, minmax(min(100%, 210px), 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::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;
}
