/* ============================================================
   Nayuta Internal Portal — refined dashboard tokens & layout
   ============================================================ */

:root {
    /* Type */
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Geist Mono', 'SF Mono', Consolas, monospace;

    /* Radius */
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-pill: 999px;

    /* Density (overridden when .density-compact) */
    --pad-card-y: 1.25rem;
    --pad-card-x: 1.25rem;
    --gap-section: 1rem;
    --row-h: 36px;
    --font-body: 0.875rem;
    --font-small: 0.78rem;
    --font-stat: 1.55rem;
}

/* ----- Dark (default) ----- */
:root, [data-theme="dark"] {
    --bg-page: #0a0e17;
    --bg-surface: #121826;
    --bg-surface-2: #1a2233;
    --bg-inset: #0a0e17;
    --bg-hover: rgba(255, 255, 255, 0.03);
    --border-1: #232b3d;
    --border-2: #2e374d;

    --text-1: #e7eaf3;
    --text-2: #aab1c5;
    --text-3: #7a8299;
    --text-faint: #525a73;

    --accent: oklch(0.68 0.13 252);
    --accent-soft: oklch(0.32 0.10 252 / 0.20);
    --accent-fg: #0a0e17;

    --ok: oklch(0.78 0.14 155);
    --ok-soft: oklch(0.32 0.08 155 / 0.22);
    --warn: oklch(0.80 0.14 80);
    --warn-soft: oklch(0.32 0.07 70 / 0.25);
    --bad: oklch(0.72 0.18 22);
    --bad-soft: oklch(0.32 0.10 22 / 0.25);
    --info: oklch(0.74 0.12 230);
    --info-soft: oklch(0.32 0.08 230 / 0.22);
    --neutral-soft: rgba(255, 255, 255, 0.06);

    --shadow-1: 0 1px 0 rgba(255,255,255,0.02) inset, 0 1px 2px rgba(0,0,0,0.4);
    --shadow-2: 0 8px 24px rgba(0,0,0,0.35);

    --stripe: linear-gradient(135deg, rgba(255,255,255,0.025) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.025) 50%, rgba(255,255,255,0.025) 75%, transparent 75%);
}

/* ----- Light ----- */
[data-theme="light"] {
    --bg-page: #f5f6f8;
    --bg-surface: #ffffff;
    --bg-surface-2: #f9fafb;
    --bg-inset: #f0f2f5;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --border-1: #e4e7ed;
    --border-2: #d3d7df;

    --text-1: #0e1422;
    --text-2: #4a5266;
    --text-3: #6b7280;
    --text-faint: #9aa1ad;

    --accent: oklch(0.55 0.16 252);
    --accent-soft: oklch(0.92 0.05 252);
    --accent-fg: #ffffff;

    --ok: oklch(0.55 0.15 155);
    --ok-soft: oklch(0.93 0.05 155);
    --warn: oklch(0.62 0.16 70);
    --warn-soft: oklch(0.94 0.07 80);
    --bad: oklch(0.58 0.20 22);
    --bad-soft: oklch(0.94 0.06 22);
    --info: oklch(0.55 0.15 230);
    --info-soft: oklch(0.94 0.05 230);
    --neutral-soft: rgba(0, 0, 0, 0.05);

    --shadow-1: 0 1px 0 rgba(255,255,255,1) inset, 0 1px 2px rgba(15,23,42,0.05);
    --shadow-2: 0 4px 16px rgba(15,23,42,0.08);

    --stripe: linear-gradient(135deg, rgba(0,0,0,0.025) 25%, transparent 25%, transparent 50%, rgba(0,0,0,0.025) 50%, rgba(0,0,0,0.025) 75%, transparent 75%);
}

/* ----- Compact density ----- */
.density-compact {
    --pad-card-y: 0.85rem;
    --pad-card-x: 1rem;
    --gap-section: 0.75rem;
    --row-h: 30px;
    --font-body: 0.82rem;
    --font-small: 0.72rem;
    --font-stat: 1.3rem;
}

