:root {
  color-scheme: light dark;
  --background: #f5f7fa;
  --surface: #fff;
  --text: #18232e;
  --muted: #47586a;
  --line: #bdc9d4;
  --accent: #15588b;
  --on-accent: #fff;
  --notice: #edf4fa;
  --error: #9b2529;
  font-family: system-ui, "Yu Gothic UI", sans-serif;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #101820;
    --surface: #19242f;
    --text: #eff5fb;
    --muted: #b1c2d2;
    --line: #596d80;
    --accent: #9bc9f1;
    --on-accent: #132536;
    --notice: #22374a;
    --error: #ffb4b4;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
main { width: min(100% - 2rem, 69rem); margin: 2rem auto 3rem; }
main.narrow { width: min(100% - 2rem, 30rem); }
h1, h2, h3 { line-height: 1.35; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 1rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .5rem 0 1rem; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
nav a { display: inline-block; padding: .35rem 0; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header > div {
  width: min(100% - 2rem, 69rem);
  margin: auto;
  min-height: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
}
.site-name { font-weight: 700; color: var(--text); }
.page-heading { margin-bottom: 1.25rem; }
.page-heading p { margin: .25rem 0 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .65rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  min-width: 0;
  margin-bottom: 1rem;
}
.stack, .fields { display: grid; gap: .8rem; }
.fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
label { display: block; font-weight: 600; min-width: 0; }
label > input:not([type="checkbox"]), label > select { display: block; margin-top: .3rem; width: 100%; }
input, select, button { font: inherit; color: inherit; }
input:not([type="checkbox"]), select, button { min-height: 2.65rem; border-radius: .35rem; }
input:not([type="checkbox"]), select {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: .4rem .6rem;
  min-width: 0;
}
input[type="checkbox"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; margin: 0; }
button {
  border: 1px solid var(--accent);
  padding: .4rem .8rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: var(--surface); color: var(--accent); }
button:disabled { opacity: .65; cursor: default; }
.notice:empty { display: none; }
.notice {
  padding: .65rem .85rem;
  margin: 0 0 1rem;
  border-radius: .35rem;
  background: var(--notice);
  overflow-wrap: anywhere;
}
.notice.error { color: var(--error); }
.muted { color: var(--muted); }
.enrollment { background: var(--notice); padding: .75rem; border-radius: .35rem; }
.enrollment p { margin: 0 0 .5rem; }
.enrollment code { overflow-wrap: anywhere; user-select: all; }
form + nav { margin-top: .8rem; }
.switches { display: grid; gap: .5rem; }
.switch { display: flex; align-items: center; gap: .6rem; min-height: 2.65rem; font-weight: 400; }
.switch input { flex: none; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .35rem; margin: 0 0 .75rem; }
legend { font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: .75rem; }
.cards button { margin-top: .5rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: .55rem .45rem; overflow-wrap: anywhere; }
th { color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td input { width: 100%; }
td button { white-space: nowrap; }
dl.summary { display: flex; flex-wrap: wrap; gap: .65rem 2rem; margin: .5rem 0; }
dt { color: var(--muted); }
dd { margin: 0; font-size: 1.1rem; font-weight: 600; }

@media (max-width: 42rem) {
  main { margin-top: 1.25rem; }
  .responsive-table thead {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .responsive-table tbody, .responsive-table tr { display: block; }
  .responsive-table tr { padding: .4rem 0; border-bottom: 1px solid var(--line); }
  .responsive-table tr:last-child { border-bottom: 0; }
  .responsive-table td { display: block; border: 0; padding: .25rem 0; }
  .responsive-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: .9rem;
  }
}
