/* ═══════════════════════════════════════════════════════════════
   COREIDON.AI — Design System (mobile-first)
   ═══════════════════════════════════════════════════════════════
   Breakpoint ladder (min-width only):
     base  0   – 639px  (phones)
     sm   640px         (large phones)
     md   768px         (tablets / first multi-column)
     lg  1024px         (laptop — sidebar becomes permanent)
     xl  1280px         (desktop)
   ─────────────────────────────────────────────────────────────── */

/* ── Theme Tokens ── */
:root {
    /* Brand */
    --brand-deep: #091C3A;
    --brand-navy: #00284A;

    /* Light surfaces */
    --bg-primary:      #FFFFFF;
    --bg-secondary:    #F8F5F0;
    --bg-surface:      #FFFFFF;
    --bg-surface-alt:  #F8F5F0;
    --bg-elevated:     #FFFFFF;
    --bg-sidebar:        #091C3A;
    --bg-sidebar-hover:  rgba(255,255,255,0.06);
    --bg-sidebar-active: rgba(56,189,248,0.16);

    /* Light text */
    --text-primary:        #000000;
    --text-secondary:      #2B303B;
    --text-muted:          #6B7280;
    --text-sidebar:        rgba(248,245,240,0.75);
    --text-sidebar-active: #FFFFFF;

    /* Light borders */
    --border-default: #E5E7EB;
    --border-subtle:  #F0EDE8;
    --border-strong:  #2B303B;
    --border-sidebar: rgba(255,255,255,0.08);

    /* Buttons (light) */
    --btn-primary-bg:        #091C3A;
    --btn-primary-text:      #FFFFFF;
    --btn-primary-hover:     #0D2A52;
    --btn-secondary-bg:      transparent;
    --btn-secondary-text:    #2B303B;
    --btn-secondary-border:  #E5E7EB;
    --btn-secondary-hover-border: #0284C7;
    --btn-secondary-hover-text:   #0284C7;
    --btn-danger-bg:         #DC2626;
    --btn-danger-text:       #FFFFFF;

    /* Semantic (light) */
    --accent-success:    #16A34A;
    --accent-success-bg: #ECFDF5;
    --accent-warning:    #D97706;
    --accent-warning-bg: #FFFBEB;
    --accent-danger:     #DC2626;
    --accent-danger-bg:  #FEF2F2;

    /* Expressive accent — cyan (data, links, focus, progress) */
    --accent-cyan:       #0284C7;
    --accent-cyan-soft:  #E0F2FE;
    --accent-cyan-ring:  rgba(2,132,199,0.35);

    /* `--accent-info` is kept as an alias for legacy callers; maps to brand navy
       so existing primary-CTA semantics keep working. Cyan has its own var. */
    --accent-info:    #091C3A;
    --accent-info-bg: #EEF2FF;

    /* Inputs (light) */
    --input-bg:           #FFFFFF;
    --input-border:       #E5E7EB;
    --input-focus-border: #0284C7;
    --input-placeholder:  #9CA3AF;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Typography */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body:    'Inter', sans-serif;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 56px;
    --content-pad-x: 16px;
    --content-pad-y: 16px;
    --tap-min: 44px;

    /* Focus ring (cyan, brand-consistent) */
    --focus-ring: 0 0 0 3px var(--accent-cyan-ring);
}

@media (min-width: 768px) {
    :root {
        --content-pad-x: 24px;
        --content-pad-y: 24px;
    }
}

@media (min-width: 1280px) {
    :root {
        --content-pad-x: 32px;
        --content-pad-y: 28px;
    }
}

/* ── Dark Theme (brand-correct navy palette) ── */
[data-theme="dark"] {
    --bg-primary:      #0A1220;
    --bg-secondary:    #0A1220;
    --bg-surface:      #121B2A;
    --bg-surface-alt:  #1F2A3C;
    --bg-elevated:     #243447;
    --bg-sidebar:        #2B303B;
    --bg-sidebar-hover:  rgba(248,245,240,0.06);
    --bg-sidebar-active: rgba(56,189,248,0.18);

    --text-primary:        #FFFFFF;
    --text-secondary:      rgba(248,245,240,0.75);
    --text-muted:          rgba(248,245,240,0.45);
    --text-sidebar:        rgba(248,245,240,0.75);
    --text-sidebar-active: #FFFFFF;

    --border-default: #2D3D52;
    --border-subtle:  #1F2A3C;
    --border-strong:  #38BDF8;
    --border-sidebar: rgba(248,245,240,0.08);

    /* In dark mode the dominant action stays navy-cool — surface contrast
       comes from the cyan focus/active ring, not from inverting the button. */
    --btn-primary-bg:        #091C3A;
    --btn-primary-text:      #FFFFFF;
    --btn-primary-hover:     #102D5A;
    --btn-secondary-bg:      transparent;
    --btn-secondary-text:    #F8F5F0;
    --btn-secondary-border:  #2D3D52;
    --btn-secondary-hover-border: #38BDF8;
    --btn-secondary-hover-text:   #38BDF8;

    --accent-success:    #34D399;
    --accent-success-bg: rgba(52,211,153,0.14);
    --accent-warning:    #FBBF24;
    --accent-warning-bg: rgba(251,191,36,0.14);
    --accent-danger:     #FB7185;
    --accent-danger-bg:  rgba(251,113,133,0.14);

    --accent-cyan:       #38BDF8;
    --accent-cyan-soft:  rgba(56,189,248,0.14);
    --accent-cyan-ring:  rgba(56,189,248,0.45);

    --accent-info:    #38BDF8;
    --accent-info-bg: rgba(56,189,248,0.14);

    --input-bg:           #121B2A;
    --input-border:       #2D3D52;
    --input-focus-border: #38BDF8;
    --input-placeholder:  rgba(248,245,240,0.35);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.55);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.6);
}

