/* ==========================================================================
   Enterprise Operations Platform — Soft White Design System
   ========================================================================== */

:root {
    /* Soft white surfaces */
    --bg:            #f6f8fb;
    --surface:       #ffffff;
    --surface-2:     #fbfcfe;
    --surface-3:     #f1f4f9;
    --sidebar:       #ffffff;

    /* Borders & lines */
    --border:        #e9edf3;
    --border-strong: #dce2eb;

    /* Text */
    --text:          #1c2433;
    --text-soft:     #5a6477;
    --text-muted:    #646e7e; /* WCAG AA: ~4.9:1 on white (was #93a0b4 ≈ 2.6:1) */

    /* Brand */
    --brand:         #5b6cff;
    --brand-soft:    #eef0ff;
    --brand-strong:  #4453e6;

    /* Status tones */
    --success:       #1f9d63;
    --success-soft:  #e6f6ee;
    --warn:          #d98307;
    --warn-soft:     #fcf2e2;
    --danger:        #e0413e;
    --danger-soft:   #fdecec;
    --info:          #2a7fd4;
    --info-soft:     #e8f2fc;
    --purple:        #8a47e0;
    --purple-soft:   #f2e9fc;
    --neutral:       #64748b;
    --neutral-soft:  #eef1f5;

    /* Shadows — soft & diffuse */
    --shadow-xs: 0 1px 2px rgba(28, 36, 51, 0.04);
    --shadow-sm: 0 1px 3px rgba(28, 36, 51, 0.06), 0 1px 2px rgba(28, 36, 51, 0.04);
    --shadow:    0 4px 14px rgba(28, 36, 51, 0.06), 0 2px 4px rgba(28, 36, 51, 0.04);
    --shadow-lg: 0 12px 32px rgba(28, 36, 51, 0.10), 0 4px 8px rgba(28, 36, 51, 0.05);

    --radius:    14px;
    --radius-sm: 9px;
    --radius-lg: 20px;

    --sidebar-w: 264px;
    --sidebar-rail: 72px;
    --topbar-h:  64px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dark mode */
[data-theme="dark"] {
    --bg:            #0e1320;
    --surface:       #171d2e;
    --surface-2:     #1b2236;
    --surface-3:     #212a42;
    --sidebar:       #141a29;
    --border:        #283150;
    --border-strong: #344063;
    --text:          #e9edf6;
    --text-soft:     #a9b4cc;
    --text-muted:    #6f7c98;
    --brand-soft:    #232a52;
    --success-soft:  #142c22;
    --warn-soft:     #2e2310;
    --danger-soft:   #2e1718;
    --info-soft:     #122436;
    --purple-soft:   #241734;
    --neutral-soft:  #232a3d;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
    --shadow:    0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Base size for any inline icon (more specific .x svg rules below override this) */
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.badge svg { width: 13px; height: 13px; }
.breadcrumb svg { width: 14px; height: 14px; }
h1 svg, h2 svg, h3 svg { width: 18px; height: 18px; }
td svg { width: 15px; height: 15px; }
::selection { background: var(--brand-soft); color: var(--brand-strong); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Layout
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar__brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar__logo {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #8a93ff);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 15px;
    box-shadow: 0 4px 10px rgba(91,108,255,.35);
    flex-shrink: 0;
}
.sidebar__title { font-weight: 700; font-size: 15px; letter-spacing: -0.2px; }
.sidebar__title small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }

/* Image-based brand logo (overrides the gradient text-box). */
.sidebar__logo.is-img, .lg-logo.is-img { background: none; box-shadow: none; border-radius: 0; }
.sidebar__logo.is-img { width: 40px; height: 40px; }
.sidebar__logo.is-img img, .lg-logo.is-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.nav-group { margin-bottom: 6px; }
.nav-group__label {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
    color: var(--text-muted); padding: 14px 12px 7px;
    background: none; border: 0; cursor: pointer; text-align: left;
    font-family: inherit; transition: color .15s;
}
.nav-group__label:hover { color: var(--text-soft); }
.nav-group__text { flex: 1; }
.nav-group__label > svg {              /* the chevron only */
    width: 14px; height: 14px; flex-shrink: 0;
    transition: transform .2s ease;
}
.nav-group.is-collapsed .nav-group__label > svg { transform: rotate(-90deg); }
.nav-group__icon { display: none; }     /* shown only in rail mode */
.nav-group__icon svg { width: 19px; height: 19px; }
.nav-group__flyhead { display: none; }  /* shown only in rail flyout */
.nav-group__items { overflow: hidden; max-height: 600px; transition: max-height .25s ease; }
.nav-group.is-collapsed .nav-group__items { max-height: 0; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 10px;
    color: var(--text-soft); font-weight: 500; font-size: 13.5px;
    margin-bottom: 2px; position: relative;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px; background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-item .nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}
.nav-item .nav-badge.soft { background: var(--surface-3); color: var(--text-soft); }

/* ── Collapsed icon rail (desktop) ─────────────────────────────────────────
   The "Collapse sidebar" button in the topbar adds body.is-rail. The sidebar
   shrinks to a strip of section icons; hovering a section reveals its menu. */
.rail-toggle { display: none; }
@media (min-width: 981px) {
    .rail-toggle { display: grid; }

    body.is-rail .sidebar { width: var(--sidebar-rail, 72px); }
    body.is-rail .main { margin-left: var(--sidebar-rail, 72px); }

    body.is-rail .sidebar__title { display: none; }
    body.is-rail .sidebar__brand { padding: 0; justify-content: center; }
    body.is-rail .sidebar__nav { overflow: visible; padding: 14px 8px 24px; }

    /* A section collapses to a single centered icon. */
    body.is-rail .nav-group__text,
    body.is-rail .nav-group__label > svg { display: none; }
    body.is-rail .nav-group__label {
        justify-content: center; padding: 11px 0; border-radius: 10px; margin: 0 0 2px;
    }
    body.is-rail .nav-group__label:hover,
    body.is-rail .nav-group.has-active .nav-group__label { background: var(--surface-3); color: var(--text); }
    body.is-rail .nav-group__icon { display: grid; place-items: center; }
    body.is-rail .nav-group.has-active .nav-group__icon svg { color: var(--brand); }

    /* Hovering the icon reveals the section's menu as a flyout. */
    body.is-rail .nav-group { position: relative; }
    body.is-rail .nav-group__items {
        position: absolute; left: 100%; top: -4px;
        min-width: 214px; max-height: none !important; overflow: visible;
        background: var(--sidebar); border: 1px solid var(--border);
        border-radius: 12px; box-shadow: var(--shadow-lg);
        padding: 8px; margin-left: 10px;
        opacity: 0; visibility: hidden; transform: translateX(-6px);
        transition: opacity .14s ease, transform .14s ease, visibility .14s;
        z-index: 60;
    }
    /* invisible bridge so the cursor can cross the gap without losing :hover */
    body.is-rail .nav-group__items::before {
        content: ''; position: absolute; top: 0; left: -12px; width: 12px; height: 100%;
    }
    body.is-rail .nav-group:hover .nav-group__items { opacity: 1; visibility: visible; transform: none; }
    body.is-rail .nav-group__flyhead {
        display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
        letter-spacing: .6px; color: var(--text-muted); padding: 5px 10px 8px;
    }

    /* Footer (Sign out) collapses to its icon too. */
    body.is-rail .sidebar__foot .nav-item { justify-content: center; }
    body.is-rail .sidebar__foot .nav-item span { display: none; }
}

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,.82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    padding: 0 26px;
}
[data-theme="dark"] .topbar { background: rgba(20,26,41,.82); }

.topbar__search {
    flex: 1; max-width: 460px;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-3);
    border: 1px solid transparent;
    border-radius: 11px; padding: 9px 14px;
    color: var(--text-muted);
    transition: border .15s, background .15s;
}
.topbar__search:focus-within { border-color: var(--brand); background: var(--surface); }
.topbar__search input { border: none; background: none; outline: none; flex: 1; font-size: 13.5px; color: var(--text); }
.topbar__search svg { width: 17px; height: 17px; }
.topbar__search kbd {
    font-size: 11px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 2px 6px; color: var(--text-muted); font-family: var(--font);
}
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* topbar digital clock */
.topbar__clock {
    align-items: center; gap: 8px;
    padding: 5px 11px; border-radius: 10px;
    background: var(--surface-3); border: 1px solid var(--border);
    color: var(--text-soft);
}
.topbar__clock svg { width: 16px; height: 16px; color: var(--brand); flex-shrink: 0; }
.topbar__clock .tc-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar__clock .tc-time { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.topbar__clock .tc-date { font-size: 10.5px; font-weight: 500; color: var(--text-muted); }

/* Live search suggestions */
.topbar__searchwrap { flex: 1; max-width: 460px; position: relative; display: flex; }
.topbar__searchwrap .topbar__search { flex: 1; max-width: none; }
.search-suggest {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-lg);
    padding: 6px; max-height: min(72vh, 480px); overflow-y: auto; z-index: 50;
}
.search-suggest[hidden] { display: none; }
.ss-group__label {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
    color: var(--text-muted); padding: 10px 10px 4px; display: flex; align-items: center; gap: 7px;
}
.ss-group__label svg { width: 13px; height: 13px; }
.ss-item {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text);
    text-decoration: none;
}
.ss-item:hover, .ss-item.is-active { background: var(--surface-3); }
.ss-item__main { min-width: 0; }
.ss-item__title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-item__title mark { background: var(--brand-soft); color: var(--brand-strong); border-radius: 3px; padding: 0 1px; }
.ss-item__meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-item .badge { flex-shrink: 0; }
.ss-foot {
    display: flex; align-items: center; justify-content: space-between;
    border-top: 1px solid var(--border); margin-top: 4px; padding: 10px;
    font-size: 12.5px; font-weight: 600; color: var(--brand-strong); cursor: pointer; border-radius: 0 0 8px 8px;
}
.ss-foot:hover { background: var(--surface-3); }
.ss-state { padding: 22px 14px; text-align: center; color: var(--text-muted); font-size: 13px; }