/* ============================================================ */
/* Reset & base                                                  */
/* ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-body);
    line-height: 1.45;
    color: var(--text-1);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
}

button, input, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

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

/* ============================================================ */
/* Shell                                                          */
/* ============================================================ */

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px 1fr;
}
.app.nav-top {
    grid-template-columns: 1fr;
}

/* ---- Sidebar ---- */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.app.nav-top .sidebar { display: none; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-1);
}
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--text-1);
    color: var(--bg-page);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.brand-name {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand-sub {
    display: block;
    font-size: 0.7rem;
    color: var(--text-3);
    font-weight: 400;
    margin-top: 1px;
}

.nav-list {
    flex: 1;
    padding: 0.75rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
}
.nav-group-label {
    font-size: 0.68rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    padding: 0.85rem 0.7rem 0.4rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 0.86rem;
    font-weight: 500;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: background 0.1s, color 0.1s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active {
    background: var(--neutral-soft);
    color: var(--text-1);
}
.nav-item .nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}
.nav-item .nav-count {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    color: var(--text-3);
    padding: 1px 6px;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.nav-item.active .nav-count { color: var(--text-1); }

.sidebar-footer {
    border-top: 1px solid var(--border-1);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}
.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-email {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-footer .user-role {
    font-size: 0.7rem;
    color: var(--text-3);
}
.logout-btn {
    background: transparent;
    border: 1px solid var(--border-1);
    color: var(--text-3);
    border-radius: var(--r-sm);
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 500;
}
.logout-btn:hover { color: var(--bad); border-color: var(--bad); }

/* ---- Top nav (alternate) ---- */
.topnav {
    display: none;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-1);
    padding: 0 1.5rem;
    align-items: center;
    gap: 1.25rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app.nav-top .topnav { display: flex; }

.topnav .brand-block { display: flex; align-items: center; gap: 0.6rem; padding-right: 1rem; border-right: 1px solid var(--border-1); height: 32px; }
.topnav-tabs { display: flex; gap: 2px; flex: 1; }
.topnav-tab {
    padding: 8px 14px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 500;
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    height: 34px;
    flex-shrink: 0;
}
.topnav-tab:hover { background: var(--bg-hover); color: var(--text-1); }
.topnav-tab.active { background: var(--neutral-soft); color: var(--text-1); }
.topnav-tab .nav-count {
    font-size: 0.68rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    color: var(--text-3);
    padding: 1px 5px;
    border-radius: var(--r-pill);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.topnav-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-1);
    height: 32px;
}
.topnav-user .user-email { font-size: 0.8rem; color: var(--text-2); }

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

.pageheader {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.75rem;
    border-bottom: 1px solid var(--border-1);
    background: var(--bg-page);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app.nav-top .pageheader { top: 56px; }

.pageheader .crumbs {
    flex: 1;
    min-width: 0;
}
.pageheader .crumbs-line {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-bottom: 2px;
    font-family: var(--font-mono);
}
.pageheader h1 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-1);
}
.pageheader .header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Status pill (global system status indicator) */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 6px 12px 6px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: var(--r-pill);
    font-size: 0.78rem;
    color: var(--text-2);
    font-weight: 500;
    white-space: nowrap;
}
.status-pill .pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    box-shadow: 0 0 0 0 currentColor;
    position: relative;
}
.status-pill .pip.live {
    background: var(--ok);
    color: var(--ok);
    animation: pip-pulse 1.6s ease-in-out infinite;
}
.status-pill .pip.warn { background: var(--warn); color: var(--warn); }
.status-pill .pip.bad { background: var(--bad); color: var(--bad); }
.status-pill .pip.info { background: var(--info); color: var(--info); }
@keyframes pip-pulse {
    0%, 100% { box-shadow: 0 0 0 0 currentColor; }
    50% { box-shadow: 0 0 0 4px transparent; }
}
.status-pill .strong { color: var(--text-1); font-weight: 600; }