/* ── Base Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    /* Fluid root: 14px on small phones, 15px desktop, 16px wide */
    font-size: clamp(14px, 0.85rem + 0.25vw, 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.45;
    background: var(--bg-secondary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Typography ── */
h1, h2, h3, h4, .heading { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.75rem); }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem); }
h4 { font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.15rem); }

/* Page-title size modifiers — for the .heading utility on detail/form pages */
.heading-md  { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem); font-weight: 700; }
.heading-lg  { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.75rem);   font-weight: 800; }
.heading-xl  { font-size: clamp(1.35rem, 1.15rem + 1vw, 1.875rem);  font-weight: 900; }
.heading-2xl { font-size: clamp(1.5rem,  1.2rem + 1.5vw, 2.25rem);  font-weight: 900; }

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visible focus for keyboard users — never strip outlines */
:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── App Shell (mobile-first) ── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Sidebar — off-canvas drawer on mobile, permanent column from lg */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s ease, background-color 0.2s ease;
    will-change: transform;
}

.sidebar.is-open { transform: translateX(0); }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10,18,32,0.55);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-sidebar);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap-min);
}

.sidebar-brand svg { width: 28px; height: 28px; flex-shrink: 0; }

.sidebar-brand-name {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-sidebar-active);
    position: relative;
    top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--tap-min);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-nav-item .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-nav-item.active-tab {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--accent-cyan);
}

/* Main column */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-secondary);
    transition: background-color 0.2s ease;
}

/* Top bar — sticky, hosts hamburger on mobile, theme toggle always */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px var(--content-pad-x);
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.top-bar-title {
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Hamburger / icon-only buttons */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap-min);
    height: var(--tap-min);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--bg-surface-alt);
    color: var(--text-primary);
}

.icon-btn svg { width: 20px; height: 20px; }

.menu-btn { /* hamburger — hidden on lg+ */ }

@media (min-width: 1024px) {
    .menu-btn { display: none; }
    .sidebar-backdrop { display: none; }

    .app-shell { flex-direction: row; }

    .sidebar {
        position: relative;
        inset: auto;
        transform: none;
        width: var(--sidebar-width);
        height: 100vh;
        height: 100dvh;
        flex-shrink: 0;
    }

    .main-area {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    .content-area { overflow-y: auto; }
}

.content-area {
    flex: 1;
    padding: var(--content-pad-y) var(--content-pad-x);
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* ── Cards & Surfaces ── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card-padded { padding: 16px; }

@media (min-width: 768px) {
    .card-padded { padding: 24px; }
}

/* ── Buttons (≥44px tap target on touch, full-width on mobile) ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: var(--tap-min);
    padding: 10px 16px;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

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

@media (min-width: 640px) {
    .btn { width: auto; }
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-color: var(--btn-secondary-border);
}
.btn-secondary:hover {
    color: var(--btn-secondary-hover-text);
    border-color: var(--btn-secondary-hover-border);
}

.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-text);
    border-color: var(--btn-danger-bg);
}
.btn-danger:hover { opacity: 0.92; }

/* Warning button outline variant — for "Disable Asset" / cautionary actions */
.btn-warning-outline {
    background: transparent;
    color: var(--accent-warning);
    border-color: var(--accent-warning);
}
.btn-warning-outline:hover {
    background: var(--accent-warning-bg);
}

/* Danger button outline variant — for inline destructive icons (× remove field) */
.btn-danger-outline {
    background: transparent;
    color: var(--accent-danger);
    border-color: var(--accent-danger);
}
.btn-danger-outline:hover {
    background: var(--accent-danger-bg);
}

/* Status updater select — pill-shaped primary-tinted dropdown for inline status changes */
.status-select {
    width: auto;
    min-height: var(--tap-min);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-radius: var(--radius-md);
    padding: 6px 32px 6px 12px;
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
}
.status-select:focus { box-shadow: var(--focus-ring); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-surface-alt); color: var(--text-primary); }

.btn-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--accent-cyan-soft);
    color: var(--accent-cyan);
    transition: opacity 0.15s ease;
}
.btn-soft:hover { opacity: 0.85; }
.btn-soft.muted {
    background: var(--bg-surface-alt);
    color: var(--text-muted);
}
.btn-soft.muted:hover { color: var(--text-primary); }

.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 0.875rem;
}

/* ── Inputs ── */
.input,
input[type="text"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="time"],
input[type="file"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], input[type="url"],
textarea, select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 11px 12px;
    min-height: var(--tap-min);
    font-family: var(--font-body);
    font-size: 0.875rem; /* 16px on smallest viewport — prevents iOS zoom */
    color: var(--text-primary);
    transition: border-color 0.15s ease, background-color 0.2s ease, box-shadow 0.15s ease;
    outline: none;
    width: 100%;
}

