:root {
  color-scheme: light;
  --blue: #0b5fa5;
  --blue-d: #084a81;
  --blue-l: #e8f2fb;
  --ink: #17222d;
  --muted: #5f6f7e;
  --line: #d9e2ea;
  --bg: #f3f6f9;
  --card: #fff;
  --ok: #1f7a3d;
  --ok-l: #e5f5ea;
  --warn: #9a5b00;
  --warn-l: #fff4dd;
  --bad: #b3261e;
  --bad-l: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 34, 52, .06), 0 4px 16px rgba(16, 34, 52, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--blue); }
a:hover { color: var(--blue-d); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .6em; }
h2, .h2 { font-size: 1.25rem; margin: 0 0 .6em; }
h3 { font-size: 1.02rem; margin: 1.2em 0 .4em; }
code { background: #eef2f6; padding: 1px 4px; border-radius: 4px; font-size: .9em; }
img, svg, iframe { max-width: 100%; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 22px; padding-bottom: 48px; }

/* hlavička */
.site-header, .admin-header { background: var(--blue); color: #fff; }
.site-header .wrap, .admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { display: block; opacity: .85; font-size: .82rem; }
.brand-mark { font-size: 1.6rem; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; }
.site-nav a, .admin-nav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.site-nav a:hover, .admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.18); }
.admin-nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.admin-nav .link { color: #fff; opacity: .85; padding: 6px 10px; }
.nav-toggle { display: none; }
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 18px 0; font-size: .9rem; color: var(--muted); }
.demo-banner { background: #fff4c2; color: #5c4400; text-align: center; font-size: .88rem; padding: 6px 16px; border-bottom: 1px solid #f0dc8c; }

/* karty a obsah */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 0 0 18px; border: 1px solid #e6edf3; }
.card.narrow { max-width: 460px; margin: 20px auto; }
.rich p:first-child { margin-top: 0; }
.rich p:last-child { margin-bottom: 0; }
.intro { margin-bottom: 18px; }
.lead { font-size: 1.08rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.big { font-size: 1.2rem; }
.warn { color: var(--warn); }
.req { color: var(--bad); font-weight: 600; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .9rem; margin-right: 6px; vertical-align: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.flash { background: var(--ok-l); border: 1px solid #b9e2c6; color: #14532b; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.errors { background: var(--bad-l); border: 1px solid #f3c1bd; color: #7a1a14; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.errors ul { margin: 6px 0 0; padding-left: 20px; }

/* formulářové prvky */
.stack > * + * { margin-top: 12px; }
.grid2, .grid3, .grid4 { display: grid; gap: 12px 16px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid2 .wide, .grid3 .wide, .grid4 .wide { grid-column: 1 / -1; }
.grid4 .wide2 { grid-column: span 2; }
.align-end { align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; min-width: 0; }
.grid2 .field, .grid3 .field, .grid4 .field { margin: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .93rem; }
.help { color: var(--muted); font-size: .84rem; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: 9px 11px; border: 1px solid #c4d0db; border-radius: 9px; background: #fff; min-height: 42px;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus, .rte-area:focus { outline: 3px solid rgba(11, 95, 165, .22); border-color: var(--blue); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
input[type="file"] { padding: 7px; }
.invalid input, .invalid select, .invalid textarea, input.invalid { border-color: var(--bad); background: #fff8f7; }
.invalid > .label, .invalid > label { color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check span { flex: 1; }
.check .help { display: block; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; max-width: 220px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 16px; min-height: 42px; border-radius: 9px; border: 1px solid #c4d0db; background: #fff; color: var(--ink); text-decoration: none;
}
.btn:hover { background: #f4f7fa; color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); color: #fff; }
.btn-secondary { background: var(--blue-l); border-color: #bcd6ee; color: var(--blue-d); }
.btn-danger { background: #fff; border-color: #e5b3af; color: var(--bad); }
.btn-danger:hover { background: var(--bad-l); color: var(--bad); }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; margin-top: 8px; }
.btn-sm { padding: 5px 10px; min-height: 34px; font-size: .88rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; text-decoration: underline; }
form.inline { display: inline; }

/* děti ve formuláři */
.child { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0 0 16px; position: relative; background: #fbfdff; min-width: 0; }
.child legend { font-weight: 700; padding: 0 8px; font-size: 1.05rem; }
.remove-child { position: absolute; top: 10px; right: 14px; font-size: .88rem; color: var(--bad); }
.child > .grid3, .child > .field, .child > .grid2 { margin-bottom: 14px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c4d0db; border-radius: 999px; padding: 7px 14px; background: #fff; cursor: pointer; font-size: .95rem; }
.pill:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.level { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #c4d0db; border-radius: 10px; padding: 10px 12px; background: #fff; cursor: pointer; }
.level:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }
.level b { display: block; font-size: .95rem; }
.level small { display: block; color: var(--muted); font-size: .84rem; }
.level details summary { font-size: .82rem; color: var(--blue); cursor: pointer; margin-top: 4px; }
.health-note { margin-top: 8px; }
.rental-sizes { margin-top: 10px; }
.rental-sizes .rich { font-size: .85rem; }
.course-note:empty { display: none; }

/* cena */
table.price { border-collapse: collapse; width: 100%; max-width: 520px; margin: 4px 0 10px; }
table.price td { padding: 6px 4px; border-bottom: 1px solid #edf1f5; }
table.price td:last-child { text-align: right; white-space: nowrap; }
table.price tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
table.price tr.due td { color: var(--blue-d); font-size: 1.08rem; }

/* stránka rodiče */
.portal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.family-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.family-head h2 { margin: 0; }
.family-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
ul.kids { margin: 0; padding-left: 20px; }
ul.kids li { margin: 4px 0; }
.paybox { border: 1px solid #cfe0f0; background: #f4f9ff; border-radius: 12px; padding: 16px; }
.paybox h3 { margin-top: 0; }
.paybox.paid { background: var(--ok-l); border-color: #b9e2c6; }
.paybox .qr { width: 220px; height: 220px; display: block; margin: 0 auto 10px; border-radius: 6px; }
.paydl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: .93rem; }
.paydl dt { color: var(--muted); }
.paydl dd { margin: 0; overflow-wrap: anywhere; }
.copy { cursor: copy; }
.mails { margin-top: 12px; }
.mails summary { cursor: pointer; color: var(--blue); }
.mail-frame { width: 100%; min-height: 560px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.demo-code { background: #fff4c2; border: 1px dashed #d9b300; padding: 10px; border-radius: 8px; text-align: center; }
.demo-code b { font-size: 1.4rem; letter-spacing: .2em; }

/* štítky */
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef2f6; color: #3b4a58; white-space: nowrap; }
.badge.st-paid, .badge.st-overpaid { background: var(--ok-l); color: var(--ok); }
.badge.st-unpaid { background: var(--blue-l); color: var(--blue-d); }
.badge.st-partial { background: var(--warn-l); color: var(--warn); }
.badge.st-overdue { background: var(--bad-l); color: var(--bad); }
.badge.st-cancelled { background: #eceff2; color: #6b7480; text-decoration: line-through; }
.badge.st-overpaid::after { content: " ↑"; }
.badge.demo { background: #fff4c2; color: #6b5200; }

/* administrace */
body.admin { background: #eef2f6; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1, .page-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 1px solid #e6edf3; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.ok b { color: var(--ok); }
.stat.bad b { color: var(--bad); }
.meter { height: 6px; background: #e6edf3; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.tasks { margin: 0; padding-left: 20px; }
.tasks li { margin: 4px 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list, table.grid-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.list th, table.grid-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.list td, table.grid-table td { padding: 8px; border-bottom: 1px solid #edf1f5; vertical-align: top; }
table.list tr:hover td { background: #fafcfe; }
.num { text-align: right !important; white-space: nowrap; }
.grid-table td.num, .grid-table th:not(:first-child) { text-align: center !important; }
tr.dim td, .dim { opacity: .55; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.filters input, .filters select { width: auto; min-width: 160px; flex: 1 1 180px; max-width: 360px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cols > .card { margin: 0 0 18px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid #edf1f5; }
details.box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
details.box summary, details.card summary { cursor: pointer; font-weight: 600; }
details.box[open] summary { margin-bottom: 10px; }
.child-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.child-edit summary { cursor: pointer; }
.child-edit[open] summary { margin-bottom: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.move { display: flex; gap: 6px; align-items: center; }
.move select { min-width: 0; width: auto; padding: 5px 8px; min-height: 34px; font-size: .88rem; }
.move select:first-of-type { max-width: 240px; }
.rental-form { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 6px; align-items: center; min-width: 360px; }
.rental-form input { min-height: 34px; padding: 5px 8px; font-size: .88rem; }
.rental-form .check { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin: 0 0 16px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; font-size: .95rem; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }
.pay-item .pay-head { margin-bottom: 8px; }
ul.suggest { list-style: none; margin: 6px 0 10px; padding: 0; }
ul.suggest li { padding: 5px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pay-actions { display: flex; flex-wrap: wrap; gap: 12px; border-top: 1px solid #edf1f5; padding-top: 10px; }
.pay-actions form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0; }
.pay-actions input { width: auto; min-height: 34px; padding: 5px 8px; max-width: 180px; }
ul.links li { margin: 8px 0; }
.field-row { border-top: 1px solid #edf1f5; padding: 14px 0; }
.field-row:first-of-type { border-top: 0; }
.field-row-head { margin-bottom: 8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; }
.row-actions .check { margin: 0; }
.slot-row { padding: 8px 0; border-bottom: 1px dashed #e2e8ee; margin-bottom: 8px; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.w-sm { width: 80px; }
td.detail { max-width: 420px; overflow-wrap: anywhere; color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 1.15rem; cursor: pointer; padding: 6px 8px; opacity: .65; }
.pw-toggle[aria-pressed="true"] { opacity: 1; }

/* editor textů */
.rte { border: 1px solid #c4d0db; border-radius: 9px; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: #f7f9fb; border-radius: 9px 9px 0 0; }
.rte-bar button { border: 0; background: none; padding: 5px 9px; border-radius: 6px; cursor: pointer; font: inherit; font-size: .9rem; min-width: 32px; }
.rte-bar button:hover, .rte-bar button.on { background: #e3eaf1; }
.rte-area { min-height: 110px; padding: 10px 12px; outline: none; border-radius: 0 0 9px 9px; overflow-wrap: anywhere; }
.rte-area p { margin: 0 0 .6em; }
.rte textarea { border: 0; border-radius: 0 0 9px 9px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; min-height: 160px; }

/* tisk */
body.print { background: #fff; font-size: 12px; }
body.print h1 { font-size: 18px; margin: 10px 16px; }
.print-bar { padding: 10px 16px; display: flex; gap: 12px; align-items: center; background: #f3f6f9; }
.sheet { padding: 0 16px; margin-bottom: 18px; }
.sheet h2 { font-size: 15px; margin: 8px 0 2px; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; vertical-align: top; }
.print-table th { background: #eef2f6; }
.print-table.att td:nth-child(n+3) { width: 7%; }
@media print {
  .no-print { display: none !important; }
  .sheet { page-break-after: always; }
  .sheet:last-child { page-break-after: auto; }
  body.print { font-size: 11px; }
}

/* mobil */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-toggle { display: inline-block; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font: inherit; cursor: pointer; }
  .admin-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .admin-nav.open { display: flex; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 16px; border-radius: 10px; }
  .grid2, .grid3, .grid4, .levels, .family-grid { grid-template-columns: 1fr; }
  .grid4 .wide2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .child { padding: 12px; }
  .brand small { display: none; }
  .filters input, .filters select { max-width: none; }
  .rental-form { min-width: 260px; grid-template-columns: 1fr 1fr; }
}

.course-checks { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.course-checks legend { padding: 0 4px; }
.inline-check { margin: 4px 0; }

.date3 { display: grid; grid-template-columns: 4.6em 1fr 5.4em; gap: 6px; }
.date3 select { padding-left: 8px; padding-right: 4px; }