.icon-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
    display: grid; place-items: center; color: var(--text-soft);
    position: relative; transition: all .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
    position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%; border: 2px solid var(--surface);
}

.topbar__user {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 10px 5px 5px; border-radius: 30px;
    border: 1px solid var(--border); background: var(--surface);
    transition: all .15s;
}
.topbar__user:hover { background: var(--surface-3); }
.topbar__user .meta { line-height: 1.2; }
.topbar__user .meta b { font-size: 13px; display: block; }
.topbar__user .meta span { font-size: 11px; color: var(--text-muted); }

/* Content */
.content { padding: 26px; flex: 1; }
.content--narrow { max-width: 1280px; margin: 0 auto; width: 100%; }

/* Page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.4px; }
.page-head p { color: var(--text-soft); margin-top: 3px; font-size: 13.5px; }
.page-head__actions { margin-left: auto; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb svg { width: 14px; height: 14px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: 10px;
    font-weight: 600; font-size: 13px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 10px rgba(91,108,255,.28); }
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.94); }
.btn--success { background: var(--success); border-color: var(--success); color: #fff; }
.btn--success:hover { filter: brightness(.94); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-3); }
.btn--sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card__head { padding: 17px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card__head h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.card__head p { font-size: 12.5px; color: var(--text-muted); }
.card__head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 19px; box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.stat__icon {
    width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
    margin-bottom: 14px;
}
.stat__icon svg { width: 21px; height: 21px; }
.stat__label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.stat__value { font-size: 27px; font-weight: 700; letter-spacing: -0.6px; margin-top: 2px; }
.stat__delta { font-size: 12px; font-weight: 600; margin-top: 7px; display: inline-flex; align-items: center; gap: 4px; }
.stat__delta.up { color: var(--success); }
.stat__delta.down { color: var(--danger); }
.stat__delta.flat { color: var(--text-muted); }

.tone-brand   { background: var(--brand-soft); color: var(--brand); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warn    { background: var(--warn-soft); color: var(--warn); }
.tone-danger  { background: var(--danger-soft); color: var(--danger); }
.tone-info    { background: var(--info-soft); color: var(--info); }
.tone-purple  { background: var(--purple-soft); color: var(--purple); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }

/* Grid helpers */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-3-2 { grid-template-columns: 3fr 2fr; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-2-1, .grid-3-2 { grid-template-columns: 1fr; } }

