/* MXdad panel — design tokens and the whole stylesheet.
 *
 * One file, no build step, no framework (AGENTS.md §2: no JS build pipeline).
 * Everything below the tokens is layout for the handful of shapes the panel
 * actually has: a nav, a table, a form, a card, a status badge. When a page
 * needs something new, add it here rather than in a <style> block, so the next
 * person can see the whole visual vocabulary in one place. */

:root {
  /* Ink and ground. Deliberately warm rather than pure grey: this is a
   * utility a customer visits when something is wrong, and a clinical palette
   * makes that worse. */
  --ink:        #1b1a17;
  --ink-soft:   #55524c;
  --ink-faint:  #8a857c;
  --ground:     #fbfaf8;
  --panel:      #ffffff;
  --rule:       #e6e2da;

  /* The three verdicts, plus unknown. These are the only saturated colours in
   * the interface, so a status is the thing your eye lands on. */
  --ok:         #1d7a4c;
  --ok-bg:      #e8f5ee;
  --warn:       #8a6100;
  --warn-bg:    #fdf3dd;
  --fail:       #a3231c;
  --fail-bg:    #fbeae9;
  --unknown:    #55524c;
  --unknown-bg: #f0eeea;

  /* **The brand green, not an arbitrary blue.** This was #2f5d8a, chosen before
   * the public site had a palette, so a customer moving from mxdad.com to the
   * panel arrived somewhere that looked like a different product. #326C65 is
   * `--brand` in docs/14, measured 5.80:1 on this ground and 6.05:1 on white.
   *
   * The warm ground and the dark scheme below stay: the reasoning above them
   * still holds, and docs/14 §9 is where a deliberate divergence is recorded
   * rather than quietly flattened. Only the colour that says *who this is* is
   * shared. */
  --accent:     #326C65;
  --accent-ink: #ffffff;

  --radius: 6px;
  --gap: 1rem;
  --measure: 42rem;   /* readable line length for prose and forms */

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece9e3; --ink-soft: #b3aea5; --ink-faint: #7d7870;
    --ground: #161513; --panel: #1e1d1a; --rule: #33312d;
    --ok: #6dc494; --ok-bg: #15291f;
    --warn: #d8ab4a; --warn-bg: #2b2313;
    --fail: #e8867f; --fail-bg: #2e1a19;
    --unknown: #b3aea5; --unknown-bg: #26251f;
    /* The brand green is 3.01:1 on this ground — it fails AA, measured, so
     * dark mode gets a lighter tint of the same hue at 8.69:1 rather than the
     * brand value applied where it cannot be read. */
    --accent: #7FBFB2; --accent-ink: #161513;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 15px/1.55 var(--font);
}
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* --- shell ---------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }
@media (max-width: 45rem) { .shell { grid-template-columns: 1fr; } }

.side {
  background: var(--panel); border-right: 1px solid var(--rule);
  padding: var(--gap); display: flex; flex-direction: column; gap: var(--gap);
}
.brand { font-weight: 650; letter-spacing: -0.01em; }
.brand a { color: var(--ink); text-decoration: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  padding: 0.35rem 0.55rem; border-radius: var(--radius);
  color: var(--ink-soft); text-decoration: none;
}
.side nav a:hover { background: var(--ground); }
.side nav a[aria-current="page"] { background: var(--ground); color: var(--ink); font-weight: 600; }
.side .who { margin-top: auto; font-size: 0.85rem; color: var(--ink-faint); }

.main { padding: 1.6rem 1.8rem; max-width: 68rem; }
h1 { font-size: 1.35rem; margin: 0 0 0.2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 1.8rem 0 0.6rem; }
.lede { color: var(--ink-soft); margin: 0 0 1.4rem; max-width: var(--measure); }

/* --- cards and tables ----------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: var(--gap);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--gap); }
.stat { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.stat small { display: block; font-size: 0.8rem; font-weight: 400; color: var(--ink-faint); letter-spacing: 0; }

/* One rule, not two: this was `overflow-x` here and `border`/`border-radius`
   five lines below, with the table rules in between. The properties did not
   clash, but a class defined twice is one whose second author cannot see what
   the first set — which is how `.empty` silently centred the first-run block. */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

