:root {
  color-scheme: light dark;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f1f7;
  --text: #1d2030;
  --muted: #646a80;
  --border: #e1e3ec;
  --accent: #4f46e5;
  --accent-soft: #eeedfd;
  --accent-text: #ffffff;
  --ok: #157f3d;
  --ok-soft: #e3f5ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #c0262d;
  --danger-soft: #fde8e8;
  --info: #1d5fbf;
  --info-soft: #e5eefc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 18 35 / 6%), 0 4px 16px rgb(16 18 35 / 4%);
  --sidebar: 15rem;
  --topbar: 3.75rem;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111320;
    --surface: #1a1d2c;
    --surface-2: #22263a;
    --text: #eceef7;
    --muted: #a3a8bf;
    --border: #2e3248;
    --accent: #8b83ff;
    --accent-soft: #2a2851;
    --accent-text: #11122a;
    --ok: #5fd08a;
    --ok-soft: #173424;
    --warn: #f0b75a;
    --warn-soft: #3a2c12;
    --danger: #ff7a7f;
    --danger-soft: #3d1a1d;
    --info: #7fb0ff;
    --info-soft: #182a47;
    --shadow: none;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}
h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.45rem;
}
h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.card > h3 + .grid-2,
.card > p + .grid-2,
.card > p + .table-wrap {
  margin-top: 1rem;
}
.job-when {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
p {
  margin: 0.35rem 0;
}
a {
  color: inherit;
}
.muted {
  color: var(--muted);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Controls */
input,
select,
textarea,
button {
  font: inherit;
  color: var(--text);
}
input:not([type="checkbox"], [type="radio"]),
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s;
}
input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
textarea {
  resize: vertical;
  min-height: 6rem;
}
textarea.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 1.05rem;
  height: 1.05rem;
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    opacity 0.15s;
}
button:disabled {
  opacity: 0.55;
  cursor: progress;
}
button.primary,
form > button:not([class]),
.form-actions > button:not([class]) {
  background: var(--accent);
  color: var(--accent-text);
}
button.primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, black);
}
button.secondary,
button:not([class]) {
  border-color: var(--border);
  background: var(--surface);
}
button.secondary:hover:not(:disabled),
button:not([class]):hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
button.ghost {
  color: var(--muted);
}
button.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}
button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--surface);
}
button.danger:hover:not(:disabled) {
  background: var(--danger-soft);
}
button.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
button.wide {
  width: 100%;
}
.icon {
  width: 1.1rem;
  height: 1.1rem;
}

/* Fields */
.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field > span {
  font-weight: 600;
  font-size: 0.9rem;
}
.field.compact > span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.hint {
  color: var(--muted);
  font-size: 0.82rem;
}
.counter {
  text-align: end;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}
.grid-2 > .field {
  margin: 0;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}
