/* Layout: one narrow column; calendar home → single-day timetable; sheets slide up for filters & class actions. */
:root {
  --bg: #eef2f1;          /* sea-salt grey with a teal bias */
  --surface: #ffffff;
  --ink: #15201f;
  --muted: #5d6b69;
  --line: #d6dfdd;
  --ocean: #0b6f6a;       /* accent: Atlantic teal */
  --ocean-soft: #d5ebe8;
  --sun: #d99a0b;         /* favourites: Fuerteventura sun */
  --sun-soft: #fbefd0;
  --ok: #23803a;
  --bad: #b93a32;
  --wish: #7a4fc4;        /* shortlist */
  --wish-soft: #ece4fa;
  --fresh: #1f6fe0;       /* fresh = new or changed in the last 24 h */
  --fresh-soft: #dce9fb;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1514; --surface: #182120; --ink: #e5eceb; --muted: #93a3a0; --line: #2a3634;
  --ocean: #45b3ab; --ocean-soft: #17322f; --sun: #f0b93a; --sun-soft: #3a2f14;
  --ok: #6cc77f; --bad: #ec7d74; --wish: #b494f0; --wish-soft: #2b2340; --fresh: #78b0ff; --fresh-soft: #16294a; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1514; --surface: #182120; --ink: #e5eceb; --muted: #93a3a0; --line: #2a3634;
  --ocean: #45b3ab; --ocean-soft: #17322f; --sun: #f0b93a; --sun-soft: #3a2f14;
  --ok: #6cc77f; --bad: #ec7d74; --wish: #b494f0; --wish-soft: #2b2340; --fresh: #78b0ff; --fresh-soft: #16294a; color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); }
.wrap { max-width: 680px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 12px 96px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ocean); outline-offset: 2px; }

/* top bar */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar h1 { font: 700 26px/1 var(--display); letter-spacing: .01em; margin: 0; flex: 1; min-width: 0; text-wrap: balance; }
.bar h1 small { display: block; font: 500 12px/1.3 var(--body); color: var(--muted); letter-spacing: 0; margin-top: 3px; }
.iconbtn { min-width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; padding: 0 10px; }
.iconbtn.on { background: var(--ocean); border-color: var(--ocean); color: var(--surface); }
.lang { height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 8px; }
.stamp { font-size: 12px; color: var(--muted); margin: 6px 0 14px; }