textarea { min-height: 96px; line-height: 1.45; resize: vertical; }

.input:focus, input:focus, textarea:focus, select:focus {
    border-color: var(--input-focus-border);
    box-shadow: var(--focus-ring);
}

::placeholder { color: var(--input-placeholder); }

/* ── Tables (mobile-first: cards on base, table from md) ──
   Each <td> should carry data-label="<column name>" — that label is
   rendered as the row's field label on mobile, hidden from md upward.
   Use class="table-fixed" on a <table> to opt out (financial cross-tabs). */

table {
    width: 100%;
    border-collapse: collapse;
    display: block;
}

thead { display: none; }

tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

tbody tr {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
tbody tr:hover { border-color: var(--accent-cyan); }

tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 6px 0;
    border: none;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

tbody td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-top: 3px;
    min-width: 90px;
    text-align: left;
}

tbody td:not([data-label])::before,
tbody td[data-label=""]::before { content: none; min-width: 0; }

/* Desktop layout (table mode) */
@media (min-width: 768px) {
    table { display: table; min-width: 560px; }
    thead { display: table-header-group; background: var(--bg-surface-alt); }
    thead th {
        padding: 10px 14px;
        text-align: left;
        font-family: var(--font-heading);
        font-size: 0.625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border-default);
        white-space: nowrap;
    }
    tbody { display: table-row-group; gap: 0; }
    tbody tr {
        display: table-row;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
    }
    tbody tr:hover { background: var(--bg-surface-alt); border: none; }
    tbody td {
        display: table-cell;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border-subtle);
        vertical-align: top;
    }
    tbody td::before { content: none; }
    tbody tr:last-child td { border-bottom: none; }
}

/* Horizontal-scroll wrapper for any table that should remain tabular */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

/* Row variants for responsive tables */
tbody tr.is-below-min { border-color: var(--accent-danger); background: var(--accent-danger-bg); }
@media (min-width: 768px) {
    tbody tr.is-below-min { background: var(--accent-danger-bg); }
}

/* Opt-out: classic table at all widths (financial cross-tabs, tiny config grids) */
.table-fixed { display: table !important; }
.table-fixed thead { display: table-header-group !important; background: var(--bg-surface-alt); }
.table-fixed thead th {
    padding: 8px 10px;
    text-align: left;
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}
.table-fixed tbody { display: table-row-group !important; gap: 0 !important; }
.table-fixed tbody tr {
    display: table-row !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}
.table-fixed tbody td {
    display: table-cell !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    vertical-align: top;
}
.table-fixed tbody td::before { content: none !important; }

/* ── Status Pills ── */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
}
.status-pill--success { background: var(--accent-success-bg); color: var(--accent-success); }
.status-pill--danger  { background: var(--accent-danger-bg);  color: var(--accent-danger);  }
.status-pill--warning { background: var(--accent-warning-bg); color: var(--accent-warning); }
.status-pill--info    { background: var(--accent-cyan-soft);  color: var(--accent-cyan);    }
.status-pill--neutral { background: var(--bg-surface-alt);    color: var(--text-muted);     }

/* Inline tag (small uppercase chip used in tables/lists) */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    white-space: nowrap;
}
.tag--info    { background: var(--accent-cyan-soft);  color: var(--accent-cyan); }
.tag--success { background: var(--accent-success-bg); color: var(--accent-success); }
.tag--warning { background: var(--accent-warning-bg); color: var(--accent-warning); }
.tag--danger  { background: var(--accent-danger-bg);  color: var(--accent-danger); }

/* Avatar circle (initials) */
.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: var(--font-heading);
    font-weight: 700;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    flex-shrink: 0;
}
.avatar-circle--sm { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-circle--md { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-circle--lg { width: 40px; height: 40px; font-size: 0.875rem; }

/* ── Modals — bottom sheet on mobile, centered card from sm ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,18,32,0.55);
    align-items: flex-end;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}
.modal.active { display: flex; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
    .modal { align-items: center; }
    .modal-content {
        max-width: 600px;
        width: 92%;
        border-radius: var(--radius-lg);
        max-height: 88vh;
    }
    .modal-content--lg { max-width: 640px; }
    .modal-content--xl { max-width: 800px; }
}

/* ── Module controls — wraps a tab bar (or title) plus an action-button cluster.
   Mobile: stacked, tabs/title on top, action buttons full-width below.
   md+:    side-by-side row with the actions pushed right.            */
.module-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}
.module-controls > .tab-bar { width: 100%; }

.module-controls-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

@media (min-width: 640px) {
    .module-controls-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}

@media (min-width: 768px) {
    .module-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
    .module-controls > .tab-bar { width: auto; flex: 1 1 auto; min-width: 0; }
    .module-controls-actions { flex-wrap: nowrap; }
}

/* ── Tabs ──
   Mobile: wrap as a pill row so every tab is visible without scrolling.
   md+ (768px): classic single-row underline tabs. */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.tab-btn {
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-surface-alt);
    padding: 8px 12px;
    min-height: var(--tap-min);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

.tab-btn.active {
    color: var(--accent-cyan);
    background: var(--accent-cyan-soft);
    border-color: var(--accent-cyan);
}

@media (min-width: 768px) {
    .tab-bar {
        flex-wrap: nowrap;
        gap: 24px;
        border-bottom: 1px solid var(--border-default);
    }

    .tab-btn {
        flex-shrink: 0;
        font-size: 0.875rem;
        background: none;
        border: none;
        border-radius: 0;
        border-bottom: 2px solid transparent;
        margin-bottom: -1px;
        padding: 10px 0;
        color: var(--text-muted);
    }

    .tab-btn:hover {
        color: var(--text-primary);
        border-color: transparent;
    }

    .tab-btn.active {
        color: var(--text-primary);
        background: none;
        border-bottom-color: var(--accent-cyan);
    }
}

/* ── Labels ── */
.label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ── Chips ── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--accent-cyan-soft);
    color: var(--accent-cyan);
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
}
/* Strip native button chrome from chip × so it inherits the chip's pill look
   instead of rendering as a default grey square button. Used everywhere chips
   come from setupChipInput (workforce form, pm-scheduler, inventory, etc.). */
