:root {
  --bg: #f4f6f8; --card: #fff; --text: #1c2430; --muted: #6b7684; --line: #dde3ea;
  --accent: #0b3d6e; --on-accent: #fff; --ok: #1f7a4a; --warn: #a15c00; --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --card: #1a212a; --text: #e6ebf0; --muted: #9aa5b1; --line: #2c3642; --accent: #6ea8e6; --on-accent: #0b1622; --ok: #5cc48a; --warn: #e0a34a; --bad: #ef7a72; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { background: #0b3d6e; color: #fff; padding: 12px 16px; }
header h1 { margin: 0 0 6px; font-size: 1.2rem; }
nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
nav a, nav .link { color: #fff; opacity: .8; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
nav a.on { opacity: 1; font-weight: 600; border-bottom: 2px solid #fff; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 360px; margin: 40px auto; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
label { display: block; margin-bottom: 10px; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
input, select, button { font: inherit; }
input[type=date], input[type=password], select { display: block; width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px; }
legend { color: var(--muted); font-size: .9rem; padding: 0 4px; }
button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 6px; padding: 9px 16px; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); padding: 5px 12px; }
form.inline { display: inline; }
.sortable { list-style: none; margin: 0; padding: 0; }
.sortable li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); counter-increment: pos; }
.sortable li:last-child { border-bottom: 0; }
.sortable li span { flex: 1; }
.sortable li span::before { content: counter(pos) ". "; color: var(--muted); }
.sortable button { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 2px 10px; }
.sortable { counter-reset: pos; }
.preview { margin: 0; padding-left: 24px; font-size: .92rem; }
.preview .more { list-style: none; color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; }
.flash { background: var(--card); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 6px; }
.warn { background: var(--card); border-left: 4px solid var(--warn); padding: 10px 12px; border-radius: 6px; }
.req { border-top: 1px solid var(--line); padding: 10px 0; }
.req:first-of-type { border-top: 0; }
.req-head { display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: .8rem; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; }
.st-booked .badge { color: var(--ok); }
.st-failed .badge { color: var(--bad); }
.st-simulated .badge, .st-skipped .badge { color: var(--warn); }
.st-cancelled, .st-expired { opacity: .6; }
.result { margin: 4px 0; font-size: .92rem; }
pre { white-space: pre-wrap; font-size: .82rem; margin: 0; }
details.options { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
details.options summary { cursor: pointer; padding: 2px 0; }
details.options[open] summary { margin-bottom: 10px; }
button.run-now { padding: 5px 12px; margin-right: 6px; }
details.req-details > summary { list-style: none; cursor: pointer; }
details.req-details > summary::-webkit-details-marker { display: none; }
.more-link { color: var(--accent); font-size: .85rem; margin-left: 6px; }
.more-link::after { content: ' ▾'; }
details.req-details[open] .more-link::after { content: ' ▴'; }
.req-prefs { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0; font-size: .92rem; }
.req-prefs dt { color: var(--muted); }
.req-prefs dd { margin: 0; }
.sortable li.off span { text-decoration: line-through; color: var(--muted); }
.court-on { width: 18px; height: 18px; margin: 0 4px 0 0; accent-color: var(--accent); }
.preset-row { align-items: flex-end; }
.preset-row button { margin-bottom: 10px; white-space: nowrap; }
input[type=text] { display: block; width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.button-link { display: inline-block; padding: 5px 12px; margin-right: 6px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); text-decoration: none; }
.cancel-link { margin-left: 12px; color: var(--muted); }
.preview .extra { display: none; }
.preview.expanded .extra { display: list-item; }
.preview .more { list-style: none; color: var(--accent); cursor: pointer; margin-top: 4px; }
.preset-tag { color: var(--accent); }
