/* Admin UI. One stylesheet, no build step, no framework.
   Modern browsers only - the Chromium M56 constraint applies to player/ and
   content_templates/, not here. */

:root {
  --ink: #16202b;
  --ink-muted: #5d6b7a;
  --line: #dde3ea;
  --bg: #f5f7f9;
  --card: #ffffff;
  --accent: #1a3a5c;
  --accent-ink: #ffffff;
  --ok: #1f7a3d;
  --warn: #a2650a;
  --danger: #a32020;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

body.centred {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--accent);
  color: var(--accent-ink);
}
.topbar a { color: var(--accent-ink); text-decoration: none; }
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar nav { display: flex; gap: 1.25rem; }
.topbar nav a:hover { text-decoration: underline; }
.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

.page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head-actions { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.crumbs { color: var(--ink-muted); font-size: 0.85rem; margin: 0 0 0.5rem; }

/* ---- surfaces ---------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.columns { display: flex; gap: 1.25rem; align-items: flex-start; }
.columns > * { flex: 1 1 0; min-width: 0; }

.tiles { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.tile {
  flex: 0 0 auto;
  min-width: 130px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
}
.tile-number { display: block; font-size: 1.9rem; font-weight: 600; }
.tile-label { color: var(--ink-muted); font-size: 0.85rem; }

/* ---- tables ------------------------------------------------------------ */

.grid { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.grid th, .grid td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.grid th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.grid tr.revoked { opacity: 0.5; }
.table-scroll { overflow-x: auto; }
.grid.editor input, .grid.editor select { width: 100%; min-width: 110px; }

/* ---- forms ------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 0.4rem; }
.form.inline { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.form label { font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.5rem; }

input, select, textarea, button {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
}
input[type="color"] { padding: 2px; height: 34px; width: 56px; }
input[type="range"] { padding: 0; border: 0; }

button, .button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  border-radius: 4px;
  padding: 0.45rem 0.9rem;
}
button:hover, .button:hover { filter: brightness(1.12); }
.button.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
button.danger { background: var(--danger); }
button.linkish {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}
button.linkish.danger { color: var(--danger); background: none; }

.login { width: 340px; }
.login h1 { text-align: center; }
.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---- status ------------------------------------------------------------ */

.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ink-muted);
  vertical-align: middle;
  margin-right: 0.3rem;
}
.dot-online { background: var(--ok); }
.dot-offline { background: var(--danger); }
.dot-unpaired { background: var(--ink-muted); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--warn); }

.flash { padding: 0.6rem 0.85rem; border-radius: var(--radius); margin: 0 0 1rem; }
.flash-ok { background: #e6f4ea; color: var(--ok); }
.flash-error { background: #fbe9e9; color: var(--danger); }

.muted { color: var(--ink-muted); }
.small { font-size: 0.85rem; }
.hint { color: var(--ink-muted); font-size: 0.85rem; }
.empty { color: var(--ink-muted); padding: 1.5rem 0; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; }
.facts dt { color: var(--ink-muted); font-size: 0.85rem; }
.facts dd { margin: 0; }

/* ---- editors ----------------------------------------------------------- */

.theme-row { margin-bottom: 0.85rem; }
.theme-row label { display: block; font-size: 0.8rem; color: var(--ink-muted); }
.theme-row .control { display: flex; align-items: center; gap: 0.6rem; }
.theme-row output { font-variant-numeric: tabular-nums; min-width: 3rem; }

.cell-image { display: flex; align-items: center; gap: 0.4rem; }
.cell-image img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }

.preview-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.key-reveal .key {
  display: block;
  padding: 0.6rem;
  background: #f3f5f7;
  border: 1px dashed var(--line);
  border-radius: 4px;
  word-break: break-all;
}
