:root {
    --bg: #0f1216;
    --panel: #171b21;
    --panel-2: #1e232b;
    --line: #2a313b;
    --text: #e6e9ee;
    --muted: #8b95a5;
    --ok: #3fb950;
    --warning: #d29922;
    --critical: #f85149;
    --accent: #58a6ff;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { font-weight: 600; font-size: 17px; color: var(--text); }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }

.badge {
    background: var(--critical);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 600;
}

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 17px; margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--critical); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.card .meta { font-size: 12px; color: var(--muted); margin: 0 0 14px; }

.card.status-critical { border-color: rgba(248, 81, 73, .5); }
.card.status-warning  { border-color: rgba(210, 153, 34, .5); }

.pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}
.pill-ok       { background: rgba(63, 185, 80, .15);  color: var(--ok); }
.pill-warning  { background: rgba(210, 153, 34, .15); color: var(--warning); }
.pill-critical { background: rgba(248, 81, 73, .15);  color: var(--critical); }
.pill-none     { background: var(--panel-2); color: var(--muted); }

.gauges { display: flex; flex-wrap: wrap; gap: 14px; }

.gauge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 220px;
}

.gauge-body { display: flex; flex-direction: column; line-height: 1.35; }
.gauge-body strong { font-size: 18px; }
.gauge-label { font-size: 13px; }

/* Chart.js runs with responsive:false on the doughnuts, so the canvas needs
   an explicit box or it collapses to the 300x150 default and looks broken. */
.gauge canvas.donut { width: 64px; height: 64px; flex: 0 0 64px; }

.mount-editor input { min-width: 0; }
.mount-editor td { padding: 4px 6px 4px 0; }
.mount-editor th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

#chart-meta { margin: 10px 0 0; }

code {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 12.5px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.empty {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #06131f;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 6px;
    border: 0;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--critical); color: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }

input, select, textarea {
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    width: 100%;
}
input:focus, select:focus { outline: 2px solid rgba(88, 166, 255, .4); outline-offset: 0; }

label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
label input, label select { margin-top: 5px; color: var(--text); }

.form-grid { max-width: 620px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.alerts-strip {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.alerts-strip h2 { font-size: 14px; margin-bottom: 8px; }
.alerts-strip ul { list-style: none; margin: 0; padding: 0; }
.alerts-strip li { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
.alerts-strip li.sev-critical { color: var(--critical); }

.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.chart-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chart-toolbar select, .chart-toolbar input { width: auto; min-width: 150px; }
.preset-btn {
    background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
    padding: 6px 11px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.preset-btn.active { background: var(--accent); border-color: var(--accent); color: #06131f; font-weight: 600; }
.chart-canvas-wrap { position: relative; height: 320px; }
.mount-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mount-tab {
    background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.mount-tab.active { border-color: var(--accent); color: var(--text); }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: 360px; }
.login-card h1 { font-size: 19px; margin-bottom: 20px; }
.login-card button { width: 100%; }

.token-box {
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
    padding: 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
    word-break: break-all; margin: 10px 0;
}
.warn-box { background: rgba(210, 153, 34, .1); border: 1px solid rgba(210, 153, 34, .4); border-radius: 6px; padding: 12px; margin: 12px 0; }