/* ==========================================================================
   Badges & tags
   ========================================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-soft   { background: var(--neutral-soft); color: var(--text-soft); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn    { background: var(--warn-soft); color: var(--warn); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-purple  { background: var(--purple-soft); color: var(--purple); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge-brand   { background: var(--brand-soft); color: var(--brand-strong); }

.label-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 6px; font-size: 11px; font-weight: 600;
    background: var(--surface-3); color: var(--text-soft);
}
.label-tag::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--brand); }

.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.prio .dot { width: 8px; height: 8px; border-radius: 50%; }
.prio-critical { color: var(--danger); } .prio-critical .dot { background: var(--danger); }
.prio-high { color: var(--warn); } .prio-high .dot { background: var(--warn); }
.prio-medium { color: var(--info); } .prio-medium .dot { background: var(--info); }
.prio-low { color: var(--neutral); } .prio-low .dot { background: var(--neutral); }

/* ==========================================================================
   Avatars
   ========================================================================== */
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; color: #fff;
    font-weight: 600; font-size: 12.5px; flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar--lg { width: 46px; height: 46px; font-size: 16px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -9px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .meta b { font-weight: 600; font-size: 13px; display: block; }
.user-cell .meta span { font-size: 11.5px; color: var(--text-muted); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
    text-align: left; padding: 12px 18px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
    border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
table.data tbody td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .mono { font-family: 'SF Mono', ui-monospace, monospace; font-size: 12px; color: var(--text-soft); }
.cell-strong { font-weight: 600; }
.cell-link { color: var(--brand); font-weight: 600; }
.cell-link:hover { text-decoration: underline; }

.table-toolbar {
    display: flex; align-items: center; gap: 10px; padding: 14px 18px;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.table-toolbar .filter-pill {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 9px; font-size: 12.5px;
    font-weight: 500; color: var(--text-soft); background: var(--surface);
}
.table-toolbar .filter-pill:hover { background: var(--surface-3); }
.table-toolbar .filter-pill.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.table-toolbar .filter-pill svg { width: 14px; height: 14px; }
.table-toolbar .spacer { flex: 1; }

.pagination { display: flex; align-items: center; gap: 4px; padding: 14px 18px; border-top: 1px solid var(--border); }
.pagination .pg { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-soft); padding: 0 8px; }
.pagination .pg.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .pg:hover:not(.active) { background: var(--surface-3); }
.pagination .info { margin-right: auto; font-size: 12.5px; color: var(--text-muted); }

/* search box inline */
.search-inline {
    display: flex; align-items: center; gap: 8px; background: var(--surface-3);
    border: 1px solid transparent; border-radius: 9px; padding: 7px 12px; color: var(--text-muted);
    min-width: 240px;
}
.search-inline:focus-within { border-color: var(--brand); background: var(--surface); }
.search-inline input { border: none; background: none; outline: none; flex: 1; font-size: 13px; color: var(--text); }
.search-inline svg { width: 16px; height: 16px; }

/* ==========================================================================
   Progress
   ========================================================================== */
.progress { height: 7px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 20px; background: var(--brand); }
.progress.success > span { background: var(--success); }
.progress.warn > span { background: var(--warn); }
.progress.danger > span { background: var(--danger); }
.meter-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-soft); margin-bottom: 5px; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
    padding: 11px 15px; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
    border: none; background: none; border-bottom: 2px solid transparent; white-space: nowrap;
    transition: color .15s;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { background: var(--surface-3); color: var(--text-soft); font-size: 11px; padding: 1px 7px; border-radius: 20px; margin-left: 6px; }

/* segmented control */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { padding: 6px 13px; font-size: 12.5px; font-weight: 600; border-radius: 8px; color: var(--text-soft); background: none; display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 15px; height: 15px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ==========================================================================
   Dual view — List (table, default) ⇄ Board (cards), CSS-only flip.
   The same <tr> nodes are restyled as cards, so filters / search / pagination
   keep working untouched. Cell labels are injected by JS (initDualView).
   ========================================================================== */
.dv--board .table-wrap { overflow: visible; }
.dv--board table.data,
.dv--board table.data tbody,
.dv--board table.data tr,
.dv--board table.data td { display: block; }
.dv--board table.data thead { display: none; }
.dv--board table.data tbody {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px; padding: 16px;
}
.dv--board table.data tr {
    border: 1px solid var(--border) !important; border-radius: var(--radius-sm);
    background: var(--surface-2); padding: 14px 16px; transition: border-color .12s, box-shadow .12s;
}
.dv--board table.data tr:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.dv--board table.data td {
    border: none !important; padding: 6px 0 !important; text-align: left !important;
    display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 0;
    font-size: 13px;
}
.dv--board table.data td::before {
    content: attr(data-label); flex-shrink: 0;
    font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-muted);
}
/* no phantom label for cells the header left unlabelled */
.dv--board table.data td:not([data-label])::before { display: none; }
/* first cell = card title (no label, larger, divider under it) */
.dv--board table.data td:first-child {
    display: block; padding-bottom: 10px !important; margin-bottom: 4px;
    border-bottom: 1px solid var(--border) !important; font-size: 14.5px;
}
.dv--board table.data td:first-child::before { display: none; }
/* action / unlabelled columns become a left-aligned card footer */
.dv--board table.data td.right,
.dv--board table.data td:not([data-label]):not(:first-child):not([colspan]) {
    justify-content: flex-start; flex-wrap: wrap; gap: 6px;
    padding-top: 11px !important; margin-top: 6px;
    border-top: 1px solid var(--border) !important;
}
.dv--board table.data td.right::before { display: none; }
/* full-width cells (empty-state / colspan) span the whole grid with no label */
.dv--board table.data td[colspan] { grid-column: 1 / -1; display: block; }
.dv--board table.data tr:has(td[colspan]) { grid-column: 1 / -1; border: none !important; background: none; padding: 0; }
.dv--board table.data td[colspan]::before { display: none; }

/* ==========================================================================
   Kanban board
   ========================================================================== */
.board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.board__col { background: var(--surface-3); border-radius: var(--radius); width: 290px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.board__col-head { padding: 13px 15px; display: flex; align-items: center; gap: 9px; position: sticky; top: 0; background: var(--surface-3); border-radius: var(--radius) var(--radius) 0 0; z-index: 1; flex-shrink: 0; }
.board__col-head .ttl { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.board__col-head .ttl .dot { width: 9px; height: 9px; border-radius: 50%; }
.board__col-head .cnt { background: var(--surface); color: var(--text-soft); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.board__col-head .add { margin-left: auto; color: var(--text-muted); }
.board__col-body { padding: 0 11px 11px; flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.kard {
    background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
    padding: 13px; box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow .15s, transform .1s;
}
.kard:hover { box-shadow: var(--shadow); }
.kard.dragging { opacity: .5; }
.kard__labels { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.kard__title { font-weight: 600; font-size: 13px; line-height: 1.4; margin-bottom: 11px; }
.kard__meta { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 11.5px; }
.kard__meta .grp { display: flex; align-items: center; gap: 4px; }
.kard__meta svg { width: 13px; height: 13px; }
.kard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.kard__id { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.board__col.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; }

/* ==========================================================================
   Activity / Timeline feed (GitHub-style)
   ========================================================================== */
.feed { position: relative; padding-left: 8px; }
.feed__item { display: flex; gap: 13px; position: relative; padding-bottom: 20px; }
.feed__item:not(:last-child)::before {
    content: ''; position: absolute; left: 16px; top: 36px; bottom: -2px; width: 2px; background: var(--border);
}
.feed__avatar { z-index: 1; flex-shrink: 0; }
.feed__body { flex: 1; padding-top: 5px; }
.feed__body .who { font-weight: 600; }
.feed__body .txt { color: var(--text-soft); font-size: 13px; }
.feed__body .time { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.feed__comment {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
    padding: 12px 14px; margin-top: 7px; font-size: 13px; color: var(--text);
}
.feed__comment .mention { color: var(--brand); font-weight: 600; }
.feed__attach {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 9px 13px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px;
}
.feed__attach .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.feed__attach .ic svg { width: 16px; height: 16px; }

/* ==========================================================================
   Workflow builder
   ========================================================================== */
.flow-canvas {
    background:
        radial-gradient(circle, var(--border) 1px, transparent 1px);
    background-size: 22px 22px;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 0;
    min-height: 480px;
}
.flow-step {
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
    width: 440px; max-width: 100%; box-shadow: var(--shadow); overflow: hidden;
}
.flow-step__head { padding: 13px 16px; display: flex; align-items: center; gap: 11px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.flow-step__num { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.flow-step__head .meta b { font-size: 13.5px; }
.flow-step__head .meta span { font-size: 11.5px; color: var(--text-muted); display: block; }
.flow-step__head .grip { margin-left: auto; color: var(--text-muted); cursor: grab; }
.flow-step__users { padding: 8px 16px 14px; }
.flow-user { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.flow-user:last-child { border-bottom: none; }
.flow-user .name { font-weight: 500; font-size: 13px; }
.flow-user .perm { margin-left: auto; }
.flow-connector { width: 2px; height: 34px; background: var(--border-strong); position: relative; }
.flow-connector::after {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--border-strong);
}
.flow-add {
    border: 2px dashed var(--border-strong); border-radius: 12px; width: 440px; max-width: 100%;
    padding: 16px; text-align: center; color: var(--text-muted); font-weight: 600; font-size: 13px;
    background: var(--surface-2); transition: all .15s;
}
.flow-add:hover { border-color: var(--brand); color: var(--brand); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.input, .select, .textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; outline: none;
    transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.select--sm { width: auto; min-width: 140px; padding: 8px 11px; font-size: 13px; }
.textarea { resize: vertical; min-height: 96px; }
.input-row { display: flex; gap: 12px; } .input-row > * { flex: 1; }

/* Responsive 2-column form grid for big create modals */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field { margin-bottom: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* Wide modal that adapts to the viewport */
.modal--wide { max-width: 820px; width: min(820px, 94vw); }

.upload-zone {
    border: 2px dashed var(--border-strong); border-radius: 12px; padding: 30px; text-align: center;
    color: var(--text-muted); background: var(--surface-2); transition: all .15s;
}
.upload-zone:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.upload-zone svg { width: 30px; height: 30px; margin-bottom: 8px; }

/* ==========================================================================
   Charts (pure CSS / SVG)
   ========================================================================== */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 12px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 60%; max-width: 38px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--brand), #8a93ff); transition: height .4s ease; min-height: 4px; }
.bars .bar.alt { background: linear-gradient(180deg, var(--success), #4cc98a); }
.bars .bar-label { font-size: 11px; color: var(--text-muted); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.legend .item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ''; position: absolute; inset: 26px; background: var(--surface); border-radius: 50%; }
.donut .donut-center { position: absolute; inset: 26px; display: grid; place-items: center; text-align: center; z-index: 1; }
.donut .donut-center b { font-size: 24px; font-weight: 700; }
.donut .donut-center span { font-size: 11px; color: var(--text-muted); display: block; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.spark span { flex: 1; background: var(--brand-soft); border-radius: 3px 3px 0 0; min-height: 3px; }

/* gauge ring */
.gauge { --val: 50; --col: var(--brand); width: 86px; height: 86px; border-radius: 50%;
    background: conic-gradient(var(--col) calc(var(--val) * 1%), var(--surface-3) 0);
    display: grid; place-items: center; position: relative; }
.gauge::before { content: ''; position: absolute; inset: 9px; background: var(--surface); border-radius: 50%; }
.gauge b { position: relative; z-index: 1; font-size: 17px; font-weight: 700; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,26,41,.45); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 24px;
    overflow-y: auto;   /* scroll the whole modal when it's taller than the viewport */
    -webkit-overflow-scrolling: touch;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: 100%; max-width: 560px; overflow: hidden; display: flex; flex-direction: column;
    margin: auto;       /* centers when it fits, allows scroll when it doesn't (no top clipping) */
    animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal__head h3 { font-size: 16px; font-weight: 700; }
.modal__head { flex-shrink: 0; }
.modal__head .close { margin-left: auto; color: var(--text-muted); }
.modal__body { padding: 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 640px) {
    /* Let the whole modal scroll within the backdrop so nothing is ever clipped */
    .modal-backdrop { padding: 10px; align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .modal { max-height: none; width: 100%; margin: auto 0; }
    .modal--wide { width: 100%; }
    .modal__body { padding: 16px; overflow: visible; min-height: 0; }
}

/* ==========================================================================
   Dropdown (notifications)
   ========================================================================== */
.dropdown { position: relative; }
.dropdown__panel {
    position: absolute; right: 0; top: calc(100% + 10px); width: 360px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); z-index: 50; display: none; overflow: hidden;
}
.dropdown__panel.open { display: block; animation: pop .15s ease; }
.dropdown__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.dropdown__head b { font-size: 14px; }
.dropdown__head a { margin-left: auto; font-size: 12px; color: var(--brand); font-weight: 600; }
.noti { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); transition: background .12s; }
.noti:hover { background: var(--surface-2); }
.noti.unread { background: var(--brand-soft); }
[data-theme="dark"] .noti.unread { background: var(--surface-2); }
.noti__ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.noti__ic svg { width: 16px; height: 16px; }
.noti__txt { font-size: 13px; line-height: 1.4; }
.noti__txt .t { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

/* ==========================================================================
   Misc
   ========================================================================== */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--success);
    border-radius: 11px; box-shadow: var(--shadow-lg); padding: 13px 16px; display: flex; gap: 11px; align-items: center;
    min-width: 280px; animation: slidein .25s ease;
}
@keyframes slidein { from { transform: translateX(120%); } to { transform: none; } }
.toast.danger { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast svg { width: 19px; height: 19px; }

.empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; margin-bottom: 12px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.flex { display: flex; align-items: center; } .flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; } .mb-20 { margin-bottom: 20px; }
.wrap { flex-wrap: wrap; } .w-full { width: 100%; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }

.list-plain { list-style: none; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-muted); }
.kv .v { font-weight: 600; }

/* Sidebar mobile */
.sidebar__backdrop { display: none; }
@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .sidebar__backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
    .topbar__search, .topbar__searchwrap { max-width: none; }
    .menu-toggle { display: grid !important; }
}
.menu-toggle { display: none; }

/* ==========================================================================
   v2 additions — auth, header polish, tracker, alerts, workflow list
   ========================================================================== */

/* Topbar refinements */
.topbar { gap: 14px; }
.topbar__cta span { display: inline; }
.hide-sm { display: inline-flex; }
@media (max-width: 720px) {
    .hide-sm { display: none !important; }
    .topbar__cta span { display: none; }
    .topbar__cta { padding: 9px; }
}

/* Sidebar footer */
.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); }
.sidebar__foot .nav-item { color: var(--text-soft); }
.sidebar__foot .nav-item:hover { color: var(--danger); background: var(--danger-soft); }

/* Page header gets a soft underline treatment */
.page-head { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.page-head h1 { background: none; }

/* Alerts */
.alert { padding: 12px 15px; border-radius: 11px; font-size: 13px; border: 1px solid; line-height: 1.5; }
.alert--info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.alert--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 22%, transparent); color: var(--success); }
.alert--warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }

/* ── Auth — clean centered login ──────────────────────────────────────── */
.lg-body {
    min-height: 100vh; display: grid; place-items: center; padding: 24px; font-family: var(--font);
    background:
        radial-gradient(760px 420px at 50% -12%, #e8ebff 0%, transparent 62%),
        radial-gradient(680px 360px at 108% 112%, #e6f6ee 0%, transparent 58%),
        var(--bg);
}
.lg-card {
    width: 100%; max-width: 408px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
    padding: 40px 36px 30px;
}
.lg-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.lg-logo {
    width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--brand), #8a93ff); color: #fff; font-weight: 800; font-size: 20px; letter-spacing: -.5px;
    box-shadow: 0 10px 22px rgba(91,108,255,.35);
}
.lg-title h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--text); }
.lg-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.lg-alert { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.lg-alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.lg-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); cursor: pointer; margin: 4px 0 22px; }
.lg-submit { justify-content: center; padding: 12px; font-size: 14px; }
.lg-foot { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--text-muted); }
@media (max-width: 480px) { .lg-card { padding: 32px 24px 26px; } }

/* inputs with a leading icon (and a trailing show/hide toggle for the password) */
.auth-ic-field { position: relative; }
.auth-ic-field > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-muted); pointer-events: none; }
.auth-ic-field .input { padding-left: 40px; }
.auth-ic-field--pw .input { padding-right: 44px; }
.auth-pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: none; background: none; color: var(--text-muted); border-radius: 8px; cursor: pointer; transition: .12s; }
.auth-pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.auth-pw-toggle.is-on { color: var(--brand); }
.auth-pw-toggle svg { width: 17px; height: 17px; }