/* Content area */
.content {
    padding: 1.25rem 1.75rem 3rem;
    display: flex;
    flex-direction: column;
    gap: var(--gap-section);
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================ */
/* Card system                                                    */
/* ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem var(--pad-card-x);
    border-bottom: 1px solid var(--border-1);
}
.card-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-header .h-sub {
    font-size: 0.75rem;
    color: var(--text-3);
    font-weight: 400;
    margin-left: 4px;
}
.card-header .h-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.card-body {
    padding: var(--pad-card-y) var(--pad-card-x);
}
.card-body.no-pad-y { padding-top: 0; padding-bottom: 0; }
.card-body.flush { padding: 0; }

/* Two-col grid for top row */
.row-2col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: var(--gap-section);
}
@media (max-width: 1100px) {
    .row-2col { grid-template-columns: 1fr; }
}

/* ============================================================ */
/* Buttons                                                        */
/* ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 14px;
    height: 34px;
    border-radius: var(--r-md);
    font-size: 0.83rem;
    font-weight: 500;
    border: 1px solid var(--border-1);
    background: var(--bg-surface-2);
    color: var(--text-1);
    transition: all 0.1s;
    white-space: nowrap;
}
.btn:hover:not(:disabled) {
    border-color: var(--border-2);
    background: var(--bg-hover);
}
.btn.btn-sm { height: 28px; padding: 0 10px; font-size: 0.78rem; }
.btn.btn-xs { height: 24px; padding: 0 8px; font-size: 0.72rem; }
.btn.btn-icon { padding: 0; width: 34px; justify-content: center; }
.btn.btn-icon.btn-sm { width: 28px; }

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
    font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); }

.btn-ok {
    background: var(--ok);
    color: var(--bg-page);
    border-color: transparent;
    font-weight: 600;
}
[data-theme="light"] .btn-ok { color: white; }
.btn-ok:hover:not(:disabled) { filter: brightness(1.05); }

.btn-bad {
    background: transparent;
    color: var(--bad);
    border-color: var(--bad-soft);
}
.btn-bad:hover:not(:disabled) {
    background: var(--bad-soft);
    border-color: var(--bad);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-1); }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    height: auto;
}

/* Anchor styled as button (used in Admin AccessDenied "Back to portal" link) */
a.btn, a.btn:hover { text-decoration: none; color: var(--text-1); }
a.btn-primary, a.btn-primary:hover { color: var(--accent-fg); }

/* Icon-button group */
.btn-group { display: inline-flex; gap: 4px; }

/* Segmented control */
.segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    gap: 2px;
}
.segmented button {
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 0.77rem;
    font-weight: 500;
}
.segmented button.on {
    background: var(--bg-surface);
    color: var(--text-1);
    box-shadow: var(--shadow-1);
}

/* ============================================================ */
/* Form controls                                                  */
/* ============================================================ */
.field-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}
select.input, input.input {
    display: block;
    width: 100%;
    height: 34px;
    background: var(--bg-surface-2);
    color: var(--text-1);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    padding: 0 12px;
    font-size: 0.84rem;
    font-weight: 500;
    transition: border-color 0.1s, box-shadow 0.1s;
    appearance: none;
    -webkit-appearance: none;
}
select.input {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8299' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    text-overflow: ellipsis;
}
[data-theme="light"] select.input {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
}
.input:focus, select.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled, select.input:disabled { opacity: 0.55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.field-row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 130px; }

