:root {
    --bg: #f6f7f5;
    --surface: #ffffff;
    --text: #1d2420;
    --muted: #5f6b64;
    --accent: #1f6f43;
    --accent-text: #ffffff;
    --warn: #8a5a00;
    --warn-bg: #fff3d6;
    --error: #a31d1d;
    --border: #dfe3e0;
    --ok: #1f6f43;
    --ok-bg: #e3f3e9;
    --error-bg: #fbe7e7;
    --range-bg: #e8eef9;
    --booked: #b45309;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121614;
        --surface: #1b211e;
        --text: #e6ebe8;
        --muted: #9aa7a0;
        --accent: #4fb07b;
        --accent-text: #0d1310;
        --warn: #f0c060;
        --warn-bg: #3a2f14;
        --error: #ff8a8a;
        --border: #2c3531;
        --ok: #7fd3a3;
        --ok-bg: #18382a;
        --error-bg: #3a1c1c;
        --range-bg: #1d2a3d;
        --booked: #f0a35a;
    }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); text-decoration: none; }
nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
nav a { color: var(--text); text-decoration: none; }
main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin: 1rem 0; overflow-x: auto; }
.narrow { max-width: 420px; margin: 2rem auto; }
.hero { padding: 3rem 0; }
.hero h1 { font-size: 2.2rem; margin: 0 0 .5rem; }
label { display: block; margin: .75rem 0; }
input { display: block; width: 100%; padding: .55rem .6rem; margin-top: .25rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.button, button.button { display: inline-block; padding: .55rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-text); font: inherit; text-decoration: none; cursor: pointer; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.badge { display: inline-block; padding: 0 .4rem; border-radius: 4px; border: 1px solid var(--border); font-size: .8rem; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }

/* ---- forms, feedback, set-up ---------------------------------------------------------------- */
.flash { padding: .6rem .9rem; border-radius: 6px; margin: .5rem 0 1rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--error-bg); color: var(--error); }
.crumbs { margin: 0 0 .25rem; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
h1 .code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8em; }
.button.small, button.button.small { padding: .3rem .65rem; font-size: .88rem; }
.button.secondary, button.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.warn-text { color: var(--warn); margin: .25rem 0 0; }
tr.is-disabled td { color: var(--muted); }
td.actions { text-align: right; }
td.actions > * { margin-left: .25rem; }
td.wrap { white-space: normal; min-width: 10rem; }
table.compact td { padding: .3rem .5rem; }
input.rank { width: 4.5rem; margin: 0; }
select { display: block; width: 100%; padding: .55rem .6rem; margin-top: .25rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1rem; align-items: end; }
.grid-form label { margin: .5rem 0; }
label.check { display: flex; gap: .5rem; align-items: center; }
label.check input { width: auto; margin: 0; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0; grid-column: 1 / -1; }
.field-error { color: var(--error); font-size: .88rem; margin: .25rem 0 0; }
.inline-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-row input, .inline-row select { width: auto; flex: 1 1 10rem; margin: 0; }
details summary { cursor: pointer; }
.inline-h { display: inline; font-size: 1.15rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.step { display: block; color: var(--text); text-decoration: none; position: relative; }
.step:hover { border-color: var(--accent); }
.step h2 { margin: .25rem 0; font-size: 1.1rem; }
.step p { margin: .2rem 0; }
.step-no { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; }

/* ---- usable-days calendar ------------------------------------------------------------------------ */
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.title-row h1 { margin: .25rem 0; }
.season-nav { display: flex; gap: .6rem; align-items: center; }
.cal-tools h2 { margin-top: 0; }
.cal-range, .cal-weekdays, .cal-actions, .cal-mode { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .5rem 0; }
.cal-range label { margin: 0; }
.cal-range input { width: auto; }
.cal-weekdays { gap: .4rem; }
.cal-mode label { display: flex; gap: .35rem; align-items: center; margin: 0; }
.cal-mode input { width: auto; margin: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .88rem; margin: .5rem 0 0; }
.sw { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; vertical-align: -2px; margin-right: .25rem; border: 1px solid var(--border); }
.sw-selected { background: var(--accent); border-color: var(--accent); }
.sw-range { background: var(--range-bg); }
.sw-booked { box-shadow: inset 0 -3px 0 var(--booked); }
.cal-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 1rem; margin: 1rem 0 5rem; user-select: none; -webkit-user-select: none; }
.cal-month { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem .8rem; }
.cal-month h3 { margin: 0 0 .4rem; font-size: 1rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-head { text-align: center; font-size: .75rem; color: var(--muted); padding-bottom: 2px; }
.cal-day { aspect-ratio: 1; min-height: 2rem; border: 1px solid transparent; border-radius: 5px; background: var(--bg); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; padding: 0; touch-action: manipulation; }
.cal-day.is-weekend { font-weight: 600; }
.cal-day.in-range { background: var(--range-bg); }
.cal-day.is-selected { background: var(--accent); color: var(--accent-text); }
.cal-day.is-booked { box-shadow: inset 0 -3px 0 var(--booked); }
.cal-day.is-today { border-color: var(--text); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-savebar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .7rem 1rem; background: var(--surface); border-top: 1px solid var(--border); z-index: 5; }
@media (max-width: 600px) {
    .cal-months { grid-template-columns: 1fr; }
    td.actions { white-space: normal; }
}