/* ── Workflow tracker (progress) ─────────────────────────────────────── */
.track { display: flex; align-items: flex-start; overflow-x: auto; padding: 8px 0 2px; }
.track__node { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 90px; flex-shrink: 0; }
.track__dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-3); color: var(--text-muted); border: 2px solid var(--border); }
.track__dot svg { width: 18px; height: 18px; }
.track__dot.done { background: var(--success); border-color: var(--success); color: #fff; }
.track__dot.reject { background: var(--danger); border-color: var(--danger); color: #fff; }
.track__dot.pending { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.track__label { text-align: center; font-size: 12px; font-weight: 600; }
.track__label span { display: block; font-weight: 400; font-size: 11px; color: var(--text-muted); }
.track__line { height: 3px; flex: 1; min-width: 28px; background: var(--border); margin-top: 19px; border-radius: 3px; }
.track__line.done { background: var(--success); }
.track__line.reject { background: var(--danger); }
.track__line.pending { background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 12px); }

/* ── Workflow templates list item ────────────────────────────────────── */
.wf-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 18px; border-bottom: 1px solid var(--border); transition: background .12s; }
.wf-item:hover { background: var(--surface-2); }
.wf-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }

.flow-step__num.off { background: var(--text-muted); }

/* Department access rows (workflow builder) */
.dept-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dept-row:last-child { border-bottom: none; }
.dept-row__main { display: flex; align-items: center; gap: 12px; width: 230px; flex-shrink: 0; }
.dept-row__users { flex: 1; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.dept-row .btn { margin-left: auto; flex-shrink: 0; }
@media (max-width: 820px) { .dept-row { flex-wrap: wrap; } .dept-row__main { width: auto; } .dept-row .btn { margin-left: 0; } }

/* Checkbox accent */
input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; }
input[type="radio"] { accent-color: var(--brand); }