.chip button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    font-size: 0.875rem;
    line-height: 1;
    font-weight: 700;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}
.chip button:hover { opacity: 1; }

/* ── Theme Toggle ── */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap-min);
    height: var(--tap-min);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover {
    background: var(--bg-surface-alt);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}
.theme-toggle svg { width: 20px; height: 20px; }

/* Sun shows in dark, Moon shows in light — simple swap */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Loading & empty states ── */
.module-loading {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--bg-primary);
    opacity: 0.9;
}
.module-loading:not(.hidden) { display: flex; }

.module-loading-inner { text-align: center; }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: tw-spin 1s linear infinite;
}

.loading-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 320px;
}
.empty-state-inner { text-align: center; padding: 24px; }
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.35;
}
.empty-state-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.empty-state-body {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── Stat value (large numeric metric in summary blocks) ── */
.stat-value {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
    font-weight: 900;
    color: var(--accent-success);
    line-height: 1.1;
}
.stat-subvalue {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.25rem);
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.2;
}
.stat-value--neutral { color: var(--text-secondary); }
.stat-value--info    { color: var(--accent-cyan); }
.stat-value--danger  { color: var(--accent-danger); }

/* Surface bar — full-width header strip used inside financial detail panels */
.surface-bar {
    padding: 14px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
}
@media (min-width: 768px) {
    .surface-bar { padding: 16px; }
}

/* Detail page bottom section (the FIFO stock table at the bottom of inventory detail) */
.detail-section-bottom {
    padding: 0 16px 16px;
}
@media (min-width: 768px) {
    .detail-section-bottom { padding: 0 24px 24px; }
}
@media (min-width: 1280px) {
    .detail-section-bottom { padding: 0 40px 40px; }
}

/* Form-page card padding (replaces inline style="padding:40px" on max-w cards) */
.card-form { padding: 20px; }
@media (min-width: 768px) {
    .card-form { padding: 32px; }
}
@media (min-width: 1280px) {
    .card-form { padding: 40px; }
}

/* Detail-page header strip — sits above the body of asset/inv/wo/insp detail pages */
.detail-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}
@media (min-width: 768px) {
    .detail-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px;
    }
}

/* Detail info-grid (the inset block of label/value pairs in asset/inventory detail) */
.detail-info {
    background: var(--bg-surface-alt);
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}
@media (min-width: 768px) {
    .detail-info { padding: 24px; }
}

/* Detail value (label/value rows in detail panels) */
.detail-value {
    font-weight: 700;
    color: var(--text-secondary);
}
.detail-value--lg {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.125rem);
}

/* Sidebar column inside detail page (h-fit + bg-surface-alt + larger padding) */
.detail-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-surface-alt);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    height: fit-content;
}
@media (min-width: 768px) {
    .detail-side { padding: 24px; gap: 20px; }
}
@media (min-width: 1024px) {
    .detail-side { padding: 28px; gap: 24px; }
}

/* Section divider — thin underline used inside cards above a sub-section title */
.label-underline {
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 8px;
}

/* Modal close (×) button */
.modal-close-btn {
    width: var(--tap-min);
    height: var(--tap-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 22px;
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.modal-close-btn:hover {
    background: var(--bg-surface-alt);
    color: var(--text-primary);
}

/* Modal header strip with title + close */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-default);
}
@media (min-width: 768px) {
    .modal-header { padding: 20px 24px; }
}

/* Runner (full-screen inspection form) hero */
.runner-hero {
    background: var(--brand-deep);
    padding: 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.runner-hero p { color: rgba(248,245,240,0.55); font-size: 0.75rem; }
.runner-hero .btn-ghost { color: rgba(248,245,240,0.55); }

/* Hero image (asset / inventory detail thumbnail) */
.hero-image {
    width: 128px;
    height: 128px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 4px solid var(--bg-surface);
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface-alt);
    flex-shrink: 0;
}
.hero-image--full {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 4px solid var(--bg-surface);
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface-alt);
}

/* QR-code container */
.qr-card {
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
}
.qr-card img { width: 192px; height: 192px; max-width: 100%; }

/* Asset-form image preview thumb */
.media-thumb {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}
.media-thumb img,
.image-preview-96 {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    background: var(--bg-surface-alt);
    display: block;
    flex-shrink: 0;
}

/* ── Surface block (subtle inset panel — toolbars, summaries, builders) ── */
.surface-block {
    background: var(--bg-surface-alt);
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}
@media (min-width: 768px) {
    .surface-block { padding: 16px; }
}

