/* SkateZone ASD – v2.4.0 */
:root {
  --yellow: #FFF50F;
  --yellow-2: #FFE600;
  --red: #E60000;
  --red-ink: #C40000;
  --black: #111111;

  --bg: #F6F3E4;
  --surface: #FFFFFF;
  --surface-2: #FBF9EF;
  --ink: #111111;
  --muted: #5E5B50;
  --line: #E3DECA;
  --card-border: #111111;
  --card-shadow: #111111;
  --focus: #FFE600;
  --overlay: rgba(10, 10, 10, .55);
  --paid-bg: #111111;
  --paid-ink: #FFF50F;
  --price-border: #111111;
  --today-bg: rgba(255, 245, 15, .22);
  --past-bg: rgba(230, 0, 0, .07);

  --r: 12px;
  --r-sm: 8px;
  --gap: 16px;
  --nav-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Arial Black", "Helvetica Neue", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0C0C;
    --surface: #191919;
    --surface-2: #202020;
    --ink: #F4F2EA;
    --muted: #A8A493;
    --line: #2E2E2E;
    --card-border: #3A3A3A;
    --card-shadow: #000000;
    --red: #FF3B30;
    --red-ink: #FF5247;
    --overlay: rgba(0, 0, 0, .7);
    --paid-bg: #FFF50F;
    --paid-ink: #111111;
    --price-border: #3A3A3A;
    --today-bg: rgba(255, 245, 15, .10);
    --past-bg: rgba(255, 59, 48, .12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-tap-highlight-color: transparent;
}
img { display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 18px; height: 18px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  background: var(--black); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, var(--black) 12px 24px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 44px; height: 44px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 900; font-size: 19px; letter-spacing: .02em; color: var(--yellow); white-space: nowrap; }
.brand-name em { font-style: normal; color: #fff; font-size: 13px; letter-spacing: .08em; margin-left: 2px; }
.brand-sub { font-size: 12px; color: #BDBAA8; letter-spacing: .04em; margin-top: 3px; white-space: nowrap; }
.ver { display: inline-block; background: var(--red); color: #fff; font-weight: 800; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 2px; letter-spacing: .03em; }

.topnav { display: none; gap: 4px; margin-left: 8px; }
.topnav a {
  text-decoration: none; color: #EDEBE0; font-weight: 700; font-size: 15px;
  padding: 8px 12px; border-radius: 8px;
}
.topnav a:hover { background: #222; }
.topnav a.active { color: var(--black); background: var(--yellow); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions .top-new { display: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; color: var(--yellow);
  background: transparent; border: 2px solid #333; cursor: pointer; text-decoration: none;
}
.icon-btn.active { background: var(--yellow); color: var(--black); border-color: var(--yellow); }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-right));
  background: var(--black);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  border-top: 3px solid var(--yellow);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #A9A696; text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 6px 0;
}
.bottomnav a.active { color: var(--yellow); }
.fab {
  justify-self: center; width: 54px; height: 54px; margin-top: -26px;
  background: var(--yellow); color: var(--black);
  border: 3px solid var(--black); outline: 2px solid var(--yellow);
  transform: rotate(45deg); border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.fab .ico { transform: rotate(-45deg); width: 28px; height: 28px; stroke-width: 3; }
.fab:active { transform: rotate(45deg) scale(.94); }

.appfoot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 8px; letter-spacing: .03em; }

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) 8px max(16px, env(safe-area-inset-right)); outline: none; }
#banners { max-width: 1080px; margin: 0 auto; padding: 18px 16px 0; }
#banners:empty { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 26px; line-height: 1.05; margin: 0; letter-spacing: .01em; }
.page-title small { display: block; font-family: var(--font); font-weight: 600; text-transform: none; font-size: 14px; color: var(--muted); letter-spacing: 0; margin-top: 4px; }
.section-title { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 15px; letter-spacing: .04em; margin: 28px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title .link { font-family: var(--font); font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--red-ink); text-decoration: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; margin-bottom: 6px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 2px solid var(--card-border);
  border-radius: var(--r); box-shadow: 4px 4px 0 var(--card-shadow);
  padding: 16px;
}
.card.flat { box-shadow: none; border-color: var(--line); }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 4px; font-size: 18px; }