/* Searchable select */
.ss { position: relative; }
.ss__control {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; cursor: pointer; text-align: left;
}
.ss__control:hover { border-color: var(--text-muted); }
.ss__control svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.ss__control .ss__ph { color: var(--text-muted); }
.ss__panel {
    position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg);
    display: none; overflow: hidden;
}
.ss__panel.open { display: block; animation: pop .12s ease; }
.ss__search { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 10px 13px; font-size: 13px; outline: none; background: var(--surface-2); color: var(--text); }
.ss__list { max-height: 240px; overflow-y: auto; padding: 5px; }
.ss__opt { padding: 8px 11px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.ss__opt:hover { background: var(--surface-3); }
.ss__opt.is-sel { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.ss__empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* multi-select dropdown (checkboxes → dropdown + chips) */
.msel { position: relative; }
.msel__control {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; cursor: pointer; text-align: left;
}
.msel__control:hover { border-color: var(--text-muted); }
.msel__control svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.msel__ph { color: var(--text-muted); }
.msel__panel {
    position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg);
    display: none; overflow-y: auto; max-height: 260px; padding: 5px;
}
.msel__panel.open { display: block; animation: pop .12s ease; }
.msel__opt { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.msel__opt:hover { background: var(--surface-3); }
.msel__opt input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand); cursor: pointer; }
.msel__opt.is-sel { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.msel__group {
    font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    color: var(--text-muted); padding: 10px 11px 4px; margin-top: 4px; border-top: 1px solid var(--border);
}
.msel__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

/* Count pill inside the Users/Subscriptions segmented tabs */
.segmented button .seg-n {
    font-size: 10.5px; font-weight: 700; line-height: 1; padding: 2px 6px; margin-left: 6px;
    border-radius: 20px; background: color-mix(in srgb, var(--text-muted) 20%, transparent); color: var(--text-soft);
}
.segmented button.active .seg-n { background: var(--brand-soft); color: var(--brand-strong); }

/* Clickable subscription seat → opens the assigned-users modal */
.seat-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 0; padding: 2px 4px; border-radius: 8px; cursor: pointer;
    color: var(--text-soft); transition: background .12s;
}
.seat-btn:hover { background: var(--surface-3); }
.seat-btn svg { width: 14px; height: 14px; color: var(--text-muted); }
.suser-row {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px; color: var(--text);
}
.suser-row:hover { background: var(--surface-3); }
.suser-row + .suser-row { border-top: 1px solid var(--border); }
.suser-row__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.suser-row__main b { font-size: 13.5px; }
.msel__chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); font-size: 12px; font-weight: 600; }
.msel__chip-x { border: none; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 5px; opacity: .65; }
.msel__chip-x:hover { opacity: 1; background: rgba(0,0,0,.07); }

