:root {
    --bg: #0a0a0c;
    --bg-1: #101014;
    --bg-2: #16161d;
    --bg-3: #1c1c25;
    --bg-sunk: #060608;

    --line: #1d1d25;
    --line-2: #2a2a36;

    --text: #f0eee8;
    --text-2: #a8a59e;
    --text-3: #6b6863;
    --text-4: #45433f;

    --accent: #e89252;
    --accent-hi: #ffaa6e;
    --accent-soft: rgba(232, 146, 82, 0.08);

    --ok: #88e8a3;
    --warn: #f5b042;
    --bad: #ff5e5e;
    --info: #7ab0ff;
    --pr: #c78fff;
    --notif: #6ad9bf;

    --sans: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::selection { background: var(--accent); color: var(--bg); }

html, body { min-height: 100vh; background: var(--bg); }
body {
    font-family: var(--sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }

/* ============ Tickerbar ============ */
.tickerbar {
    background: var(--bg-sunk);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    display: flex;
    gap: 14px;
    align-items: center;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.tickerbar::-webkit-scrollbar { display: none; }
.ticker-mark { color: var(--text-2); }
.ticker-sep { color: var(--text-4); }
.ticker-time { margin-left: auto; color: var(--text-2); }

/* ============ Topbar ============ */
.topbar {
    background: var(--bg-1);
    border-bottom: 1px solid var(--line-2);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.brand-glyph {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav-tab {
    padding: 8px 14px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    border: 1px solid transparent;
    transition: color 0.12s, background 0.12s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active {
    color: var(--text);
    background: var(--bg-2);
}
.nav-action {
    margin-left: 14px;
    padding: 8px 14px;
    background: var(--accent);
    color: var(--bg);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--accent);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.nav-action:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

/* ============ Container ============ */
.container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 36px 24px 96px;
}

/* ============ Page head ============ */
.page-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 28px;
}
.page-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 28px;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.02em;
}
.page-sub {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    margin-top: 8px;
    letter-spacing: 0.04em;
}

/* ============ Overview: KPI strip ============ */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 1px solid var(--line);
    background: var(--bg-1);
    margin-bottom: 16px;
}
.kpi {
    padding: 20px 22px;
    border-right: 1px solid var(--line);
    position: relative;
}
.kpi:last-child { border-right: none; }
.kpi-key {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 10px;
}
.kpi-val {
    font-family: var(--sans);
    font-size: 30px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.kpi-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    margin-top: 10px;
    letter-spacing: 0.04em;
}
.kpi-alert .kpi-val,
.kpi-alert .kpi-key,
.kpi-alert .kpi-sub { color: var(--accent); }
.kpi-alert::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 24px;
    height: 1px;
    background: var(--accent);
}
.kpi-zero .kpi-val { color: var(--text-3); }

a.kpi { transition: background 0.12s; cursor: pointer; }
a.kpi:hover { background: var(--bg-2); }
.kpi-ready .kpi-val,
.kpi-ready .kpi-key,
.kpi-ready .kpi-sub { color: var(--ok); }
.kpi-ready::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 24px;
    height: 1px;
    background: var(--ok);
}

/* Ready-to-close badge on incident row */
.ready-badge {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ok);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

/* Sync + suggest banners on detail page */
.sync-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--line-2);
    background: var(--bg-1);
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    letter-spacing: 0.02em;
}
.sync-icon {
    color: var(--accent);
    font-size: 14px;
}

.suggest-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border: 1px solid rgba(136, 232, 163, 0.25);
    background: rgba(136, 232, 163, 0.04);
    margin-bottom: 24px;
}
.suggest-banner strong {
    color: var(--ok);
    font-weight: 600;
    margin-right: 8px;
}
.suggest-banner .subtle {
    color: var(--text-2);
    font-size: 13px;
}

