/* ARES ServerLauncher — one stylesheet, no framework, no inline styles.
   The Content-Security-Policy forbids inline style and script, so everything
   visual lives here and everything behavioural lives in serverlaunch.js. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #646b78;
  --line: #e2e5ea;
  --accent: #2f5bd7;
  --accent-ink: #ffffff;
  --ok: #17794a;
  --ok-bg: #e4f5ec;
  --warn: #8a5800;
  --warn-bg: #fdf1dc;
  --bad: #b3261e;
  --bad-bg: #fdeceb;
  --run: #1f5f9e;
  --run-bg: #e5f0fa;
  --code-bg: #f3f4f7;
  --radius: 9px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f25;
    --ink: #e8eaee;
    --muted: #98a0ad;
    --line: #2b2f37;
    --accent: #6f95ef;
    --accent-ink: #0d1117;
    --ok: #63d19a;
    --ok-bg: #143026;
    --warn: #e5b45f;
    --warn-bg: #33280f;
    --bad: #f0857c;
    --bad-bg: #3a1a18;
    --run: #79b4ef;
    --run-bg: #14283c;
    --code-bg: #15181d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ------------------------------------------------------------------ nav */
nav.top {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}
nav.top .brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink); text-decoration: none; font-size: 15px;
}
nav.top .brand b { font-weight: 700; }
nav.top .mark { color: var(--accent); }
nav.top .links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav.top .links a {
  color: var(--muted); text-decoration: none;
  padding: 6px 11px; border-radius: 6px; font-size: 14px;
}
nav.top .links a:hover { background: var(--bg); color: var(--ink); }
nav.top .links a.go { color: var(--accent); font-weight: 600; }
nav.top .who { font-size: 13px; color: var(--muted); }
nav.top .who em { font-style: normal; display: block; font-size: 11px; opacity: .8; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
footer {
  max-width: 1180px; margin: 0 auto; padding: 0 22px 34px;
  color: var(--muted); font-size: 12.5px;
}

/* --------------------------------------------------------------- layout */
.head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 280px; }
h1 { font-size: 25px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 16px 0 6px; text-transform: uppercase;
     letter-spacing: .05em; color: var(--muted); }
