/* ---------------------------------------------------------------------------
   admin.css — configuration screens.

   Denser than the kiosk on purpose: this is read by one admin standing close, not
   from across a workshop. Shares the kiosk's palette so the two pages look like
   one application, but not its 88px tap targets.
--------------------------------------------------------------------------- */

:root {
  --gold: #f5b301;
  --gold-dim: #c08f00;
  --ink: #f4f4f5;
  --ink-quiet: #a1a1aa;
  --bg: #17181c;
  --surface: #212227;
  --surface-raised: #2c2d34;
  --line: #3a3b43;
  --ok: #22c55e;
  --problem: #f87171;
  --radius: 10px;
  --gap: 12px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win.
   The browser's own stylesheet says [hidden] { display: none }, but any author
   rule that sets `display` outranks it -- and `.login { display: flex }` below
   does exactly that. Without this line, hiding the login form does nothing and
   it renders on top of the workspace. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --- Top bar ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__team { color: var(--gold); font-weight: 700; letter-spacing: 0.08em; }
.topbar__app { margin-left: 10px; font-weight: 600; }
.topbar__right { display: flex; align-items: center; gap: var(--gap); }
.topbar__who { color: var(--ink-quiet); font-size: 0.9rem; }

/* --- Banner ------------------------------------------------------------- */

.banner { margin: 0; padding: 12px 22px; font-weight: 600; }
.banner--problem { background: var(--problem); color: #1a0000; }
.banner--ok { background: var(--ok); color: #00220c; }

/* --- Login -------------------------------------------------------------- */

.login { display: flex; justify-content: center; padding: 64px 22px; }

.login__form {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login__form h2 { margin: 0 0 6px; }
.login__hint { margin: 0 0 20px; color: var(--ink-quiet); font-size: 0.85rem; }
.login__hint code { color: var(--gold); font-size: 0.8rem; }
.login__error { min-height: 1.4em; margin: 6px 0 12px; color: var(--problem); }
.login__form .button { width: 100%; }

/* --- Tabs --------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.tab {
  padding: 12px 16px;
  font: inherit;
  color: var(--ink-quiet);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--ink); }

.tab--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* --- Stage -------------------------------------------------------------- */

.stage {
  max-width: 900px;
  margin: 0 auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.empty { color: var(--ink-quiet); text-align: center; padding: 36px 0; }

/* --- Cards -------------------------------------------------------------- */

.card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card__header {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.card__title { margin: 0; font-size: 1.05rem; }
.card__meta { margin: 2px 0 10px; color: var(--ink-quiet); font-size: 0.88rem; }
.card__actions { display: flex; gap: var(--gap); margin-top: 14px; }

.badge {
  padding: 3px 9px;
  font-size: 0.75rem;
  color: var(--ink-quiet);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.badge--override { color: var(--gold); border-color: var(--gold-dim); }

.swatch {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* --- Forms -------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: var(--gap); }

.form--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 14px;
  margin-top: 12px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.form--inline .field { flex: 1 1 130px; }
.form--inline .button { align-self: center; margin-top: 18px; }

.form__banner {
  margin: 0;
  padding: 10px 12px;
  color: var(--problem);
  background: rgba(248, 113, 113, 0.1);
  border-left: 3px solid var(--problem);
  border-radius: 4px;
  font-size: 0.9rem;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 0.85rem; color: var(--ink-quiet); }

.field__input {
  padding: 9px 11px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.field__input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.field__hint { font-size: 0.78rem; color: var(--ink-quiet); }

/* An error slot is always present, so the layout does not jump when a message
   appears under a field. */
.field__error { min-height: 1.1em; font-size: 0.82rem; color: var(--problem); }
.field--invalid .field__input { border-color: var(--problem); }

/* --- Windows ------------------------------------------------------------ */

.windows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.windows__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
}

/* A row can hold its own edit form. Wrapping, plus a full-width form, puts the
   form on a line of its own below the row's text and buttons when it opens. */
.windows__item { flex-wrap: wrap; }
.windows__item > .form { flex-basis: 100%; margin-top: 4px; }

.row-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* --- Points by week ----------------------------------------------------- */

.points-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.points-table th,
.points-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

/* The week label reads as text; every other column is a number. */
.points-table th:first-child,
.points-table td:first-child { text-align: left; }

.points-table th { color: var(--ink-quiet); font-size: 0.8rem; font-weight: 500; }

.points-table__empty td { color: var(--ink-quiet); }

.points-table tfoot td { font-weight: 600; border-bottom: none; }

.windows__empty { color: var(--ink-quiet); font-size: 0.88rem; font-style: italic; }

/* --- Checklists --------------------------------------------------------- */

.checklist { display: flex; flex-direction: column; gap: 6px; }

.checklist__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.checklist__warn {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--gold);
}

/* --- Definitions -------------------------------------------------------- */

.definitions { margin: 0; }
.definitions dt { font-weight: 600; margin-top: 10px; }
.definitions dd { margin: 2px 0 0; color: var(--ink-quiet); font-size: 0.9rem; }

/* --- Boards ------------------------------------------------------------- */

.boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}

.board {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent, var(--gold));
  border-radius: var(--radius);
}

.board__title { margin: 0 0 10px; font-size: 1rem; color: var(--accent, var(--gold)); }
.board__empty { color: var(--ink-quiet); font-size: 0.88rem; margin: 0; }
.board__list { list-style: none; margin: 0; padding: 0; }

.board__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.board__row:last-child { border-bottom: none; }

.board__rank {
  min-width: 1.6em;
  color: var(--ink-quiet);
  font-variant-numeric: tabular-nums;
}

.board__name { flex: 1; }
.board__value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* A rank's badge, drawn by boards.js beside any value that names a rank. */
.insignia {
  width: 18px;
  height: 18px;
  margin-right: 4px;
  vertical-align: -3px;
}

/* --- Buttons ------------------------------------------------------------ */

.button {
  padding: 9px 16px;
  font: 600 0.9rem/1 system-ui, sans-serif;
  border-radius: 7px;
  border: 1px solid var(--line);
  cursor: pointer;
  /* Some buttons are links (<a class="button">); drop the link underline so
     they look the same as the real <button>s beside them. */
  text-decoration: none;
}

.button--primary { background: var(--gold); border-color: var(--gold-dim); color: #1a1500; }
.button--quiet { background: var(--surface-raised); color: var(--ink); }
.button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
