/* ═══════════════════════════════════════════════════════════
   MyRent Agents — Dashboard theme
   Aligned to the official MyRent Design System (v1.0, April 2026):
   turquoise #2DBEBE interactive accent · yellow #FCD502 brand/nav accent ·
   black #1E1E1E · Inter · 4px spacing · elevation + radius tokens.
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* ── Brand palette ────────────────────────── */
    --brand-dark:          #1E1E1E;
    --brand-mid:           #3A3A3C;
    --brand-turquoise:     #2DBEBE;
    --brand-turquoise-lt:  #00FFFF;
    --brand-turquoise-dk:  #155858;
    --brand-yellow:        #FCD502;
    --brand-yellow-lt:     #FFEC83;

    /* Interactive accent = turquoise (focus, links, KPI, ticket ids) */
    --brand-accent:        #2DBEBE;
    --brand-accent-hover:  #155858;
    --brand-accent-soft:   rgba(45, 190, 190, 0.12);
    /* Brand accent = yellow (nav active/hover, brand mark) */
    --brand-yellow-soft:   rgba(252, 213, 2, 0.13);

    /* Brand gradients */
    --gradient-h:          linear-gradient(to right, #2DBEBE, #00FFFF);
    --gradient-v:          linear-gradient(to bottom, #2DBEBE, #155858);
    --gradient-yellow:     linear-gradient(to right, #FCD502, #FFEC83);

    /* ── Surfaces ─────────────────────────────── */
    --bg-page:             #FAFAFA;
    --bg-card:             #ffffff;
    --bg-header:           #F6F7F8;
    --bg-hover:            rgba(45, 190, 190, 0.06);
    --border-color:        #E6E7EA;
    --border-light:        #F0F1F2;

    /* ── Text (WCAG AA on white) ──────────────── */
    --text-primary:        #1E1E1E;
    --text-secondary:      #5A5A5A;   /* ~7:1  on white */
    --text-muted:          #6E747E;   /* ~4.7:1 on white */

    /* ── Severity ─────────────────────────────── */
    --sev-critical:        #DC2626;
    --sev-high:            #EA580C;
    --sev-medium:          #CA8A04;
    --sev-low:             #6B7280;
    --sev-info:            #2DBEBE;

    /* ── Semantic (official palette) ──────────── */
    --success:             #276749;
    --success-bg:          #C6F6D5;
    --warning:             #92400E;
    --warning-bg:          #FEF3C7;
    --danger:              #9B2C2C;
    --danger-bg:           #FED7D7;
    --draft:               #4A5568;
    --draft-bg:            #E2E8F0;
    --live:                #22C55E;   /* live dot — bright enough on dark sidebar */

    /* ── Sizing / tokens ──────────────────────── */
    --sidebar-w:           240px;
    --radius-s:            4px;
    --radius-sm:           6px;        /* button / input — radius/button */
    --radius:              8px;        /* card — radius/m */
    --radius-lg:           12px;       /* radius/l, radius/badge */
    --shadow-sm:           0 1px 3px rgba(0,0,0,.08);   /* elev-1 */
    --shadow:              0 1px 3px rgba(0,0,0,.08);   /* elev-1 */
    --shadow-md:           0 4px 12px rgba(0,0,0,.12);  /* elev-2 */
    --shadow-lg:           0 8px 24px rgba(0,0,0,.16);  /* elev-3 */
    --transition:          200ms ease;
}

/* ═══════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════ */
body.dark {
    --bg-page:             #131316;
    --bg-card:             #1e1e21;
    --bg-header:           #1a1a1d;
    --bg-hover:            rgba(45,190,190,0.08);
    --border-color:        #2e2e33;
    --border-light:        #252528;
    --text-primary:        #e4e4e7;
    --text-secondary:      #a9a9b2;
    --text-muted:          #8a8a93;
    --sev-medium:          #eab308;
    --shadow-sm:           0 1px 2px rgba(0,0,0,.3);
    --shadow:              0 1px 3px rgba(0,0,0,.35);
    --shadow-md:           0 4px 12px rgba(0,0,0,.45);
    --shadow-lg:           0 8px 24px rgba(0,0,0,.55);
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 13.5px;
    line-height: 1.55;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Shared high-contrast focus ring for keyboard users (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--brand-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition);
    overflow: hidden;
}
.sidebar-brand {
    padding: 22px 20px 20px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--gradient-v);          /* DS: vertical turquoise header */
    border-bottom: 1px solid rgba(252,213,2,0.25);
}
.brand-logo {
    height: 28px;
    flex-shrink: 0;
}
.brand-label {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #fff;                            /* legible on turquoise */
    position: relative;
    top: -4px;                              /* align with the "myrent" wordmark */
}
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}
.nav-section {
    padding: 18px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: rgba(255,255,255,.30);
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 16px;
    margin: 1px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.62);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    border: none;
    background: none;
    width: calc(100% - 20px);
    text-align: left;
    font-family: inherit;
    font-weight: 500;
}
.nav-item:hover { background: rgba(252,213,2,.10); color: rgba(255,255,255,.92); }
.nav-item.active {                          /* DS: translucent yellow tint + yellow text */
    background: var(--brand-yellow-soft);
    color: var(--brand-yellow);
    font-weight: 600;
}
.nav-item:focus-visible { outline-color: var(--brand-yellow); outline-offset: -2px; }
.nav-item .icon { font-size: 15px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item .badge-count {
    margin-left: auto;
    background: rgba(255,255,255,.10);
    color: inherit;
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 22px;
    text-align: center;
}
.nav-item.active .badge-count { background: rgba(252,213,2,.18); }
.sidebar-footer {
    padding: 14px 20px;
    font-size: 10.5px;
    color: rgba(255,255,255,.40);
    border-top: 1px solid rgba(255,255,255,.06);
    position: relative;
}
.sidebar-footer::before {                   /* DS: horizontal gradient accent strip */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-h);
}
.dark-toggle {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    color: rgba(255,255,255,.62);
    font-size: 11.5px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    margin-top: 8px;
    transition: background var(--transition), color var(--transition);
}
.dark-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.live-indicator {
    display: block;
    font-size: 10px;
    color: var(--live);
    margin-top: 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
    animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@media (prefers-reduced-motion: reduce) {
    .live-indicator { animation: none; }
    * { transition: none !important; }
}

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.header-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.header-bar::after {                        /* subtle brand accent line */
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--gradient-h);
    opacity: 0.9;
}
.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin: 0;
}
.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}
.content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* ═══════════════════════════════════════════════════
   KPI / STATS GRID
   ═══════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px 22px 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card::before {                        /* DS KPI accent bar */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-h);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.5px;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   SECTION LABEL
   ═══════════════════════════════════════════════════ */
