/* Support console. Colours are the Robin of Loxley kit's tokens (rol/tokens.css
   in the apps), copied by value: the console has no build step and the kit
   isn't vendored into this repo. Fonts are the system stack for the same reason. */

:root {
  --lincoln: #1F4D35;
  --lincoln-2: #2E6A4A;
  --scarlet: #C0392B;
  --scarlet-soft: #F6DAD5;
  --gold: #D4A23C;
  --gold-soft: #F4E7C4;
  --green-soft: #DCEBDF;
  --parchment: #F5EFE1;
  --linen: #FCF9F2;
  --ink: #17201A;
  --ink-soft: #4A554D;
  --ink-faint: #636C65;
  --line: rgba(23, 32, 26, 0.12);
  --line-strong: rgba(23, 32, 26, 0.24);
  --band: #17201A;
  --band-text: #F5EFE1;
  --band-soft: #C9D3C6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --lincoln: #86BD98;
    --lincoln-2: #A6D3B3;
    --scarlet: #EE7A64;
    --scarlet-soft: #3A1F1A;
    --gold: #E2B658;
    --gold-soft: #3A3322;
    --green-soft: #1E3326;
    --parchment: #0F1813;
    --linen: #16221B;
    --ink: #EEE8D9;
    --ink-soft: #B4BCB2;
    --ink-faint: #858E86;
    --line: rgba(238, 232, 217, 0.10);
    --line-strong: rgba(238, 232, 217, 0.22);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
a { color: var(--lincoln); }
a:hover { color: var(--lincoln-2); }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--line); padding: 0 4px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }
p { margin: 0 0 0.75em; }

