/* Civic Sentinel design system (mockup/civic_sentinel/DESIGN.md) */

:root {
    --surface: #fcf8fa;
    --surface-muted: #F8FAFC;
    --surface-white: #ffffff;
    --surface-container: #f0edef;
    --on-surface: #1b1b1d;
    --on-surface-variant: #45464d;
    --border-subtle: #E2E8F0;
    --outline: #76777d;
    --primary: #0F172A;
    --secondary: #334155;
    --status-critical: #DC2626;
    --status-critical-bg: #FEE2E2;
    --status-ongoing: #D97706;
    --status-ongoing-bg: #FEF3C7;
    --status-resolved: #059669;
    --status-resolved-bg: #D1FAE5;
    --status-action: #2563EB;
    --status-action-bg: #DBEAFE;
    --shadow-float: 0 4px 12px rgba(15, 23, 42, 0.08);
    --radius: 0.25rem;
    --radius-lg: 0.5rem;
    --font-ui: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 20px;
    color: var(--on-surface);
    background: var(--surface-muted);
    height: 100%;
}

h1, h2, h3 { margin: 0; }
a { color: var(--status-action); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #f0edef;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; }
.sidebar .brand-mark {
    width: 40px; height: 40px; border-radius: 10px; background: var(--primary);
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.sidebar .brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar .brand-sub { font-size: 12px; color: var(--on-surface-variant); }

.btn-new-ticket {
    display: block; width: 100%; background: #000; color: #fff; border: none;
    padding: 12px; border-radius: var(--radius); font-weight: 600; font-size: 14px;
    cursor: pointer; text-align: center; margin-bottom: 16px; font-family: inherit;
}
.btn-new-ticket:hover { background: var(--primary); text-decoration: none; color: #fff; }

.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--radius-lg); color: var(--on-surface-variant);
    font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: #e4e2e4; text-decoration: none; }
.nav-item.active { background: #dbe4fd; color: var(--primary); font-weight: 600; }
.nav-item .icon { width: 20px; text-align: center; }
.sidebar .spacer { flex: 1; }

/* ---- Top bar ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: 16px; padding: 14px 32px;
    background: var(--surface-white); border-bottom: 1px solid var(--border-subtle);
    position: sticky; top: 0; z-index: 10;
}
.topbar .search {
    flex: 1; max-width: 480px; background: var(--surface-muted);
    border: 1px solid var(--border-subtle); border-radius: var(--radius);
    padding: 9px 14px; font-size: 14px; font-family: inherit; color: var(--on-surface);
}
.topbar .search:focus { outline: 2px solid var(--status-action); outline-offset: -1px; }
.topbar .grow { flex: 1; }
.community-selector {
    border: 1px solid var(--border-subtle); background: var(--surface-white);
    padding: 9px 14px; border-radius: var(--radius); font-size: 14px; font-family: inherit;
    color: var(--on-surface); cursor: pointer;
}
.user-chip { font-size: 13px; color: var(--on-surface-variant); white-space: nowrap; }

/* ---- Content ---- */
.content { padding: 32px; max-width: 1400px; width: 100%; }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 40px; }
.page-sub { color: var(--on-surface-variant); margin-top: 4px; margin-bottom: 24px; }

/* ---- Cards & stats ---- */
.card {
    background: var(--surface-white); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 20px;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 24px; }
.stat-card { position: relative; padding-left: 24px; }
.stat-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    border-radius: 4px 0 0 4px; background: var(--border-subtle);
}
.stat-card.critical::before { background: var(--status-critical); }
.stat-card.ongoing::before { background: var(--status-ongoing); }
.stat-card.action::before { background: var(--status-action); }
.stat-card.resolved::before { background: var(--status-resolved); }
.stat-label {
    font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--on-surface-variant);
}
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; }
.stat-hint { font-size: 13px; color: var(--on-surface-variant); }
.stat-hint.alert { color: var(--status-critical); }