/* license password history (in the password vault modal) */
.pw-hist { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.pw-hist__head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: 10px; }
.pw-hist__head svg { width: 14px; height: 14px; }
.pw-hist__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); margin-bottom: 8px; }
.pw-hist__left { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pw-hist__pw { font-family: var(--font-mono, monospace); font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.pw-hist__meta { font-size: 11px; color: var(--text-muted); }

/* ==========================================================================
   Global responsive polish (sidebar handled above; this covers content)
   ========================================================================== */
.table-wrap { -webkit-overflow-scrolling: touch; }

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
    .page-head__actions { margin-left: 0; width: 100%; }
    .segmented { flex-wrap: wrap; }
}
@media (max-width: 680px) {
    .input-row { flex-direction: column; gap: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 20px; }
    .page-head { gap: 12px; }
    .card__head { flex-wrap: wrap; }
    .card__head .right { margin-left: 0; }
    /* any inline 2-column grid collapses to one column */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns:300px"] { grid-template-columns: 1fr !important; }
}
@media (max-width: 560px) {
    .modal__foot { flex-wrap: wrap; }
    .modal__foot .btn { flex: 1; justify-content: center; }
    .stat__value { font-size: 22px; }
    .avatar--lg { width: 40px; height: 40px; font-size: 14px; }
    .donut-wrap { justify-content: center; }
}
@media (max-width: 460px) {
    /* Keep the global search visible on phones too — just let it shrink to fit. */
    .topbar__searchwrap { display: flex; flex: 1; min-width: 0; max-width: none; }
    .topbar__search input { font-size: 13px; }
    .content { padding: 12px; }
    .page-head h1 { font-size: 18px; }
    .btn { padding: 8px 12px; font-size: 12.5px; }
}

/* Mobile: notification & user dropdowns become full-width sheets under the header */
@media (max-width: 560px) {
    .dropdown__panel {
        position: fixed !important; top: calc(var(--topbar-h) + 4px) !important;
        left: 10px !important; right: 10px !important; width: auto !important;
        max-height: 76vh; overflow-y: auto;
    }
}

/* Mobile: tables become stacked cards (labels injected by initTableLabels) */
@media (max-width: 600px) {
    table.data thead { display: none; }
    table.data, table.data tbody { display: block; width: 100%; }
    table.data tr { display: block; border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; background: var(--surface); box-shadow: var(--shadow-xs); }
    table.data tbody tr:hover { background: var(--surface); }
    table.data td {
        display: flex; align-items: center; justify-content: space-between; gap: 14px;
        padding: 9px 14px; border: none; border-bottom: 1px solid var(--border); text-align: right;
    }
    table.data td:last-child { border-bottom: none; }
    table.data td::before {
        content: attr(data-label); font-weight: 700; color: var(--text-muted);
        font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; text-align: left; flex-shrink: 0;
    }
    table.data td[data-label=""]::before { content: ""; }
    .table-toolbar { gap: 8px; }
    .table-toolbar .search-inline { min-width: 100%; }
    .pagination { flex-wrap: wrap; }
}

/* Compact dashboard — fit everything in one view, with consistent padding.
   --dpad = the single horizontal/vertical padding used by every card region. */
.dash { --dpad: 15px; }
.dash .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.dash .stat { padding: var(--dpad); }
.dash .stat__icon { width: 30px; height: 30px; border-radius: 8px; margin-bottom: 7px; }
.dash .stat__icon svg { width: 16px; height: 16px; }
.dash .stat__value { font-size: 19px; }
.dash .stat__label { font-size: 11px; }
.dash .grid { gap: 12px; }
.dash .mb-20 { margin-bottom: 12px !important; }
.dash .card__head { padding: var(--dpad); }
.dash .card__head h3 { font-size: 13.5px; }
.dash .card__head p { font-size: 11px; }
.dash .card__body { padding: var(--dpad); }
.dash .bars { height: 130px; padding-top: 6px; }
.dash .donut { width: 112px; height: 112px; }
.dash .donut::after { inset: 20px; }
.dash .donut .donut-center { inset: 20px; }
.dash .donut .donut-center b { font-size: 19px; }
.dash .feed__item { padding-bottom: 11px; }
.dash .feed__item:not(:last-child)::before { top: 30px; }
.dash .feed__avatar { width: 28px; height: 28px; }
.dash .dash-row { padding: var(--dpad) !important; }
.dash .progress { height: 6px; }
.dash .meter-label { margin-bottom: 3px; font-size: 11px; }

/* Range slider */
input[type="range"].range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 20px; background: var(--surface-3); outline: none; }
input[type="range"].range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); cursor: pointer; box-shadow: 0 2px 6px rgba(91,108,255,.5); border: 2px solid #fff; }
input[type="range"].range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); cursor: pointer; border: 2px solid #fff; }

