:root {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-2: #475569;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --ok-border: #a7f3d0;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --err: #dc2626;
    --err-soft: #fef2f2;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.14);
    --radius: 7px;
    --font-ui: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #162033;
    --surface-hover: #1e293b;
    --border: #1f2937;
    --border-strong: #334155;
    --text: #f1f5f9;
    --text-2: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: rgba(59, 130, 246, 0.14);
    --ok: #34d399;
    --ok-soft: rgba(16, 185, 129, 0.14);
    --ok-border: rgba(52, 211, 153, 0.3);
    --warn: #fbbf24;
    --warn-soft: rgba(245, 158, 11, 0.14);
    --err: #f87171;
    --err-soft: rgba(239, 68, 68, 0.14);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 11px; }
.muted { color: var(--text-muted); font-size: 11px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-center { text-align: center !important; }
.col-right { text-align: right !important; }

code {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1px 4px;
    border-radius: 4px;
    color: var(--text-2);
}

/* App Shell */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top SaaS Bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.brand-logo {
    border-radius: 6px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text);
}

.env-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.brand-sub {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ok);
    background: var(--ok-soft);
    border: 1px solid var(--ok-border);
    padding: 3px 9px;
    border-radius: 999px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
    animation: pulse 2s infinite;
}

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

.quick-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}

.quick-toggle input { accent-color: var(--primary); cursor: pointer; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 27px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s, opacity 0.14s;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; }
.btn-icon { width: 27px; padding: 0; background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

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

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-soft); }

.ico { width: 13px; height: 13px; flex-shrink: 0; }

/* KPI Strip */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 9px 14px 6px;
    flex-shrink: 0;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 11px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}

.kpi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-val {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.25;
}

.kpi-val-sm { font-size: 13.5px; padding-top: 2px; }
.kpi-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* Chips / Badges */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-err { background: var(--err-soft); color: var(--err); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* Tab Navigation */
.tabbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    margin-top: 4px;
    flex-shrink: 0;
}

.tabbar-left { display: flex; align-items: center; gap: 2px; }
.tabbar-right { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-muted); }

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.14s, border-color 0.14s;
}

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

.tab-count {
    font-size: 10px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.tab-btn.active .tab-count {
    background: var(--primary-soft);
    border-color: rgba(37, 99, 235, 0.25);
    color: var(--primary);
}

.mini-check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.mini-check input { accent-color: var(--primary); }

/* Workspace */
.workspace {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-panel { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.tab-panel.active { display: flex; }

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-fill { flex: 1 1 auto; }

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 11px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}

.panel-toolbar.wrap { flex-wrap: wrap; }
.toolbar-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.toolbar-title h2 { font-size: 12.5px; font-weight: 700; color: var(--text); }
.toolbar-actions, .filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.field-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); font-weight: 600; }

.input {
    height: 28px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 11.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    outline: none;
    transition: border-color 0.14s, box-shadow 0.14s;
}

.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.input-sm { height: 24px; font-size: 11px; padding: 0 7px; }

.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box .search-ico { position: absolute; left: 7px; color: var(--text-muted); pointer-events: none; width: 12px; height: 12px; }
.search-box .input { padding-left: 24px; width: 175px; }

