/* 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;
}

/* ------------------------------------------------------------- side nav */
/* The menu lives in a left pane that stays put while the page scrolls. Below
   860px there is no room beside the content, so the pane becomes a header with
   a Menu button that opens the same links underneath it. */
:root { --side-w: 232px; }
aside.side {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 20;
  display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 14px 12px max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
body[data-side] .shell { margin-left: var(--side-w); }
aside.side .side-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 16px; }
aside.side .brand {
  display: flex; align-items: center; gap: 8px; flex: 1;
  color: var(--ink); text-decoration: none; font-size: 15px;
}
aside.side .brand b { font-weight: 700; }
aside.side .mark { color: var(--accent); }
aside.side .side-toggle { display: none; }
aside.side .side-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
aside.side .links { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
aside.side .links .group {
  margin: 14px 10px 4px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
aside.side .links a {
  color: var(--muted); text-decoration: none;
  padding: 7px 10px; border-radius: 6px; font-size: 14px;
  border-left: 3px solid transparent;
}
aside.side .links a:hover { background: var(--bg); color: var(--ink); }
aside.side .links a.on { background: var(--bg); color: var(--ink); font-weight: 600;
                         border-left-color: var(--accent); }
aside.side .links a.go { color: var(--accent); font-weight: 600; }
aside.side .side-foot { border-top: 1px solid var(--line); padding: 12px 4px 0; margin-top: 10px; }
aside.side .account { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 4px; }
aside.side .who { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; flex: 1; min-width: 0;
                  overflow-wrap: anywhere; }
aside.side a.who:hover { color: var(--ink); }
aside.side .who em { font-style: normal; display: block; font-size: 11px; opacity: .8; }
aside.side .aids { display: flex; gap: 6px; flex-wrap: wrap; }
aside.side .aid {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 6px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 13px; background: var(--panel);
}
aside.side .aid:hover, aside.side .aid.on { color: var(--ink); border-color: var(--muted); }
aside.side .aid .glyph {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font: 700 11px/1 system-ui, sans-serif;
}
@media (max-width: 860px) {
  aside.side {
    position: sticky; bottom: auto; width: auto; height: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 8px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  }
  body[data-side] .shell { margin-left: 0; }
  aside.side .side-head { padding: 0; }
  aside.side .side-toggle {
    display: inline-block; background: none; color: var(--ink);
    border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; font-size: 14px;
  }
  aside.side .side-body { display: none; max-height: calc(100vh - 60px); overflow-y: auto; padding-top: 8px; }
  aside.side.open .side-body { display: flex; }
}
footer .foot-links { float: right; }
footer .foot-links a { color: var(--muted); }

/* ----------------------------------------------------------- help guide */
.guide { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.guide .toc { position: sticky; top: 22px; font-size: 13.5px; }
.guide .toc ol { margin: 0; padding-left: 20px; }
.guide .toc li { margin: 3px 0; }
.guide .toc a { color: var(--muted); text-decoration: none; }
.guide .toc a:hover { color: var(--accent); }
.guide section.card { scroll-margin-top: 22px; }
@media (max-width: 860px) { .guide section.card { scroll-margin-top: 70px; } }
.guide h3 { text-transform: none; font-size: 15px; letter-spacing: 0; color: var(--ink); }
.guide dl.terms dt { font-weight: 600; margin-top: 8px; }
.guide dl.facts { grid-template-columns: minmax(110px, auto) minmax(0, 1fr); }
.guide dl.facts dd { overflow-wrap: anywhere; }
.guide dl.terms dd { margin: 2px 0 0 0; color: var(--ink); }
@media (max-width: 860px) {
  .guide { grid-template-columns: minmax(0, 1fr); }
  .guide .toc { position: static; }
}
.about-mark { color: var(--accent); }
.about-mark svg { width: 46px; height: 46px; }


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%; }

/* ------------------------------------------------- phones and tablets */
/* The same console runs in the Android and iOS apps, and in any phone's
   browser. Nothing here changes what a desktop sees. */

/* Notches and home indicators: viewport-fit=cover hands the whole screen to
   the page, so the page has to keep its own content out from under them. */
footer { padding-bottom: max(34px, env(safe-area-inset-bottom)); }

/* A finger, not a pointer: targets at least 44px, and inputs at 16px so iOS
   does not zoom the page every time one takes focus. */
@media (pointer: coarse) {
  .btn, button { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .btn.small, button.small { min-height: 38px; }
  button.link { min-height: 40px; }
  aside.side .links a { padding: 10px 12px; }
  aside.side .aid { padding-top: 8px; padding-bottom: 8px; }
  input[type=text], input[type=password], input[type=number], input:not([type]),
  select, textarea { font-size: 16px; padding: 11px 12px; }
  .check input { width: 22px; height: 22px; margin-top: 1px; }
  details summary { padding: 10px 0; }
}
/* Hover highlights stick after a tap on touch screens. */
@media (hover: none) {
  tbody tr:hover { background: transparent; }
}

/* Tablet portrait and smaller. */
@media (max-width: 860px) {
  main { padding: 20px 16px 48px; }
  footer { padding-left: 16px; padding-right: 16px; }
  footer .foot-links { float: none; display: block; margin-top: 6px; }
}

@media (max-width: 640px) {
  main { padding: 16px 12px 40px; }
  h1 { font-size: 21px; }
  .head .grow { min-width: 0; flex-basis: 100%; }
  .card { padding: 14px; border-radius: 8px; }
  .card.tight .card-head, .card.tight > h2 { padding: 0 14px; }
  ol.steps { padding: 0 14px 12px; }
  .row > .field, .field.narrow { flex: 1 1 100%; min-width: 0; }
  dl.facts, .guide dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dl.facts dt { margin-top: 8px; }
  ul.cols { columns: 1; }
  .actions { flex-wrap: wrap; }
  .actions .btn, .actions button { flex: 1 1 auto; text-align: center; }
  th, td { padding: 8px 10px; }
  td.notes, td.detail { max-width: 220px; }
  pre.code, pre.out, pre.cmd { font-size: 12px; }
  body.login-page main { padding-top: 24px; }
}