/* Kanban card progress */
.kard__progress { margin-top: 11px; }
.kard__progress .meter-label { margin-bottom: 4px; }
.kard__stat { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.kard__stat svg { width: 13px; height: 13px; }

/* Task attachments grid */
.attach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.attach { position: relative; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--surface-2); }
.attach__preview { display: block; height: 88px; }
.attach__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach__ic { width: 100%; height: 100%; display: grid; place-items: center; }
.attach__ic svg { width: 30px; height: 30px; }
.attach__meta { padding: 8px 10px; }
.attach__name { font-size: 12px; font-weight: 600; display: block; }
.attach__name:hover { color: var(--brand); }
.attach__by { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; color: var(--text-soft); font-weight: 500; }
.attach__del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 7px; border: none;
    background: rgba(20,26,41,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.attach__del:hover { background: var(--danger); }
.attach__del svg { width: 13px; height: 13px; }

@media (max-width: 640px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .topbar__search kbd { display: none; }
}

/* ==========================================================================
   Dashboard analog clock — big, centred under the KPI row
   ========================================================================== */
/* Clock in the middle, a card hugging each side to fill the width. */
.clock-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px; align-items: stretch;
}
.clock-row__center {
    display: flex; align-items: center; justify-content: center;
    padding: 8px 8px 48px;   /* room for the caption below the dial */
}

/* The analog clock */
.analog {
    position: relative; width: 272px; height: 272px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 32%, var(--surface), var(--surface-3));
    box-shadow: 0 22px 60px rgba(2,8,40,.20), inset 0 0 0 1px var(--border);
    z-index: 1;
}
.analog--lg { width: 320px; height: 320px; }
.analog svg { width: 100%; height: 100%; display: block; }
.ac-face { fill: none; stroke: var(--border-strong, var(--border)); stroke-width: 2; }
.ac-tick { stroke: var(--text-muted); stroke-width: 1; opacity: .45; }
.ac-tick--major { stroke: var(--text-soft); stroke-width: 2.4; opacity: .9; }
.ac-num {
    fill: var(--text); font-size: 13px; font-weight: 700;
    text-anchor: middle; dominant-baseline: central; font-family: var(--font);
}
.ac-hand {
    stroke-linecap: round;
    transform-box: view-box; transform-origin: 100px 100px;
}
.ac-hour { stroke: var(--text); stroke-width: 5; }
.ac-min  { stroke: var(--text); stroke-width: 3.4; }
.ac-sec  { stroke: var(--brand); stroke-width: 1.8; }
.ac-cap  { fill: var(--brand); }
.analog__caption {
    position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%);
    text-align: center; white-space: nowrap;
}
.ac-digital {
    display: block; font-size: 20px; font-weight: 700;
    font-variant-numeric: tabular-nums; letter-spacing: 1px; color: var(--text);
}
.ac-date { font-size: 12px; color: var(--text-muted); }