/* --- status ---------------------------------------------------------------- */
.badge {
  display: inline-block; padding: 0.05rem 0.45rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-ok      { color: var(--ok);      background: var(--ok-bg); }
.badge-warning { color: var(--warn);    background: var(--warn-bg); }
.badge-fail    { color: var(--fail);    background: var(--fail-bg); }
.badge-unknown { color: var(--unknown); background: var(--unknown-bg); }
.advice { color: var(--ink-soft); font-size: 0.86rem; margin-top: 0.25rem; max-width: var(--measure); }
.found { color: var(--ink-faint); font-size: 0.82rem; margin-top: 0.2rem; }

/* --- forms ----------------------------------------------------------------- */
form { max-width: var(--measure); }
label { display: block; margin: 0.8rem 0 0.2rem; font-weight: 550; font-size: 0.9rem; }
.hint { color: var(--ink-faint); font-size: 0.82rem; margin-top: 0.2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 0.45rem 0.6rem; font: inherit;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .btn {
  display: inline-block; margin-top: 1rem; padding: 0.45rem 0.9rem; font: inherit; font-weight: 550;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
button.secondary, .btn.secondary { color: var(--ink); background: var(--panel); border-color: var(--rule); }
button.danger, .btn.danger { color: var(--fail); background: var(--fail-bg); border-color: transparent; }
button.small, .btn.small { margin-top: 0; padding: 0.2rem 0.5rem; font-size: 0.83rem; }

/* --- messages -------------------------------------------------------------- */
.notice { border-radius: var(--radius); padding: 0.7rem 0.9rem; margin-bottom: var(--gap); max-width: var(--measure); }
.notice-error { color: var(--fail); background: var(--fail-bg); }
.notice-ok    { color: var(--ok);   background: var(--ok-bg); }
.notice-warn  { color: var(--warn); background: var(--warn-bg); }

/* A secret shown exactly once. Loud on purpose: the customer has one chance to
 * copy it, and a value that looks like ordinary output gets closed past. */
.secret {
  font-family: var(--mono); font-size: 0.95rem; word-break: break-all;
  background: var(--warn-bg); color: var(--warn);
  padding: 0.7rem 0.9rem; border-radius: var(--radius); margin: 0.5rem 0;
}

.muted { color: var(--ink-faint); }
.row { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: var(--gap); }

/* Centred single-column pages: sign-in, two-factor, the forward confirmation. */
.solo { max-width: 24rem; margin: 4rem auto; padding: 0 1rem; }
.solo .card { padding: 1.4rem; }

/* Usage and quota meters. A bar is capped at 100% so it cannot run off its
   track; the number beside it is what tells you an over-limit day apart from a
   day exactly at the limit. */
.meter {
  display: inline-block;
  height: .5rem;
  min-width: 3rem;
  background: var(--line, #e6e6e6);
  border-radius: .25rem;
  overflow: hidden;
  vertical-align: middle;
}
.meter > span {
  display: block;
  height: 100%;
  background: var(--accent, #3b7ddd);
  border-radius: .25rem;
}
.meter.over > span { background: var(--danger, #c33); }
td .meter { max-width: 12rem; }

/* A form that sits inside a table cell beside other content. */
form.inline { display: inline; }

/* The empty state. One instruction, not a grid of zeros — and no card, because
   there is nothing beside it to be separated from. */
.firstrun { max-width: var(--measure); margin: 2rem 0; }
.firstrun h2 { margin-top: 0; }
.firstrun p { color: var(--ink-soft); }
.firstrun .btn { margin-top: .5rem; }

/* The sidebar shows the same mark as the sign-in page and the public site,
   swapped by scheme for the same reason. */
.side .brand img.mark { display: block; width: 104px; height: auto; }
.side .brand img.mark-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .side .brand img.mark { display: none; }
  .side .brand img.mark-dark { display: block; }
}

/* --- sign in ---------------------------------------------------------------
   The one page a customer sees before they are a customer, and the only place
   the public site and the panel meet. It gets the wordmark and a sentence
   saying what this is, because the address that matters most — "I want to read
   my mail" — is webmail, not here, and somebody who lands on the wrong one with
   no explanation just tries their password again. */
.signin { max-width: 26rem; margin: 8vh auto 0; padding: 0 1.25rem 4rem; }
.signin .mark { display: block; width: 132px; height: auto; margin-bottom: 2rem; }
.signin .mark-dark { display: none; }
.signin h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 .5rem; }
.signin .lede { color: var(--ink-soft); margin: 0 0 2rem; }
.signin label { display: block; margin-bottom: .35rem; font-weight: 600; }
.signin input { width: 100%; margin-bottom: 1.25rem; }
.signin button { width: 100%; }
.signin .elsewhere {
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule);
  color: var(--ink-soft); font-size: .9rem;
}
.signin .elsewhere p { margin: 0 0 .5rem; }
/* A link breaks as a unit or not at all: "Find your / account" split across
   two lines reads as two links. The sentence wraps before it instead. */
.signin .elsewhere a { white-space: nowrap; }
/* A label with a link on its right, for "Forgotten your password?" beside the
   field it is about. The label keeps its own spacing; the link is quieter. */
.signin .label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.signin .label-row a { font-size: .85rem; white-space: nowrap; }
/* Facts on the sign-up page: three short lines, not a marketing block. */
.signin .facts { margin: 0 0 1.75rem; padding-left: 1.1rem; color: var(--ink-soft); }
.signin .facts li { margin: 0 0 .35rem; }
/* Side-by-side calls to action that wrap on a narrow phone. Links styled as
   buttons keep their text colour off the accent-on-accent default. */
.signin .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.signin .actions .btn { width: auto; flex: 1 1 10rem; text-align: center; text-decoration: none;
  /* A two-line button reads as two buttons. When the pair does not fit side
     by side they stack, each full width, instead of squeezing. */
  white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .signin .mark { display: none; }
  .signin .mark-dark { display: block; }
}

