/* PEE & FLEE CONTROL CENTER (Fase 8): donker, strak en leesbaar, met het crème/paars/geel van het spel als accent. Alleen externe CSS (de CSP staat geen inline stijlen toe). */
:root {
  color-scheme: dark;
  --bg: #14101e;
  --surface: #1e1930;
  --surface-2: #272040;
  --border: #3b3354;
  --text: #f4eedc;
  --muted: #b9b0cf;
  --accent: #a58bff;
  --accent-strong: #7d5cff;
  --yellow: #ffd966;
  --ok: #6ee7a8;
  --warn: #ffb454;
  --bad: #ff7f90;
  --radius: 10px;
  --shadow: 0 2px 14px rgb(0 0 0 / 35%);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
}

a {
  color: var(--accent);
}

code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  word-break: break-all;
}

code.json {
  display: inline-block;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--yellow);
  color: #000;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 0;
}

/* ---------- indeling ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand .logo {
  font-size: 1.3rem;
}

.brand-sub {
  color: var(--yellow);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.who {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.who .role {
  background: var(--accent-strong);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.who .email {
  color: var(--muted);
  font-size: 0.85rem;
}

.live {
  font-size: 0.75rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.live-on {
  color: var(--ok);
  border-color: var(--ok);
}

.live-off {
  color: var(--warn);
  border-color: var(--warn);
}

.shell {
  display: grid;
  grid-template-columns: 15rem 1fr;
  min-height: calc(100vh - 3.2rem);
}

.nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

.nav a:hover {
  background: var(--surface-2);
}

.nav a[aria-current='page'] {
  background: var(--accent-strong);
  color: #fff;
  font-weight: 600;
}

main {
  padding: 1.25rem;
  min-width: 0;
}

main:focus {
  outline: none;
}

.centered {
  max-width: 34rem;
  margin: 4rem auto;
  padding: 1rem;
}

.btn.menu-button {
  display: none;
}

/* ---------- onderdelen ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card-title {
  color: var(--yellow);
}

.grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.grid-stats {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.grid-small {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.grid-two {
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stat-hint {
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.stat-ok .stat-value {
  color: var(--ok);
}

.stat-warn .stat-value {
  color: var(--warn);
}

.stat-bad .stat-value {
  color: var(--bad);
}

.stat-na .stat-value {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.badge-ok {
  color: var(--ok);
  border-color: var(--ok);
}

.badge-warn {
  color: var(--warn);
  border-color: var(--warn);
}

.badge-bad {
  color: var(--bad);
  border-color: var(--bad);
}

.badge-info {
  color: #8fc4ff;
  border-color: #8fc4ff;
}

.badge-accent {
  color: var(--accent);
  border-color: var(--accent);
}

.badge-muted {
  color: var(--muted);
}

.flags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* ---------- tabellen ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background: rgb(255 255 255 / 3%);
}

.empty,
.loading,
.help,
.range,
small {
  color: var(--muted);
}

.help,
.range {
  font-size: 0.8rem;
  display: block;
}

.error-box {
  background: rgb(255 127 144 / 12%);
  border: 1px solid var(--bad);
  color: var(--bad);
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
}

/* ---------- formulieren en knoppen ---------- */
.toolbar,
.actions,
.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.5rem 0 0.9rem;
}

.row-actions {
  margin: 0;
}

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  font-weight: 600;
}

.btn-danger {
  background: #8a2336;
  border-color: #c4475d;
  color: #fff;
}

.btn-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

input,
select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  min-width: 0;
}

input[type='number'].num {
  width: 5.5rem;
}

input[type='search'],
input[type='text'],
input[type='email'] {
  min-width: 14rem;
}

input.switch {
  width: 2.6rem;
  height: 1.4rem;
  accent-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.9rem 1.2rem;
  margin: 0.75rem 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.field-bool {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.unit {
  color: var(--muted);
  font-weight: 400;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.tab {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.tab-active {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
}

.ops-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.unavailable {
  background: var(--surface-2);
  border-left: 4px solid var(--warn);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  margin: 0.75rem 0;
}

.share {
  min-width: 7rem;
}

.sharebar {
  background: var(--surface-2);
  border-radius: 999px;
  height: 0.5rem;
  overflow: hidden;
  margin-top: 0.2rem;
}

.sharebar-fill {
  --w: 0%;
  width: var(--w);
  height: 100%;
  background: var(--yellow);
}

.chart {
  width: 100%;
  height: auto;
  max-height: 11rem;
}

.chart-bar {
  fill: var(--accent);
}

.chart-label,
.chart-value {
  fill: var(--muted);
  font-size: 10px;
}

.figure {
  margin: 0;
}

.figure figcaption {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- dialogen en meldingen ---------- */
dialog.dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 12px;
  max-width: min(36rem, 94vw);
  width: 100%;
  padding: 1.1rem 1.3rem;
}

dialog.dialog::backdrop {
  background: rgb(5 3 10 / 75%);
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  max-width: min(26rem, 92vw);
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  box-shadow: var(--shadow);
}

.toast-ok {
  border-left-color: var(--ok);
}

.toast-error {
  border-left-color: var(--bad);
}

.toast-info {
  border-left-color: var(--accent);
}

/* ---------- smal scherm ---------- */
@media (max-width: 860px) {
  .btn.menu-button {
    display: inline-block;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
    position: fixed;
    inset: 3.2rem 0 0 0;
    z-index: 15;
    overflow-y: auto;
  }

  .nav.nav-open {
    display: flex;
  }

  .who .email {
    display: none;
  }

  main {
    padding: 0.9rem;
  }

  .ops-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- inloggen en setupcodes (Fase 8.2) ---------- */
.code-box {
  display: inline-block;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.08em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  user-select: all;
}

.code-big {
  font-size: 1.4rem;
  padding: 0.6rem 0.9rem;
}

.steps {
  padding-left: 1.2rem;
}

.steps li {
  margin-bottom: 0.4rem;
}

.ok-box {
  background: rgb(110 231 168 / 12%);
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}
