:root {
  --bg: #0a0806;
  --surface: #16100a;
  --surface-2: #1f170f;
  --edge: #312418;
  --edge-strong: #4a3724;
  --text: #f0e6cc;
  --text-dim: #9c8566;
  --gold: #c9a84c;
  --gold-strong: #e0bf62;
  --ok: #4fb477;
  --warn: #e0a326;
  --bad: #e0594f;
  --radius: 12px;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: Consolas, 'SF Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-dim); }
.small { font-size: 13px; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }

.brand {
  margin: 0;
  font: 700 22px/1.2 var(--serif);
  color: var(--gold);
  letter-spacing: 0.01em;
}
.brand span {
  color: var(--text-dim);
  font: 600 13px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-left: 8px;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--edge-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 600 14px/1 var(--sans);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--sm { padding: 7px 11px; font-size: 13px; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #1a130c; }
.btn--gold:hover:not(:disabled) { background: var(--gold-strong); border-color: var(--gold-strong); }
.btn--ghost { background: transparent; }
.btn--danger:hover:not(:disabled) { border-color: var(--bad); color: #ffd9d5; }

/* Login ------------------------------------------------------------------ */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login__card {
  width: min(100%, 380px);
  display: grid;
  gap: 14px;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.login__card p { margin: 0; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
.field input, .notice-form input {
  width: 100%;
  font: 15px var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--edge-strong);
  border-radius: 8px;
  padding: 10px 12px;
}
.field input:focus, .notice-form input:focus { outline: none; border-color: var(--gold); }

/* Dashboard -------------------------------------------------------------- */
.dash {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar__right { display: flex; align-items: center; gap: 12px; }

.jobs { display: grid; gap: 8px; }
.jobs:empty { display: none; }
.job {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: rgba(224, 163, 38, 0.1);
  border: 1px solid rgba(224, 163, 38, 0.5);
  border-radius: 10px;
}
.job__text { flex: 1; min-width: 200px; }
.job__count { font: 700 18px var(--mono); color: var(--warn); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: 16px;
}

.card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-top: 3px solid var(--edge-strong);
  border-radius: var(--radius);
}
.card[data-state='online'] { border-top-color: var(--ok); }
.card[data-state='degraded'] { border-top-color: var(--warn); }
.card[data-state='offline'] { border-top-color: var(--bad); }

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card__title { margin: 0 0 2px; font: 700 20px/1.2 var(--serif); }
.card__host { font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font: 700 12px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.pill[data-state='online'] { color: var(--ok); }
.pill[data-state='degraded'] { color: var(--warn); }
.pill[data-state='offline'] { color: var(--bad); }
.pill[data-state='loading'] { color: var(--text-dim); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}
.metric {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--edge);
  border-radius: 10px;
  display: grid;
  gap: 2px;
}
.metric b { font: 700 20px/1.15 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric span { font-size: 12px; color: var(--text-dim); }
.metric--hero b { font-size: 26px; color: var(--gold); }

.section-label {
  margin: 0 0 8px;
  font: 700 11px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.tables { display: grid; gap: 6px; }
.table-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 14px;
}
.table-row code { font: 700 13px var(--mono); color: var(--gold); }
.table-row .tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok);
}

.note {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px dashed var(--edge-strong);
  font-size: 13px;
  color: var(--text-dim);
}

.actions { display: grid; gap: 12px; padding-top: 4px; border-top: 1px solid var(--edge); }
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
}
.action-row__label { display: grid; gap: 2px; }
.action-row__label b { font-size: 14px; }
.action-row__label span { font-size: 12px; color: var(--text-dim); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }

.notice-form { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 12px; }
.notice-form input { flex: 1 1 200px; }

.procs { font-size: 12px; color: var(--text-dim); display: flex; gap: 14px; flex-wrap: wrap; }
.procs b { color: var(--text); font-weight: 600; }

details.errors summary { cursor: pointer; font-size: 13px; color: var(--text-dim); }
details.errors[data-has='yes'] summary { color: var(--warn); }
details.errors ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
details.errors li {
  font: 12px/1.4 var(--mono);
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
details.errors li time { color: var(--text-dim); margin-right: 8px; }

.panel {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.panel__title { margin: 0 0 8px; font: 700 16px var(--serif); }
.panel pre {
  margin: 10px 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--edge);
  border-radius: 8px;
  font: 12px/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 14px;
  z-index: 10;
}
.toast[data-kind='bad'] { border-color: var(--bad); }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .brand span { display: block; margin: 4px 0 0; }
  .action-row { align-items: flex-start; flex-direction: column; }
}

/* Temporary-login reminder and the "Your login" form */
.temp-warning {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(224, 89, 79, 0.12);
  border: 1px solid rgba(224, 89, 79, 0.55);
  font-size: 14px;
}
.account-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  margin-top: 12px;
}
.account-form .field input { width: 100%; }
.account-form__row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Scheduling at a set time */
.time-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--edge);
  border-radius: 10px;
}
.time-input {
  font: 14px var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--edge-strong);
  border-radius: 8px;
  padding: 8px 10px;
  color-scheme: dark;
}
.time-input:focus { outline: none; border-color: var(--gold); }
.job__text { display: grid; gap: 2px; }

/* Activity: quiet-time summary, hour chart, day-by-hour heatmap */
.activity { display: grid; gap: 14px; }
.activity .section-label { margin: 4px 0 -6px; }
.quiet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.quiet p { margin: 0; }
.quiet__text { display: grid; gap: 2px; }
.quiet__text b { font: 700 22px/1.2 var(--serif); color: var(--ok); }
.chart svg { display: block; width: 100%; height: auto; max-height: 220px; }
.chart text { font-family: var(--sans); }

.heatmap { display: grid; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.heat-row {
  display: grid;
  grid-template-columns: 58px repeat(24, minmax(9px, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 330px;
}
.heat-day { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.heat-cell { height: 18px; border-radius: 3px; background: #2a1f14; }
.heat-cell[data-empty='yes'] { background: transparent; border: 1px dashed #2a1f14; }
.heat-cell[data-level='0'] { background: #2a1f14; }
.heat-cell[data-level='1'] { background: #4a3a1d; }
.heat-cell[data-level='2'] { background: #6b5322; }
.heat-cell[data-level='3'] { background: #8f6f2c; }
.heat-cell[data-level='4'] { background: #b08c3a; }
.heat-cell[data-level='5'] { background: #e0bf62; }
.heat-axis .heat-label { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: visible; }

/* Links out to the game sites */
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.topbar__right { flex-wrap: wrap; justify-content: flex-end; }
.card__head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Backups panel */
.panel__row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.panel__row p { margin: 0 0 10px; }
#backups { display: grid; gap: 6px; }
.backup-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.backup-list code { font: 12px var(--mono); color: var(--text); }