/* ============================================================ */
/* Job creation strip                                             */
/* ============================================================ */
.create-strip {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: 0.75rem;
    padding: var(--pad-card-y) var(--pad-card-x);
}
.create-strip .seg-wrap { padding-bottom: 1px; }
.create-strip .field-row { flex: 1; min-width: 0; }
.create-strip .field { min-width: 120px; }
.create-strip .field:has(> #ci-country) { min-width: 260px; }
.create-strip .submit-wrap { display: flex; gap: 0.4rem; align-items: end; padding-bottom: 1px; }
.create-strip.scheduled .field { min-width: 110px; }
.create-strip.scheduled .field:has(> #ci-country) { min-width: 260px; }

@media (max-width: 900px) {
    .create-strip { grid-template-columns: 1fr; }
}

.create-divider {
    height: 1px;
    background: var(--border-1);
    margin: 0;
}
.create-sched-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 0.6rem;
    align-items: end;
    padding: 0.85rem var(--pad-card-x);
    background: var(--bg-surface-2);
}
@media (max-width: 900px) {
    .create-sched-row { grid-template-columns: 1fr 1fr; }
}

/* ============================================================ */
/* Stats                                                          */
/* ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--border-1);
}
.stat-tile {
    padding: 0.9rem var(--pad-card-x);
    border-right: 1px solid var(--border-1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.stat-tile:last-child { border-right: none; }
.stat-label {
    font-size: 0.7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-value {
    font-size: var(--font-stat);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    line-height: 1.1;
}
.stat-value.muted { color: var(--text-3); }
.stat-value.bad { color: var(--bad); }
.stat-meta {
    font-size: 0.72rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-tile:nth-child(3) { border-right: none; }
    .stat-tile:nth-child(n+4) { border-top: 1px solid var(--border-1); }
}

.progress-section {
    padding: 0.9rem var(--pad-card-x) 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.progress-meta .pmain { color: var(--text-2); font-weight: 500; }
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-inset);
    border-radius: var(--r-pill);
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: var(--ok);
    border-radius: var(--r-pill);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.progress-fill.is-running::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--stripe);
    background-size: 14px 14px;
    animation: stripe-slide 0.8s linear infinite;
}
@keyframes stripe-slide {
    to { background-position: 28px 0; }
}

/* ============================================================ */
/* Table                                                          */
/* ============================================================ */
.tbl-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--border-1);
}
.card-body.flush > .tbl-wrap:first-child { border-top: none; }
.tbl-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-1);
}
.tbl-pager .h-actions { display: flex; align-items: center; gap: 8px; }
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-body);
}
.tbl th {
    position: sticky;
    top: 0;
    background: var(--bg-surface-2);
    text-align: left;
    color: var(--text-3);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px var(--pad-card-x);
    border-bottom: 1px solid var(--border-1);
    white-space: nowrap;
}
.tbl td {
    padding: 0 var(--pad-card-x);
    height: var(--row-h);
    border-bottom: 1px solid var(--border-1);
    color: var(--text-1);
    vertical-align: middle;
    white-space: nowrap;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-hover); }