/* Notify-user panel */
.notify-section {
    border: 1px solid var(--line);
    background: var(--bg-1);
    padding: 18px 20px;
    margin-bottom: 32px;
}
.notify-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}
.notify-tab {
    padding: 5px 12px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.12s;
}
.notify-tab:hover { border-color: var(--accent); color: var(--text); }
.notify-tab.active {
    background: var(--bg-2);
    border-color: var(--accent);
    color: var(--accent);
}
.notify-textarea {
    width: 100%;
    min-height: 130px;
    padding: 14px;
    background: var(--bg-sunk);
    border: 1px solid var(--line-2);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    resize: vertical;
    margin-bottom: 12px;
}
.notify-textarea:focus { outline: none; border-color: var(--accent); }
.notify-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.notify-actions .btn { cursor: pointer; }
#copy-notify-msg.copied {
    border-color: var(--ok);
    color: var(--ok);
}
.notify-already {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ok);
    letter-spacing: 0.04em;
}

/* === Auth: user chip in topbar === */
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    padding: 4px 4px 4px 10px;
    border: 1px solid var(--line-2);
    background: var(--bg-sunk);
}
.user-chip img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.user-chip-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-chip-name {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}
.user-chip-role {
    font-family: var(--mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.role-support { color: var(--accent); }
.role-product { color: var(--info); }
.role-leadership { color: var(--text-2); }
.user-chip-logout {
    background: transparent;
    border: 1px solid var(--line-2);
    color: var(--text-2);
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-family: var(--sans);
    transition: all 0.12s;
}
.user-chip-logout:hover {
    border-color: var(--bad);
    color: var(--bad);
}
.role-hint {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 8px;
    border: 1px dashed var(--line-2);
}

/* === Login page === */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}
.login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    border: 1px solid var(--line);
    background: var(--bg-1);
    position: relative;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 48px;
    height: 1px;
    background: var(--accent);
}
.login-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}
.login-sub {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 28px;
}
.login-sub strong { color: var(--text); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.login-field input {
    background: var(--bg-sunk);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: 10px 12px;
    font-family: var(--sans);
    font-size: 14px;
}
.login-field input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-1);
}
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    margin-top: 6px;
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s;
}
.login-btn:hover { background: var(--accent-hi); }
.login-error {
    padding: 12px 14px;
    border: 1px solid rgba(255, 94, 94, 0.4);
    background: rgba(255, 94, 94, 0.06);
    color: var(--bad);
    margin-bottom: 20px;
    font-family: var(--sans);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.login-error span { color: var(--text-2); font-size: 12px; }
.login-foot {
    margin-top: 24px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    text-align: center;
}

/* === Alert strip (stale/stuck on dashboard) === */
.alert-strip {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.alert-cell {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    border: 1px solid;
    text-decoration: none;
    transition: background 0.12s;
}
.alert-bad {
    color: var(--bad);
    border-color: rgba(255, 94, 94, 0.35);
    background: rgba(255, 94, 94, 0.05);
}
.alert-warn {
    color: var(--warn);
    border-color: rgba(245, 176, 66, 0.35);
    background: rgba(245, 176, 66, 0.05);
}
.alert-cell:hover { background: rgba(255, 255, 255, 0.04); }
.alert-key {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.alert-val {
    font-family: var(--sans);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-left: auto;
}
.alert-arrow {
    font-family: var(--sans);
    font-size: 16px;
    opacity: 0.6;
}

/* === Reports table === */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: 13px;
}
.report-table th {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-2);
}
.report-table th.num,
.report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:hover td { background: var(--bg-2); }
.report-table a { color: var(--accent); }
.report-table a:hover { color: var(--accent-hi); }
.row-bad td { background: rgba(255, 94, 94, 0.04); }
.row-warn td { background: rgba(245, 176, 66, 0.04); }
.bad-text { color: var(--bad); font-weight: 500; }
.warn-text { color: var(--warn); font-weight: 500; }

.status-mini {
    display: inline-block;
    padding: 2px 7px;
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid currentColor;
    background: transparent;
}
.status-mini.overdue { color: var(--bad); }
.status-mini.missed { color: var(--warn); }

.ttr-bar {
    width: 200px;
    height: 6px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    overflow: hidden;
}
.ttr-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ok), var(--warn), var(--bad));
}

/* === Pagination === */
.pagination-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}
.pagination-meta strong { color: var(--text); font-weight: 500; }

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.page-link {
    display: inline-block;
    padding: 6px 12px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-2);
    border: 1px solid var(--line);
    background: var(--bg-1);
    text-decoration: none;
    transition: all 0.12s;
}
.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.page-link.current {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}
.page-link.disabled {
    color: var(--text-4);
    cursor: not-allowed;
    background: transparent;
}
.page-link.ellipsis {
    border: none;
    background: transparent;
    color: var(--text-3);
}