/* ── Section heading (page title + subtitle + actions) ── */
.section-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
}
.section-heading-text { min-width: 0; }
.section-heading-title {
    font-family: var(--font-heading);
    font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.section-heading-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.section-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (min-width: 768px) {
    .section-heading {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-bottom: 24px;
    }
    .section-heading-actions { flex-wrap: nowrap; }
}

/* ── Toolbar (search + filters above lists) ── */
.toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-surface-alt);
    padding: 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    margin-bottom: 16px;
}
.toolbar > * { width: 100%; }

@media (min-width: 768px) {
    .toolbar {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 14px;
    }
    .toolbar > .toolbar-search { flex: 1 1 auto; min-width: 0; }
    .toolbar > select,
    .toolbar > .toolbar-filter { width: auto; min-width: 160px; }
}

/* ── Auto-fill grid (mobile = 1 col, desktop = auto-fill 220px) ── */
.auto-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 640px) {
    .auto-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
}
.auto-grid-md {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 640px) {
    .auto-grid-md {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

/* ── Stat / info card variants ── */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { border-color: var(--accent-cyan); box-shadow: var(--shadow-md); }
.stat-card--info {
    background: var(--accent-cyan-soft);
    border-color: var(--border-default);
}

/* Dashed action card (Add / Manage) */
.dashed-card {
    background: var(--bg-surface);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    text-align: center;
    color: var(--text-muted);
    min-height: 120px;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.dashed-card:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: var(--bg-surface-alt);
}
.dashed-card-icon { font-size: 1.5rem; line-height: 1; }
.dashed-card-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Media tile (image gallery) ── */
.media-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    overflow: hidden;
}
.media-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    display: block;
}
.media-tile-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-danger);
    color: #fff;
    border: 2px solid var(--bg-surface);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
}

/* Form-builder field row — single column on mobile, 2fr/1fr/2fr/auto from sm */
.form-field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}
@media (min-width: 640px) {
    .form-field-grid {
        grid-template-columns: 2fr 1fr 2fr auto;
        gap: 8px;
        align-items: center;
    }
}

/* ── Edit-row grids (inline operation editors in workorders.js) ── */
.edit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
}
@media (min-width: 640px) {
    .edit-row--3col { grid-template-columns: minmax(0, 1fr) 6rem auto; align-items: center; }
    .edit-row--time { grid-template-columns: 8rem 1fr auto; align-items: end; }
    .edit-row--part { grid-template-columns: minmax(0, 1fr) 6rem auto; align-items: end; }
}

/* Compact input/select used inside edit rows */
.input-sm {
    height: 36px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.75rem;
}

/* Dark divider above modal/edit footer actions */
.divider-top {
    border-top: 1px solid var(--border-default);
    padding-top: 12px;
    margin-top: 12px;
}
.divider-top--strong {
    border-top-width: 2px;
    padding-top: 24px;
    margin-top: 24px;
}

/* Worker card (renderWorkforce) */
.worker-card {
    background: var(--accent-cyan-soft);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.worker-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-cyan);
}

/* Progress bar (use --progress custom property to set width) */
.progress {
    height: 6px;
    width: 100%;
    background: var(--bg-surface-alt);
    border-radius: 9999px;
    overflow: hidden;
}
.progress--lg { height: 16px; }
.progress--md { height: 10px; }
.progress-bar {
    height: 100%;
    width: var(--progress, 0%);
    background: var(--accent-cyan);
    transition: width 0.3s ease;
}
.progress-bar--success { background: var(--accent-success); }
.progress-bar--warning { background: var(--accent-warning); }
.progress-bar--danger  { background: var(--accent-danger); }

/* Schedule-grid bars (workforce daily/weekly views — left/width set inline) */
.schedule-bar {
    position: absolute;
    height: 100%;
}
.schedule-bar--shift {
    background: var(--accent-cyan-soft);
    border-left: 2px solid var(--accent-cyan);
}
.schedule-bar--task {
    top: 12px;
    height: 24px;
    background: var(--accent-success);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.625rem;
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 10;
}
.schedule-bar--task:hover { opacity: 0.92; }
.schedule-marker {
    position: absolute;
    bottom: 0;
    height: 100%;
    border-left: 1px solid var(--border-subtle);
    padding-left: 4px;
    font-size: 0.5625rem;
    color: var(--text-muted);
}