.tbl td.muted { color: var(--text-3); }
.tbl td.mono { font-family: var(--font-mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.tbl td.id { color: var(--text-3); font-family: var(--font-mono); font-size: 0.78rem; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.tbl td.bad-num { color: var(--bad); }
.tbl td.actions { text-align: right; }

.tiny-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
}
.tiny-bar .bar {
    width: 70px;
    height: 5px;
    background: var(--bg-inset);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.tiny-bar .bar > div {
    height: 100%;
    background: var(--ok);
    border-radius: var(--r-pill);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 7px;
    border-radius: var(--r-pill);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.4;
    border: 1px solid transparent;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge.in_progress { color: var(--ok); background: var(--ok-soft); }
.badge.queueing    { color: var(--info); background: var(--info-soft); }
.badge.pending     { color: var(--text-2); background: var(--neutral-soft); }
.badge.completed   { color: var(--info); background: var(--info-soft); }
.badge.stopped     { color: var(--text-3); background: var(--neutral-soft); }
.badge.failed      { color: var(--bad); background: var(--bad-soft); }
.badge.crashed     { color: var(--bad); background: var(--bad-soft); }

/* Priority cell */
.pri-cell {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-family: var(--font-mono);
}
.pri-cell .pri-val {
    min-width: 22px;
    text-align: center;
    font-weight: 600;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}
.pri-cell button {
    height: 22px;
    width: 22px;
    border: 1px solid var(--border-1);
    background: transparent;
    color: var(--text-3);
    border-radius: var(--r-sm);
    font-size: 0.7rem;
    display: grid;
    place-items: center;
}
.pri-cell button:hover { color: var(--text-1); border-color: var(--border-2); }

/* Toggle */
.tgl {
    display: inline-flex;
    width: 32px;
    height: 18px;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: 9px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.tgl.on { background: var(--ok); border-color: var(--ok); }
.tgl::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.tgl.on::after { transform: translateX(14px); }
[data-theme="dark"] .tgl::after { background: var(--text-1); }

/* Kebab menu */
.kebab-wrap { position: relative; display: inline-block; }
.kebab-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    z-index: 50;
    min-width: 180px;
    box-shadow: var(--shadow-2);
    padding: 4px;
    display: none;
}
.kebab-menu.open { display: block; }
.kebab-menu button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text-1);
    border: none;
    padding: 6px 10px;
    font-size: 0.81rem;
    font-weight: 500;
    border-radius: var(--r-sm);
}
.kebab-menu button:hover { background: var(--bg-hover); }
.kebab-menu button.danger { color: var(--bad); }
.kebab-menu button.danger:hover { background: var(--bad-soft); }
.kebab-menu .divider { height: 1px; background: var(--border-1); margin: 4px 0; }

/* ============================================================ */
/* Workers                                                        */
/* ============================================================ */
.workers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.6rem;
    padding: var(--pad-card-y) var(--pad-card-x);
}
.worker {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    padding: 0.7rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
}
.worker .w-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.worker .w-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-1);
}
.worker .w-state {
    font-size: 0.7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.worker .w-state::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
}
.worker.scraping .w-state { color: var(--ok); }
.worker.scraping .w-state::before { background: var(--ok); animation: pip-pulse 1.6s ease-in-out infinite; box-shadow: 0 0 0 0 var(--ok); }
.worker.idle .w-state { color: var(--text-3); }
.worker .w-url {
    color: var(--text-3);
    font-size: 0.74rem;
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
}
.worker .w-foot {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ============================================================ */
/* Logs                                                           */
/* ============================================================ */
.log-box {
    background: var(--bg-inset);
    border-top: 1px solid var(--border-1);
    padding: 0.85rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-2);
    border-bottom-left-radius: var(--r-lg);
    border-bottom-right-radius: var(--r-lg);
}
.log-line { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line .ts { color: var(--text-faint); margin-right: 0.65rem; }
.log-line .lvl {
    display: inline-block;
    width: 42px;
    color: var(--text-3);
}
.log-line.info .lvl { color: var(--info); }
.log-line.warn .lvl { color: var(--warn); }
.log-line.err .lvl { color: var(--bad); }
.log-line.ok .lvl { color: var(--ok); }
/* Level-wide text colour driven by the DB `level` column (worker entries) or
   inferLevel() (app_logs file). Inline .inst-tag colour + .ts faint colour win
   over these via specificity-from-inline-style or earlier rules. */
.log-line.err  { color: var(--bad); }
.log-line.warn { color: var(--warn); }
.log-line .src { color: var(--text-faint); margin-right: 0.5rem; }
.log-line .inst-tag { font-weight: 600; margin-right: 0.5rem; }
.log-filter {
    background: var(--bg-inset);
    color: var(--text-2);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    font-size: 0.78rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

/* ============================================================ */
/* Drawer (job creation alternate)                                */
/* ============================================================ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 92vw;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-1);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-1);
}
.drawer-head h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.drawer-foot {
    border-top: 1px solid var(--border-1);
    padding: 0.85rem 1.25rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.fld-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fld-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.summary-box {
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    padding: 0.75rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-2);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.summary-box .sk {
    color: var(--text-3);
    display: inline-block;
    width: 80px;
}
.summary-box .sv { color: var(--text-1); }

/* Section "anchor" headings within content (for sidebar nav targets) */
.section-anchor {
    position: relative;
    top: -8px;
}

/* Toolbar separator */
.sep-v {
    width: 1px;
    height: 18px;
    background: var(--border-1);
    margin: 0 4px;
}

/* Empty state */
.empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-3);
    font-size: 0.85rem;
}