/* === Activity timeline === */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--line);
    background: var(--bg-1);
}
.activity-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: baseline;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.activity-row:last-child { border-bottom: none; }
.activity-actor {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.04em;
    font-weight: 500;
}
.activity-actor.system { color: var(--text-3); }
.activity-desc {
    font-family: var(--sans);
    color: var(--text);
    line-height: 1.4;
}
.activity-desc em {
    font-style: normal;
    color: var(--accent-hi);
    font-family: var(--mono);
    font-size: 11px;
    padding: 0 4px;
    background: var(--bg-2);
    border: 1px solid var(--line);
}
.activity-time {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* === Search bar === */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}
.search-bar input[type="search"] {
    flex: 1;
    background: var(--bg-1);
    border: 1px solid var(--line-2);
    padding: 10px 14px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
}
.search-bar input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-1);
}

/* ============ Status distribution bar ============ */
.dist-block {
    margin-bottom: 28px;
    padding: 18px 22px;
    border: 1px solid var(--line);
    background: var(--bg-1);
}
.dist-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}
.dist-title {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.dist-total {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: 0.04em;
}
.dist-bar {
    display: flex;
    height: 6px;
    background: var(--bg-sunk);
    border: 1px solid var(--line);
    overflow: hidden;
    margin-bottom: 14px;
}
.dist-seg { transition: opacity 0.12s; }
.dist-seg:hover { opacity: 0.75; }
.dist-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 22px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.legend-label {
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.legend-count { color: var(--text); font-weight: 500; }

.st-bg-new, .st-dot-new { background: var(--info); }
.st-bg-in_progress, .st-dot-in_progress { background: var(--warn); }
.st-bg-pr_open, .st-dot-pr_open { background: var(--pr); }
.st-bg-fixed, .st-dot-fixed { background: var(--ok); }
.st-bg-user_notified, .st-dot-user_notified { background: var(--notif); }
.st-bg-closed, .st-dot-closed { background: var(--text-4); }

/* ============ Filters bar ============ */
.filters {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    font-family: var(--sans);
    font-size: 12px;
}
.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: var(--text-3);
}
.filter-group + .filter-group { border-left: 1px solid var(--line); }
.filter-label {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.filter-group select {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 6px;
    width: auto;
    text-transform: capitalize;
}
.filter-group select:focus { outline: none; color: var(--accent); }
.filter-clear {
    margin-left: auto;
    color: var(--text-3);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border: 1px solid var(--line-2);
}
.filter-clear:hover { color: var(--accent); border-color: var(--accent); }

/* ============ Incident list ============ */
.incident-list { display: flex; flex-direction: column; }

.incident {
    display: grid;
    grid-template-columns: 64px 84px minmax(0, 1fr) 210px 140px;
    gap: 22px;
    align-items: center;
    padding: 18px 18px 18px 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    position: relative;
    transition: background 0.12s;
}
.incident:hover { background: var(--bg-1); }
.incident::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0; bottom: 0;
    width: 2px;
    background: transparent;
    transition: background 0.15s;
}
.incident:hover::before { background: var(--accent); }

.incident-id {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    padding-left: 16px;
}

.incident-prio {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 5px currentColor;
    flex-shrink: 0;
}
.prio-urgent { color: var(--bad); }
.prio-urgent .led { animation: pulse 1.4s ease-in-out infinite; }
.prio-high { color: var(--accent); }
.prio-medium { color: var(--text-2); }
.prio-medium .led { box-shadow: 0 0 3px currentColor; }
.prio-low { color: var(--text-3); }
.prio-low .led { box-shadow: none; opacity: 0.5; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.8); }
}

.incident-body { min-width: 0; }
.incident-title {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.12s;
}
.incident:hover .incident-title { color: var(--accent); }

.incident-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}
.incident-meta .sep { color: var(--text-4); margin: 0 4px; }

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px 2px 5px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    text-transform: lowercase;
}
.tag-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.incident-reporter {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--text-2);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.incident-reporter .email {
    color: var(--text-3);
    font-size: 11px;
    font-family: var(--mono);
    display: block;
    margin-top: 3px;
    letter-spacing: 0.02em;
}

