/* ============================================================================
   Shared styles for both pages (login.html and app.html); app.css adds the
   panel page's own rules and loads after this file.

   Conventions
   - Every colour is a custom property on :root, overridden for dark mode by the
     prefers-color-scheme media query. Change colours here, not in rules.
   - No build step, no preprocessor: this file is served exactly as written.
   - Specificity reminder: #id > .class > element; on a tie the later rule wins.
   ============================================================================ */

/* The colour palette, light mode. */
:root {
  --bg: #f4f1ea;          /* page background */
  --card: #fffdf8;        /* card background */
  --ink: #1d211e;         /* main text */
  --muted: #6b706a;       /* secondary text */
  --line: #e3ddd0;        /* borders */
  --accent: #b8651b;      /* main buttons, graphs */
  --accent-ink: #fff;     /* text on main buttons */
  --ok: #2f8a4e;          /* green: online */
  --warn: #c2860e;        /* amber: needs attention */
  --bad: #b83a2e;         /* red: errors, the Stop button */
  --busy: #3c6fb0;        /* blue: starting or stopping */
  --soft: #efe9dc;        /* quiet buttons and boxes */
}

/* The same palette for when the phone or computer is in dark mode. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --card: #18201b;
    --ink: #e9ebe6;
    --muted: #9aa39b;
    --line: #2a342d;
    --accent: #e8a33d;
    --accent-ink: #1a1308;
    --ok: #57c27a;
    --warn: #e3b341;
    --bad: #f07167;
    --busy: #6ea8f0;
    --soft: #202a23;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

/* env(safe-area-inset-*) keeps content clear of a phone's notch and home bar
   (needs viewport-fit=cover in the pages' viewport meta tag). */
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

/* Single centred column of cards; the layout is phone-first. */
main {
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

/* Each <section> of the panel. */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

/* The page title (top left). */
h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--muted);
  letter-spacing: .02em;
}

/* Small grey capitals at the top of each card, like "WHO'S ONLINE". */
h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 10px;
}

/* Buttons default to full-width tap targets; app.css narrows specific ones. */
button,
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
}

/* A quieter button (like Dismiss). */
button.secondary {
  background: var(--soft);
  color: var(--ink);
}

/* The red Stop button. */
button.danger {
  background: var(--bad);
  color: #fff;
}

button:disabled {
  opacity: .5;
  cursor: default;
}

/* Sign-in form fields. */
input {
  font: inherit;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

/* Utility classes used in the HTML and by app.js. */
.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}