/* Scrollbar styling (subtle) */
.log-box::-webkit-scrollbar,
.tbl-wrap::-webkit-scrollbar,
.nav-list::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.log-box::-webkit-scrollbar-thumb,
.tbl-wrap::-webkit-scrollbar-thumb,
.nav-list::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb {
    background: var(--border-1);
    border-radius: 10px;
    border: 2px solid var(--bg-surface);
}
.log-box::-webkit-scrollbar-thumb { border-color: var(--bg-inset); }
.tbl-wrap::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ============================================================ */
/* User profile menu                                              */
/* ============================================================ */
.user-menu-wrap { position: relative; }
.user-menu-wrap.is-sidebar { border-top: 1px solid var(--border-1); }

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-1);
    transition: background 0.1s;
}
.user-trigger.is-sidebar {
    padding: 0.55rem 0.7rem;
    gap: 0.5rem;
}
.user-trigger.is-sidebar .avatar {
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
}
.user-trigger.is-sidebar .user-email {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-trigger.is-sidebar:hover { background: var(--bg-hover); }
.user-trigger.is-topnav {
    padding: 4px 10px 4px 4px;
    height: 36px;
    width: auto;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    margin-left: 1rem;
}
.user-trigger.is-topnav:hover {
    background: var(--bg-hover);
    border-color: var(--border-1);
}
.user-trigger .user-email {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-trigger.is-topnav .user-email {
    font-size: 0.82rem;
    color: var(--text-2);
    max-width: 180px;
}
.user-trigger .user-chev {
    color: var(--text-3);
    margin-left: 4px;
    flex-shrink: 0;
}

.user-popover {
    position: absolute;
    background: var(--bg-surface);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    min-width: 240px;
    padding: 0.45rem;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.12s, transform 0.12s;
}
.user-popover.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.user-popover.is-sidebar {
    bottom: calc(100% + 6px);
    left: 8px;
    right: 8px;
}
.user-popover.is-topnav {
    top: calc(100% + 6px);
    right: 0;
}

.up-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.7rem 0.7rem;
}
.avatar.lg {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
}
.up-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.up-role {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-top: 1px;
}
.up-divider {
    height: 1px;
    background: var(--border-1);
    margin: 0.25rem 0;
}
.up-section-label {
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 0.45rem 0.7rem 0.25rem;
}
.up-theme {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 0 0.45rem 0.35rem;
}
.up-theme-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.7rem;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 500;
    position: relative;
}
.up-theme-btn:hover { color: var(--text-1); border-color: var(--border-2); }
.up-theme-btn.on {
    color: var(--text-1);
    background: var(--accent-soft);
    border-color: var(--accent);
}
.up-theme-btn .up-check {
    margin-left: auto;
    color: var(--accent);
}

.up-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.7rem;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-1);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    border-radius: var(--r-sm);
    white-space: nowrap;
}
.up-item:hover { background: var(--bg-hover); }
.up-item.danger { color: var(--bad); }
.up-item.danger:hover { background: var(--bad-soft); }

/* SR-only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Data sources (collapsible) */
.src-card .src-toggle {
    background: none;
    border: 0;
    width: 100%;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
}
.src-card .src-toggle:hover h2 { color: var(--accent); }
.src-card .src-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.src-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem var(--pad-card-x);
}
.src-row + .src-row { border-top: 1px solid var(--border-1); }
.src-title { font-size: 0.9rem; font-weight: 600; color: var(--text-1); }
.src-desc { font-size: 0.82rem; color: var(--text-2); line-height: 1.45; }
.src-ident {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--text-faint);
    word-break: break-all;
}
.src-meta { font-size: 0.75rem; color: var(--text-3); }
.src-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    margin-top: 0.15rem;
    width: fit-content;
}
.src-link:hover { text-decoration: underline; }
/* ============================================================ */
/* Admin / Access control — settings-style page                   */
/* ============================================================ */

/* Settings page: narrower, centered, lighter chrome */
.content.settings {
    max-width: 760px;
    padding-top: 2rem;
    padding-bottom: 4rem;
    gap: 1.5rem;
}

.settings-intro h2 {
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-1);
    margin-bottom: 0.4rem;
}
.settings-intro p {
    color: var(--text-2);
    font-size: 0.9rem;
    line-height: 1.55;
    max-width: 60ch;
}

/* Lighter, flatter card variant — no border, just a divider feel */
.s-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
}