.incident-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

/* ============ Status pills ============ */
.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    border: 1px solid;
    background: transparent;
}
.status::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 4px currentColor;
}
.st-new { color: var(--info); border-color: rgba(122,176,255,0.3); background: rgba(122,176,255,0.04); }
.st-in_progress { color: var(--warn); border-color: rgba(245,176,66,0.35); background: rgba(245,176,66,0.04); }
.st-pr_open { color: var(--pr); border-color: rgba(199,143,255,0.35); background: rgba(199,143,255,0.04); }
.st-fixed { color: var(--ok); border-color: rgba(136,232,163,0.35); background: rgba(136,232,163,0.04); }
.st-user_notified { color: var(--notif); border-color: rgba(106,217,191,0.35); background: rgba(106,217,191,0.04); }
.st-closed { color: var(--text-3); border-color: var(--line-2); background: transparent; }
.st-closed::before { box-shadow: none; }

.gh-stamp {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent);
    letter-spacing: 0.06em;
}

/* ============ Empty state ============ */
.empty {
    border: 1px dashed var(--line-2);
    padding: 64px 24px;
    text-align: center;
    background: var(--bg-1);
}
.empty-glyph {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 8px;
}
.empty-text {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

/* ============ Detail page ============ */
.detail-head {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: end;
}
.detail-id {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}
.detail-title {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text);
}
.detail-tags {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
.detail-left, .detail-right {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Section header with rule */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
}
.section-title {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 500;
}
.section-rule {
    flex: 1;
    border-bottom: 1px solid var(--line);
    margin-bottom: 3px;
    min-width: 12px;
}
.section-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Narrative */
.narrative {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    padding: 4px 0;
}

/* Manifest */
.manifest { display: flex; flex-direction: column; gap: 6px; }
.manifest-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--mono);
}
.manifest-key {
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    flex-shrink: 0;
}
.manifest-dots {
    flex: 1;
    border-bottom: 1px dotted var(--line-2);
    align-self: flex-end;
    margin-bottom: 4px;
    min-width: 12px;
}
.manifest-val {
    font-size: 12px;
    color: var(--text);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}
.manifest-val a { color: var(--accent); }
.manifest-val a:hover { color: var(--accent-hi); }

/* Interventions */
.intervention {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    margin-bottom: 6px;
    align-items: center;
    background: var(--bg-1);
    transition: border-color 0.12s;
}
.intervention:hover { border-color: var(--line-2); }
.intervention.done {
    opacity: 0.55;
    border-style: dashed;
    background: transparent;
}
.intervention-marker {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--accent);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
}
.intervention.done .intervention-marker { color: var(--ok); }
.intervention-type {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
}
.intervention-desc {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
    letter-spacing: 0.02em;
}
.intervention-status {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-2);
    text-align: right;
}
.intervention-status .pending {
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 10px;
}
.intervention-status .done-by {
    color: var(--ok);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
    font-weight: 500;
}
.intervention-status .done-at {
    display: block;
    color: var(--text-3);
    font-size: 10px;
    margin-top: 3px;
}
.intervention-actions { display: flex; gap: 6px; align-items: center; }

.add-intervention {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

/* ============ Attachments ============ */
.attach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.attach-tile {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    background: var(--bg-sunk);
    overflow: hidden;
    transition: border-color 0.12s;
}
.attach-tile:hover { border-color: var(--accent); }
.attach-img {
    display: block;
    width: 100%;
    height: 100%;
}
.attach-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.attach-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0) 100%);
    padding: 22px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.attach-tile:hover .attach-overlay { opacity: 1; }