.switch-row > span {
  display: flex;
  flex-direction: column;
}
input.switch {
  appearance: none;
  flex: none;
  width: 2.6rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
input.switch::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.14rem;
  height: 1.14rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: transform 0.2s;
}
input.switch:checked {
  background: var(--accent);
}
input.switch:checked::after {
  transform: translateX(1.1rem);
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.form-actions > .muted {
  margin-inline-end: auto;
  font-size: 0.85rem;
}
details.help {
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0.6rem 0.9rem;
}
details.help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
details.help p {
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Alerts, badges, toast */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin: 0 0 1rem;
}
.alert-error,
.warning {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.info {
  background: var(--info-soft);
  color: var(--info);
}
.toast {
  position: fixed;
  z-index: 50;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 8px 30px rgb(0 0 0 / 25%);
  font-weight: 500;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
.toast.success {
  background: var(--ok);
  color: #fff;
}

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(60rem 30rem at 10% -10%, var(--accent-soft), transparent),
    var(--bg);
}
.login-card {
  width: min(26rem, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.login-card h1 {
  margin-top: 0.5rem;
}
dialog.reauth {
  margin: auto;
  color: inherit;
}
dialog.reauth:not([open]) {
  display: none;
}
dialog.reauth::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-language {
  margin-top: 0.5rem;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.brand small {
  color: var(--muted);
  font-weight: 500;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 800;
}
.brand-large {
  font-size: 1.2rem;
}

/* Shell */
.shell {
  /* Paint the sidebar column down the whole page, however long. */
  background: linear-gradient(
    to right,
    var(--surface) calc(var(--sidebar) - 1px),
    var(--border) calc(var(--sidebar) - 1px) var(--sidebar),
    var(--bg) var(--sidebar)
  );
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  grid-template-areas:
    "top top"
    "side main";
  min-height: 100vh;
}
.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar select {
  width: auto;
  padding: 0.4rem 0.6rem;
}
.user-email {
  font-size: 0.88rem;
}
.sidebar {
  grid-area: side;
  position: sticky;
  top: var(--topbar);
  align-self: start;
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-group {
  margin: 1rem 0.75rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  position: relative;
}
.sidebar a:hover {
  background: var(--surface-2);
}
.sidebar a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.sidebar a.has-error::after {
  content: "!";
  margin-inline-start: auto;
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}
.nav-icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}
.content {
  grid-area: main;
  padding: 1.75rem 2rem 4rem;
  min-width: 0;
}
.view {
  max-width: 72rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}
.lead {
  color: var(--muted);
  max-width: 44rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 0;
  min-width: 0;
}
.card.subtle {
  background: var(--surface-2);
  box-shadow: none;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar,
.bank-status {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.toolbar .field {
  min-width: 12rem;
}
.toolbar-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.bank-status {
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Overview */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.tile-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tile strong {
  font-size: 1.25rem;
}
.tile-note {
  font-size: 0.85rem;
  color: var(--muted);
}
.tile strong.ok,
.state-ok {
  color: var(--ok);
}
.tile strong.warn,
.state-warn {
  color: var(--warn);
}
.tile strong.danger,
.state-danger {
  color: var(--danger);
}
.meter {
  display: block;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 0.35rem 0;
}
.meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}
.meter > span.warn {
  background: var(--warn);
}
.meter > span.danger {
  background: var(--danger);
}

/* Questions */
.question-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
}
.question-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.question-number {
  font-weight: 700;
  color: var(--muted);
}
.question-text {
  font-weight: 600;
  white-space: pre-wrap;
}
.question-options {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0;
  display: grid;
  gap: 0.3rem;
}
.question-options li {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.92rem;
}
.question-options li.correct {
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
}
.question-options li.correct::before {
  content: "✓ ";
}
.question-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.editor {
  border-color: var(--accent);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th {
  text-align: start;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
td.mono {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--muted);
}
td.error-cell {
  color: var(--danger);
  white-space: normal;
  min-width: 10rem;
}
td input[type="number"] {
  width: 5.5rem;
}
/* Trello NAXdWLz3: default + iOS + Android columns of the free plan. */
.access-table td.access-setting {
  white-space: normal;
  min-width: 14rem;
  max-width: 26rem;
}
.access-table td.access-setting .hint {
  display: block;
}
.mix-table td.total {
  font-weight: 700;
}
.mix-table td.total.bad {
  color: var(--danger);
}

/* App update */
fieldset.platform {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
fieldset.platform legend {
  float: left;
  width: 100%;
  padding: 0;
  font-weight: 700;
  font-size: 1.1rem;
}
fieldset.platform legend + * {
  clear: both;
}
.summary {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
}
.summary.force {
  background: var(--danger-soft);
  color: var(--danger);
}
.summary.optional {
  background: var(--info-soft);
  color: var(--info);
}
fieldset.platform.off .field {
  opacity: 0.55;
}

/* Responsive */
@media (max-width: 52rem) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "top"
      "side"
      "main";
  }
  .topbar {
    position: static;
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
  }
  .user-email {
    display: none;
  }
  .shell {
    background: var(--bg);
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 9;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 0.25rem;
  }
  .nav-group {
    display: none;
  }
  .sidebar a {
    flex: none;
    padding: 0.45rem 0.7rem;
  }
  .content {
    padding: 1.25rem 1rem 4rem;
  }
  .view-header {
    flex-direction: column;
  }
  .toolbar .field {
    min-width: 0;
    flex: 1 1 10rem;
  }
  .toolbar-actions {
    margin-inline-start: 0;
  }
}
