/* Maps API — panou de administrare. Fără dependențe externe (CSP: style-src 'self'). */
:root {
    --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e2e5ea;
    --text: #1b1f24; --muted: #646d78; --accent: #2563eb; --accent-text: #ffffff;
    --ok: #15803d; --ok-bg: #dcfce7; --warn: #a16207; --warn-bg: #fef3c7;
    --err: #b91c1c; --err-bg: #fee2e2; --bar: #3b82f6; --bar-err: #ef4444;
    --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2a313b;
        --text: #e6e9ee; --muted: #98a2b0; --accent: #60a5fa; --accent-text: #0b1220;
        --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #3a2c0b;
        --err: #f87171; --err-bg: #3b1515; --bar: #60a5fa; --bar-err: #f87171;
        --shadow: none; color-scheme: dark;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.text-err { color: var(--err); }
.break { word-break: break-all; }

/* Bara de sus */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px;
    background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand svg { width: 20px; height: 20px; fill: var(--accent); }
.brand span, .login-card h1 span { font-weight: 500; color: var(--muted); }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a, .user a { padding: 6px 10px; border-radius: 6px; color: var(--muted); white-space: nowrap; }
.nav a:hover, .user a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active, .user a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.user { display: flex; gap: 4px; align-items: center; }

.page { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.crumbs { margin: 0; font-size: 13px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.narrow { max-width: 720px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }

/* Tabele */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: var(--surface-2); }
.table tfoot th { border-bottom: 0; color: var(--text); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }
.row-error td:first-child { box-shadow: inset 3px 0 0 var(--bar-err); }
.method { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }

/* Insigne */
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--text); margin: 0 4px 4px 0; }

/* Grafic */
.chart { margin: 0; }
.chart svg { width: 100%; height: 190px; display: block; }
.chart .bar { fill: var(--bar); }
.chart .bar-error { fill: var(--bar-err); }
.chart .hit { fill: transparent; }
.chart g:hover .bar { opacity: .75; }
.chart .axis { stroke: var(--border); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--border); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart-labels { display: flex; margin-top: -18px; font-size: 11px; color: var(--muted); }
.chart-labels span { flex: 1 1 0; min-width: 0; text-align: left; white-space: nowrap; overflow: visible; }
.chart figcaption { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.dot-ok { background: var(--bar); } .dot-err { background: var(--bar-err); margin-left: 8px; }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=datetime-local], select {
    font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); min-width: 0; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.check input { margin-top: 3px; }
fieldset.scopes { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
fieldset.scopes legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters label.check { min-width: 0; align-self: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.btn-small { padding: 3px 9px; font-size: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented a { padding: 6px 12px; color: var(--muted); border-right: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.segmented a:last-child { border-right: 0; }
.segmented a.active { background: var(--accent); color: var(--accent-text); }
.segmented a:hover { text-decoration: none; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.flash-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
code.copy { background: var(--surface-2); padding: 4px 8px; border-radius: 6px; word-break: break-all; display: inline-block; }
code.secret { border: 1px dashed var(--warn); }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px; margin: 0 0 10px; white-space: pre; }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.upstream { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.upstream header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.danger-zone form { border-top: 1px solid var(--border); padding-top: 12px; }
.danger-zone form:first-child { border-top: 0; padding-top: 0; }
.pager { display: flex; justify-content: center; gap: 16px; align-items: center; margin-top: 14px; font-size: 13px; }
meter { width: 110px; height: 10px; vertical-align: middle; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 18px; }

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
    .nav { order: 3; flex-basis: 100%; }
    .user { margin-left: auto; }
    .page { padding: 16px 16px 40px; }
}