/* ---------- shell ---------- */
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.layout { background: linear-gradient(to right, var(--band) 230px, transparent 230px); }
.sidebar { background: var(--band); color: var(--band-text); padding: 20px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar a { color: var(--band-text); text-decoration: none; }
.sidebar .mark { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: 2px; }
.sidebar .sub { color: var(--band-soft); font-size: 0.8rem; margin-bottom: 18px; }
.sidebar ul { list-style: none; margin: 0 0 18px; padding: 0; }
.sidebar li a { display: block; padding: 6px 8px; border-radius: 4px; }
.sidebar li a:hover, .sidebar li a[aria-current="page"] { background: rgba(245, 239, 225, 0.12); }
.sidebar .group { color: var(--band-soft); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 8px 4px; }
.sidebar .count { float: right; background: var(--scarlet); color: #fff; border-radius: 9px; padding: 0 7px; font-size: 0.75rem; }
.sidebar .foot { border-top: 1px solid rgba(245, 239, 225, 0.15); padding-top: 12px; font-size: 0.85rem; color: var(--band-soft); }
.sidebar .foot button { color: var(--band-text); }
main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .sidebar { position: static; height: auto; padding: 12px 16px; }
  .sidebar ul { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin-bottom: 8px; }
  .sidebar li a { white-space: nowrap; }
  .sidebar .group, .sidebar .sub, .sidebar .ext { display: none; }
  main { padding: 20px 16px 48px; }
}

/* ---------- pieces ---------- */
.head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h2 { margin: 0; }
.muted { color: var(--ink-faint); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.05rem; color: var(--ink-soft); }
.card { background: var(--linen); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.card > h3:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.cards .card { margin: 0; }
.flash { background: var(--green-soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.warn { background: var(--gold-soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.danger { background: var(--scarlet-soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }

.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line-strong); white-space: nowrap; }
.tag.ok { background: var(--green-soft); color: var(--lincoln); border-color: transparent; }
.tag.warn, .tag.warning { background: var(--gold-soft); border-color: transparent; }
.tag.bad, .tag.critical { background: var(--scarlet-soft); color: var(--scarlet); border-color: transparent; }
.tag.muted { color: var(--ink-faint); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: var(--lincoln); }
.dot.bad { background: var(--scarlet); }
.dot.warn { background: var(--gold); }

table { width: 100%; border-collapse: collapse; background: var(--linen); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
dl.facts { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--ink-faint); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

form.inline { display: inline; }
input[type=text], input[type=search], input[type=password], input[type=email], select, textarea {
  font: inherit; color: var(--ink); background: var(--linen); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 7px 10px; max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--lincoln); outline-offset: 1px; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 4px; padding: 7px 14px;
  background: var(--lincoln); color: var(--linen); border: 1px solid var(--lincoln); text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--lincoln-2); color: var(--linen); }
button.secondary, .btn.secondary { background: transparent; color: var(--lincoln); }
button.linklike { background: none; border: 0; padding: 0; color: var(--lincoln); font-weight: 400; text-decoration: underline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.row input[type=search] { flex: 1 1 320px; }
.stack label { display: block; font-weight: 600; margin: 10px 0 4px; }
.stack input { width: 100%; }
.linkrow a { margin-right: 12px; white-space: nowrap; }
.secret { font: 1.05rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.08em; word-break: break-all; background: var(--line); padding: 8px 10px; border-radius: 4px; }

.alert-row td:first-child { width: 1%; white-space: nowrap; }
.alert-row.acked { opacity: 0.7; }
.ack-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ack-form input { flex: 1 1 180px; }

.app-card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.app-card h3 { margin: 0; }
.app-card p { margin: 6px 0; }

.result-app { margin-bottom: 18px; }
.result-app h3 { display: flex; gap: 8px; align-items: baseline; }

/* ---------- runbooks ---------- */
.support-hits { list-style: none; padding: 0; }
.support-hits li { background: var(--linen); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; }
.doc-snippet { color: var(--ink-soft); margin: 4px 0 0; font-size: 0.9rem; }
.support-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 28px; }
.support-side { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; font-size: 0.9rem; }
.support-side ul { padding-left: 18px; }
.support-toc ul { padding-left: 14px; }
.doc-body { background: var(--linen); border: 1px solid var(--line); border-radius: 6px; padding: 20px 26px; overflow-wrap: anywhere; }
.doc-body table { font-size: 0.9rem; }
.doc-body pre { background: var(--line); padding: 10px; border-radius: 4px; overflow-x: auto; }
.doc-body h2 { margin-top: 1.6em; padding-top: 0.4em; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .support-layout { grid-template-columns: 1fr; }
  .support-side { position: static; max-height: none; order: -1; }
  .doc-body { padding: 14px 16px; }
}

.login-box { max-width: 380px; margin: 10vh auto; }
.login-box.wide { max-width: 520px; }

/* utilities (the CSP forbids inline style attributes, so these live here) */
.mt { margin-top: 14px; }
.grow { flex: 1 1 200px; }
.full { width: 100%; max-width: 100%; }
.nowrap { white-space: nowrap; }
.wrap-pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.plain { list-style: none; padding: 0; }
.plain li { margin-bottom: 8px; }
.stack label.check, label.check { display: flex; gap: 8px; align-items: baseline; font-weight: 400; margin: 6px 0; }
.stack label.check input { width: auto; flex: none; }
.row label.check { margin: 0; }
textarea { font: inherit; color: var(--ink); background: var(--linen); border: 1px solid var(--line-strong); border-radius: 4px; padding: 7px 10px; }
.incident-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
.incident-layout > aside { font-size: 0.9rem; }
@media (max-width: 900px) { .incident-layout { grid-template-columns: 1fr; } }

/* alert rows stack on a phone: severity and app on one line, then the rest */
@media (max-width: 700px) {
  .alert-table thead { display: none; }
  .alert-table, .alert-table tbody, .alert-table tr, .alert-table td { display: block; width: 100%; }
  .alert-table tr { border-bottom: 1px solid var(--line-strong); padding: 6px 0; }
  .alert-table td { border: 0; padding: 4px 12px; }
  .alert-table td:nth-child(1), .alert-table td:nth-child(2) { display: inline-block; width: auto; }
  .alert-row td:first-child { width: auto; }
}