.attach-name {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attach-meta {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-2);
    letter-spacing: 0.02em;
}
.attach-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0;
    transition: opacity 0.12s;
    margin: 0;
}
.attach-tile:hover .attach-delete { opacity: 1; }
.attach-delete button {
    background: rgba(10,10,12,0.85);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: 0 7px;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    font-family: var(--sans);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.attach-delete button:hover {
    background: var(--bad);
    border-color: var(--bad);
    color: var(--bg);
}

.attach-files {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.attach-file {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: var(--bg-1);
    transition: border-color 0.12s;
}
.attach-file:hover { border-color: var(--line-2); }
.attach-file-icon {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-2);
    background: var(--bg-2);
    padding: 4px 8px;
    letter-spacing: 0.1em;
    font-weight: 500;
    border: 1px solid var(--line-2);
    min-width: 44px;
    text-align: center;
}
.attach-file-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attach-file-name {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attach-file-name:hover { color: var(--accent); }
.attach-file-meta {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}

.attach-upload {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.attach-drop {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 22px 16px;
    border: 1px dashed var(--line-2);
    background: var(--bg-sunk);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    position: relative;
    overflow: hidden;
}
.attach-drop:hover {
    border-color: var(--accent);
    background: var(--bg-1);
}
.attach-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
}
.attach-drop-text {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}
.attach-drop-hint {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    text-align: center;
}
.attach-drop.uploading {
    border-color: var(--accent);
    background: var(--bg-2);
    pointer-events: none;
}
.attach-drop.uploading .attach-drop-text {
    color: var(--accent);
}

/* ============ Side panels ============ */
.panel {
    border: 1px solid var(--line);
    padding: 20px;
    background: var(--bg-1);
}
.panel.danger { border-color: rgba(255,94,94,0.2); }

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--bg); }
.btn-success { background: transparent; border-color: var(--ok); color: var(--ok); }
.btn-success:hover { background: var(--ok); color: var(--bg); border-color: var(--ok); }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: var(--bg); border-color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn-ghost:hover { color: var(--text); background: var(--bg-2); border-color: var(--line); }

/* ============ Forms ============ */
input[type="text"], input[type="email"], input[type="url"], textarea, select {
    background: var(--bg-sunk);
    border: 1px solid var(--line-2);
    color: var(--text);
    font-family: var(--sans);
    font-size: 13px;
    padding: 9px 12px;
    width: 100%;
    transition: border-color 0.12s, background 0.12s;
}
input[type="color"] {
    background: var(--bg-sunk);
    border: 1px solid var(--line-2);
    padding: 4px;
    cursor: pointer;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-1);
}
textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.55;
}
select { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--text-4); }

.input-inline {
    padding: 5px 8px !important;
    font-size: 11px !important;
}

/* Form layout */
.form-shell {
    border: 1px solid var(--line);
    background: var(--bg-1);
    padding: 36px;
    max-width: 820px;
}
.form-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 22px;
}
.form-row label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.form-row .hint {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--text);
}
.checkbox-row input { width: auto; accent-color: var(--accent); }
.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--line);
}

/* Tag picker */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--line-2);
    background: var(--bg-sunk);
    font-family: var(--sans);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    color: var(--text-2);
    transition: all 0.12s;
}
.tag-toggle input { display: none; }
.tag-toggle:hover { border-color: var(--accent); color: var(--text); }
.tag-toggle:has(input:checked) {
    background: var(--bg-2);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============ Tags page ============ */
.tag-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}
.tag-table {
    border: 1px solid var(--line);
    background: var(--bg-1);
}
.tag-table-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    transition: background 0.12s;
}
.tag-table-row:hover { background: var(--bg-2); }
.tag-table-row:last-child { border-bottom: none; }
.tag-swatch {
    width: 18px; height: 18px;
    border: 1px solid var(--line-2);
}
.tag-table-name {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* ============ Responsive ============ */
@media (max-width: 1100px) {
    .kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .kpi:nth-child(3) { border-right: none; }
}
@media (max-width: 700px) {
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .kpi { border-right: 1px solid var(--line) !important; }
    .kpi:nth-child(even) { border-right: none !important; }
    .incident {
        grid-template-columns: 50px 80px 1fr;
        gap: 14px;
        padding-right: 14px;
    }
    .incident-reporter, .incident-right {
        grid-column: 3;
        text-align: left;
        align-items: flex-start;
    }
    .detail-grid, .tag-grid, .form-grid, .add-intervention {
        grid-template-columns: 1fr;
    }
    .detail-title { font-size: 24px; }
    .page-title { font-size: 22px; }
    .container { padding: 24px 16px 64px; }
    .topbar { padding: 12px 16px; }
    .tickerbar { padding: 6px 14px; gap: 10px; }
}