/* home: big today / tomorrow */
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bigday { text-align: left; border: 0; border-radius: 18px; padding: 14px 16px; background: var(--ocean); color: var(--surface); display: grid; gap: 4px; }
.bigday + .bigday { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.bigday .k { font: 600 13px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.bigday .d { font: 700 30px/1 var(--display); }
.bigday .m { font-size: 13px; opacity: .9; }
.bigday:disabled { opacity: .45; cursor: default; }

/* calendar */
.sec { font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wd { font: 600 11px/1 var(--body); color: var(--muted); text-align: center; padding-bottom: 2px; text-transform: uppercase; letter-spacing: .06em; }
.cell { aspect-ratio: 1 / 1.05; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 6px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; min-width: 0; }
.cell .n { font: 700 20px/1 var(--display); }
.cell .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cell .dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dot-wish { background: var(--wish); } .dot-fav { background: var(--sun); } .dot-booked { background: var(--ok); }
.cell.live { border-color: var(--ocean); }
.cell.live .n { color: var(--ocean); }
.cell.forecast { background: transparent; border-style: dashed; }
.cell.empty { background: transparent; border-color: transparent; color: var(--muted); cursor: default; }
.cell.today { background: var(--ocean); border-color: var(--ocean); }
.cell.today .n, .cell.today .cap { color: var(--surface); }
.cell .cap { font-size: 10px; color: var(--muted); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend .sq { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ocean); }
.legend .sq.dash { border: 1px dashed var(--muted); }

/* shortlist on home */
.wishlist { display: grid; gap: 8px; }
.wishrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; text-align: left; }
.wishrow .when { font: 700 16px/1.05 var(--display); min-width: 54px; }
.wishrow .when small { display: block; font: 500 11px/1.2 var(--body); color: var(--muted); }
.wishrow .what { min-width: 0; }
.wishrow .what b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wishrow .what span { font-size: 12px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); } .pill.wait { color: var(--wish); } .pill.booked { background: var(--ok); color: var(--surface); border-color: var(--ok); } .pill.muted { color: var(--muted); }
.emptynote { color: var(--muted); font-size: 13px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px; }

/* day view */
.daynav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; }
.daynav button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 6px 12px; white-space: nowrap; display: grid; line-height: 1.1; text-align: center; }
.daynav button b { font: 700 18px/1 var(--display); }
.daynav button small { font-size: 11px; color: var(--muted); }
.daynav button.on { background: var(--ocean); border-color: var(--ocean); color: var(--surface); }
.daynav button.on small { color: var(--surface); }
.daynav button.fc { border-style: dashed; }
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; }
.chip.on { background: var(--ocean-soft); border-color: var(--ocean); color: var(--ink); font-weight: 600; }
.banner { background: var(--wish-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 8px 0; }
.period { font: 700 15px/1 var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 20px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.period span { font: 500 12px/1 var(--body); letter-spacing: 0; text-transform: none; }

.cardwrap { position: relative; border-radius: 14px; overflow: hidden; margin: 6px 0; background: var(--bg); }
.swipebg { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; font-weight: 600; font-size: 13px; }
.swipebg .l { color: var(--wish); } .swipebg .r { color: var(--bad); }
.card { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; touch-action: pan-y; transition: transform .18s ease; width: 100%; text-align: left; }
.card.dragging { transition: none; }
.card .t { font: 700 20px/1 var(--display); font-variant-numeric: tabular-nums; }
.card .t small { display: block; font: 500 12px/1.4 var(--body); color: var(--muted); }
.card .nm { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.card .sub .fav { color: var(--sun); font-weight: 600; }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.tag.free { color: var(--ok); } .tag.paid { color: var(--ink); }
.marks { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 15px; }
.card.fav { border-color: var(--sun); box-shadow: inset 4px 0 0 var(--sun); background: linear-gradient(90deg, var(--sun-soft), var(--surface) 55%); }
.card.wish { box-shadow: inset 4px 0 0 var(--wish); }
.card.fav.wish { box-shadow: inset 4px 0 0 var(--wish); }
.card.booked { box-shadow: inset 4px 0 0 var(--ok); }
.card.isfull { opacity: .62; }
.card.past { opacity: .45; }
.collapse { width: 100%; margin-top: 14px; border: 1px dashed var(--line); background: transparent; border-radius: 12px; padding: 10px; color: var(--muted); font-size: 13px; text-align: left; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 86vh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); box-shadow: 0 -10px 30px rgb(0 0 0 / .18); }
.sheet .inner { max-width: 680px; margin: 0 auto; }
.sheet h2 { font: 700 22px/1.1 var(--display); margin: 4px 0 2px; text-wrap: balance; }
.sheet .meta { color: var(--muted); font-size: 13px; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 8px; }
.sheet { padding-top: 0; }
.sheethead { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-top: 10px; margin: 0 -2px; touch-action: none; cursor: grab; }
.sheethead .row { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sheethead h2 { flex: 1; min-width: 0; margin: 0; }
.done { border: 0; border-radius: 10px; background: var(--ocean); color: var(--surface); font-weight: 600; padding: 8px 14px; }
.sheetfoot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); background: var(--surface); padding: 10px 0 calc(20px + env(safe-area-inset-bottom, 0px)); margin-bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); margin-top: 12px; }
.sheetfoot .done { width: 100%; padding: 12px; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.trow > span { min-width: 0; overflow-wrap: anywhere; }
.trow.isfav > span { color: var(--sun); font-weight: 600; }
.trow.ishidden > span { color: var(--muted); text-decoration: line-through; }
.tri button { min-width: 38px; }
.tri button.on.fv { background: var(--sun); }
.tri button.on.hd { background: var(--bad); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.act { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 11px 12px; text-align: left; font-weight: 500; }
.act.on { border-color: currentColor; font-weight: 600; }
.act.wishc.on { color: var(--wish); background: var(--wish-soft); }
.act.favc.on { color: var(--sun); background: var(--sun-soft); }
.act.okc.on { color: var(--ok); }
.act.hidec { color: var(--bad); }
.act.wide { grid-column: 1 / -1; text-align: center; background: var(--ocean); color: var(--surface); border-color: var(--ocean); text-decoration: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

.fgroup { border-top: 1px solid var(--line); padding: 10px 0; }
.fgroup summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 600; list-style: none; gap: 8px; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary .cnt { font-weight: 400; font-size: 12px; color: var(--muted); }
.acts { display: grid; gap: 2px; margin-top: 8px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.toggle:last-child { border-bottom: 0; }
.toggle span { min-width: 0; overflow-wrap: anywhere; }
.sw { position: relative; width: 40px; height: 24px; flex: none; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 12px; background: var(--line); transition: background .15s; pointer-events: none; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.sw input:checked + i { background: var(--ocean); }
.sw input:checked + i::after { transform: translateX(16px); }
.sw input:focus-visible + i { outline: 2px solid var(--ocean); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); padding: 6px 11px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ocean); color: var(--surface); }
.frow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.frow label { font-weight: 600; }
.trainers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.trainers .chip.on { background: var(--sun-soft); border-color: var(--sun); }
.searchbox { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); margin: 8px 0 4px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px; display: flex; gap: 14px; align-items: center; font-size: 14px; max-width: calc(100% - 32px); }
.toast button { background: none; border: 0; color: var(--sun); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .card, .sw i, .sw i::after { transition: none; } }

/* --- app additions: account sheet, sync, forms --- */
html, body { margin: 0; overflow-anchor: none; }
.iconbtn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.form { display: grid; gap: 10px; margin-top: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form input, .form select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 16px; }
.form .done { padding: 12px; }
.err { color: var(--bad); font-size: 13px; }
.ok { color: var(--ok); font-size: 13px; }
.note { font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.copyrow { display: flex; gap: 8px; align-items: center; }
.copyrow input { flex: 1; min-width: 0; font-size: 12px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.danger { border: 1px solid var(--bad); color: var(--bad); background: transparent; border-radius: 10px; padding: 10px; }
.persons { display: flex; gap: 12px; flex-wrap: wrap; }
.persons label { flex: 1; min-width: 120px; }
@media (prefers-reduced-motion: reduce) { .iconbtn.spin { animation: none; } }
.link { background: none; border: 0; padding: 0; color: inherit; text-align: left; font: inherit; min-width: 0; overflow-wrap: anywhere; }
.trow .link { color: var(--ink); }
.trow.isfav .link { color: var(--sun); font-weight: 600; }
.trow.ishidden .link { color: var(--muted); text-decoration: line-through; }
a.act { color: inherit; text-decoration: none; display: block; }
/* hour slots with sticky headers */
.slot { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3; display: flex; align-items: baseline; gap: 10px; margin: 14px -4px 4px; padding: 8px 4px 6px; background: var(--bg); border-bottom: 1px solid var(--line); }
.slot b { font: 700 20px/1 var(--display); font-variant-numeric: tabular-nums; }
.slot .per { font: 600 11px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.slot .cnt { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 65%; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
/* classes that overlap something already saved: greyed and indented */
.cardwrap.clashwrap { margin-left: 22px; }
.card.clash { background: var(--bg); border-style: dashed; }
.card.clash > * { opacity: .55; }
.card.clash .t { color: var(--muted); }
.clashnote { display: block; font-size: 12px; color: var(--wish); margin-top: 4px; }
.toast { width: calc(100% - 32px); max-width: 480px; justify-content: space-between; }
.toast span { min-width: 0; }

/* --- free mode v2 --- */
.iconbtn { min-width: 44px; height: 44px; }
.done { min-height: 44px; }
.done.wide { width: 100%; margin-top: 14px; }
.chip { min-height: 44px; padding: 0 14px; }
.daynav button { min-height: 44px; min-width: 44px; }
.seg button { min-height: 44px; min-width: 44px; }
.tri button { min-width: 48px; }
.act { min-height: 44px; }
.collapse { min-height: 44px; }
.wishrow { min-height: 52px; }
.trow { min-height: 52px; }
.link { min-height: 44px; display: inline-flex; align-items: center; }
.toggle { min-height: 48px; }
.sw { width: 48px; height: 28px; }
.sw i { border-radius: 14px; }
.sw i::after { top: 4px; left: 4px; width: 20px; height: 20px; }
.sw input:checked + i::after { transform: translateX(20px); }
select { min-height: 44px; }
.dot-fresh { background: var(--fresh); }
i.dot-fresh { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.card.fresh { outline: 2px solid var(--fresh); outline-offset: -2px; }
.card.fc { border-style: dashed; }
.card.cancelled .nm { text-decoration: line-through; color: var(--muted); }
.strike { text-decoration: line-through; }
.chg { display: block; font-size: 12px; font-weight: 600; color: var(--fresh); margin-top: 3px; }
.chgbox { background: var(--fresh-soft); color: var(--fresh); border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin: 8px 0; }
.cell.partial { border-style: dashed; }
.sub3 { font: 600 13px/1 var(--body); color: var(--ink); margin: 12px 0 6px; }
.fyrow { display: grid; gap: 6px; }
.fyact { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.fyact .act { text-align: center; }
.fyact .act.wide { grid-column: auto; }
.opts { display: grid; gap: 4px; margin-top: 14px; }
.opt .act { width: 100%; }
.opt .hint { margin: 4px 2px 8px; }
.actions.one { grid-template-columns: 1fr; }
.calitem { border-top: 1px solid var(--line); padding: 8px 0; }
.calname { margin: 4px 0; font-size: 14px; } .calname span { color: var(--muted); font-size: 12px; }
.calrow { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; min-height: 48px; }
.calrow .sw { margin-top: 2px; }
.calrow small { display: block; font-size: 12px; color: var(--muted); }
.exp { font-size: 11px; font-style: normal; color: var(--ok); border: 1px solid currentColor; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.foot { margin-top: 28px; text-align: center; border-top: 1px solid var(--line); padding-top: 14px; }
.foot .stamp { margin: 4px 0; }
.reload { min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0 18px; font-weight: 600; }
.reload.spin { opacity: .6; }
.notice { background: var(--ocean-soft); border-radius: 14px; padding: 12px; margin: 10px 0; font-size: 13px; }
.notice p { margin: 0 0 10px; }
.notice .row { display: flex; gap: 8px; flex-wrap: wrap; }
.testcal { margin-top: 28px; border: 2px dashed var(--fresh); border-radius: 14px; padding: 12px; }
.desc { white-space: pre-line; font-size: 14px; margin: 0; overflow-wrap: anywhere; }
input.upper { text-transform: uppercase; letter-spacing: .1em; }
.gh { display: flex; justify-content: space-between; font-weight: 600; margin: 4px 0; }
.gh .cnt { font-weight: 400; font-size: 12px; color: var(--muted); }
.sheethead .grab { height: 6px; width: 48px; }
.sheethead { padding-top: 12px; }
a.act { display: flex; align-items: center; }
a.act.wide { justify-content: center; }

.sheetfoot.two { display: flex; gap: 8px; }
.sheetfoot.two > * { flex: 1; text-align: center; justify-content: center; }
.sheetfoot.two .done { width: auto; padding: 12px; }
.fyact .act { padding: 10px 6px; font-size: 14px; }
