/*
 * Operator console stylesheet.
 *
 * This used to live inline in fragments/layout.html, and the reason it moved is size rather than a
 * change of heart: the console grew from five read-only pages to roughly twenty with forms, and an
 * 800-line <style> block wrapped around the markup is not something anyone can read.
 *
 * The constraint it was protecting is intact and is the one that matters — no CDN, no framework, no
 * build step. This file ships inside the jar and is served by the same process as the pages, so the
 * console still renders identically from a jump host with no internet access, which is exactly when
 * you need it most.
 *
 * Palette, shared with the sibling services:
 *   background #0f1117 · panel #1a1b23 · inset #15161e · border #2a2b35
 *   accent #6366f1 · text #e4e4e7 · muted #71717a
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    color: #e4e4e7;
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------ header */

.header {
    background: #1a1b23;
    border-bottom: 1px solid #2a2b35;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header h1 { font-size: 18px; font-weight: 700; white-space: nowrap; }
.header h1 span { color: #6366f1; }
.header-right { display: flex; align-items: center; gap: 12px; }

.top-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.top-nav a {
    padding: 6px 12px;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.top-nav a:hover { border-color: #6366f1; color: #c7d2fe; }
.top-nav a.active { color: #c7d2fe; border-color: #6366f1; background: rgba(99,102,241,0.12); }
.nav-divider { width: 1px; background: #2a2b35; margin: 2px 4px; align-self: stretch; }

.operator-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
    white-space: nowrap;
}
.operator-chip .operator-name { font-size: 13px; font-weight: 600; color: #e4e4e7; }
.operator-chip .operator-role { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; color: #818cf8; }

.btn-logout {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    color: #a1a1aa;
    font-size: 13px;
    cursor: pointer;
}
.btn-logout:hover { border-color: #ef4444; color: #fca5a5; }

/* ------------------------------------------------------------------ layout */

.container { max-width: 1440px; margin: 0 auto; padding: 24px; }
.section { margin-bottom: 24px; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.section-title { font-size: 16px; font-weight: 600; color: #fff; }
.section-sub { font-size: 12px; color: #71717a; margin-top: 2px; }

.breadcrumb { font-size: 12px; color: #71717a; margin-bottom: 10px; }
.breadcrumb a { color: #818cf8; }
.breadcrumb a:hover { color: #a5b4fc; }

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

/* ------------------------------------------------------------------ badges */

.badge { padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-purple { background: rgba(99,102,241,0.15); color: #818cf8; }
.badge-green  { background: rgba(34,197,94,0.15);  color: #4ade80; }
.badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-yellow { background: rgba(234,179,8,0.15);  color: #facc15; }
.badge-gray   { background: rgba(148,163,184,0.15); color: #cbd5e1; }
.badge-blue   { background: rgba(56,189,248,0.15); color: #38bdf8; }

/* ------------------------------------------------------------------ cards */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card { background: #1a1b23; border: 1px solid #2a2b35; border-radius: 10px; padding: 20px; }
.card-label {
    font-size: 12px;
    font-weight: 500;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.card-value { font-size: 24px; font-weight: 700; color: #fff; margin-top: 4px; word-break: break-word; }
.card-sub { font-size: 12px; color: #71717a; margin-top: 4px; }
.card-value.small { font-size: 16px; }

/* ------------------------------------------------------------------ tables */

.table-wrap { background: #1a1b23; border: 1px solid #2a2b35; border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #15161e;
    border-bottom: 1px solid #2a2b35;
    white-space: nowrap;
}
td { padding: 10px 16px; border-bottom: 1px solid #1e1f2a; font-size: 13px; vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99,102,241,0.04); }
.mono { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 30px; color: #71717a; }
.row-link { color: #818cf8; font-weight: 600; }
.row-link:hover { color: #a5b4fc; }

/* Definition table used by every detail page. */
.detail-table td { border-bottom: 1px solid #1e1f2a; }
.detail-table td:first-child {
    color: #71717a;
    width: 220px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ filters */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
    background: #15161e;
    border: 1px solid #2a2b35;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}
.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.filter-bar input, .filter-bar select {
    min-width: 160px;
    padding: 7px 10px;
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 13px;
}
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: #6366f1; }
.filter-bar button, .filter-bar a.btn-reset {
    padding: 8px 14px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.filter-bar a.btn-reset { background: transparent; color: #a1a1aa; border: 1px solid #2a2b35; }
.filter-bar button:hover { background: #4f46e5; }
.filter-bar a.btn-reset:hover { border-color: #6366f1; color: #c7d2fe; }

/* ------------------------------------------------------------------ forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
    font-size: 11px;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.field input, .field select, .field textarea {
    padding: 9px 11px;
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
}
.field textarea {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    min-height: 320px;
    resize: vertical;
    line-height: 1.5;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #6366f1; }
.field .hint { font-size: 11px; color: #71717a; text-transform: none; letter-spacing: 0; font-weight: 400; }
.field-wide { grid-column: 1 / -1; }

.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
    padding: 9px 16px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn:hover { background: #4f46e5; }
.btn-secondary { background: transparent; color: #a1a1aa; border: 1px solid #2a2b35; }
.btn-secondary:hover { background: transparent; border-color: #6366f1; color: #c7d2fe; }
.btn-danger { background: transparent; color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); }
.btn-danger:hover { background: rgba(239,68,68,0.12); border-color: #ef4444; }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn[disabled], .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.inline-form { display: inline; }

/* ------------------------------------------------------------------ messages */

.notice {
    background: #15161e;
    border: 1px solid #2a2b35;
    border-radius: 8px;
    color: #fbbf24;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
}
.notice-error { color: #fca5a5; border-color: rgba(239,68,68,0.35); }
.notice-success { color: #4ade80; border-color: rgba(34,197,94,0.35); }
.notice-info { color: #a5b4fc; }

/* The one-time voucher reveal. Deliberately loud: it cannot be shown twice. */
.reveal-panel {
    background: rgba(99,102,241,0.07);
    border: 1px solid #6366f1;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.reveal-codes {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 15px;
    line-height: 2;
    color: #fff;
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 8px;
    padding: 16px;
    margin: 14px 0;
    user-select: all;
    max-height: 420px;
    overflow: auto;
}

/* ------------------------------------------------------------------ pager */

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: #71717a;
    font-size: 13px;
}
.pager a, .pager span.disabled {
    padding: 6px 12px;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 13px;
}
.pager a:hover { border-color: #6366f1; color: #c7d2fe; }
.pager span.disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------------ code blocks */

details.json-block summary { cursor: pointer; color: #818cf8; font-size: 12px; user-select: none; }
details.json-block summary:hover { color: #a5b4fc; }
pre.json {
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 6px;
    padding: 10px;
    margin-top: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    color: #cbd5e1;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Configuration revision diff. Server-computed; the colours only label the result. */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.diff-pane {
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 8px;
    padding: 12px;
    overflow: auto;
    max-height: 560px;
}
.diff-line { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 11px; white-space: pre-wrap; }
.diff-add { background: rgba(34,197,94,0.12); color: #86efac; }
.diff-del { background: rgba(239,68,68,0.12); color: #fca5a5; }
.diff-same { color: #71717a; }

/* ------------------------------------------------------------------ health */

.health-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.health-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1b23;
    border: 1px solid #2a2b35;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
}
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.health-name { color: #e4e4e7; font-weight: 600; text-transform: capitalize; }
.health-detail { color: #71717a; }
.health-latency { color: #a1a1aa; font-variant-numeric: tabular-nums; }
.dot-good { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.dot-critical { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.5); }
.dot-neutral { background: #94a3b8; }

/* ------------------------------------------------------------------ charts */

/* Charts are <svg> elements rendered by Thymeleaf from geometry computed in Java. There is no
   charting library, and with it no CDN and no build step. */
.chart { width: 100%; height: auto; display: block; }
.chart-axis { stroke: #2a2b35; stroke-width: 1; }
.chart-grid { stroke: #1e1f2a; stroke-width: 1; }
.chart-label { fill: #71717a; font-size: 10px; font-family: inherit; }
.chart-line { fill: none; stroke: #6366f1; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(99,102,241,0.14); stroke: none; }
.chart-bar { fill: #6366f1; }
.chart-bar-alt { fill: #38bdf8; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #a1a1aa; margin-top: 8px; }
.chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* Campaign geofence, drawn to scale from the campaign's own radius. Never a check-in position:
   no such column exists, by design. */
.geofence { background: #0f1117; border: 1px solid #2a2b35; border-radius: 8px; }
.geofence-core { fill: rgba(99,102,241,0.16); stroke: #6366f1; stroke-width: 1.5; }
.geofence-edge { fill: rgba(99,102,241,0.06); stroke: #4f46e5; stroke-width: 1; stroke-dasharray: 4 3; }
.geofence-centre { fill: #818cf8; }

/* ------------------------------------------------------------------ auth pages */

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.auth-card {
    background: #1a1b23;
    border: 1px solid #2a2b35;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
}
.auth-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-card h1 span { color: #6366f1; }
.auth-card .subtitle { font-size: 13px; color: #71717a; margin-bottom: 22px; line-height: 1.6; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; padding: 11px; margin-top: 6px; }
.auth-footnote { font-size: 12px; color: #71717a; margin-top: 18px; line-height: 1.6; }

.secret-block {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 14px;
    letter-spacing: 1.5px;
    background: #0f1117;
    border: 1px solid #2a2b35;
    border-radius: 8px;
    padding: 14px;
    color: #fff;
    user-select: all;
    word-break: break-all;
    margin: 10px 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2b35; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3b45; }
