/* themes: <html data-theme="system|light|dark|pink">, chosen in the settings */
:root, :root[data-theme="light"] {
  color-scheme:light;
  --bg:#f5f7fb; --bg-top:#e9eefb; --card:#fff; --input:#f8f9fc; --text:#1a2233; --muted:#667085; --line:#e6e9f0;
  --accent:#3d63dd; --accent-soft:#eef2fd; --ok:#1e9e5a; --bad:#d64545;
  --shadow:0 1px 2px rgba(16,24,40,.04), 0 4px 14px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme:dark;
    --bg:#14171d; --bg-top:#14171d; --card:#1c2029; --input:#14171d; --text:#e6e9ef; --muted:#9aa3b5; --line:#2c3240;
    --accent:#6d97f5; --accent-soft:#1f2a44; --ok:#3cc47c; --bad:#f06a6a; --shadow:none;
  }
}
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#14171d; --bg-top:#14171d; --card:#1c2029; --input:#14171d; --text:#e6e9ef; --muted:#9aa3b5; --line:#2c3240;
  --accent:#6d97f5; --accent-soft:#1f2a44; --ok:#3cc47c; --bad:#f06a6a; --shadow:none;
}
/* buttons: filled with the accent by default; the pink theme makes them white with pink text */
:root { --btn-bg:var(--accent); --btn-text:#fff; --btn-line:var(--accent); --btn-hover:var(--accent);
        --ok-bg:var(--ok); --ok-text:#fff; }
:root[data-theme="pink"] {
  color-scheme:light;
  --btn-bg:#fff; --btn-text:#c2306f; --btn-line:#f0bcd2; --btn-hover:#fff0f6; --ok-bg:#f1faf5; --ok-text:#23855e;
  --bg:#fdf4f8; --bg-top:#fbdfeb; --card:#fff; --input:#fff7fb; --text:#3a1d2c; --muted:#94677d; --line:#f3d8e4;
  --accent:#d63f84; --accent-soft:#fde6f0; --ok:#2a9d6f; --bad:#c62f3c;
  --shadow:0 1px 2px rgba(120,30,70,.05), 0 6px 18px rgba(214,63,132,.09);
}
* { box-sizing:border-box; }
body { margin:0; font:15px/1.5 system-ui, sans-serif; color:var(--text);
       background:var(--bg) linear-gradient(180deg, var(--bg-top), var(--bg) 340px) no-repeat; min-height:100vh; }
nav { background:var(--card); border-bottom:1px solid var(--line); box-shadow:var(--shadow); padding:0 16px;
      display:flex; gap:20px; position:sticky; top:0; z-index:20; }  /* stays on top while scrolling */
nav a { padding:14px 0; color:var(--muted); text-decoration:none; font-weight:500; }
nav a.on { color:var(--text); box-shadow:inset 0 -2px var(--accent); }
.menu { margin-left:auto; position:relative; align-self:center; }
.menu summary { border:0; padding:6px; display:flex; color:var(--muted); }
.menu summary:hover, .menu.on summary { color:var(--text); }
.dropdown { position:absolute; right:0; top:calc(100% + 6px); min-width:190px; z-index:10;
            display:flex; flex-direction:column; padding:6px; box-shadow:0 8px 24px rgba(0,0,0,.25); }
.dropdown span { padding:6px 12px; font-size:13px; }
nav .dropdown a { padding:8px 12px; border-radius:6px; color:var(--text); }
nav .dropdown a:hover { background:var(--accent-soft); }
/* browser autofill paints inputs yellow; keep the site's colors */
input:-webkit-autofill { -webkit-box-shadow:0 0 0 40px var(--input) inset; -webkit-text-fill-color:var(--text);
                         caret-color:var(--text); }
main { max-width:820px; margin:0 auto; padding:20px 16px 60px; }
h1 { font-size:24px; margin:4px 0 16px; }
h2 { font-size:17px; margin:28px 0 10px; }
a { color:var(--accent); }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
.row { display:flex; align-items:center; gap:12px; padding:10px 14px; border-top:1px solid var(--line); flex-wrap:wrap; }
.row:first-child { border-top:0; }
.grow { flex:1; min-width:140px; }
.muted { color:var(--muted); }
.day { font-size:13px; font-weight:600; color:var(--muted); text-transform:uppercase; margin:18px 0 6px; }
.day.late { color:var(--bad); }
form.inline { display:inline-flex; gap:6px; margin:0; }
form.add { display:flex; gap:8px; flex-wrap:wrap; align-items:center; padding:12px 14px; }
form.add + form.add { border-top:1px solid var(--line); }
input, select, button, summary { font:inherit; padding:7px 10px; border-radius:8px; border:1px solid var(--line);
                                 background:var(--input); color:var(--text); }
input:focus, select:focus { outline:2px solid var(--accent-soft); border-color:var(--accent); }
input[type=checkbox] { padding:0; }
button { cursor:pointer; background:var(--btn-bg); color:var(--btn-text); border-color:var(--btn-line); }
button:hover { filter:brightness(1.06); }
:root[data-theme="pink"] main button:not(.ghost):hover { background:var(--btn-hover); filter:none; }
:root[data-theme="pink"] main button:not(.ghost) { box-shadow:0 1px 2px rgba(214,63,132,.12); font-weight:500; }
button.ghost, summary { background:transparent; color:var(--muted); border-color:var(--line); cursor:pointer; }
button.ghost:hover, summary:hover { background:var(--accent-soft); color:var(--text); filter:none; }
button.ok { background:var(--ok-bg); border-color:var(--ok); color:var(--ok-text); }
details { display:inline-block; }
details.move[open] summary { display:none; }
summary { list-style:none; }
summary::-webkit-details-marker { display:none; }
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:10px; }
.stats + .stats { margin-top:10px; }
.label { font-size:13px; font-weight:600; color:var(--muted); text-transform:uppercase; margin:0 0 6px; }
.nums { display:flex; gap:12px; flex-wrap:wrap; }
.nums span { min-width:64px; text-align:right; }
.head { font-size:13px; color:var(--muted); }
@media (max-width:600px) { .hide-sm { display:none; } }
.stat { padding:14px; text-align:center; }
.stat b { display:block; font-size:28px; }
.left { font-weight:600; white-space:nowrap; }
.left.low { color:var(--bad); }
.done { text-decoration:line-through; color:var(--muted); }
.empty { padding:18px 14px; color:var(--muted); }
.msg { padding:10px 14px; margin-bottom:12px; border-radius:8px; border:1px solid var(--line); }
.msg.err { color:var(--bad); border-color:var(--bad); }
.msg.ok { color:var(--ok); border-color:var(--ok); }
.narrow { max-width:360px; margin:40px auto; }
.js .js-hide { display:none; }  /* fallbacks for when the script is off */
.toast { position:fixed; left:50%; bottom:20px; transform:translateX(-50%); z-index:30; width:max-content;
         max-width:calc(100% - 32px); display:flex; gap:12px; align-items:center; padding:10px 10px 10px 16px;
         border-radius:10px; background:var(--text); color:var(--bg); box-shadow:0 8px 28px rgba(0,0,0,.3);
         transition:opacity .3s; }
