/* Dark theme over a full-page background (one per site: teal portal, mono test portal, amber notes); content sits on
   heavily blurred translucent panels. The background is never cropped: it covers screens at least 16:9 wide (the
   whole image on 32:9 ultra-wide) and is shown whole, centred on black, on narrower screens; phones held upright get
   the image turned a quarter turn (9:32), which fills their height. */
:root {
  color-scheme: dark;
  --ink: #e9eef0; --dim: #9ba7ad; --faint: rgba(255, 255, 255, 0.10); --line-soft: rgba(255, 255, 255, 0.06);
  --panel: rgba(12, 16, 18, 0.55); --tile: rgba(255, 255, 255, 0.04); --field: rgba(0, 0, 0, 0.35);
  --accent: #5fd3c6; --chart: #5fd3c6; --bg-wide: url("bg/teal-3840.webp"); --bg-narrow: url("bg/teal-1920.webp");
  --bg-portrait: url("bg/teal-portrait.webp");
  /* state colours are fixed on every site, so ok/late/failed mean the same everywhere */
  --ok: #4cc38a; --late: #e3b341; --failed: #f0717a; --running: #9ba7ad;
}
html[data-instance="test"] {
  --accent: #d4d7da; --chart: #e6e8ea; --panel: rgba(14, 14, 14, 0.58);
  --bg-wide: url("bg/mono-3840.webp"); --bg-narrow: url("bg/mono-1920.webp");
  --bg-portrait: url("bg/mono-portrait.webp");
}
html[data-instance="notes"] {
  --accent: #f0b45a; --chart: #f0b45a; --panel: rgba(20, 14, 8, 0.55);
  --bg-wide: url("bg/amber-3840.webp"); --bg-narrow: url("bg/amber-1920.webp");
  --bg-portrait: url("bg/amber-portrait.webp");
}
* { box-sizing: border-box; }
html { background: #000; }
body { margin: 0; min-height: 100vh; background: transparent; color: var(--ink);
       font: 15px/1.45 -apple-system, "Helvetica Neue", Arial, sans-serif; }
/* fixed layer rather than background-attachment: fixed, which iOS Safari ignores */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: #000 var(--bg-wide) center / cover no-repeat; }
@media (max-aspect-ratio: 16/9) { body::before { background-size: contain; } }
@media (max-width: 1000px) { body::before { background-image: var(--bg-narrow); } }
@media (orientation: portrait) and (max-aspect-ratio: 3/4) { body::before { background-image: var(--bg-portrait); background-size: contain; } }

header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
         background: rgba(0, 0, 0, 0.35); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
         border-bottom: 1px solid var(--faint); position: sticky; top: 0; z-index: 2; }
header .home { font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
header .home::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
                       background: var(--accent); margin-right: 8px; box-shadow: 0 0 10px var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }
a { color: var(--accent); }
h1 { font-size: 1.25rem; margin: 0 0 10px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.dim { color: var(--dim); }
.small { font-size: 0.85rem; font-weight: normal; }
.crumbs { margin: 0 0 4px; }

.panel { background: var(--panel); -webkit-backdrop-filter: blur(28px) saturate(1.2); backdrop-filter: blur(28px) saturate(1.2);
         border: 1px solid var(--faint); border-radius: 14px; padding: 14px 16px; margin: 0 0 16px;
         box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); overflow-x: auto; }
.panel > :last-child { margin-bottom: 0; }

button { font: inherit; padding: 6px 12px; border: 1px solid var(--faint); background: var(--tile); color: var(--ink);
         border-radius: 8px; cursor: pointer; }