/* To Do — idea board cards & star ratings */
.idea-card .card__body { display: flex; flex-direction: column; height: 100%; }
.idea-rate-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.idea-avg-block { display: flex; align-items: center; gap: 7px; }
.idea-avg { font-size: 18px; font-weight: 800; }
.idea-stars-display { color: #f5b301; letter-spacing: 1px; font-size: 14px; }
.idea-stars-input { display: inline-flex; margin: 0; }
.idea-star {
    background: none; border: none; cursor: pointer; padding: 0 1px;
    font-size: 18px; line-height: 1; color: var(--border-strong, #c7ccd9); transition: color .12s, transform .12s;
}
.idea-star.on { color: #f5b301; }
.idea-stars-input:hover .idea-star { color: #f5b301; }
.idea-stars-input .idea-star:hover ~ .idea-star { color: var(--border-strong, #c7ccd9); }
.idea-star:hover { transform: scale(1.15); }
.idea-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* IT → Users: expandable per-user detail panels */
.itu-row { cursor: pointer; }
.itu-row.open .itu-toggle svg { transform: rotate(90deg); }
.itu-toggle svg { transition: transform .15s ease; }
.itu-panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); }
.itu-panel { background: var(--surface); padding: 14px 16px; }
.itu-panel__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.itu-panel__head svg { width: 16px; height: 16px; color: var(--text-muted); }
.itu-kv { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.itu-kv > span:first-child { width: 78px; color: var(--text-muted); flex-shrink: 0; }
.itu-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.itu-line:last-child { border-bottom: none; }
@media (max-width: 820px) { .itu-panels { grid-template-columns: 1fr; } }

/* Dashboard "Created vs Resolved" trend chart */
.trend-chart { width: 100%; height: 190px; display: block; }
.trend-axis { stroke: var(--border); stroke-width: 1; }
.trend-area { fill: rgba(91,108,255,.10); stroke: none; }
.trend-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trend-line--created  { stroke: #5b6cff; }
.trend-line--resolved { stroke: #22a06b; }
.trend-x { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--text-muted); }

/* Narrow: stack the side cards above/below the clock instead of flanking it. */
@media (max-width: 920px) {
    .clock-row { grid-template-columns: 1fr; }
    .clock-row__center { order: -1; padding-bottom: 44px; }
}
@media (max-width: 560px) {
    .analog--lg { width: 250px; height: 250px; }
}

/* ==========================================================================
   Accessibility & polish (added in the UX audit pass)
   ========================================================================== */

/* 1 ─ Visible keyboard focus everywhere. Mouse clicks stay clean (:focus-visible
       only fires for keyboard/AT), so this is purely additive for keyboard users. */
:where(a, button, .btn, .icon-btn, .nav-item, .nav-group__label, [tabindex],
       [data-action], summary):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
/* Inputs that previously killed their outline now show a focus ring on keyboard focus. */
.topbar__search:focus-within,
.search-inline:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible,
.ss__search:focus-visible, input[type="range"]:focus-visible {
    outline: 2px solid var(--brand); outline-offset: 1px;
}
/* Never leave users with no focus indication. */
*:focus-visible { outline-color: var(--brand); }

/* 2 ─ Screen-reader-only utility (skip link, table captions, helper text). */
.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 3 ─ Skip-to-content link: hidden until focused, then pinned top-left. */
.skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 200;
    background: var(--brand); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg);
    transform: translateY(-150%); transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

/* 4 ─ Required-field marker: not colour-only — exposes "required" to AT via aria. */
.req { color: var(--danger); margin-left: 2px; }

/* 5 ─ Field-level validation error text. */
.field-error {
    display: flex; align-items: center; gap: 5px;
    font-size: 11.5px; color: var(--danger); margin-top: 5px; font-weight: 500;
}
.field-error svg { width: 13px; height: 13px; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus, .select.is-invalid:focus, .textarea.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-soft);
}
/* Error summary list (top of form) — show ALL errors, not just the first. */
.alert--danger ul { margin: 6px 0 0; padding-left: 18px; }
.alert--danger ul li { margin: 2px 0; }

/* 6 ─ Modal dialog semantics helpers (role/aria added by JS). */
.modal:focus { outline: none; }

/* 7 ─ Inline busy spinner (live search, async actions). */
.spinner {
    display: inline-block; width: 15px; height: 15px;
    border: 2px solid var(--border-strong); border-top-color: var(--brand);
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.search-suggest .ss-state .spinner { margin-right: 8px; vertical-align: -2px; }

/* 8 ─ Sortable table headers. */
th[data-sortable] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sortable]:hover { color: var(--text); }
th[data-sortable] .th-sort {
    display: inline-block; width: 12px; margin-left: 4px; opacity: .35; font-size: 10px;
    transition: opacity .12s;
}
th[aria-sort="ascending"] .th-sort,
th[aria-sort="descending"] .th-sort { opacity: 1; color: var(--brand); }

/* 9 ─ Complete the spacing scale so views stop reaching for inline margins. */
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; } .gap-4 { gap: 4px; } .gap-20 { gap: 20px; }

/* 10 ─ Touch targets: ensure interactive controls are >=44px on touch screens.
        Visual size is preserved; the tap area is expanded via min-size + flex centring. */
@media (max-width: 820px) {
    .icon-btn { min-width: 44px; min-height: 44px; }
    .pagination .pg { min-width: 40px; min-height: 40px; }
    .nav-item, .btn { min-height: 42px; }
    .auth-pw-toggle { min-width: 40px; min-height: 40px; }
}

/* 11 ─ Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important;
    }
}

/* ── Notifications: dropdown + page polish ─────────────────────────────── */
.icon-btn { position: relative; }
.noti-count { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 9px; background: var(--danger); color: #fff; font: 800 10px/1 Inter, sans-serif;
    display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.dropdown__panel--noti { width: 384px; padding: 0; }
.noti-list { max-height: 60vh; overflow-y: auto; }
.noti { position: relative; align-items: flex-start; }
.noti.unread::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.noti__txt { flex: 1; min-width: 0; }
.noti__txt .body { color: var(--text-muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.noti__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 6px; }
.dropdown__foot { padding: 11px 14px; border-top: 1px solid var(--border); text-align: center; background: var(--surface-2); }
.dropdown__foot a { font-size: 12.5px; font-weight: 700; color: var(--brand); }

/* Notifications page — feed */
.noti-feed { display: flex; flex-direction: column; }
.noti-feed .nf { display: flex; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--border); position: relative; transition: background .12s; text-decoration: none; color: inherit; }
.noti-feed .nf:last-child { border-bottom: 0; }
.noti-feed .nf:hover { background: var(--surface-2); }
.noti-feed .nf.unread { background: var(--brand-soft); }
[data-theme="dark"] .noti-feed .nf.unread { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.noti-feed .nf.unread::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.noti-feed .nf__ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.noti-feed .nf__ic svg { width: 19px; height: 19px; }
.noti-feed .nf__body { flex: 1; min-width: 0; }
.noti-feed .nf__body .ttl { font-weight: 600; font-size: 14px; }
.noti-feed .nf__body .bdy { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.noti-feed .nf__meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.noti-feed .nf__time { color: var(--text-muted); font-size: 12px; }
.noti-feed .nf__new { font: 700 10px/1 Inter, sans-serif; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }

/* Theme-toggle icon: moon in light mode (→ switch to dark), sun in dark mode. */
.theme-ic { display: none; }
[data-theme="light"] .theme-ic--moon { display: block; }
[data-theme="dark"] .theme-ic--sun { display: block; }
