/* PCArmour Server Shield. Fonts are self-hosted from /assets/fonts (SIL OFL licences alongside); no font CDN. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #17202b;
  --muted: #5c6878;
  --border: #d9dee6;
  --brand: #1673d4;
  --brand-strong: #0f5bb0;
  --brand-ink: #ffffff;
  --ok: #1f8a4c;
  --ok-bg: #e3f4ea;
  --warn: #a35f00;
  --warn-bg: #fff1d6;
  --bad: #c22d2d;
  --bad-bg: #fde6e6;
  --info-bg: #e5f0fc;
  --steel: #2a3340;
  --series-0: #1673d4;
  --series-1: #e07b00;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171e27;
    --surface-2: #1f2833;
    --text: #e6ebf1;
    --muted: #9aa6b5;
    --border: #2c3744;
    --brand: #4c9cf0;
    --brand-strong: #78b4f4;
    --brand-ink: #08121e;
    --ok: #4cc382;
    --ok-bg: #133524;
    --warn: #f0b04c;
    --warn-bg: #3a2a0d;
    --bad: #f07171;
    --bad-bg: #3d1717;
    --info-bg: #142739;
    --steel: #0b0f14;
    --series-0: #4c9cf0;
    --series-1: #f0a04c;
    --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: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .5rem 1.25rem; background: var(--steel); color: #fff; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-size: 1rem; }
.brand:hover { text-decoration: none; }
.brand strong { font-weight: 700; }
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.mainnav a { color: #cfd8e3; padding: .4rem .65rem; border-radius: 6px; }
.mainnav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.mainnav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.usermenu { display: flex; gap: .75rem; align-items: center; }
.usermenu a, .usermenu .linklike { color: #cfd8e3; }
.usermenu form { margin: 0; }
.nav-toggle { display: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--brand); }

.banner { padding: .55rem 1.25rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: .9rem; }
.banner form { margin: 0; }
.banner-view { background: var(--warn-bg); color: var(--text); border-bottom: 1px solid var(--border); }
.banner-global { background: var(--info-bg); border-bottom: 1px solid var(--border); }
.banner-warn { background: var(--bad-bg); border-bottom: 1px solid var(--border); }

.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head p { margin: .25rem 0 0; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.panel.narrow { max-width: 560px; margin: 2rem auto; }
.panel-highlight { border-color: var(--brand); }
.panel-danger { border-color: var(--bad); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.panel-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 1.25rem; }
.empty { text-align: center; padding: 2rem 1rem; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
a.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile-num { font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-num-sm { font-size: 1.2rem; white-space: nowrap; }
.tile-ok .tile-num { color: var(--ok); }
.tile-warn { border-color: var(--warn); }
.tile-warn .tile-num { color: var(--warn); }
.tile-bad { border-color: var(--bad); }
.tile-bad .tile-num { color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.disabled td { opacity: .55; }
.table-form td { vertical-align: middle; }
meter { width: 70px; height: .7rem; vertical-align: middle; }

/* Pills, badges, dots */
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; vertical-align: middle; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-neutral { background: var(--surface-2); color: var(--muted); }
.badge { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center; text-transform: capitalize; }
.badge.sev-critical { background: var(--bad); color: #fff; }
.badge.sev-warning { background: var(--warn); color: #fff; }
.sev-text-critical { color: var(--bad); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-warn { background: var(--warn); }
.dot-info { background: var(--muted); }

.alert-list, .svc-list, .event-list, .plain { list-style: none; margin: 0; padding: 0; }
.alert-list li, .event-list li, .svc-list li, .plain li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.alert-list li:last-child, .event-list li:last-child, .svc-list li:last-child, .plain li:last-child { border-bottom: 0; }
.svc-list { columns: 2; }
.svc-list li { break-inside: avoid; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* Forms and buttons */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); width: 100%;
}
input:focus, select:focus, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input:disabled { background: var(--surface-2); color: var(--muted); }
input.num { width: 6.5rem; display: inline-block; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1rem; align-items: end; margin-top: 1rem; }
.form-actions { display: flex; gap: .5rem; align-items: end; }
.inline-form { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin: .75rem 0; }
.inline-form label { flex-direction: row; align-items: center; gap: .4rem; }
.inline-form input[type=text] { width: auto; }
form.inline { display: inline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.actions form { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }
.btn-warn { color: var(--warn); }
.btn-small { padding: .25rem .6rem; font-size: .8rem; }

.inline-details { display: inline-block; position: relative; }
.inline-details summary { list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.details-body { position: absolute; right: 0; z-index: 10; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); min-width: 420px; text-align: left; }

textarea { font: inherit; font-family: var(--mono); font-size: .85rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); width: 100%; resize: vertical; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; margin: .3rem 0; }
label.check input { width: auto; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1rem; margin: .25rem 0 .75rem; }
fieldset.plain-fieldset, fieldset.dest-fields { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem 1rem; margin: .75rem 0; min-width: 0; }
fieldset legend { font-weight: 600; padding: 0 .35rem; }
.kit { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; white-space: pre-wrap; word-break: break-all; font-size: .85rem; max-height: 420px; overflow: auto; }
.seg-links { flex-wrap: wrap; }
.seg-links a { font-size: .85rem; padding: .35rem .8rem; color: var(--muted); border-right: 1px solid var(--border); }
.seg-links a:last-child { border-right: 0; }
.seg-links a.active { background: var(--brand); color: var(--brand-ink); text-decoration: none; }
details summary { cursor: pointer; }

/* Flash messages */
.flash { padding: .65rem .9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.flash-info { background: var(--info-bg); border-color: var(--border); }

/* Code boxes */
.codebox { display: flex; gap: .5rem; align-items: center; background: var(--steel); color: #e8eef5; border-radius: 6px; padding: .6rem .75rem; margin: .5rem 0; }
.codebox code { flex: 1; overflow-x: auto; white-space: nowrap; color: inherit; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem 1rem; list-style: none; padding: 0; }
.codes code { font-size: 1rem; }
.secret { letter-spacing: .05em; word-break: break-all; }

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: .8rem; padding: .3rem .65rem; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--brand); color: var(--brand-ink); }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.chart-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .line { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.chart-svg .line.s0 { stroke: var(--series-0); }
.chart-svg .line.s1 { stroke: var(--series-1); }
.chart-svg .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }
.chart-legend .key::before { content: ""; display: inline-block; width: .8rem; height: .2rem; margin-right: .35rem; vertical-align: middle; border-radius: 2px; }
.chart-legend .key.s0::before { background: var(--series-0); }
.chart-legend .key.s1::before { background: var(--series-1); }
.chart-tip { font-size: .8rem; color: var(--text); margin-top: .2rem; font-variant-numeric: tabular-nums; }

/* Sign-in pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.75rem; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.auth-brand strong { display: block; font-size: 1.15rem; }
.auth-brand span { color: var(--muted); font-size: .9rem; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: .75rem; }
.steps { padding-left: 1.2rem; }
.qr { width: 220px; height: 220px; margin: .75rem auto; }
.qr svg { width: 100%; height: 100%; border-radius: 6px; }

/* Narrow screens */
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; margin-left: auto; background: none; border: 1px solid rgba(255, 255, 255, .3); color: #fff; border-radius: 6px; padding: .3rem .7rem; font: inherit; }
  .mainnav, .usermenu { display: none; width: 100%; }
  .nav-open .mainnav { display: flex; flex-direction: column; }
  .nav-open .usermenu { display: flex; justify-content: space-between; padding: .5rem .65rem; }
  .cols { grid-template-columns: 1fr; }
  .container { padding: 1rem; }
  .details-body { min-width: 280px; }
  .svc-list { columns: 1; }
}