button:hover { border-color: var(--accent); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.list th { color: var(--dim); font-weight: 500; font-size: 0.85rem; }
table.list tr:last-child td { border-bottom: none; }
table.kv th { text-align: left; color: var(--dim); font-weight: 500; padding: 2px 12px 2px 0; vertical-align: top; }
table.kv pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
pre.table { background: var(--field); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; overflow-x: auto;
            font-size: 0.8rem; margin: 0; }

.state, .level { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 0.8rem; }
.state.ok, .level.done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.state.running, .level.info { background: var(--faint); color: var(--running); }
.state.late, .level.warn { background: color-mix(in srgb, var(--late) 18%, transparent); color: var(--late); }
.state.failed, .level.error { background: color-mix(in srgb, var(--failed) 18%, transparent); color: var(--failed); }

.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--tile); border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 10px; }
.card .head { display: flex; justify-content: space-between; align-items: center; }
.card .name { font-weight: 500; word-break: break-all; }
svg.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
svg .grid { stroke: var(--line-soft); stroke-width: 1; }
svg .axis { fill: var(--dim); font-size: 11px; }
svg .line { fill: none; stroke: var(--chart); stroke-width: 1.8; }
svg .dot { fill: var(--chart); }
svg .cross { stroke: var(--dim); stroke-dasharray: 3 3; }

ul.events { list-style: none; padding: 0; margin: 0; }
ul.events li { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
ul.events li:last-child { border-bottom: none; }
ul.events .ts, ul.events .src { color: var(--dim); font-size: 0.8rem; }
ul.events .text { white-space: pre-wrap; word-break: break-word; }

form.login { max-width: 360px; margin: 10vh auto; display: flex; flex-direction: column; gap: 12px; }
form.login input { width: 100%; font: inherit; padding: 9px; border: 1px solid var(--faint); border-radius: 8px;
                   background: var(--field); color: var(--ink); margin-top: 4px; }
form.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--failed); }

.test-banner { background: #e3b341; color: #111; text-align: center; font-weight: 600; padding: 6px 16px; font-size: 0.9rem; }
nav.links { display: flex; flex-wrap: wrap; gap: 8px; }
nav.links a { padding: 7px 13px; border: 1px solid var(--faint); border-radius: 999px; background: var(--tile);
              text-decoration: none; color: var(--ink); }
nav.links a:hover { border-color: var(--accent); color: var(--accent); }
table.list tr.sub td { padding-top: 0; font-size: 0.85rem; }
table.list.checks tr:has(+ tr.sub) td { border-bottom: none; }
.reason { color: var(--failed); margin-right: 8px; }
details summary { cursor: pointer; color: var(--dim); }
details pre.table { margin-top: 6px; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel { background: rgba(10, 12, 14, 0.88); }
}
@media (max-width: 600px) {
  main { padding: 12px 10px 40px; }
  .panel { padding: 12px; border-radius: 12px; }
  table.list th:nth-child(n+4), table.list td:nth-child(n+4) { display: none; }
}

/* instance health in the header: icon + bar (disk, memory) or icon + short number (database, backup) */
header { gap: 10px; }
header .home { white-space: nowrap; }
.health-bar { display: flex; align-items: center; gap: 12px; margin-left: auto; margin-right: 4px; font-size: 0.8rem; color: var(--dim); }
.hs { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.hs .ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hs .bar { width: 38px; height: 8px; }
.hs .bar .track { fill: rgba(255, 255, 255, 0.12); }
.hs .bar .fill.ok { fill: var(--ok); } .hs .bar .fill.warn { fill: var(--late); } .hs .bar .fill.bad { fill: var(--failed); }
.hs.warn .num { color: var(--late); } .hs.bad .num { color: var(--failed); }
.hs .tick { width: 14px; height: 14px; fill: none; stroke: var(--ok); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 480px) {
  header { padding: 8px 10px; gap: 8px; }
  header .home .site, .hs .unit { display: none; }
  header button { padding: 4px 9px; font-size: 0.85rem; }
  .health-bar { gap: 9px; margin-right: 0; }
  .hs .bar { width: 28px; }
  .hs .ico { width: 15px; height: 15px; }
}

/* notes */
form.quicklog { display: flex; flex-direction: column; gap: 8px; }
form.quicklog textarea { width: 100%; font: inherit; padding: 9px; border: 1px solid var(--faint); border-radius: 8px;
                         background: var(--field); color: var(--ink); resize: vertical; }
form.quicklog textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
form.quicklog button { align-self: flex-end; }
ul.entries { list-style: none; padding: 0; margin: 0; }
ul.entries li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
ul.entries li:last-child { border-bottom: none; }
ul.entries .ts { color: var(--dim); font-size: 0.8rem; }
.text { white-space: pre-wrap; word-break: break-word; }
.text.body { margin-top: 10px; }