.toast button { background:transparent; color:inherit; border-color:currentColor; padding:5px 10px; font-weight:600; }
.toast .x { border-color:transparent; opacity:.7; padding:5px 8px; }
.narrow form.add { flex-direction:column; align-items:stretch; }
.stat .sub { display:block; font-size:12px; color:var(--muted); margin-top:4px; }
.badge { font-size:12px; padding:2px 9px; border-radius:20px; border:1px solid var(--line); color:var(--muted); white-space:nowrap; }
.badge.ok { color:var(--ok); border-color:var(--ok); }
.badge.wait { color:var(--accent); border-color:var(--accent); }
.badge.bad { color:var(--bad); border-color:var(--bad); }
/* theme picker in the settings */
.themes { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:10px; }
.themes button { display:flex; flex-direction:column; gap:8px; align-items:stretch; padding:10px; text-align:left;
                 background:var(--card); color:var(--text); border:1px solid var(--line); border-radius:12px;
                 box-shadow:var(--shadow); }
.themes button.on { border-color:var(--accent); outline:2px solid var(--accent-soft); }
.swatch { height:54px; border-radius:8px; border:1px solid rgba(0,0,0,.08); position:relative; overflow:hidden; }
.swatch::after { content:""; position:absolute; left:10px; right:40%; bottom:10px; height:10px; border-radius:5px; }
.sw-light { background:linear-gradient(180deg, #e9eefb, #f5f7fb); }
.sw-light::after { background:#3d63dd; }
.sw-dark { background:#14171d; }
.sw-dark::after { background:#6d97f5; }
.sw-pink { background:linear-gradient(180deg, #fbdfeb, #fdf4f8); }
.sw-pink::after { background:#d63f84; }
.sw-system { background:linear-gradient(115deg, #f5f7fb 0 50%, #14171d 50% 100%); border-color:transparent; }
.sw-system::after { background:linear-gradient(90deg, #3d63dd 50%, #6d97f5 50%); }
/* "delete lesson" dialog: pick what happens to the pack, then confirm */
dialog.ask { border:1px solid var(--line); border-radius:14px; background:var(--card); color:var(--text);
             padding:20px; width:min(440px, calc(100% - 32px)); box-shadow:0 16px 48px rgba(0,0,0,.35); }
dialog.ask::backdrop { background:rgba(0,0,0,.45); }
dialog.ask .q { margin:0 0 14px; font-size:17px; font-weight:600; }
dialog.ask .choice { display:grid; gap:8px; }
dialog.ask .choice button { background:var(--input); color:var(--text); border-color:var(--line); text-align:left;
                            padding:10px 12px; box-shadow:none; }
dialog.ask .choice button.on { border-color:var(--accent); background:var(--accent-soft); font-weight:600; }
dialog.ask .hint { margin:12px 0 16px; font-size:13px; min-height:38px; }
dialog.ask .actions { display:flex; gap:8px; justify-content:flex-end; }
button:disabled { opacity:.45; cursor:not-allowed; filter:none; }
.row.unpaid > .grow { opacity:.6; }  /* schedule: a regular day with no paid lesson left */