.lede { color: var(--muted); margin: 0; max-width: 72ch; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.card.tight { padding: 14px 0 0; }
.card.tight .card-head, .card.tight > h2 { padding: 0 20px; }
.card.narrow { max-width: 560px; margin-inline: auto; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-head h2 { flex: 1; margin: 0; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }

.empty { padding: 26px 20px; color: var(--muted); text-align: center; }
.empty-card { text-align: center; padding: 30px; }
.empty-card h2 { margin-bottom: 6px; }
.empty-card p { color: var(--muted); max-width: 56ch; margin: 0 auto 14px; }

/* ---------------------------------------------------------------- flash */
.flash {
  padding: 11px 15px; border-radius: var(--radius); margin-bottom: 16px;
  border: 1px solid transparent; font-size: 14px;
}
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: currentColor; }
.warn-card { border-color: var(--warn); background: var(--warn-bg); }
.warn-card h2 { color: var(--warn); }
.err-card { border-color: var(--bad); background: var(--bad-bg); }
.err-card h2 { color: var(--bad); }
.err-text { color: var(--bad); }

/* --------------------------------------------------------------- tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
  padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
tr.dim { opacity: .55; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.notes, td.detail { max-width: 340px; }

a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.8px; }
.wrap { white-space: pre-wrap; word-break: break-all; }

/* ----------------------------------------------------------------- tags */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap; margin: 1px 2px 1px 0;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag.run { background: var(--run-bg); color: var(--run); border-color: transparent; }
.tag.failed { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag.rolled_back { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.skipped { opacity: .7; }
.state-big .tag { font-size: 14px; padding: 6px 16px; }

/* -------------------------------------------------------------- buttons */
.btn, button {
  display: inline-block; padding: 8px 15px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover, button:hover { border-color: var(--muted); }
.btn.primary, button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  font-weight: 500;
}
.btn.small, button.small { padding: 5px 11px; font-size: 13px; }
.btn.danger, button.danger { background: var(--bad); color: #fff; border-color: transparent; }
button.link { background: none; border: none; color: var(--muted); padding: 4px 8px;
              text-decoration: underline; font-size: 13px; }
form.inline { display: inline-flex; align-items: center; gap: 8px; }
.actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }

/* ---------------------------------------------------------------- forms */
.form h2 { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.form h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 190px; }
.field { margin-bottom: 14px; }
.field.narrow { flex: 0 0 140px; min-width: 120px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input:not([type]),
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px;
}
textarea.mono, input.mono { font-family: var(--mono); font-size: 12.8px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400;
         margin-bottom: 9px; font-size: 14px; }
.check input { width: auto; margin-top: 3px; }
[data-when], [data-when-check] { display: none; }
[data-when].show, [data-when-check].show { display: block; }
.row[data-when-check].show { display: flex; }
.inline-form { margin-top: 10px; }

/* ----------------------------------------------------------------- misc */
dl.facts { display: grid; grid-template-columns: minmax(130px, auto) 1fr;
           gap: 5px 16px; margin: 0; font-size: 14px; }
dl.facts.tight { font-size: 13px; gap: 3px 12px; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; }

pre.code, pre.out, pre.cmd {
  background: var(--code-bg); border: 1px solid var(--line);
  border-radius: 7px; padding: 11px 13px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; margin: 8px 0;
  white-space: pre; tab-size: 2;
}
pre.out { max-height: 380px; overflow-y: auto; }
pre.out.err { color: var(--bad); }
pre.cmd { background: transparent; border-style: dashed; color: var(--muted); }

details summary { cursor: pointer; color: var(--muted); font-size: 13px;
                  padding: 4px 0; }
details summary h2 { display: inline; font-size: 17px; color: var(--ink); }
details[open] summary { margin-bottom: 8px; }
.card.danger { border-color: var(--bad); }
.danger-inline { margin-top: 14px; }

ul.decisions { margin: 0; padding-left: 20px; color: var(--ink); font-size: 14px; }
ul.decisions li { margin-bottom: 5px; }
ol.ordered { padding-left: 22px; }
ol.ordered li { margin-bottom: 8px; }
ul.cols { columns: 2; padding-left: 20px; }

/* ------------------------------------------------------ the web servers */
.ws { border: 1px solid var(--line); border-radius: 7px; padding: 12px 14px;
      margin-bottom: 10px; }
.ws.live { border-left: 3px solid var(--ok); }
.ws-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
           flex-wrap: wrap; }

/* ------------------------------------------------------------- the steps */
ol.steps { list-style: none; margin: 0; padding: 0 20px 14px; }
.step { border-left: 2px solid var(--line); padding: 0 0 14px 18px;
        margin-left: 7px; position: relative; }
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step .dot { position: absolute; left: -7px; top: 5px; width: 11px; height: 11px;
             border-radius: 50%; background: var(--line);
             border: 2px solid var(--panel); }
.step.ok { border-left-color: var(--ok); }
.step.ok .dot { background: var(--ok); }
.step.failed { border-left-color: var(--bad); }
.step.failed .dot { background: var(--bad); }
.step.running .dot { background: var(--run); animation: pulse 1.1s ease-in-out infinite; }
.step.rolled_back { border-left-color: var(--warn); }
.step.rolled_back .dot { background: var(--warn); }
.step.skipped { opacity: .62; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step .note { margin: 5px 0 0; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.diagnosis { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- login */
/* A column, not a row: the body's flex children are main *and* footer, and
   side by side they put the strapline next to the sign-in box instead of
   under it. Obvious in a narrow desktop window, wrong everywhere. */
body.login-page { display: flex; flex-direction: column; align-items: center;
                  justify-content: center; min-height: 100vh; }
body.login-page main { width: 100%; max-width: 430px; }
body.login-page footer { text-align: center; padding-bottom: 0; }
.login-box .lockup { display: flex; align-items: center; gap: 9px;
                     justify-content: center; margin-bottom: 6px; font-size: 18px; }
.login-box .lockup .mark { color: var(--accent); }
.login-box .lede { text-align: center; margin-bottom: 20px; }
.login-box button { width: 100%; }