/* Smart-add input row */
.smart-add {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-1);
}
.smart-add .sa-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.smart-add .sa-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.smart-add .sa-icon {
    position: absolute;
    left: 12px;
    color: var(--text-3);
    pointer-events: none;
    transition: color 0.15s;
}
.smart-add input.input {
    height: 38px;
    padding-left: 38px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    background: var(--bg-inset);
    border-color: transparent;
}
.smart-add input.input:focus { background: var(--bg-surface-2); border-color: var(--accent); }
.smart-add .sa-notes-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.smart-add .sa-notes-wrap .sa-icon { color: var(--text-faint); }
.smart-add input.input.sa-notes {
    height: 32px;
    font-family: var(--font-sans);
    font-size: 0.81rem;
    font-weight: 400;
    color: var(--text-2);
    padding-left: 38px;
    background: transparent;
    border: 1px dashed var(--border-1);
}
.smart-add input.input.sa-notes:focus {
    background: var(--bg-inset);
    border-style: solid;
    border-color: var(--accent);
    color: var(--text-1);
}
.smart-add .sa-detect {
    font-size: 0.7rem;
    color: var(--text-3);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--neutral-soft);
    white-space: nowrap;
}
.smart-add .sa-detect.email  { background: var(--info-soft); color: var(--info); }
.smart-add .sa-detect.domain { background: var(--ok-soft);   color: var(--ok); }
.smart-add .sa-detect.wild   { background: var(--warn-soft); color: var(--warn); }
.smart-add .sa-detect.bad    { background: var(--bad-soft);  color: var(--bad); }
.smart-add .btn { height: 38px; }
.smart-add .sa-role {
    height: 38px;
    padding: 0 0.6rem;
    font-size: 0.82rem;
    flex: 0 0 auto;
    width: auto;
}

/* Allowlist rows — flatter, no table chrome */
.al-list {
    display: flex;
    flex-direction: column;
}
.al-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 120px 150px 32px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-1);
}
.al-row:last-child { border-bottom: none; }
.al-row:hover { background: var(--bg-hover); }
.al-row.disabled .al-value { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-faint); }
.al-row .al-tile {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: var(--bg-inset);
    color: var(--text-3);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.al-row.domain .al-tile { background: var(--ok-soft); color: var(--ok); }
.al-row.email .al-tile { background: var(--info-soft); color: var(--info); }
.al-row .al-value {
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--text-1);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.al-row .al-sub {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 400;
    margin-top: 1px;
}
.al-row .al-meta {
    color: var(--text-3);
    font-size: 0.74rem;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.al-row .al-tag-cell {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.al-row .al-tag {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: var(--r-pill);
    background: var(--neutral-soft);
    color: var(--text-3);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.al-row.disabled .al-tag { color: var(--text-3); }
.al-row .al-tag.wild { color: var(--warn); background: var(--warn-soft); }
.al-row .al-tag.admin {
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid color-mix(in oklch, var(--accent) 35%, transparent);
}
.al-row .al-kebab {
    display: flex;
    justify-content: center;
}
@media (max-width: 640px) {
    .al-row {
        grid-template-columns: 28px minmax(0, 1fr) auto 32px;
    }
    .al-row .al-tag-cell { display: none; }
}

/* Empty state for the allowlist */
.al-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-3);
    font-size: 0.85rem;
}

/* Slim alert banner for pending requests */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: var(--warn-soft);
    border: 1px solid color-mix(in oklch, var(--warn) 30%, transparent);
    border-radius: var(--r-md);
    color: var(--text-1);
    font-size: 0.85rem;
}
.alert-banner .ab-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--warn);
    color: var(--bg-page);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
[data-theme="light"] .alert-banner .ab-icon { color: white; }
.alert-banner .ab-msg { flex: 1; }
.alert-banner .ab-msg strong { color: var(--text-1); font-weight: 600; }
.alert-banner .ab-actions { display: flex; gap: 0.4rem; }

