:root {
  color-scheme: light dark;
  --bg: #f7f8f5;
  --surface: #fff;
  --text: #20271d;
  --muted: #687363;
  --border: #dce3d8;
  --accent: #3f6e1e;
  --accent-soft: #eef4e9;
  --red: #a52f2f;
  --amber: #8b600e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea {
  font: inherit;
}
button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover {
  filter: brightness(.92);
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.secondary, .quiet {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}
.quiet {
  border-color: transparent;
}
.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-align: left;
}
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
}
textarea {
  min-height: 88px;
  resize: vertical;
}
label {
  display: block;
  font-weight: 600;
  margin: 12px 0;
}
h1, h2, h3, p {
  margin: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.2;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 15px;
}
p {
  color: var(--muted);
}
:focus-visible {
  outline: 3px solid #72a94d;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.shell {
  min-height: 100vh;
}
.rail {
  display: none;
}
main {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 16px 108px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .12em;
  font-weight: 700;
}
.mobile-nav {
  position: fixed;
  z-index: 3;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.mobile-nav button {
  flex: 1;
  padding: 14px 4px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
}
.mobile-nav button.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.more-menu {
  position: fixed;
  z-index: 4;
  bottom: 56px;
  right: 8px;
  display: grid;
  min-width: 180px;
  padding: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.more-menu button {
  text-align: left;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.cards {
  display: grid;
  gap: 16px;
}
.card, .stat, .banner {
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.stat .value {
  margin-top: 8px;
  font-size: 27px;
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.label, .meta, .hint {
  color: var(--muted);
  font-size: 13px;
}
.hint {
  display: block;
  font-weight: 400;
}
.banner {
  display: block;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
}
.banner.degraded {
  border-left-color: var(--amber);
  color: var(--amber);
}
.banner.maintenance {
  border-left-color: var(--red);
  color: var(--red);
}
.section {
  margin-top: 24px;
}
.section:first-child {
  margin-top: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.controls, .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.controls button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.chart {
  display: block;
  width: 100%;
  height: 180px;
  overflow: visible;
}
.chart line {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.chart polygon {
  fill: var(--accent-soft);
}
.chart rect {
  fill: var(--accent);
}
.chart text {
  fill: var(--muted);
  font-size: 10px;
}
.table-wrap {
  width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: normal;
}
th {
  color: var(--muted);
  font-weight: 600;
}
.details {
  overflow-wrap: anywhere;
}
.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.error {
  min-height: 1.5em;
  color: var(--red);
}
.success {
  color: var(--accent);
  font-size: 13px;
}
.form-grid {
  display: grid;
  gap: 8px;
}
.login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 16px;
}
.login-card {
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.login-card > p {
  margin-bottom: 16px;
}
.login-card button {
  width: 100%;
}
dialog {
  width: min(92vw, 480px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop {
  background: #0008;
}
dialog p {
  margin-top: 12px;
  white-space: pre-wrap;
}
.actions {
  justify-content: flex-end;
  margin-top: 16px;
}
.inline {
  display: flex;
  gap: 8px;
  align-items: end;
}
.inline label {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.system {
  display: flex;
  gap: 16px 24px;
  flex-wrap: wrap;
}
.system span {
  color: var(--muted);
  font-size: 13px;
}
.system strong {
  color: var(--text);
}
.definition {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr);
  gap: 8px 16px;
  margin: 0;
}
.definition dt {
  color: var(--muted);
}
.definition dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.action-block {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.action-block .inline {
  flex: 1 1 260px;
}
.player-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}
.player-row strong {
  color: var(--accent);
}
.player-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.tag {
  display: inline-block;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.nowrap {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}
.switch {
  min-width: 64px;
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
}
.switch[aria-checked="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.incident {
  display: grid;
  gap: 16px;
}
.incident p {
  margin: 4px 0 8px;
}
@media (max-width: 899px) {
  table, tbody, tr, td {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
  }
  td {
    display: grid;
    grid-template-columns: minmax(90px, 35%) minmax(0, 1fr);
    gap: 8px;
    padding: 6px;
    border: 0;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }
}
@media (min-width: 700px) {
  .cards, .form-grid, .incident {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .shell {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: start;
  }
  .rail {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    padding: 24px 16px;
    border-right: 1px solid var(--border);
    background: var(--surface);
  }
  .brand {
    margin: 0 8px 32px;
    font-size: 19px;
    font-weight: 750;
  }
  .brand span {
    color: var(--accent);
  }
  .rail nav {
    display: grid;
    gap: 4px;
  }
  .rail nav button {
    border: 0;
    background: none;
    color: var(--muted);
    text-align: left;
  }
  .rail nav button.active {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .rail > .quiet {
    margin-top: auto;
    text-align: left;
  }
  main {
    padding: 40px;
  }
  .mobile-nav, .more-menu {
    display: none;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161b15;
    --surface: #20271e;
    --text: #edf2e9;
    --muted: #abb7a6;
    --border: #3b4837;
    --accent: #9acb78;
    --accent-soft: #2b3b26;
    --red: #f28b82;
    --amber: #e5bd68;
  }
  button {
    color: #172011;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

label > .switch {
  margin-left: 12px;
}

/* iOS zooms the page when a focused field is under 16px. */
@media (max-width: 899px) {
  input, select, textarea {
    font-size: 16px;
  }
}

/* iOS gives date fields an intrinsic width that pushes past the form. */
input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
}
form {
  min-width: 0;
  max-width: 100%;
}

td > .tag {
  justify-self: start;
}
