/* Theme tokens: "system" follows the operating system, "light" and "dark" are explicit. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #fff;
  --hover: #f0f4f1;
  --row-hover: #f6faf7;
  --notice-bg: #f3f7f4;
  --text: #24332e;
  --text-soft: #43574d;
  --muted: #6f7a75;
  --border: #dce2df;
  --line: #e3e8e5;
  --line-soft: #edf0ee;
  --accent: #215e4a;
  --accent-hover: #174a39;
  --on-accent: #fff;
  --link: #215e4a;
  --current-bg: #e5f2ec;
  --current: #174a39;
  --focus: #82b8a1;
  --chart: #53957b;
  --danger: #b64342;
  --danger-fill: #b64342;
  --neutral-bg: #eef1ef;
  --neutral: #4c5853;
  --ok-bg: #e3f3ea;
  --ok: #1d6b48;
  --warn-bg: #fdf1d8;
  --warn: #8a5a00;
  --bad-bg: #fbe5e4;
  --bad: #a33a39;
  --info-bg: #e4eefb;
  --info: #2d5a94;
  --toast-bg: #24332e;
  --toast: #fff;
  --backdrop: #1d2a2466;
  --shadow: #0003;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1513;
  --surface: #161e1b;
  --hover: #212c28;
  --row-hover: #1b2421;
  --notice-bg: #1b2421;
  --text: #dbe5e0;
  --text-soft: #a9bcb2;
  --muted: #8d9a94;
  --border: #2f3b36;
  --line: #243029;
  --line-soft: #232d29;
  --accent: #2f7d62;
  --accent-hover: #38916f;
  --on-accent: #fff;
  --link: #7cc6a6;
  --current-bg: #1f3a30;
  --current: #a6dcc3;
  --focus: #5fa486;
  --chart: #4f9a7c;
  --danger: #f08b84;
  --danger-fill: #b84a47;
  --neutral-bg: #232b2e;
  --neutral: #b4c0bb;
  --ok-bg: #183326;
  --ok: #7cc79a;
  --warn-bg: #33290f;
  --warn: #e2b866;
  --bad-bg: #3a1d1d;
  --bad: #f08b84;
  --info-bg: #1b2a3d;
  --info: #8db5ea;
  --toast-bg: #dbe5e0;
  --toast: #0f1513;
  --backdrop: #000000a6;
  --shadow: #00000080;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0f1513;
    --surface: #161e1b;
    --hover: #212c28;
    --row-hover: #1b2421;
    --notice-bg: #1b2421;
    --text: #dbe5e0;
    --text-soft: #a9bcb2;
    --muted: #8d9a94;
    --border: #2f3b36;
    --line: #243029;
    --line-soft: #232d29;
    --accent: #2f7d62;
    --accent-hover: #38916f;
    --on-accent: #fff;
    --link: #7cc6a6;
    --current-bg: #1f3a30;
    --current: #a6dcc3;
    --focus: #5fa486;
    --chart: #4f9a7c;
    --danger: #f08b84;
    --danger-fill: #b84a47;
    --neutral-bg: #232b2e;
    --neutral: #b4c0bb;
    --ok-bg: #183326;
    --ok: #7cc79a;
    --warn-bg: #33290f;
    --warn: #e2b866;
    --bad-bg: #3a1d1d;
    --bad: #f08b84;
    --info-bg: #1b2a3d;
    --info: #8db5ea;
    --toast-bg: #dbe5e0;
    --toast: #0f1513;
    --backdrop: #000000a6;
    --shadow: #00000080;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font:
    14px system-ui,
    "Segoe UI",
    Arial,
    sans-serif;
  line-height: 1.5;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 14px;
  font-weight: 600;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.primary:hover {
  background: var(--accent-hover);
}
.primary.danger-fill {
  background: var(--danger-fill);
  border-color: var(--danger-fill);
}
.secondary:hover {
  background: var(--hover);
}
.danger {
  color: var(--danger);
}
.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--link);
  font-weight: 600;
}
h1 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 17px;
  margin: 0 0 12px;
}
p {
  margin: 0 0 12px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 14px;
}
label.check {
  flex-direction: row;
  align-items: center;
  font-weight: 500;
}
input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
input[type="checkbox"] {
  width: auto;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.error {
  color: var(--danger);
  white-space: pre-line;
}
.error:empty {
  display: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.6px;
}
.brand span {
  font-weight: 400;
  margin-left: -5px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.login-card {
  width: min(400px, 100%);
}
.login-card button {
  width: 100%;
}
.captcha-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.login-card .captcha-row button {
  width: auto;
  font-size: 18px;
}
.captcha-row img {
  /* The picture keeps its own light background in both themes. */
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f1ea;
  max-width: 100%;
  height: auto;
}
.layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  margin-bottom: 18px;
  padding: 0 8px;
}
.nav {
  border: 0;
  text-align: left;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav:hover {
  background: var(--hover);
}
.nav[aria-current="page"] {
  background: var(--current-bg);
  color: var(--current);
  font-weight: 650;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 0 8px;
}
.content {
  padding: 28px 32px;
  min-width: 0;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  margin-bottom: 18px;
}
.two {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  margin-bottom: 18px;
}
.tile .value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.tile .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
}
.row > label {
  margin: 0;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
td.num,
th.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover {
  background: var(--row-hover);
}
.badge {
  display: inline-block;
  white-space: nowrap;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--neutral-bg);
  color: var(--neutral);
}
.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.badge.info {
  background: var(--info-bg);
  color: var(--info);
}
.pill {
  background: var(--danger-fill);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: 11px;
  padding: 0 7px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
}
.bars span {
  flex: 1;
  background: var(--chart);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.progress {
  height: 6px;
  background: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
  min-width: 120px;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.mono {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}
dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(520px, calc(100% - 32px));
  box-shadow: 0 20px 60px var(--shadow);
}
dialog::backdrop {
  background: var(--backdrop);
}
.dialog {
  padding: 22px;
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--toast-bg);
  color: var(--toast);
  border-radius: 8px;
  padding: 10px 16px;
  max-width: calc(100% - 32px);
}
.detail dt {
  color: var(--muted);
  font-size: 12px;
}
.detail dd {
  margin: 0 0 10px;
}
.notice {
  background: var(--notice-bg);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-soft);
}
@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar .brand {
    width: 100%;
    margin-bottom: 6px;
  }
  .sidebar-bottom {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .content {
    padding: 20px 16px;
  }
  .two {
    grid-template-columns: 1fr;
  }
}