/* Exception bars (vacation / sick / generic blocked overlays) */
.schedule-bar--vacation { background: var(--accent-warning, #f59e0b); opacity: 0.85; }
.schedule-bar--sick     { background: var(--accent-danger,  #ef4444); opacity: 0.85; }
.schedule-bar--blocked  { background: var(--text-muted,     #94a3b8); opacity: 0.55; }
/* Scheduled work-order operation (Labor Allocation stage 3 result). */
.schedule-bar--op       { background: var(--accent-success, #22c55e); opacity: 0.92; }
/* Day-view op bars are clickable (open the parent work order). The hover
   state and pointer cursor signal the affordance to the user. */
.schedule-bar--clickable        { cursor: pointer; transition: outline 0.1s ease, opacity 0.1s ease; }
.schedule-bar--clickable:hover  { outline: 2px solid var(--accent-success); outline-offset: 1px; opacity: 1; }

/* Daily-load mini-bar (workforce schedule cells) */
.load-bar-vert {
    width: 100%;
    height: var(--load, 0%);
    transition: height 0.3s ease;
}

/* ─── Workforce → Schedule tab (week / month / year roster) ──────────────── */

.schedule-week-grid,
.schedule-month-grid,
.schedule-year-grid {
    display: grid;
    gap: 4px;
    overflow-x: auto;
    padding: 4px 0;
}
.schedule-week-grid  { grid-template-columns: 180px repeat(7, minmax(80px, 1fr)); }
.schedule-month-grid { grid-template-columns: 180px repeat(var(--n-days, 31), minmax(20px, 1fr)); }
.schedule-year-grid  { grid-template-columns: 200px repeat(12, minmax(60px, 1fr)); }

.schedule-week-grid  > .schedule-row,
.schedule-month-grid > .schedule-row,
.schedule-year-grid  > .schedule-row {
    display: contents;
}

.schedule-cell {
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    font-size: 0.75rem;
}
.schedule-cell--name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-cell--day  { cursor: pointer; }
.schedule-cell--mday { padding: 6px 2px; cursor: pointer; }
.schedule-cell--month{ padding: 6px 4px; }
.schedule-cell--head { cursor: default; }

.schedule-row--header > .schedule-cell {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.625rem;
    color: var(--text-muted);
    background: var(--surface-alt);
}
.schedule-cell--day:not(.schedule-cell--head):hover  > div,
.schedule-cell--mday:not(.schedule-cell--head):hover > div { outline: 2px solid var(--accent-primary, #2563eb); }

/* ─── Contract Hours modal controls ──────────────────────────────────────── */

.dow-toggle {
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dow-toggle:hover  { border-color: var(--accent-cyan); }
.dow-toggle.active { background: var(--accent-cyan-soft); color: var(--accent-cyan); border-color: var(--accent-cyan); }

.dow-preset {
    padding: 4px 12px;
    border-radius: 9999px;
    border: 1px dashed var(--border-default);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.dow-preset:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }

#ch-existing:empty { display: none; }

.ch-existing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.ch-link {
    background: transparent;
    border: 0;
    color: var(--accent-cyan);
    cursor: pointer;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0;
}
.ch-link:hover { text-decoration: underline; }

.ch-existing-day {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.ch-existing-day:last-child { border-bottom: 0; }
.ch-existing-day-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.ch-existing-day-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-existing-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--accent-cyan-soft);
    color: var(--accent-cyan);
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
}
.ch-existing-chip button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
}
.ch-existing-range {
    font-size: 0.5625rem;
    font-weight: 500;
    opacity: 0.75;
    padding-left: 4px;
    border-left: 1px solid currentColor;
}

/* A chip flagged for deletion that will commit on the next Apply pattern. */
.ch-existing-chip.pending-delete {
    text-decoration: line-through;
    opacity: 0.45;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
}
.ch-existing-chip.pending-delete button { text-decoration: none; }

.ch-error {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md, 8px);
    background: var(--accent-danger-soft, rgba(239, 68, 68, 0.1));
    color: var(--accent-danger, #ef4444);
    font-size: 0.75rem;
    font-weight: 500;
}
.ch-error.hidden { display: none; }
.ch-existing-empty {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-style: italic;
}


/* ── Image Lightbox ── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.88);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 16px;
}
.lightbox:not(.hidden) { display: flex; }

.lightbox-img {
    max-width: 96vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: var(--tap-min);
    height: var(--tap-min);
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ── Generic modal footer ── */
.modal-footer {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    padding: 16px;
    background: var(--bg-surface-alt);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    border-top: 1px solid var(--border-subtle);
}

@media (min-width: 640px) {
    .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
        gap: 12px;
        padding: 16px 24px;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utility ── */
.hidden { display: none !important; }
.module-content.hidden { display: none !important; }

/* ── Prevent FOUC ── */
html:not([data-theme]) { visibility: hidden; }

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

/* ═══════════════════════════════════════════════════════════════
   Tailwind-replacement Utility Classes
   (Kept verbatim for compatibility with module-rendered markup)
   ═══════════════════════════════════════════════════════════════ */

/* ── Display ── */
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* ── Flexbox ── */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* ── Grid (mobile-first: single column at base) ── */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-7 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 1 / span 1; }
.col-span-3 { grid-column: span 1 / span 1; }
.col-span-4 { grid-column: span 1 / span 1; }
.col-span-5 { grid-column: span 1 / span 1; }

@media (min-width: 640px) {
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .col-span-2 { grid-column: span 2 / span 2; }
    .col-span-3 { grid-column: span 2 / span 2; }
    .col-span-4 { grid-column: span 2 / span 2; }
}

@media (min-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid-cols-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .col-span-3 { grid-column: span 3 / span 3; }
    .col-span-4 { grid-column: span 4 / span 4; }
    .col-span-5 { grid-column: span 5 / span 5; }
}

/* ── Gap ── */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-12 { gap: 3rem; }
.gap-x-6 { column-gap: 1.5rem; }
.gap-y-2 { row-gap: 0.5rem; }

/* ── Space Between ── */
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* ── Divide ── */
.divide-y > * + * { border-top: 1px solid var(--border-default); }

/* ── Padding ── */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-0 { padding-left: 0; }
.pl-1 { padding-left: 0.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pl-4 { padding-left: 1rem; }

/* ── Margin ── */
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ── Width ── */
.w-2 { width: 0.5rem; }
.w-qty { width: 6rem; flex-shrink: 0; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.min-w-\[120px\] { min-width: 120px; }
.min-w-\[220px\] { min-width: 220px; }
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-\[220px\] { max-width: 220px; }

/* ── Height ── */
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-24 { height: 6rem; }
.h-32 { height: 8rem; }
.h-48 { height: 12rem; }
.h-fit { height: fit-content; }
.h-full { height: 100%; }
.max-h-40 { max-height: 10rem; }
.max-h-60 { max-height: 15rem; }
.max-h-96 { max-height: 24rem; }
.max-h-\[70vh\] { max-height: 70vh; }
.min-h-\[160px\] { min-height: 160px; }

/* ── Typography ── */
.text-\[9px\] { font-size: 0.5625rem; }
.text-\[10px\] { font-size: 0.625rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.6; }
.text-xl { font-size: 1.25rem; line-height: 1.6; }
.text-2xl { font-size: 1.5rem; line-height: 1.4; }
.text-3xl { font-size: 1.875rem; line-height: 1.3; }
.text-4xl { font-size: 2.25rem; line-height: 1.2; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-widest { letter-spacing: 0.1em; }
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.6; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Text Colors (custom theme) ── */
.text-c-primary   { color: var(--text-primary); }
.text-c-secondary { color: var(--text-secondary); }
.text-c-muted     { color: var(--text-muted); }
.text-c-success   { color: var(--accent-success); }
.text-c-warning   { color: var(--accent-warning); }
.text-c-danger    { color: var(--accent-danger); }
.text-c-info      { color: var(--accent-cyan); }
.text-c-cyan      { color: var(--accent-cyan); }
.text-white       { color: #fff; }
.text-green-700   { color: var(--accent-success); }
.text-purple-700  { color: var(--accent-cyan); }

/* ── Background Colors (custom theme) ── */
.bg-surface       { background-color: var(--bg-surface); }
.bg-surface-alt   { background-color: var(--bg-surface-alt); }
.bg-brand-deep    { background-color: var(--brand-deep); }
.bg-c-success     { background-color: var(--accent-success); }
.bg-c-success-bg  { background-color: var(--accent-success-bg); }
.bg-c-danger      { background-color: var(--accent-danger); }
.bg-c-danger-bg   { background-color: var(--accent-danger-bg); }
.bg-c-warning     { background-color: var(--accent-warning); }
.bg-c-warning-bg  { background-color: var(--accent-warning-bg); }
.bg-c-info-bg     { background-color: var(--accent-cyan-soft); }
.bg-c-cyan-soft   { background-color: var(--accent-cyan-soft); }
.bg-green-100     { background-color: var(--accent-success-bg); }
.bg-purple-100    { background-color: var(--accent-cyan-soft); }

/* ── Border Colors ── */
.border           { border-width: 1px; border-style: solid; border-color: var(--border-default); }
.border-2         { border-width: 2px; border-style: solid; border-color: var(--border-default); }
.border-t         { border-top-width: 1px; border-top-style: solid; border-top-color: var(--border-default); }
.border-t-0       { border-top-width: 0; }
.border-b         { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: var(--border-default); }
.border-b-2       { border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: var(--border-default); }
.border-l         { border-left-width: 1px; border-left-style: solid; border-left-color: var(--border-default); }
.border-l-2       { border-left-width: 2px; border-left-style: solid; border-left-color: var(--border-default); }
.border-c-border  { border-color: var(--border-default); }
.border-c-border-subtle { border-color: var(--border-subtle); }
.border-transparent { border-color: transparent; }
.border-dashed    { border-style: dashed; }
.border-blue-200  { border-color: var(--accent-cyan-soft); }
.border-blue-500  { border-color: var(--accent-cyan); }
.border-blue-600  { border-color: var(--accent-cyan); }
.border-red-100   { border-color: var(--accent-danger-bg); }
.border-red-200   { border-color: var(--accent-danger); }
.border-amber-100 { border-color: var(--accent-warning-bg); }
.border-amber-200 { border-color: var(--accent-warning); }
.border-emerald-100 { border-color: var(--accent-success-bg); }

/* ── Border Radius ── */
.rounded     { border-radius: 0.25rem; }
.rounded-md  { border-radius: 0.375rem; }
.rounded-lg  { border-radius: 0.5rem; }
.rounded-xl  { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.rounded-t-lg { border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; }
.rounded-b-lg { border-bottom-left-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }

/* ── Shadows ── */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.12), 0 8px 10px -6px rgba(0,0,0,0.1); }

/* ── Positioning ── */
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0  { top: 0; right: 0; bottom: 0; left: 0; }
.top-1\.5 { top: 0.375rem; }
.top-3    { top: 0.75rem; }
.top-full { top: 100%; }
.right-0  { right: 0; }
.right-2  { right: 0.5rem; }
.right-8  { right: 2rem; }
.bottom-0 { bottom: 0; }
.left-0   { left: 0; }

/* ── Overflow & Visibility ── */
.overflow-hidden  { overflow: hidden; }
.overflow-x-auto  { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.overflow-y-auto  { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pointer-events-none { pointer-events: none; }

/* ── Opacity ── */
.opacity-0 { opacity: 0; }

/* ── Object Fit ── */
.object-cover { object-fit: cover; }

/* ── Cursor ── */
.cursor-pointer { cursor: pointer; }
.cursor-move    { cursor: move; }

/* ── Outline ── */
.outline-none { outline: none; }

/* ── Transitions ── */
.transition-all     { transition: all 0.15s ease; }
.transition-colors  { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.transition-opacity { transition: opacity 0.15s ease; }
.transition-shadow  { transition: box-shadow 0.15s ease; }

/* ── Animations ── */
.animate-spin  { animation: tw-spin 1s linear infinite; }
.animate-pulse { animation: tw-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes tw-spin  { to { transform: rotate(360deg); } }
@keyframes tw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.field-invalid {
    animation: field-flash 0.6s ease-out 3;
    border-color: var(--accent-danger) !important;
    background: var(--accent-danger-bg) !important;
}

.worker-card-dragging-invalid {
    opacity: 0.35;
    filter: grayscale(80%);
    pointer-events: none;
    transition: opacity 0.15s ease, filter 0.15s ease;
}
.worker-card-dragging-valid {
    outline: 2px dashed var(--accent-success);
    outline-offset: 2px;
    transition: outline 0.15s ease;
}
@keyframes field-flash {
    0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50%  { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* ── Table ── */
.align-top { vertical-align: top; }

/* ── Accent Color ── */
.accent-blue-600 { accent-color: var(--accent-cyan); }

/* ── Scrollbar ── */
.scrollbar-thin::-webkit-scrollbar { width: 4px; height: 4px; }

/* ── Group Hover ── */
.group:hover .group-hover\:visible { visibility: visible; }

/* ── Hover States ── */
.hover\:bg-surface-alt:hover  { background-color: var(--bg-surface-alt); }
.hover\:bg-brand-deep:hover   { background-color: var(--brand-deep); }
.hover\:bg-c-success:hover    { background-color: var(--accent-success); }
.hover\:bg-c-danger:hover     { background-color: var(--accent-danger); }
.hover\:bg-c-danger-bg:hover  { background-color: var(--accent-danger-bg); }
.hover\:bg-c-info-bg:hover    { background-color: var(--accent-cyan-soft); }
.hover\:bg-c-warning-bg:hover { background-color: var(--accent-warning-bg); }
.hover\:bg-green-200:hover    { background-color: var(--accent-success-bg); }
.hover\:text-c-primary:hover  { color: var(--text-primary); }
.hover\:text-c-secondary:hover{ color: var(--text-secondary); }
.hover\:text-c-info:hover     { color: var(--accent-cyan); }
.hover\:text-c-danger:hover   { color: var(--accent-danger); }
.hover\:border-c-info:hover   { border-color: var(--accent-cyan); }
.hover\:underline:hover       { text-decoration: underline; }
.hover\:opacity-80:hover      { opacity: 0.8; }
.hover\:shadow-md:hover       { box-shadow: var(--shadow-md); }

/* ── File Input Pseudo ── */
.file\:bg-c-info-bg::file-selector-button     { background-color: var(--accent-cyan-soft); }
.file\:border-0::file-selector-button         { border: 0; }
.file\:font-semibold::file-selector-button    { font-weight: 600; }
.file\:mr-4::file-selector-button             { margin-right: 1rem; }
.file\:px-4::file-selector-button             { padding-left: 1rem; padding-right: 1rem; }
.file\:py-2::file-selector-button             { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.file\:rounded-full::file-selector-button     { border-radius: 9999px; }
.file\:text-c-info::file-selector-button      { color: var(--accent-cyan); }
.file\:text-sm::file-selector-button          { font-size: 0.875rem; }
.hover\:file\:bg-c-info-bg:hover::file-selector-button { background-color: var(--accent-cyan-soft); }

/* ── Last Child ── */
.last\:border-0:last-child { border-width: 0; }

/* ── Responsive: md (768px) — for module-rendered markup that uses md:* classes ── */
@media (min-width: 768px) {
    .md\:flex-row    { flex-direction: row; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:col-span-2  { grid-column: span 2 / span 2; }
    .md\:text-right  { text-align: right; }
    .md\:text-left   { text-align: left; }
    .md\:hidden      { display: none !important; }
    .md\:block       { display: block; }
    .md\:flex        { display: flex; }
}

/* ── Responsive: lg (1024px) ── */
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:col-span-2  { grid-column: span 2 / span 2; }
}

/* ── Add User to Maintenance: employee typeahead + scope picker ── */
.au-typeahead { position: relative; }
.au-suggestions {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
    max-height: 16rem; overflow-y: auto; margin-top: 2px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-default, #E5E7EB);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.au-suggestion { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.9rem; }
.au-suggestion:hover { background: var(--bg-surface-alt, #F8F5F0); }
.au-suggestion .au-sub { color: var(--text-muted, #6B7280); font-size: 0.75rem; }
.au-suggestion.au-empty { color: var(--text-muted, #6B7280); cursor: default; }
.au-scope-group { margin-bottom: 0.5rem; }
.au-scope-mod {
    font-size: 0.7rem; text-transform: uppercase; font-weight: 700;
    color: var(--text-muted, #6B7280); margin: 0.25rem 0;
}
.au-scope { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; padding: 0.15rem 0; }
.au-scope.au-disabled { opacity: 0.5; }