.count-pill {
    font-size: 11px;
    font-weight: 600;
    color: var(--ok);
    background: var(--ok-soft);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Compact Data Tables */
.table-wrap { overflow: auto; flex: 1 1 auto; min-height: 0; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.data-table th {
    padding: 6px 10px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table.sticky-head th { position: sticky; top: 0; z-index: 2; }

.data-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.empty-cell {
    text-align: center !important;
    padding: 24px !important;
    color: var(--text-muted) !important;
}

.emp-name { font-weight: 600; color: var(--primary); }
.dev-sub { display: block; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.act-group { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.btn-row {
    height: 21px;
    padding: 0 7px;
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
}
.btn-row:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-row-del:hover { border-color: var(--err); color: var(--err); background: var(--err-soft); }

/* Docked Audit Console */
.console-dock {
    flex-shrink: 0;
    background: #0b1120;
    color: #cbd5e1;
    border-top: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    height: 150px;
    transition: height 0.16s ease;
}

.console-dock.collapsed { height: 28px; }
.console-dock.collapsed .console-body { display: none; }

.console-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    height: 28px;
    flex-shrink: 0;
}

.console-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
}

.console-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.console-count { font-size: 10px; color: #64748b; }
.console-actions { display: flex; gap: 6px; }

.btn-term {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}
.btn-term:hover { background: #334155; color: #fff; }

.console-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
}

.log-line { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.log-ts { color: #64748b; flex-shrink: 0; }
.log-lvl {
    display: inline-block;
    min-width: 44px;
    text-align: center;
    font-size: 9.5px;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 3px;
    flex-shrink: 0;
}
.lvl-PUNCH { background: rgba(16, 185, 129, 0.22); color: #34d399; }
.lvl-OK { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.lvl-SQL { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.lvl-CMD { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
.lvl-WARN { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.lvl-ERR { background: rgba(239, 68, 68, 0.24); color: #f87171; }
.lvl-INFO { background: rgba(148, 163, 184, 0.14); color: #94a3b8; }
.log-msg { color: #e2e8f0; }
.console-empty { color: #64748b; }

/* Native <dialog> Modals */
dialog.modal {
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
    width: min(500px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

dialog.modal-lg { width: min(640px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px); }

.modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 13.5px; font-weight: 700; }
.modal-header p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 0 15px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.mtab {
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.mtab.active { color: var(--primary); border-bottom-color: var(--primary); }

.modal-body {
    padding: 13px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mtab-panel { display: none; flex-direction: column; gap: 10px; }
.mtab-panel.active { display: flex; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    padding: 10px 15px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 11px; font-weight: 600; color: var(--text-2); }
.field .input { width: 100%; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; }

.switch-row, .check-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--text);
    cursor: pointer;
}
.switch-row input, .check-line input { accent-color: var(--primary); }

.radio-row { display: flex; gap: 16px; font-size: 11.5px; padding: 3px 0; }
.radio-row label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.radio-row input { accent-color: var(--primary); }

.fieldset-box {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.fieldset-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.test-bar { display: flex; align-items: center; gap: 10px; padding-top: 2px; }
.test-msg { font-size: 11px; font-weight: 600; }
.test-msg.ok { color: var(--ok); }
.test-msg.err { color: var(--err); }
.test-msg.info { color: var(--info); }

/* Toasts */
.toast-stack {
    position: fixed;
    right: 14px;
    bottom: 42px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 360px;
}

.toast {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-left: 3px solid var(--primary);
    padding: 8px 11px;
    border-radius: 6px;
    font-size: 11.5px;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.18s ease-out;
}
.toast.ok { border-left-color: #22c55e; }
.toast.err { border-left-color: #ef4444; }
.toast.warn { border-left-color: #f59e0b; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PUNCH MONITOR (TODAY) — GRAPHICAL DAILY ANALYSIS UI
   ============================================================ */
.monitor-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-right: 2px;
}

.monitor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    box-shadow: var(--shadow-sm);
}

.seg-group {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.seg-btn {
    height: 20px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.mon-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.mon-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 11px;
    box-shadow: var(--shadow-sm);
}

.mon-stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.mon-stat-val {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.25;
}

.mon-stat-val-sm { font-size: 14px; padding: 2px 0; }
.mon-stat-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.progress-track {
    height: 5px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #10b981);
    transition: width 0.35s ease;
}

/* Charts Grid */
.mon-charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr) minmax(240px, 1.15fr);
    gap: 9px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.chart-head h3 { font-size: 12px; font-weight: 700; color: var(--text); }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 10.5px;
    color: var(--text-2);
    white-space: nowrap;
}

.leg-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    margin-right: 3px;
    vertical-align: middle;
}
.leg-in { background: #3b82f6; }
.leg-out { background: #f59e0b; }
.leg-ok { background: #10b981; }
.leg-abs { background: #cbd5e1; }
html[data-theme="dark"] .leg-abs { background: #334155; }

.chart-stage {
    position: relative;
    width: 100%;
    height: 158px;
}

.chart-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.chart-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-axis-lbl { fill: var(--text-muted); font-size: 9.5px; font-family: var(--font-mono); }
.chart-val-lbl { fill: var(--text-2); font-size: 9px; font-weight: 700; font-family: var(--font-mono); }
.bar-hit { fill: transparent; cursor: pointer; }
.bar-hit:hover { fill: var(--primary-soft); }

.trend-node { cursor: pointer; transition: r 0.12s; }
.trend-node:hover { r: 5.5; }

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 10.5px;
    font-family: var(--font-mono);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 20;
    transform: translate(-50%, -100%);
}

/* Donut Layout */
.donut-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 1 1 auto;
}

.donut-svg { width: 118px; height: 118px; flex-shrink: 0; }
.donut-track { fill: none; stroke: var(--border); stroke-width: 12; }
.donut-ring { fill: none; stroke: #10b981; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.donut-pct { fill: var(--text); font-size: 20px; font-weight: 700; font-family: var(--font-ui); }
.donut-sub { fill: var(--text-muted); font-size: 9px; font-weight: 600; text-transform: uppercase; }

.donut-metrics {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
}

.dm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-2);
}
.dm-row strong { color: var(--text); }
.dm-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* Bottom Operational Split */
.mon-ops-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr);
    gap: 9px;
    min-height: 220px;
}

.mon-table-wrap { max-height: 260px; }

.tl-axis {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-weight: 600;
}

.tl-track {
    position: relative;
    height: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: visible;
}

.tl-span {
    position: absolute;
    top: 5px;
    height: 4px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.35);
}

.tl-dot {
    position: absolute;
    top: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translateX(-50%);
    border: 1.5px solid var(--surface);
    cursor: pointer;
    z-index: 2;
}
.tl-dot.in { background: #10b981; }
.tl-dot.out { background: #f59e0b; }
.tl-dot:hover { transform: translateX(-50%) scale(1.35); z-index: 4; }

.stream-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stream-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
}
.stream-item:hover { background: var(--surface-hover); }

.stream-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.avatar-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stream-meta { min-width: 0; }
.stream-name { font-size: 11.5px; font-weight: 600; color: var(--text); }
.stream-sub { font-size: 10px; color: var(--text-muted); }

.stream-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.stream-time { font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }

@media (max-width: 1100px) {
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mon-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mon-charts-grid { grid-template-columns: 1fr; }
    .mon-ops-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; }
}