/* ---- Chips ---- */
.chip {
    display: inline-block; padding: 3px 10px; border-radius: 9999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.critical { background: var(--status-critical-bg); color: var(--status-critical); }
.chip.high, .chip.ongoing { background: var(--status-ongoing-bg); color: var(--status-ongoing); }
.chip.resolved, .chip.approved, .chip.completed { background: var(--status-resolved-bg); color: var(--status-resolved); }
.chip.action, .chip.inprogress, .chip.assigned { background: var(--status-action-bg); color: var(--status-action); }
.chip.neutral { background: var(--surface-container); color: var(--on-surface-variant); }

.mono { font-family: var(--font-mono); font-size: 13px; }

/* ---- Tables / queues ---- */
.queue-table { width: 100%; border-collapse: collapse; }
.queue-table th {
    text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--on-surface-variant);
    padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-muted);
}
.queue-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.queue-table tbody tr { cursor: pointer; border-left: 4px solid transparent; }
.queue-table tbody tr:hover { background: var(--surface-muted); }
.queue-table tbody tr.sev-critical { border-left-color: var(--status-critical); }
.queue-table tbody tr.sev-high { border-left-color: var(--status-ongoing); }
.queue-table .title { font-weight: 600; }
.queue-table .desc { color: var(--on-surface-variant); font-size: 13px; margin-top: 2px; }
.sla-ok { color: var(--on-surface-variant); }
.sla-warn { color: var(--status-ongoing); font-weight: 600; }
.sla-breach { color: var(--status-critical); font-weight: 700; }

/* ---- Buttons & forms ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
    border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; background: var(--primary); color: #fff;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn.secondary { background: var(--surface-white); color: var(--secondary); border-color: var(--border-subtle); }
.btn.resolve { background: var(--status-resolved); }
.btn.danger { background: var(--status-critical); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field-label {
    display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--on-surface-variant); margin-bottom: 6px;
}
.field-input, .field-select, .field-textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border-subtle);
    border-radius: var(--radius); font-size: 14px; font-family: inherit; background: var(--surface-white);
    color: var(--on-surface);
}
.field-input:focus, .field-select:focus, .field-textarea:focus { outline: 2px solid var(--status-action); outline-offset: -1px; }
.field-row { margin-bottom: 16px; }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 20px 24px; border-left: 2px solid var(--border-subtle); margin-left: 8px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
    content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--surface-white); border: 2px solid var(--outline);
}
.timeline li.accent-critical::before { border-color: var(--status-critical); background: var(--status-critical); }
.timeline li.accent-action::before { border-color: var(--status-action); background: var(--status-action); }
.timeline .t-title { font-weight: 600; }
.timeline .t-meta { font-family: var(--font-mono); font-size: 12px; color: var(--on-surface-variant); margin-top: 2px; }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
.grid-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.muted { color: var(--on-surface-variant); }
.section-title { font-size: 18px; font-weight: 600; line-height: 24px; }
.divider { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }

/* ---- Report cards ---- */
.report-card { background: var(--surface-muted); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 14px 16px; }
.report-card .who { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--secondary); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.report-card .name { font-weight: 600; }
.report-card .meta { font-size: 12px; color: var(--on-surface-variant); }
.report-card .quote { font-style: normal; }

/* ---- Score bar ---- */
.score-bar { height: 6px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.score-bar > div { height: 100%; background: var(--status-action); }
.score-value { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.score-label { color: var(--status-resolved); font-weight: 600; font-size: 13px; margin-left: 8px; }

/* ---- Simple bar chart ---- */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 160px; padding: 8px 4px 0; }
.bars .day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; align-items: flex-end; gap: 4px; flex: 1; width: 100%; justify-content: center; }
.bars .bar { width: 16px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .bar.reports { background: var(--secondary); }
.bars .bar.resolved { background: var(--status-resolved); }
.bars .day-label { font-family: var(--font-mono); font-size: 11px; color: var(--on-surface-variant); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--surface-muted); }
.login-card { width: 380px; box-shadow: var(--shadow-float); }
.login-card .brand-mark { margin: 0 auto 12px; }

/* ---- Workload meter ---- */
.workload { display: flex; gap: 3px; }
.workload span { width: 8px; height: 18px; border-radius: 2px; background: var(--border-subtle); }
.workload span.filled { background: var(--status-resolved); }
.workload.busy span.filled { background: var(--status-ongoing); }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
    .grid-2 { grid-template-columns: 1fr; }
}