/* Inline pending review (expanded) */
.pending-review {
    background: var(--bg-inset);
    border-top: 1px solid var(--border-1);
}
.pending-review .pr-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-1);
}
.pending-review .pr-row:last-child { border-bottom: none; }
.pending-review .pr-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.pending-review .pr-email {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pending-review .pr-meta {
    font-size: 0.72rem;
    color: var(--text-3);
    font-family: var(--font-mono);
}
.pending-review .pr-actions { display: flex; gap: 4px; }

/* Recent changes — slim, footer-style */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.recent-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-2);
    padding: 0.25rem 0;
}
.recent-row .r-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}
.recent-row.add .r-dot { background: var(--ok); }
.recent-row.remove .r-dot { background: var(--bad); }
.recent-row.toggle .r-dot { background: var(--info); }
.recent-row.deny .r-dot { background: var(--warn); }
.recent-row .r-target { font-family: var(--font-mono); color: var(--text-1); }
.recent-row .r-when {
    margin-left: auto;
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

/* Section headers within settings page */
.settings-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

/* Collapsible "How it works" info card */
.info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.info-card .info-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-1);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s;
}
.info-card .info-head:hover { background: var(--bg-hover); }
.info-card .info-head .info-glyph {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.info-card .info-head .info-spacer { flex: 1; }
.info-card .info-head .info-chev {
    color: var(--text-3);
    transition: transform 0.2s;
}
.info-card.open .info-head .info-chev { transform: rotate(180deg); }
.info-card .info-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.info-card.open .info-body { grid-template-rows: 1fr; }
.info-card .info-body > div {
    overflow: hidden;
    min-height: 0;
}
.info-card .info-inner {
    border-top: 1px solid var(--border-1);
    padding: 1rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--bg-surface-2);
}
.info-rule {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.7rem;
    align-items: start;
}
.info-rule .ir-tile {
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.info-rule.domain .ir-tile { background: var(--ok-soft);   color: var(--ok); }
.info-rule.email  .ir-tile { background: var(--info-soft); color: var(--info); }
.info-rule.wild   .ir-tile { background: var(--warn-soft); color: var(--warn); }
.info-rule .ir-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 2px;
}
.info-rule .ir-desc {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.5;
}
.info-rule .ir-desc code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--bg-inset);
    color: var(--text-1);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-1);
    white-space: nowrap;
}

/* Filter chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: var(--r-pill);
    color: var(--text-2);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-2); }
.chip.on {
    background: var(--accent-soft);
    color: var(--text-1);
    border-color: color-mix(in oklch, var(--accent) 40%, transparent);
}
.chip .chip-count {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.chip.on .chip-count { color: var(--text-1); }

/* Differentiate admin page header subtly with an accent indicator */
.pageheader.admin {
    border-bottom-color: var(--border-1);
}
.pageheader.admin .crumbs h1 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.pageheader.admin .crumbs h1::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
    display: inline-block;
}

/* Access-denied screen (admin gate) */
.access-denied-wrap {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 3rem 1rem 6rem;
}
.access-denied {
    max-width: 460px;
    width: 100%;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-1);
    border-radius: var(--r-lg);
    padding: 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.access-denied .ad-shield {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--warn-soft);
    color: var(--warn);
    display: grid;
    place-items: center;
}
.access-denied h2 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-1);
}
.access-denied p {
    color: var(--text-2);
    font-size: 0.88rem;
    line-height: 1.55;
    max-width: 38ch;
}
.access-denied .ad-admins {
    width: 100%;
    background: var(--bg-inset);
    border: 1px solid var(--border-1);
    border-radius: var(--r-md);
    padding: 0.75rem 0.9rem;
    text-align: left;
    margin-top: 0.5rem;
}
.access-denied .ad-admins .ad-label {
    font-size: 0.7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.access-denied .ad-admins ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.access-denied .ad-admins li {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 6px;
}
.access-denied .ad-admins li .ad-li-icon { color: var(--accent); flex-shrink: 0; }
.access-denied .ad-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* ---------- Initial load overlay ---------- */
/* Covers the viewport until the first /api/* burst resolves so we don't
   flash empty Jobs/Schedules/Workers/Logs cards at the user. */
.load-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--bg-page);
    z-index: 1000;
}
.load-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: load-spin 0.8s linear infinite;
}
.load-text {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    color: var(--text-faint);
}
@keyframes load-spin { to { transform: rotate(360deg); } }