/* Hero */
.hero {
  background: var(--yellow); color: var(--black);
  border: 2px solid var(--black); border-radius: var(--r); box-shadow: 4px 4px 0 var(--black);
  padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.hero .h-date { font-weight: 700; text-transform: capitalize; font-size: 15px; }
.hero .h-big { font-family: var(--font-display); font-weight: 900; font-size: 30px; line-height: 1; margin-top: 4px; }
.hero .h-sub { font-weight: 600; font-size: 14px; margin-top: 6px; }
.hero .btn { background: var(--black); color: var(--yellow); border-color: var(--black); box-shadow: none; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.stat { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-sm); padding: 12px; }
.stat .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v.red { color: var(--red-ink); }
.stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Instructor cards */
.coach-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.coach {
  background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r);
  box-shadow: 4px 4px 0 var(--card-shadow); padding: 14px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.coach-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coach-name { font-family: var(--font-display); font-weight: 900; font-size: 18px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dia {
  width: 30px; height: 30px; flex: none; position: relative; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; font-size: 13px; color: var(--black);
}
.dia::before {
  content: ""; position: absolute; inset: 4px; background: var(--yellow); border: 2px solid var(--black);
  transform: rotate(45deg); border-radius: 3px;
}
.dia span { position: relative; }
.dia.lg { width: 46px; height: 46px; font-size: 18px; }
.dia.lg::before { inset: 6px; border-width: 3px; }
.coach .due { font-family: var(--font-display); font-weight: 900; font-size: 24px; color: var(--red-ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.coach .due.zero { color: var(--muted); }
.coach .lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.coach .kv { font-size: 13px; }
.coach .kv dt { white-space: nowrap; }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  font-weight: 800; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn:active { transform: translate(2px, 2px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--yellow); color: var(--black); border-color: var(--black); box-shadow: 3px 3px 0 var(--card-shadow); }
.btn-primary:active { box-shadow: 1px 1px 0 var(--card-shadow); }
.topbar .btn-primary { box-shadow: none; border-color: var(--yellow); }
.btn-pay { background: var(--black); color: var(--yellow); border-color: var(--black); }
.btn-pay[disabled] { background: transparent; color: var(--muted); border-color: var(--line); opacity: 1; }
@media (prefers-color-scheme: dark) { .tabs a.active { background: var(--yellow); color: var(--black); } }
@media (prefers-color-scheme: dark) { .btn-pay { background: var(--yellow); color: var(--black); border-color: var(--yellow); } }
.btn-danger { background: transparent; color: var(--red-ink); border-color: var(--red); }
.btn-danger-solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 17px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.input, .select, textarea.input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: 74px; resize: vertical; }
.select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.input:focus, .select:focus, .dp-btn:focus-visible, .btn:focus-visible, .chip:focus-within, .icon-btn:focus-visible {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); }
.err { color: var(--red-ink); font-size: 13px; font-weight: 700; }
.with-btn { display: flex; gap: 8px; }
.with-btn .select { flex: 1; min-width: 0; }

/* Instructor chips */
.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 8px 4px; border: 2px solid var(--line); border-radius: 10px;
  font-weight: 800; font-size: 14px; background: var(--surface); text-align: center;
}
.chip input:checked + span { background: var(--yellow); color: var(--black); border-color: var(--black); box-shadow: 3px 3px 0 var(--card-shadow); }
.chip input:checked + span .dia::before { background: var(--black); border-color: var(--black); }
.chip input:checked + span .dia { color: var(--yellow); }

/* Price box */
.pricebox {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--black); color: #fff; border-radius: 10px; padding: 12px 14px; margin: 4px 0 16px;
  border: 2px solid var(--price-border);
}
.pricebox .p { font-family: var(--font-display); font-weight: 900; font-size: 24px; color: var(--yellow); font-variant-numeric: tabular-nums; }
.pricebox .d { font-size: 13px; color: #CFCBB8; }

/* ---------- Date picker ---------- */
.dp { position: relative; }
.dp-btn {
  width: 100%; min-height: 50px; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px;
}
.dp-btn .t { flex: 1; text-transform: capitalize; font-weight: 600; }
.dp-btn .ico.sm { color: var(--muted); }
.dp-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: min(340px, 100%);
  background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r);
  box-shadow: 4px 4px 0 var(--card-shadow), 0 12px 30px rgba(0,0,0,.18); padding: 10px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-head b { text-transform: capitalize; font-size: 16px; }
.dp-nav { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.dp-day {
  position: relative; height: 40px; border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px;
}
.dp-day:hover { background: var(--surface-2); }
.dp-day.out { color: var(--muted); opacity: .45; }
.dp-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.dp-day.sel { background: var(--yellow); color: var(--black); box-shadow: inset 0 0 0 2px var(--black); font-weight: 900; }
.dp-day.has::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--red); }
.dp-foot { display: flex; gap: 6px; margin-top: 8px; }
.dp-foot .btn { flex: 1; }