.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--brand-yellow);   /* DS: yellow section divider */
    display: inline-block;
}

/* ═══════════════════════════════════════════════════
   AGENT CARDS (State page)
   ═══════════════════════════════════════════════════ */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.agent-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.agent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-header);
}
.agent-icon { font-size: 22px; flex-shrink: 0; }
.agent-card-title { flex: 1; min-width: 0; }
.agent-card-title strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.agent-card-title span {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}
.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.agent-dot.active {
    background: var(--live);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.agent-dot.idle {
    background: var(--text-muted);
    opacity: 0.5;
}
.agent-card-body { padding: 14px 18px 16px; }
.agent-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 12.5px;
}
.agent-detail span:first-child {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.agent-detail span:last-child {
    color: var(--text-secondary);
    font-weight: 500;
    text-align: right;
}
.agent-detail code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    background: var(--bg-page);
    border: none;
    padding: 1px 5px;
    border-radius: 3px;
}
.agent-status-active { color: var(--success) !important; font-weight: 600 !important; }
body.dark .agent-status-active { color: var(--live) !important; }
.agent-status-idle   { color: var(--text-muted) !important; }

/* ═══════════════════════════════════════════════════
   SEARCH & FILTERS
   ═══════════════════════════════════════════════════ */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: center;
}
.search-input {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    border: 1.5px solid var(--brand-accent);
    box-shadow: 0 0 0 3px var(--brand-accent-soft);
}
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-family: inherit;
    font-weight: 500;
}
.filter-btn:hover { border-color: var(--brand-accent); color: var(--text-primary); }
.filter-btn.active {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #fff;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   CARD / TABLE
   ═══════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Each table declares its own column template via a cols-* modifier so the
   shared row never inherits the wrong (ticket) grid. */
.table-row {
    display: grid;
    grid-template-columns: 120px minmax(0,1fr) 92px 116px 104px 120px 84px 120px;
    align-items: center;
    padding: 11px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
    gap: 10px;
}
.table-row.cols-tickets    { grid-template-columns: 120px minmax(0,1fr) 92px 116px 104px 120px 84px 120px; }
.table-row.cols-inbox-md   { grid-template-columns: 132px 104px 86px 84px minmax(0,1fr) 124px; }
.table-row.cols-inbox-json { grid-template-columns: minmax(0,1fr) 88px 88px 88px 88px 76px 96px 124px; }
.table-row.cols-reports    { grid-template-columns: minmax(0,1fr) 140px 150px; }
.table-row.cols-daily      { grid-template-columns: 220px minmax(0,1fr); }

.table-row:last-child { border-bottom: none; }
.table-row:not(.table-header):hover { background: var(--bg-hover); }
.table-row:not(.table-header):focus-visible { outline-offset: -2px; background: var(--bg-hover); }
.table-header {
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    background: var(--bg-header);
    cursor: default;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table-header:hover { background: var(--bg-header); }
.sort-hdr {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: left;
}
.sort-hdr:hover { color: var(--brand-accent); }
.ticket-id {
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--brand-accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   INBOX CATEGORY CARDS
   ═══════════════════════════════════════════════════ */
.inbox-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.inbox-category-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.inbox-category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--brand-accent);
}
.inbox-category-card:focus-visible { transform: translateY(-2px); }
.inbox-category-card.inactive {
    opacity: 0.55;
    cursor: default;
}
.inbox-category-card.inactive:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
}
.inbox-cat-icon { font-size: 28px; flex-shrink: 0; }
.inbox-cat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.inbox-cat-info strong {
    font-size: 13.5px;
    text-transform: capitalize;
}
.inbox-category-card .badge-count {
    background: var(--bg-header);
    color: var(--text-secondary);
    padding: 3px 11px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   INBOX AGENT SECTIONS (legacy helpers — kept for safety)
   ═══════════════════════════════════════════════════ */
.inbox-agent-section {
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.inbox-section-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    user-select: none;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.inbox-section-hdr .badge-count {
    margin-left: auto;
    background: var(--bg-header);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 600;
}
.inbox-item {
    padding: 10px 18px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    transition: background var(--transition);
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item .ticket-id { margin-right: 8px; }
.inbox-agent-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.4;
}
.inbox-agent-dot.active {
    background: var(--live);
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.inbox-empty {
    padding: 14px 20px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-style: italic;
}
.inbox-item-main { display: flex; align-items: center; gap: 10px; width: 100%; }
.inbox-item-meta { color: var(--text-muted); font-size: 11.5px; margin-left: auto; margin-right: 8px; }
.inbox-done { font-size: 11px; margin-right: 4px; }
.inbox-item-preview {
    padding: 4px 0 4px 28px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ═══════════════════════════════════════════════════
   BADGES  (status pills carry a ● dot — DS rule 1.2 / 9.3)
   ═══════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
    line-height: 1.3;
}
.badge-critical { background: #fef2f2; color: var(--sev-critical); }
.badge-high     { background: #fff7ed; color: var(--sev-high); }
.badge-medium   { background: #fefce8; color: #a16207; }
.badge-low      { background: #f3f4f6; color: var(--sev-low); }
.badge-info     { background: #ecfeff; color: var(--brand-turquoise-dk); }
/* status pills — official semantic palette + mandatory dot */
.badge-status   { background: var(--success-bg); color: var(--success); }
.badge-pending  { background: var(--warning-bg); color: var(--warning); }
.badge-expired  { background: var(--danger-bg);  color: var(--danger); }
.badge-draft    { background: var(--draft-bg);   color: var(--draft); }
.badge-status::before, .badge-pending::before,
.badge-expired::before, .badge-draft::before {
    content: "\25CF";              /* ● */
    font-size: 0.7em;
    line-height: 1;
}

body.dark .badge-critical { background: #3d1111; }
body.dark .badge-high     { background: #3d2000; }
body.dark .badge-medium   { background: #3d3300; color: var(--sev-medium); }
body.dark .badge-low      { background: #2a2a2b; color: #9ca3af; }
body.dark .badge-info     { background: #0d2a2a; color: #67e8f9; }
body.dark .badge-status   { background: #0d3320; color: #6ee7a8; }
body.dark .badge-pending  { background: #33240d; color: #fcd34d; }
body.dark .badge-expired  { background: #3d1414; color: #f3a3a3; }
body.dark .badge-draft    { background: #24272e; color: #cbd5e1; }

/* ═══════════════════════════════════════════════════
   DETAIL VIEW
   ═══════════════════════════════════════════════════ */
.back-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.back-btn:hover:not(:disabled) { border-color: var(--brand-accent); color: var(--text-primary); }
.detail-nav { display: flex; align-items: center; gap: 6px; }
.detail-nav .nav-pos { font-size: 12px; color: var(--text-muted); padding: 0 8px; font-weight: 500; }
.detail-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail-ticket {
    font-size: 20px;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--text-primary);
}
.detail-title { font-size: 15px; color: var(--text-secondary); font-weight: 500; }

.meta-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.meta-table td { padding: 7px 14px; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.meta-table td:first-child { font-weight: 600; color: var(--text-muted); width: 120px; }

.commits-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 12px; }
.commits-table th {
    background: var(--bg-header);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}
.commits-table td { padding: 7px 12px; border-bottom: 1px solid var(--border-light); }
.commits-table tr:nth-child(even) td { background: var(--bg-header); }
.commits-table .hash {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--brand-accent);
    font-size: 11px;
}

/* ═══════════════════════════════════════════════════
   FINDINGS
   ═══════════════════════════════════════════════════ */
.findings-section { margin-bottom: 24px; }
.section-heading {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-heading.code-review { border-color: var(--sev-high); color: var(--sev-high); }
.section-heading.security   { border-color: var(--sev-critical); color: var(--sev-critical); }

.finding-block {
    background: var(--bg-header);
    border-left: 3px solid var(--border-color);
    padding: 14px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 10px;
    transition: background var(--transition);
}
.finding-block.critical { border-color: var(--sev-critical); background: #fef2f2; }
.finding-block.high     { border-color: var(--sev-high); background: #fff7ed; }
.finding-block.medium   { border-color: var(--sev-medium); background: #fefce8; }
.finding-block.low      { border-color: #ccc; }
.finding-block.info     { border-color: var(--sev-info); background: #ecfeff; }
.finding-block.resolved { opacity: 0.55; }
.finding-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.finding-desc { font-size: 13.5px; font-weight: 600; }
.finding-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.7; padding-left: 4px; }

body.dark .finding-block          { background: #1a1a1d; }
body.dark .finding-block.critical { background: #2d1111; border-color: #662222; }
body.dark .finding-block.high     { background: #2d1a0a; border-color: #663d11; }
body.dark .finding-block.medium   { background: #2d280a; border-color: #665511; }
body.dark .finding-block.info     { background: #0d2424; border-color: #1d4d4d; }

/* ═══════════════════════════════════════════════════
   FULL-OUTPUT DROPDOWNS (ticket detail)
   ═══════════════════════════════════════════════════ */
details.drop {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--bg-card);
    overflow: hidden;
}
details.drop > summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-header);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 9px;
    list-style: none;
    transition: color var(--transition);
}
details.drop > summary::-webkit-details-marker { display: none; }
details.drop > summary::before {
    content: "▸";
    display: inline-block;
    color: var(--brand-accent);
    font-size: 11px;
    transition: transform var(--transition);
}
details.drop[open] > summary::before { transform: rotate(90deg); }
details.drop[open] > summary { border-bottom: 1px solid var(--border-light); }
details.drop > summary:hover { color: var(--brand-accent); }
.drop-meta {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.drop-body { padding: 16px; }
.drop-body .markdown-content { font-size: 12.5px; }

/* ═══════════════════════════════════════════════════
   CODE  (DS: yellow-tinted inline code)
   ═══════════════════════════════════════════════════ */
code {
    background: rgba(252, 213, 2, 0.16);
    border: 1px solid rgba(252, 213, 2, 0.40);
    padding: 1px 5px;
    border-radius: var(--radius-s);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-primary);
}
body.dark code {
    background: rgba(252, 213, 2, 0.12);
    border-color: rgba(252, 213, 2, 0.22);
    color: #e4e4e7;
}

/* ═══════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 52px; margin-bottom: 16px; opacity: 0.35; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; }

/* ═══════════════════════════════════════════════════
   MARKDOWN CONTENT (cross-check, daily, inbox)
   ═══════════════════════════════════════════════════ */
.markdown-content { font-size: 13px; line-height: 1.8; color: var(--text-primary); }
.markdown-content h1 { font-size: 18px; font-weight: 700; margin: 0 0 16px; }
.markdown-content h2 {
    font-size: 15px; font-weight: 700; margin: 22px 0 10px;
    padding-bottom: 7px; border-bottom: 1px solid var(--border-light);
}
.markdown-content h3 { font-size: 13.5px; font-weight: 600; margin: 16px 0 8px; }
.markdown-content h4 { font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.markdown-content ul { margin: 8px 0 8px 22px; }
.markdown-content li { margin: 2px 0; }
.markdown-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.markdown-content th { background: var(--bg-header); padding: 8px 12px; text-align: left; font-weight: 600; }
.markdown-content td { padding: 6px 12px; border-bottom: 1px solid var(--border-light); }
.markdown-content strong { font-weight: 600; }
.markdown-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.6;
    margin: 8px 0;
}
body.dark .markdown-content pre { background: #0d0d0f; border-color: #2e2e33; }
.markdown-content pre code { background: none; border: none; color: inherit; padding: 0; }

/* ═══════════════════════════════════════════════════
   REPORTS VIEW
   ═══════════════════════════════════════════════════ */
.report-versions {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
}

/* ── Daily digest search match preview ── */
.daily-matches {
    padding: 4px 18px 12px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
}
.daily-match {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 3px 0;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 0;
}
.daily-match .ticket-id { flex-shrink: 0; }
.daily-match-date { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.daily-match-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-match-more { color: var(--text-muted); font-style: italic; font-size: 11px; }

/* ── Markdown tables (daily digests, cross-check) ── */
.md-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.md-table th {
    background: var(--bg-header);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}
.md-table td { padding: 7px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.md-table tr:hover td { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════ */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.pager-info {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.2px;
}
.pager-controls { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager-btn {
    min-width: 34px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.pager-btn:hover:not(:disabled):not(.active) { border-color: var(--brand-accent); color: var(--text-primary); }
.pager-btn.active {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #fff;
}
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-ellipsis { color: var(--text-muted); padding: 0 4px; user-select: none; }

/* Per-commit sections inside a full code/security review */
.commit-review { border: 1px solid var(--border-color); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.commit-review:last-child { margin-bottom: 0; }
.commit-review-head { font-weight: 700; font-size: 13px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
code.rev-hash { background: var(--bg-page); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--brand-accent); }

/* ═══════════════════════════════════════════════════
   RESPONSIVE — column hiding keeps visible-span count == grid columns
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .sidebar { width: 56px; }
    .sidebar-brand { padding: 18px 0; justify-content: center; }
    .sidebar-brand .brand-label,
    .nav-item span:not(.icon), .nav-item .badge-count,
    .nav-section, .sidebar-footer span, .sidebar-footer .live-indicator, .dark-toggle { display: none; }
    .nav-item { justify-content: center; padding: 12px; margin: 1px 6px; width: calc(100% - 12px); }
    .header-bar, .content { padding-left: 20px; padding-right: 20px; }

    /* Tickets: hide Code(5), Security(6), Findings(7) → 5 visible spans */
    .table-row.cols-tickets { grid-template-columns: 110px minmax(0,1fr) 84px 110px 110px; }
    .table-row.cols-tickets > :nth-child(5),
    .table-row.cols-tickets > :nth-child(6),
    .table-row.cols-tickets > :nth-child(7) { display: none; }

    /* Inbox markdown: hide Preview(5) → 5 visible spans */
    .table-row.cols-inbox-md { grid-template-columns: 120px 100px 84px 80px 120px; }
    .table-row.cols-inbox-md > :nth-child(5) { display: none; }

    /* Inbox json: hide N/A(5) + Tests(6) → 6 visible spans */
    .table-row.cols-inbox-json { grid-template-columns: minmax(0,1fr) 84px 84px 84px 90px 120px; }
    .table-row.cols-inbox-json > :nth-child(5),
    .table-row.cols-inbox-json > :nth-child(6) { display: none; }

    .agent-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .sidebar { display: none; }
    .header-bar, .content { padding-left: 14px; padding-right: 14px; }

    /* Tickets: keep Ticket(1), Summary(2), Committed(8) → 3 visible spans */
    .table-row.cols-tickets { grid-template-columns: 90px minmax(0,1fr) 104px; }
    .table-row.cols-tickets > :nth-child(3),
    .table-row.cols-tickets > :nth-child(4) { display: none; }

    /* Inbox markdown: Ticket(1), Severity(2), Modified(6) → 3 visible spans */
    .table-row.cols-inbox-md { grid-template-columns: 120px 104px minmax(0,1fr); }
    .table-row.cols-inbox-md > :nth-child(3),
    .table-row.cols-inbox-md > :nth-child(4) { display: none; }

    /* Inbox json: Run(1), Pass Rate(7), Modified(8) → 3 visible spans */
    .table-row.cols-inbox-json { grid-template-columns: minmax(0,1fr) 90px 120px; }
    .table-row.cols-inbox-json > :nth-child(2),
    .table-row.cols-inbox-json > :nth-child(3),
    .table-row.cols-inbox-json > :nth-child(4) { display: none; }

    .table-row.cols-reports { grid-template-columns: minmax(0,1fr) 130px; }
    .table-row.cols-reports > :nth-child(2) { display: none; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════
   DIFF VIEWER
   ═══════════════════════════════════════════════════ */
.diff-link {
    color: var(--brand-accent);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition);
}
.diff-link:hover { color: var(--brand-accent-hover); text-decoration: underline; }

.diff-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}

.diff-viewer {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: 70vh;
}

.diff-file-tree {
    background: var(--bg-header);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 70vh;
}

.diff-file-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
    overflow: hidden;
}
.diff-file-item:hover { background: var(--bg-hover); }
.diff-file-item.active {
    background: var(--brand-accent-soft);
    color: var(--brand-accent);
    font-weight: 600;
}

.diff-file-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    margin-top: 1px;
}
.diff-file-item.active .diff-file-icon { color: var(--live); }
.diff-file-icon.diff-change-added   { color: #16a34a; }
.diff-file-icon.diff-change-deleted { color: #dc2626; }
.diff-file-icon.diff-change-renamed { color: var(--brand-accent); }

/* Filename-first sidebar entry: basename never clipped, directory muted below */
.diff-file-label {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.diff-file-base {
    font-size: 11.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.diff-file-item.active .diff-file-base { color: var(--brand-accent); }
.diff-file-dir {
    font-size: 9.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sticky full-path header inside the diff pane */
.diff-file-path {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-primary);
}
.diff-file-path-text {
    flex: 1;
    min-width: 0;
    word-break: break-all;
}
.diff-file-path-tag {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 7px;
    border-radius: 8px;
    background: var(--bg-page);
    color: var(--text-muted);
}
.diff-file-path-tag.diff-change-added   { background: rgba(34, 197, 94, 0.14);  color: #16a34a; }
.diff-file-path-tag.diff-change-deleted { background: rgba(220, 38, 38, 0.14);   color: #dc2626; }
.diff-file-path-tag.diff-change-renamed { background: rgba(252, 213, 2, 0.18);   color: var(--brand-accent); }

.diff-file-hunks {
    flex-shrink: 0;
    background: var(--bg-page);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.diff-pane {
    overflow-y: auto;
    max-height: 70vh;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.55;
    background: var(--bg-card);
}

.diff-hunk {
    border-bottom: 1px solid var(--border-light);
}
.diff-hunk:last-child { border-bottom: none; }

.diff-hunk-header {
    padding: 6px 12px;
    background: var(--bg-header);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line {
    display: grid;
    grid-template-columns: 50px 50px 1fr;
    min-height: 21px;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line-no {
    text-align: right;
    padding: 1px 6px 1px 4px;
    color: var(--text-muted);
    font-size: 10.5px;
    user-select: none;
    border-right: 1px solid var(--border-light);
}

.diff-line-content {
    padding: 1px 10px;
}

/* Line types */
.diff-line-added   { background: rgba(34, 197, 94, 0.08); }
.diff-line-removed { background: rgba(220, 38, 38, 0.08); }
.diff-line-context { background: transparent; }
.diff-line-skip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
    background: var(--bg-header);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

/* Highlighted line (jumped to from finding) */
.diff-line-highlight {
    background: rgba(252, 213, 2, 0.22) !important;
    transition: background 0.3s ease;
}

body.dark .diff-line-added   { background: rgba(34, 197, 94, 0.12); }
body.dark .diff-line-removed { background: rgba(220, 38, 38, 0.12); }
body.dark .diff-line-highlight { background: rgba(252, 213, 2, 0.16) !important; }

/* Collapse context checkbox */
#diff-collapse-ctx {
    accent-color: var(--brand-accent);
    cursor: pointer;
}

/* Mobile diff: stack vertically */
@media (max-width: 768px) {
    .diff-viewer { grid-template-columns: 1fr; max-height: none; }
    .diff-file-tree { max-height: 180px; }
    .diff-pane { max-height: 60vh; }
}

/* ═══════════════════════════════════════════════════
   CROSS-CHECK VIEW (scoped under .crosscheck- prefix)
   ═══════════════════════════════════════════════════ */

/* Row templates for cross-check tables */
.table-row.crosscheck-row-stale { grid-template-columns: 116px 55px minmax(0,1fr) 92px 140px 80px 110px; }
.table-row.crosscheck-row-qa    { grid-template-columns: 116px 55px minmax(0,1fr) 92px 140px 80px 110px; }
.table-row.crosscheck-row-cr    { grid-template-columns: 116px 55px 100px 92px 140px 80px 110px; }
.table-row.crosscheck-row-bp    { grid-template-columns: 70px 120px 110px 100px 70px 80px; }

/* Assignee bar chart */
.crosscheck-assignee-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
}
.crosscheck-assignee-row:last-child { border-bottom: none; }
.crosscheck-assignee-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crosscheck-assignee-counts {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 100px;
}
.crosscheck-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-header);
    border-radius: 999px;
    overflow: hidden;
    min-width: 40px;
}
.crosscheck-bar-fill {
    display: block;
    height: 100%;
    background: var(--gradient-h);
    border-radius: 999px;
    min-width: 2px;
    transition: width 0.4s ease;
}
.crosscheck-bar-total {
    font-weight: 700;
    font-size: 14px;
    color: var(--brand-accent);
    min-width: 30px;
    text-align: right;
}

/* Cross-check collapsible drops (slightly tighter) */
.crosscheck-drop {
    margin-bottom: 12px;
}

/* QA row hover cursor */
.crosscheck-row-qa:not(.table-header) { cursor: pointer; }
.crosscheck-row-qa:not(.table-header):hover { background: var(--bg-hover); }
.crosscheck-row-stale:not(.table-header) { cursor: default; }

/* ═══════════════════════════════════════════════════
   DEVELOPER CARDS
   ═══════════════════════════════════════════════════ */
.dev-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.dev-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.dev-card:hover { box-shadow: var(--shadow-md); }
.dev-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: background var(--transition);
}
.dev-card-head:hover { background: var(--bg-hover); }
.dev-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gradient-h);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}
.dev-info { flex: 1; min-width: 0; }
.dev-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.dev-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.dev-stats {
    display: flex;
    gap: 24px;
    flex-shrink: 0;
}
.dev-stat { text-align: center; }
.dev-stat-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.dev-stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-top: 2px;
}
.dev-bar-row { padding: 0 18px; }
.dev-bar {
    background: var(--bg-header);
    border-radius: 999px;
    overflow: hidden;
    height: 6px;
}
.dev-card-body {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border-light);
}
.dev-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 14px 0;
}
.dev-detail-hdr {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.dev-detail-sev {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.dev-range {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    font-style: italic;
}

/* ── Overview page & progress charts (added) ─────────────────────── */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.chart-card { padding: 18px 20px; }
.chart-title {
    font-size: 12px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px;
}
.chart-empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

.ov-bars { display: flex; flex-direction: column; gap: 9px; }
.ov-bar-row {
    display: grid; grid-template-columns: 116px 1fr 44px;
    align-items: center; gap: 10px; font-size: 12px;
}
.ov-bar-label {
    color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ov-bar-track {
    background: var(--bg-page); border: 1px solid var(--border-light);
    border-radius: 6px; height: 16px; overflow: hidden;
}
.ov-bar-fill {
    display: block; height: 100%; border-radius: 6px 0 0 6px;
    min-width: 2px; transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.ov-bar-val {
    text-align: right; font-weight: 700; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.ov-svg { width: 100%; height: 150px; display: block; }
.ov-svg-axis {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text-muted); margin-top: 6px;
}

/* ── Polish within the design system ─────────────────────────────── */
.stat-card {
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 30, 30, .09);
    border-color: var(--brand-accent);
}
.chart-card { transition: box-shadow .15s ease; }
.chart-card:hover { box-shadow: 0 4px 18px rgba(30, 30, 30, .07); }

/* ── Cross-Check: collapsible report sections (added) ─────────────── */
.cc-intro { padding: 14px 20px; }
.cc-section { padding: 0; margin-bottom: 10px; overflow: hidden; }
.cc-section > summary {
    cursor: pointer; list-style: none; padding: 12px 18px;
    font-size: 13px; font-weight: 700; color: var(--text-primary);
    background: var(--bg-header); border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 8px;
}
.cc-section > summary::-webkit-details-marker { display: none; }
.cc-section > summary::before {
    content: "\25B8"; color: var(--brand-accent); font-size: 11px;
    transition: transform .15s ease;
}
.cc-section[open] > summary::before { transform: rotate(90deg); }
.cc-section > summary:hover { background: var(--bg-hover); }
.cc-section > .markdown-content { padding: 14px 20px; }

/* ═══════════════════════════════════════════════════
   DASHBOARD 2.0 AUTH (Phase D) — user chip, role badge,
   access-denied card, System group divider (added)
   Sidebar pieces sit on the always-dark sidebar, so they read the
   same in light and dark mode; content-area pieces use the surface
   variables and get explicit body.dark tuning below.
   ═══════════════════════════════════════════════════ */

/* The refresh CSS nudges .brand-label +4px against the bottom-weighted myrent
   wordmark. The Dogma Systems fallback wordmark is vertically balanced — undo
   the nudge when it is the sidebar logo (flagged by the template). */
.brand-logo-balanced + .brand-label { top: 0; }

/* Selected project name — full-width second line under the logo+label lockup.
   A 240px sidebar cannot fit a long display name inline next to the pill
   (it ellipsized down to a single letter). */
body.authed .sidebar-brand { flex-wrap: wrap; row-gap: 7px; }
.brand-project {
    flex-basis: 100%;
    min-width: 0;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: rgba(255,255,255,.80);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* System group divider — separates the admin System block (Agent State +
   the JS-added Users entry) from the content views. Scoped to authed
   sessions so files mode stays pixel-identical. */
body.authed .sidebar-nav .nav-section:not(:first-child) {
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: 10px;
    padding-top: 14px;
}

/* Compact user chip (sits between the nav and the sidebar footer) */
.user-chip {
    margin: 0 10px 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.user-chip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.user-chip-email {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: rgba(255,255,255,.78);
}
.user-chip-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.user-chip-switch {
    flex: 1;
    min-width: 0;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--brand-turquoise);          /* DS: turquoise = interactive */
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition);
}
.user-chip-switch:hover { color: var(--brand-turquoise-lt); text-decoration: underline; }
.user-chip-logout {
    margin-left: auto;
    flex-shrink: 0;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    color: rgba(255,255,255,.62);
    font-size: 10.5px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.user-chip-logout:hover {
    background: rgba(220,38,38,.18);
    border-color: rgba(220,38,38,.40);
    color: #fff;
}

/* Role badge (admin = yellow brand accent, developer = turquoise) */
.role-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 7px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
}
.role-badge.role-admin {
    background: var(--brand-yellow-soft);
    color: var(--brand-yellow);
    border-color: rgba(252,213,2,.35);
}
.role-badge.role-developer {
    background: var(--brand-accent-soft);
    color: var(--brand-turquoise);
    border-color: rgba(45,190,190,.40);
}

/* Access-denied card (content area; turquoise accent per DS convention) */
.access-denied-card {
    max-width: 460px;
    margin: 48px auto;
    padding: 34px 36px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--brand-turquoise);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.access-denied-icon { color: var(--brand-turquoise); margin-bottom: 10px; }
.access-denied-card h3 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.access-denied-card p { font-size: 12.5px; color: var(--text-muted); }

/* Dark-mode variants (sidebar chip/badges already live on the dark
   sidebar; the content-area card re-reads the dark surface tokens) */
body.dark .access-denied-card {
    background: var(--bg-card);
    border-color: var(--border-color);
    border-top-color: var(--brand-turquoise);
    box-shadow: var(--shadow-md);
}
body.dark .user-chip { background: rgba(255,255,255,.04); }
body.dark.authed .sidebar-nav .nav-section:not(:first-child) {
    border-top-color: rgba(255,255,255,.08);
}

/* ═══════════════════════════════════════════════════
   DASHBOARD 2.0 USER MANAGEMENT (Phase D2) — users table,
   grant chips, add/edit modal (added)
   DS convention: turquoise = interactive/focus, yellow stays a
   nav/admin accent. Light-mode first; body.dark tuning at the
   end of this block.
   ═══════════════════════════════════════════════════ */

/* Toolbar row above the users table */
.users-toolbar { justify-content: space-between; }
.users-count { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

/* Buttons (small action buttons + the primary Add User) */
.users-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.users-btn:hover { border-color: var(--brand-turquoise); color: var(--text-primary); }
.users-btn-primary {
    background: var(--brand-turquoise);
    border-color: var(--brand-turquoise);
    color: #fff;
}
.users-btn-primary:hover {
    background: var(--brand-turquoise-dk);
    border-color: var(--brand-turquoise-dk);
    color: #fff;
}
.users-btn-sm { padding: 3px 10px; font-size: 11px; }
.users-btn-danger:hover {
    border-color: var(--sev-critical);
    color: var(--sev-critical);
    background: rgba(220,38,38,.06);
}

/* Users table grid (email · name · role · active · dashboards · created · actions) */
.table-row.cols-users {
    grid-template-columns: minmax(0,1.4fr) minmax(0,0.9fr) 92px 86px minmax(0,1.4fr) 96px 128px;
}
.users-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-row-actions { display: flex; gap: 6px; }

/* Active dot */
.users-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.users-dot.on  { background: #16A34A; }
.users-dot.off { background: var(--sev-low); }

/* Granted-dashboard chips */
.users-proj-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-proj-chip {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: var(--radius-lg);
    background: var(--brand-accent-soft);
    color: var(--brand-turquoise-dk);
    border: 1px solid rgba(45,190,190,.30);
}
.users-proj-all, .users-proj-none {
    font-size: 11.5px;
    color: var(--text-muted);
    font-style: italic;
}

/* The D1 role badge was tuned for the dark sidebar; on the light content
   surface raw brand yellow/turquoise text is too faint — darken it here. */
.users-view .role-badge.role-admin { color: #A16207; border-color: rgba(202,138,4,.35); }
.users-view .role-badge.role-developer { color: var(--brand-turquoise-dk); }

/* Inline error banner above the table (delete failures etc.) */
.users-error {
    margin-bottom: 12px;
    padding: 9px 14px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    background: rgba(220,38,38,.08);
    border: 1px solid rgba(220,38,38,.35);
    color: var(--sev-critical);
}

/* Add/Edit modal */
.users-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(20,20,22,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.users-modal {
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--brand-turquoise);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 20px 24px 22px;
}
.users-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.users-modal-head h3 { font-size: 16px; color: var(--text-primary); }
.users-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: var(--radius-s);
}
.users-modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Form fields */
.users-field {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.users-field input, .users-field select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.users-field input:focus, .users-field select:focus {
    outline: none;
    border-color: var(--brand-turquoise);
    box-shadow: 0 0 0 3px var(--brand-accent-soft);
}
.users-field input:disabled {
    background: var(--bg-header);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Spec Layer 4 warning under the email field */
.users-email-warn {
    margin: -6px 0 12px;
    padding: 6px 10px;
    font-size: 11.5px;
    border-radius: var(--radius-s);
    background: var(--brand-yellow-soft);
    border: 1px solid rgba(202,138,4,.30);
    color: #A16207;
}

/* Checkboxes: active toggle + per-dashboard grants */
.users-active-check, .users-proj-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
}
.users-active-check { margin-bottom: 12px; }
.users-active-check input, .users-proj-check input { accent-color: var(--brand-turquoise); }
.users-proj-check.coming-soon,
.users-proj-fieldset.all-implicit .users-proj-check { opacity: .5; cursor: not-allowed; }
.users-soon { color: var(--text-muted); font-size: 11px; }

.users-proj-fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.users-proj-fieldset legend {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: 0 4px;
}
.users-proj-note { font-size: 11.5px; color: var(--text-muted); font-style: italic; }

/* Inline form error (400s: duplicate email, self-modification guard) */
.users-form-error {
    margin-bottom: 12px;
    padding: 8px 12px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    background: rgba(220,38,38,.08);
    border: 1px solid rgba(220,38,38,.35);
    color: var(--sev-critical);
}
.users-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Narrow screens: drop Name + Created, keep the load-bearing columns */
@media (max-width: 900px) {
    .table-row.cols-users { grid-template-columns: minmax(0,1.4fr) 88px 78px minmax(0,1fr) 118px; }
    .table-row.cols-users > :nth-child(2),
    .table-row.cols-users > :nth-child(6) { display: none; }
}

/* Dark-mode variants */
body.dark .users-view .role-badge.role-admin {
    color: var(--brand-yellow);
    border-color: rgba(252,213,2,.35);
}
body.dark .users-view .role-badge.role-developer { color: var(--brand-turquoise); }
body.dark .users-proj-chip {
    color: var(--brand-turquoise);
    border-color: rgba(45,190,190,.35);
}
body.dark .users-modal-overlay { background: rgba(0,0,0,.68); }
body.dark .users-field input, body.dark .users-field select { background: var(--bg-page); }
body.dark .users-field input:disabled { background: var(--bg-header); }
body.dark .users-email-warn {
    background: rgba(252,213,2,.10);
    border-color: rgba(252,213,2,.30);
    color: var(--brand-yellow);
}
body.dark .users-error, body.dark .users-form-error {
    background: rgba(220,38,38,.14);
    border-color: rgba(220,38,38,.45);
    color: #F87171;
}
body.dark .users-dot.on { background: #22C55E; }