/* ---------- Lists ---------- */
.list { background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r); box-shadow: 4px 4px 0 var(--card-shadow); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line);
  text-decoration: none; background: transparent; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer;
  color: inherit; font: inherit;
}
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .t1 { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .t2 { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-item .amt { font-weight: 900; font-variant-numeric: tabular-nums; }
.timebox { flex: none; width: 54px; text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; font-size: 15px; }
.timebox small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.day-sep { padding: 8px 14px; background: var(--surface-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.day-sep:first-child { border-top: 0; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

.badge { display: inline-block; font-size: 10.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; white-space: nowrap; }
.badge-due { background: var(--red); color: #fff; }
.badge-paid { background: var(--paid-bg); color: var(--paid-ink); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* Filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.filters .search { grid-column: 1 / -1; position: relative; }
.filters .wide { grid-column: 1 / -1; }
.filters .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters .search .input { padding-left: 42px; }
.sumbar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-items: center;
  background: var(--black); color: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px;
}
.sumbar b { color: var(--yellow); font-variant-numeric: tabular-nums; }

/* Banners */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 10px;
  background: var(--surface); border: 2px solid var(--card-border); border-left: 10px solid var(--yellow); border-radius: 10px; font-size: 14px;
}
.banner.warn { border-left-color: var(--red); }
.banner .main { flex: 1; }
.banner b { display: block; }

/* Danger zone */
.danger { border: 2px dashed var(--red); border-radius: var(--r); padding: 16px; background: transparent; }
.danger h3 { color: var(--red-ink); margin: 0 0 6px; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; font-family: var(--font-display); }
.danger p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.danger .row + p { margin-top: 12px; }

/* ---------- Sheet / dialog ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
.sheet {
  width: 100%; max-height: 92vh; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 18px 18px 0 0; border-top: 4px solid var(--yellow);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
  animation: up .2s ease;
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px; margin: 0 -16px 4px;
  border-bottom: 2px solid var(--line);
}
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-weight: 900; text-transform: uppercase; font-size: 20px; }
.sheet-body { padding-top: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions .btn { flex: 1; }
.dialog .sheet-body p { margin: 0 0 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; margin-bottom: 12px; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--red); flex: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

/* Toasts */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: var(--black); color: var(--yellow); border: 2px solid var(--yellow);
  padding: 10px 16px; border-radius: 10px; font-weight: 800; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  animation: up .2s ease; max-width: 520px;
}
.toast.err { color: #fff; background: var(--red); border-color: var(--red); }

/* Backup list */
.bk-meta { font-size: 13px; color: var(--muted); }
.folder-box { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface-2); margin-bottom: 12px; }
.folder-box .main { flex: 1; min-width: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.on { background: #18A558; }
.status-dot.warn { background: var(--red); }


/* ---------- v0.2: tabella "Da fare", crediti allievi ---------- */
.tabs { display: flex; gap: 6px; background: var(--surface); border: 2px solid var(--card-border); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; border-radius: 8px; font-weight: 800; text-decoration: none; color: var(--muted); }
.tabs a.active { background: var(--black); color: var(--yellow); }
.tabs .count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--red); color: #fff; font-size: 12px; line-height: 1.5; }
.filters-2 { grid-template-columns: 1fr 1fr; }

.agenda-wrap { background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r); box-shadow: 4px 4px 0 var(--card-shadow); overflow: hidden; }
table.agenda { width: 100%; border-collapse: collapse; font-size: 15px; }
.agenda th { text-align: left; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.agenda td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.agenda tbody tr:first-child td { border-top: 0; }
.agenda tbody tr { cursor: pointer; }
.agenda tbody tr:hover { background: var(--surface-2); }
.agenda tr.is-today { background: var(--today-bg); }
.agenda tr.is-past { background: var(--past-bg); }
.agenda .c-time { font-weight: 900; font-variant-numeric: tabular-nums; }
.agenda .c-date { text-transform: capitalize; white-space: nowrap; font-weight: 600; }
.agenda .c-who { font-weight: 800; }
.agenda .c-dur { white-space: nowrap; color: var(--muted); }
.agenda .c-act { text-align: right; white-space: nowrap; width: 1%; }
.agenda .c-meta { display: none; }
.tag-past { display: inline-block; font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--red-ink); margin-left: 4px; }
.red-txt { color: var(--red-ink); }
.btn-done { min-width: 92px; }

.badge-warn { background: transparent; color: var(--red-ink); border: 1.5px solid var(--red); padding: 2px 6px; }

.credit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 2px solid var(--card-border); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: 4px 4px 0 var(--card-shadow); }
.credit > div { padding: 12px 6px; text-align: center; border-left: 1px solid var(--line); min-width: 0; }
.credit > div:first-child { border-left: 0; }
.credit .k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.credit .v { font-family: var(--font-display); font-weight: 900; font-size: 28px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.credit .rest { background: var(--yellow); color: var(--black); border-left-color: var(--black); }
.credit .rest .k { color: #3a3a2a; }
.credit .rest.neg { background: var(--red); color: #fff; }
.credit .rest.neg .k { color: #fff; }

.credit-hint { font-weight: 700; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 2px 0 0; }
.credit-hint.neg { color: var(--red-ink); border-color: var(--red); }
.status-line { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.status-line.done { background: var(--today-bg); }

[data-nav] { position: relative; }
.nav-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; }
.bottomnav .nav-badge { position: absolute; top: 2px; left: 50%; margin-left: 6px; }
.topnav .nav-badge { margin-left: 6px; vertical-align: 1px; }

.toast { display: flex; align-items: center; gap: 12px; }
.toast.has-action { pointer-events: auto; }
.toast button { flex: none; background: var(--yellow); color: var(--black); border: 0; border-radius: 6px; padding: 6px 10px; font-weight: 900; font-size: 13px; cursor: pointer; }

@media (max-width: 719px) {
  .agenda thead { display: none; }
  .agenda, .agenda tbody { display: block; }
  .agenda tbody tr {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-areas: "time who act" "date meta act";
    column-gap: 10px; row-gap: 1px; padding: 10px 12px; border-top: 1px solid var(--line);
  }
  .agenda tbody tr:first-child { border-top: 0; }
  .agenda td { padding: 0; border: 0; }
  .agenda .c-time { grid-area: time; font-size: 17px; }
  .agenda .c-date { grid-area: date; font-size: 12px; color: var(--muted); }
  .agenda .c-date .tag-past { display: none; }
  .agenda .c-who { grid-area: who; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .agenda .c-meta { display: block; grid-area: meta; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .agenda .c-instr, .agenda .c-dur, .agenda .c-cov { display: none; }
  .agenda .c-act { grid-area: act; align-self: center; width: auto; }
  .btn-done { min-width: 0; }
  .credit .v { font-size: 24px; }
}


/* ---------- v0.3: istruttori e WhatsApp ---------- */
.chips { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
.btn-wa { background: #25D366; color: #06301a; border-color: #128C4A; }
.btn-wa:hover { filter: brightness(1.04); }
.wa-preview {
  white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 14px; line-height: 1.45;
  background: var(--surface); border: 2px solid var(--line); border-left: 6px solid #25D366; border-radius: 10px;
  padding: 12px 14px; margin: 0 0 14px; max-height: 40vh; overflow: auto;
}
.coach-phone { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); margin-top: -4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ico.xs { width: 14px; height: 14px; }
.wa-fix { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin: -4px 0 14px; padding: 10px 12px; border: 1.5px dashed var(--red); border-radius: 10px; font-size: 13.5px; color: var(--red-ink); font-weight: 700; }
body.has-sheet #toasts { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; }


/* ---------- v0.5: orari occupati ---------- */
.chip .busy-tag { display: none; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--red-ink); line-height: 1; }
.chip.is-busy .busy-tag { display: block; }
.chip.is-busy > span { border-style: dashed; border-color: var(--red); }
.chip.is-busy input:checked + span { border-style: solid; border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.conflict { border: 2px solid var(--red); background: var(--past-bg); border-radius: 10px; padding: 12px 14px; margin: -2px 0 14px; font-size: 14px; }
.conflict p { margin: 6px 0 0; }
.conflict-head { display: flex; align-items: center; gap: 6px; font-weight: 900; color: var(--red-ink); text-transform: uppercase; letter-spacing: .04em; font-size: 13px; }
.conflict-free { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--red); }
@media (max-width: 719px) { .agenda .c-who .tag-past { display: none; } }


/* ---------- v0.6: sincronizzazione ---------- */
.sync-ind { position: relative; }
.sync-ind[hidden] { display: none !important; }
.sync-dot { position: absolute; right: 5px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: #18A558; border: 2px solid var(--black); }
.sync-ind[data-state="busy"] .sync-dot { background: var(--yellow); animation: szpulse 1s ease-in-out infinite; }
.sync-ind[data-state="warn"] .sync-dot { background: var(--red); }
.status-dot.busy { background: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--black); animation: szpulse 1s ease-in-out infinite; }
.sync-card { border-color: var(--card-border); }
.sync-card .folder-box { margin-bottom: 12px; }
@keyframes szpulse { 50% { opacity: .35; } }


/* ---------- v0.9: scheda allievo e storico ---------- */
.kv-wide { grid-template-columns: minmax(118px, max-content) 1fr; gap: 7px 16px; font-size: 14.5px; }
.kv-wide dd { text-align: left; font-weight: 600; }
.kv-wide dd.pre { white-space: pre-wrap; }
.kv-wide a { color: inherit; font-weight: 800; }
.info-card { margin-top: 14px; }
.tl-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-chip { border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; }
.tl-chip span { color: var(--muted); font-weight: 700; margin-left: 2px; }
.tl-chip.active { background: var(--black); color: var(--yellow); border-color: var(--black); }
.tl-chip.active span { color: #CFCBB8; }
.timeline { background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r); box-shadow: 4px 4px 0 var(--card-shadow); overflow: hidden; }
.tl-month { padding: 8px 14px; background: var(--surface-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px solid var(--line); }
.tl-month:first-child { border-top: 0; }
.tl-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; width: 100%; text-align: left; background: transparent; color: inherit; font: inherit; border: 0; border-top: 1px solid var(--line); border-left: 6px solid transparent; }
button.tl-item { cursor: pointer; }
button.tl-item:hover { background: var(--surface-2); }
.tl-pay { border-left-color: #18A558; }
.tl-done { border-left-color: var(--ink); }
.tl-planned { border-left-color: var(--yellow); }
.tl-late { border-left-color: var(--red); background: var(--past-bg); }
.tl-date { width: 38px; flex: none; text-align: center; line-height: 1.05; }
.tl-date b { display: block; font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.tl-date small { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.tl-main { flex: 1; min-width: 0; }
.tl-tag { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tl-pay .tl-tag { color: #128C4A; }
.tl-late .tl-tag { color: var(--red-ink); }
.tl-main .t1 { font-weight: 800; }
.tl-main .t2 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tl-delta { font-family: var(--font-display); font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
.tl-delta.plus { color: #128C4A; }
.tl-bal { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tl-del { flex: none; min-height: 34px; padding: 0 9px; }
.print-only { display: none; }
@media (prefers-color-scheme: dark) {
  .tl-chip.active { background: var(--yellow); color: var(--black); border-color: var(--yellow); }
  .tl-chip.active span { color: #3a3a2a; }
  .tl-pay .tl-tag, .tl-delta.plus { color: #3DDC84; }
}
@media (min-width: 900px) { .student-split { grid-template-columns: 1fr 1.1fr; } }
@media print {
  .no-print, .tl-filters, .tl-del, .back-link, .agenda .c-act { display: none !important; }
  .print-only { display: block; font-size: 12px; color: #555; margin: 0 0 6px; }
  .split { display: block; }
  .card, .timeline, .credit, .agenda-wrap { box-shadow: none !important; break-inside: avoid; }
  .tl-item { break-inside: avoid; }
  main { padding-top: 0; }
}


/* ---------- v1.0: lezioni solo storico ---------- */
.tl-hist { border-left-color: var(--muted); border-left-style: dashed; }
.tl-hist .tl-tag { color: var(--muted); }
.note-box { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border: 1.5px dashed var(--muted); border-radius: 10px; font-size: 13.5px; background: var(--surface-2); }
.note-box .ico { margin-top: 2px; color: var(--muted); }
.section-title .btn { font-family: var(--font); text-transform: none; letter-spacing: 0; }

/* ---------- v1.1: gruppi, ricorrenze, documenti, avvisi, riepilogo, calendario ---------- */
.form-sec { margin: 6px 0 12px; padding-top: 12px; border-top: 2px dashed var(--line); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--red-ink); }
.warn-txt { color: #A06F00; }
.tag-group { display: inline-block; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px; background: var(--black); color: var(--yellow); vertical-align: 1px; white-space: nowrap; }
.toast button + button { margin-left: -4px; }

/* form lezione */
.group-rows { display: grid; gap: 8px; margin-top: 4px; }
.group-rows:empty { display: none; }
.group-row .g-credit { margin: 4px 0 0; }
.group-row .g-credit:empty { display: none; }
#lf-credit:empty { display: none; }
.add-member { align-self: flex-start; margin-top: 2px; color: var(--red-ink); padding-left: 2px; padding-right: 6px; }
.group-hint { margin: 2px 0 0; }
.conflict.soft { border-color: #C9A400; background: var(--today-bg); }
.conflict.soft .conflict-head { color: var(--ink); }
.conflict.soft .conflict-free { border-top-color: #C9A400; }
.conflict-free > span:empty { display: none; }
.rep-prev { margin-top: 2px; border: 2px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.rep-head { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.rep-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rep-d { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.rep-d.skip { color: var(--red-ink); border-color: var(--red); background: var(--past-bg); }
.pack-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.pack-quick .btn.active { background: var(--yellow); color: var(--black); border-color: var(--black); }

/* Home: promemoria di domani e avvisi */
.remind-card { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 2px solid #128C4A; border-radius: var(--r); background: rgba(37, 211, 102, .10); }
.remind-card.done { border-color: var(--line); background: var(--surface); }
.rc-ico { width: 40px; height: 40px; border-radius: 50%; background: #25D366; color: #06301a; display: flex; align-items: center; justify-content: center; flex: none; }
.remind-card.done .rc-ico { background: var(--surface-2); color: #18A558; }
.remind-card .main { flex: 1; min-width: 0; }
.remind-card .main b { display: block; }
.remind-card .main span { font-size: 13px; color: var(--muted); }
.count-pill { display: inline-block; min-width: 22px; padding: 1px 8px; border-radius: 11px; background: var(--red); color: #fff; font-family: var(--font); font-size: 12px; letter-spacing: 0; text-align: center; margin-right: auto; }
.alert-item { cursor: default; gap: 10px; padding: 10px 12px; }
.alert-item .main { color: inherit; text-decoration: none; }
.al-ico { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.al-red .al-ico { background: var(--red); color: #fff; }
.al-warn .al-ico { background: var(--yellow); color: var(--black); border: 1.5px solid var(--black); }
.al-act { display: flex; gap: 6px; flex: none; }
.al-act .btn { padding: 0 9px; min-height: 36px; }
.list-more { display: block; width: 100%; padding: 11px; border: 0; border-top: 1px solid var(--line); background: var(--surface-2); font: inherit; font-weight: 800; color: var(--red-ink); cursor: pointer; }
.rem-list { display: grid; gap: 8px; margin-bottom: 8px; }
.rem-item { border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rem-item.sent { border-color: #18A558; background: rgba(24, 165, 88, .06); }
.rem-head { display: flex; align-items: center; gap: 8px; }
.rem-name { font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-ok { display: none; }
.rem-item.sent .rem-ok { display: inline-block; background: #18A558; color: #fff; }
.rem-sub { font-size: 13px; color: var(--muted); margin: 2px 0 8px; text-transform: none; }
.rem-btns { gap: 8px; }
.doc-warn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border: 2px solid var(--red); border-radius: 10px; background: var(--past-bg); font-size: 14px; }
.doc-warn > span { flex: 1; min-width: 200px; }
.doc-warn > .ico { color: var(--red-ink); }

/* Impostazioni: listino */
.price-list { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.price-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-top: 1px solid var(--line); font-size: 14.5px; }
.price-row:first-child { border-top: 0; }
.price-row b { font-variant-numeric: tabular-nums; }
.price-row .muted { font-size: 12.5px; }
.price-add { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; margin-bottom: 14px; }

/* Calendario settimanale */
.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wk-label { flex: 1; text-align: center; min-width: 0; }
.wk-label b { display: block; font-size: 16px; }
.wk-label span { font-size: 13px; color: var(--muted); }
.cal-help { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.cal-legend { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
.lg-planned { background: var(--yellow); border: 1.5px solid var(--black); }
.lg-done { background: var(--black); border: 1.5px solid var(--black); }
.lg-late { background: var(--red); }
.cal-scroll { overflow-x: auto; background: var(--surface); border: 2px solid var(--card-border); border-radius: var(--r); box-shadow: 4px 4px 0 var(--card-shadow); -webkit-overflow-scrolling: touch; }
.cal { min-width: 680px; }
.cal-row { display: flex; align-items: stretch; }
.cal-name { width: 100px; flex: none; position: sticky; left: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; gap: 4px; padding: 0 6px; font-size: 13px; font-weight: 800; border-right: 1px solid var(--line); }
.cal-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-scale { position: relative; flex: 1; height: 24px; }
.cal-scale span { position: absolute; top: 5px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-scale span:first-child { transform: none; padding-left: 3px; }
.cal-scale span:last-child { transform: translateX(-100%); padding-right: 3px; }
.cal-day { border-top: 2px solid var(--card-border); }
.cal-dhead { display: flex; gap: 12px; padding: 6px 10px; background: var(--surface-2); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.cal-dhead span { position: sticky; left: 10px; }
.cal-dhead span + span { color: var(--muted); font-weight: 700; text-transform: none; letter-spacing: 0; left: auto; }
.cal-day.is-today .cal-dhead { background: var(--yellow); color: var(--black); }
.cal-day.is-today .cal-dhead span + span { color: #3a3a2a; }
.cal-lane {
  position: relative; flex: 1; height: 42px; border-top: 1px solid var(--line); cursor: pointer;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--hours)) 100%;
}
.cal-day.is-past .cal-lane { background-color: var(--surface-2); }
.cal-lane:hover { background-color: var(--today-bg); }
.cal-ev {
  position: absolute; top: 4px; bottom: 4px; min-width: 8px; border-radius: 6px; border: 1.5px solid var(--black);
  background: var(--yellow); color: var(--black); font: inherit; font-size: 11.5px; line-height: 1.15; padding: 2px 5px;
  text-align: left; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; justify-content: center; box-shadow: 2px 2px 0 var(--card-shadow);
}
.cal-ev b { font-size: 11px; font-variant-numeric: tabular-nums; }
.cal-ev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.cal-ev.ev-done { background: var(--black); color: var(--yellow); }
.cal-ev.ev-late { background: var(--red); color: #fff; border-color: var(--red); }

@media (prefers-color-scheme: dark) {
  .tag-group { background: var(--yellow); color: var(--black); }
  .warn-txt { color: #FFD60A; }
  .lg-done, .cal-ev.ev-done { background: #3a3a3a; border-color: #555; }
  .cal-ev.ev-done { color: var(--yellow); }
  .pack-quick .btn.active { border-color: var(--yellow); }
}
@media (max-width: 719px) {
  .cal { min-width: 600px; }
  .cal-name { width: 74px; }
  .cal-name .dia { display: none; }
  .remind-card { flex-wrap: wrap; }
  .remind-card .main { flex: 1 1 180px; }
  .remind-card .btn { flex: 1 1 100%; }
  .alert-item .t2 { white-space: normal; }
  .price-row .muted { display: none; }
  .price-row { grid-template-columns: 1fr auto auto; }
}
@media print {
  .remind-card, .alert-list, .count-pill { display: none !important; }
  .stats .stat { break-inside: avoid; }
}

/* ---------- v1.2: pagamenti nello storico ---------- */
.tl-pay[data-action] { cursor: pointer; }
.tl-pay[data-action]:hover { background: var(--surface-2); }

/* ---------- v1.3: pagamenti degli allievi ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 8px; font-weight: 800; font-size: 14px; color: var(--muted); text-align: center; min-height: 46px; line-height: 1.15; }
.seg input:checked + span { background: var(--black); color: var(--yellow); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); }
[data-kind][hidden] { display: none !important; }
#student-pays { flex-wrap: wrap; scroll-margin-top: 96px; }
.sec-sub { font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--muted); text-transform: none; letter-spacing: 0; margin-right: auto; }
.pay-item { cursor: default; gap: 10px; }
.pay-item.money { box-shadow: inset 5px 0 0 #18A558; }
.pay-date { width: 40px; text-align: center; flex: none; line-height: 1.05; }
.pay-date b { display: block; font-family: var(--font-display); font-size: 19px; font-variant-numeric: tabular-nums; }
.pay-date small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.pay-item .t1 { font-variant-numeric: tabular-nums; }
.pay-item .t2 { white-space: normal; }
.credit > a { display: block; padding: 12px 6px; text-align: center; min-width: 0; text-decoration: none; color: inherit; }
.credit-link:hover { background: var(--surface-2); }
.credit-link .k { color: var(--red-ink); }
@media (max-width: 420px) { .hide-xs { display: none; } }
@media (prefers-color-scheme: dark) { .seg input:checked + span { background: var(--yellow); color: var(--black); } }

/* ---------- v1.6: anagrafica da screenshot ---------- */
.ocr-box { border: 2px dashed var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 16px; background: var(--surface-2); transition: border-color .15s, background .15s; }
.ocr-box.drag { border-color: var(--black); background: var(--today-bg); }
.ocr-head { display: flex; align-items: center; gap: 10px; }
.ocr-head .main { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.ocr-head .main b { display: block; color: var(--ink); font-size: 15px; }
.ocr-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--yellow); color: var(--black); border: 2px solid var(--black); display: flex; align-items: center; justify-content: center; flex: none; }
.ocr-pick { flex: none; cursor: pointer; position: relative; }
.ocr-status { margin-top: 10px; font-size: 13.5px; display: grid; gap: 4px; }
.ocr-status b { display: flex; align-items: center; gap: 6px; }
.ocr-status.ok b { color: #128C4A; }
.ocr-status.warn b { color: #A06F00; }
.ocr-status.err { color: var(--red-ink); font-weight: 700; }
.ocr-status.busy { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ocr-dup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 2px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: szspin .8s linear infinite; flex: none; }
@keyframes szspin { to { transform: rotate(360deg); } }
.ocr-thumb { display: block; margin-top: 10px; max-width: 100%; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.ocr-running .sheet-actions .btn-primary { opacity: .5; pointer-events: none; }
.input.ocr-filled, .select.ocr-filled { background: var(--today-bg); border-color: #C9A400; }
.input.ocr-check, .select.ocr-check { border-color: var(--red); box-shadow: 0 0 0 2px var(--past-bg); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }
.sf-row-cf { grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); }
.sf-row-addr { grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr) minmax(0, .6fr); }
@media (max-width: 420px) { .ocr-head .main span { font-size: 12.5px; } }
@media (prefers-color-scheme: dark) {
  .ocr-status.ok b { color: #3DDC84; }
  .ocr-status.warn b { color: #FFD60A; }
  .ocr-thumb { background: #fff; }
}

/* ---------- v1.7: ricevute ---------- */
.rc-row-top { grid-template-columns: minmax(0, .7fr) minmax(0, 1.6fr); }
.rc-head, .rc-line { display: grid; grid-template-columns: minmax(0, 1fr) 62px 96px 44px; gap: 6px; align-items: center; }
.rc-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 4px; }
#rc-lines { display: grid; gap: 8px; }
.rc-line .input { min-width: 0; padding-left: 10px; padding-right: 8px; }
.rc-del { padding: 0; min-height: 44px; }
.rc-linked { grid-column: 1 / -1; margin-top: -4px; font-size: 11.5px; color: #128C4A; font-weight: 700; }
.rc-quick .btn { font-size: 13px; }
.rc-chip { font-variant-numeric: tabular-nums; }
.rc-ask { margin: 0 0 12px; padding-left: 20px; }
.rc-head-m { display: none; margin: 0 0 6px; }
.rc-item-add { grid-template-columns: minmax(0, 1.8fr) minmax(0, .8fr) auto; }
.rc-item-row { grid-template-columns: 1fr auto auto; }
@media (max-width: 560px) {
  .rc-head { display: none; }
  .rc-head-m { display: block; }
  .rc-line { grid-template-columns: 54px minmax(0, 1fr) 44px; }
  .rc-line .rc-desc { grid-column: 1 / -1; }
  .rc-line .rc-qty { grid-column: 1; }
  .rc-line .rc-price { grid-column: 2; }
  .rc-line { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
}
@media (prefers-color-scheme: dark) { .rc-linked { color: #3DDC84; } }

/* Ricevuta stampata: 2 copie su un foglio A4 */
#print-area { display: none; }
@page { size: A4 portrait; margin: 8mm; }
@media print {
  body.print-receipt { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  body.print-receipt > *:not(#print-area) { display: none !important; }
  body.print-receipt #print-area { display: block !important; }
}
.rcp-page { width: 194mm; margin: 0 auto; color: #111; font-family: var(--font); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rcp { height: 135mm; box-sizing: border-box; padding: 6mm 7mm 6mm; border: 0.4mm solid #111; border-radius: 3mm; position: relative; display: flex; flex-direction: column; overflow: hidden; break-inside: avoid; page-break-inside: avoid; background: #fff; }
.rcp-cut { height: 8mm; display: flex; align-items: center; gap: 2mm; color: #999; font-size: 10pt; }
.rcp-cut::before, .rcp-cut::after { content: ""; flex: 1; border-top: 0.3mm dashed #999; }
.rcp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; }
.rcp-org { display: flex; gap: 3.5mm; align-items: center; font-size: 8.5pt; color: #333; line-height: 1.4; min-width: 0; }
.rcp-logo { width: 19mm; height: 19mm; flex: none; }
.rcp-name { font-family: var(--font-display); font-weight: 900; font-size: 18pt; color: #111; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; }
.rcp-sub { font-weight: 700; color: #111; }
.rcp-no { text-align: right; flex: none; }
.rcp-copy { font-size: 7pt; color: #777; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 1.5mm; }
.rcp-title { display: inline-block; background: #111; color: #FFF50F; font-family: var(--font-display); font-weight: 900; font-size: 15pt; padding: 1.6mm 3.6mm; border-radius: 1.6mm; text-transform: uppercase; white-space: nowrap; }
.rcp-date { margin-top: 2.5mm; color: #C40000; font-weight: 800; font-size: 11.5pt; }
.rcp-stripe { height: 2.4mm; margin: 4mm 0 3mm; background: repeating-linear-gradient(-45deg, #FFF50F 0 2.6mm, #111 2.6mm 5.2mm); border-radius: 1mm; }
.rcp-who { display: flex; justify-content: space-between; gap: 4mm; background: #F1F1F1; padding: 2mm 3mm; font-size: 10pt; border-radius: 1.5mm; }
.rcp-who b { font-weight: 800; }
.rcp-words { margin: 3mm 0 2mm; background: #FFF50F; border: 0.5mm solid #111; border-radius: 1.5mm; padding: 2.2mm 3.5mm; font-family: var(--font-display); font-weight: 900; font-size: 15pt; max-width: 64%; box-sizing: border-box; overflow-wrap: anywhere; }
.rcp-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.rcp-table th { text-align: left; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em; color: #111; border-bottom: 0.6mm solid #E60000; padding: 1.4mm 2mm; }
.rcp-table td { padding: 1.5mm 2mm; border-bottom: 0.2mm solid #ddd; }
.rcp-table tbody tr:nth-child(odd) td { background: #F6F6F6; }
.rcp-table .r { text-align: right; white-space: nowrap; }
.rcp-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-top: 3mm; }
.rcp-sign { width: 72mm; text-align: center; font-size: 9.5pt; color: #333; }
.rcp-line { display: block; border-top: 0.3mm solid #111; margin: 11mm 0 1mm; }
.rcp-total { display: flex; align-items: center; gap: 4mm; background: #111; color: #FFF50F; padding: 2mm 4mm; border-radius: 1.6mm; }
.rcp-total span { font-size: 9pt; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: #fff; }
.rcp-total b { font-family: var(--font-display); font-weight: 900; font-size: 16pt; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .chip > span { font-size: 12.5px; }
  .brand-name { font-size: 16px; }
}
@media (min-width: 720px) {
  .sheet { max-width: 580px; border-radius: 18px; border: 2px solid var(--card-border); border-top: 6px solid var(--yellow); margin-bottom: 4vh; box-shadow: 6px 6px 0 var(--card-shadow); }
  .overlay { align-items: center; }
  .coach-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .filters .search, .filters .wide { grid-column: auto; }
  .stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sumbar { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .page-title { font-size: 32px; }
}
@media (min-width: 900px) {
  body { padding-bottom: 20px; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
  .top-actions .top-new { display: inline-flex; }
  .top-backup { display: none; }
  #toasts { bottom: 24px; }
  .split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; }
}
@media print {
  .topbar, .bottomnav, #banners, .btn, .appfoot { display: none !important; }
  body { background: #fff; }
}

/* ---------- v2.0: date da scrivere e lettura dei documenti con la fotocamera ---------- */
.dfield { position: relative; }
.dfield .dtext { padding-right: 52px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dfield-cal { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 46px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-left: 2px solid var(--line); pointer-events: none; }
.dfield-native { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 46px; height: auto; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; }
.dfield-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
.dfield:hover .dfield-cal { color: var(--ink); }
.input.bad { border-color: var(--red); box-shadow: 0 0 0 2px var(--past-bg); }
.dp-type { display: flex; gap: 6px; margin-bottom: 8px; }
.dp-type .input { min-height: 42px; padding: 6px 10px; font-size: 16px; flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.dp-type .btn { flex: none; }
.dp-my { display: flex; gap: 4px; flex: 1; justify-content: center; min-width: 0; }
.dp-sel { min-height: 40px; padding: 4px 26px 4px 8px; border-radius: 8px; border: 2px solid var(--line); background-color: var(--surface); color: var(--ink); font-weight: 800; font-size: 15px; background-position: right 6px center; background-size: 14px; min-width: 0; }
.dp-sel[data-dp-month] { flex: 1 1 auto; max-width: 140px; }
.ocr-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.ocr-type { position: relative; }
.ocr-type input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.ocr-type span { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.ocr-type input:checked + span { background: var(--yellow); color: var(--black); border-color: var(--black); }
.ocr-type input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus); }
.ocr-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.ocr-acts .btn { flex: 1 1 auto; justify-content: center; }
.ocr-or { font-size: 13px; flex: 1 1 100%; }
@media (min-width: 561px) { .ocr-or { flex: 1 1 auto; } .ocr-acts .btn { flex: 0 0 auto; } }
.ocr-thumb[hidden], .ocr-status[hidden] { display: none !important; }
.rc-wa-prev { display: block; width: 100%; max-height: 260px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* v2.3: allievi con lezioni da fare / tutti gli allievi */
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 4px; margin: 0 0 10px; }
.tabs2 a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 8px; border-radius: 8px; font-weight: 800; font-size: 14.5px; color: var(--muted); text-decoration: none; text-align: center; line-height: 1.15; }
.tabs2 a b { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 12.5px; }
.tabs2 a.active { background: var(--black); color: var(--yellow); }
.tabs2 a.active b { background: var(--yellow); color: var(--black); }
@media (min-width: 900px) and (max-width: 1180px) { .topnav { gap: 2px; margin-left: 4px; } .topnav a { padding: 8px 9px; font-size: 14px; } }

/* ---------- 2.4: accesso con email e password, ruoli ---------- */
body:not(.role-istr) .nav-istr, .role-istr .nav-admin { display: none !important; }
body.locked .topnav, body.locked .top-actions, body.locked .bottomnav, body.locked #banners { display: none !important; }
body.locked { padding-bottom: 24px; }
.auth-wrap { max-width: 440px; margin: 22px auto 0; }
.auth-card { padding: 22px 20px; }
.auth-card h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.15; margin: 0 0 10px; }
.auth-card > .hint { margin: 0 0 16px; font-size: 14px; }
.auth-card .btn-block { margin-top: 6px; }
.auth-card .err { margin: 0 0 10px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 14px; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; font-size: 14px; cursor: pointer; }
.link-btn:hover { color: var(--red-ink); }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }
.auth-code { letter-spacing: .32em; font-size: 22px; text-align: center; }
.auth-off { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 8px 10px; border: 2px solid var(--red); border-radius: var(--r-sm); background: var(--past-bg); font-weight: 700; font-size: 14px; }
.auth-off span { flex: 1; }
.acc-row { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.acc-row .main { min-width: 0; }
.acc-row b { display: block; overflow-wrap: anywhere; }
.account-card .bk-meta { overflow-wrap: anywhere; }
.roles-box { display: grid; gap: 8px; margin: 0 0 16px; }
.roles-box div { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; }
.roles-box b { display: block; margin-bottom: 2px; }
.chips.two { grid-template-columns: 1fr 1fr; }
.filters-1 { grid-template-columns: 1fr; }
@media (min-width: 700px) { .roles-box { grid-template-columns: 1fr 1fr; } }
