/* ==========================================================================
   Centrum Odkrywania Doskonałości — CRM · system UI
   Identyfikacja ze strony cod.biz.pl: Fraunces (nagłówki) + Manrope (tekst), night #0e2a30, teal #1a6472,
   aqua #8acfdc, złoto #c8a96a, tła #fbfaf7 / #f2ede0, tekst #14282c, przyciski-pigułki, miękkie zaokrąglenia.
   Zasady z paczki wzorcowej: jedna wysokość kontrolek w rzędzie (--ctl), siatka odstępów 4/8 px,
   menu boczne z grupami, dolny pasek na telefonie, tabele jako karty na wąskim ekranie.
   1 fonty · 2 tokeny · 3 baza · 4 układ · 5 kontrolki · 6 powierzchnie · 7 tabele · 8 kalendarz · 9 ekrany · 10 telefon
   ========================================================================== */

/* 1 ── fonty (licencja SIL OFL, pliki w /static/fonts) ───────────────────── */
@font-face { font-family: "Manrope"; src: url("fonts/manrope-var.woff") format("woff"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces-var.woff") format("woff"); font-weight: 300 600; font-display: swap; }

/* 2 ── tokeny ───────────────────────────────────────────────────────────── */
:root {
  --night: #0e2a30; --night-2: #14393f; --night-3: #1c4a52;
  --teal: #1a6472; --teal-hi: #135562;
  --aqua: #8acfdc; --aqua-2: #5fb8c9; --aqua-soft: #e3f3f6; --aqua-glow: rgba(138, 207, 220, .45);
  --gold: #c8a96a; --gold-soft: #f6efe0;
  --bg: #fbfaf7; --paper: #ffffff; --sand: #f2ede0; --sand-2: #e9e2d0;
  --ink: #14282c; --ink-soft: #4a5d61; --faint: #7b8a8d;
  --line: rgba(20, 40, 44, .09); --line-2: rgba(20, 40, 44, .16); --field-border: rgba(20, 40, 44, .2);
  --ok: #2f7a5b; --ok-soft: #e4f2ea;
  --warn: #a8641c; --warn-soft: #fbefdf;
  --bad: #b2433a; --bad-soft: #f9e5e2;
  --info: #1a6472; --info-soft: #e3f3f6;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 13.5px; --fs-base: 15px; --fs-md: 17px; --fs-lg: 22px; --fs-xl: 34px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(14, 42, 48, .06);
  --shadow-2: 0 24px 48px -28px rgba(14, 42, 48, .45);
  --ring: 0 0 0 4px var(--aqua-glow);
  --ctl: 42px; --ctl-sm: 34px; --tap: 44px;
  --rail-w: 252px; --main-max: 1320px; --tabbar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (pointer: coarse) { :root { --ctl: 46px; --ctl-sm: 40px; } }

/* 3 ── baza ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-base)/1.6 var(--sans);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
a { color: var(--teal); text-decoration-color: rgba(26, 100, 114, .35); text-underline-offset: 3px; }
a:hover { color: var(--teal-hi); text-decoration-color: currentColor; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; line-height: 1.12; margin: 0; color: var(--ink); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); font-weight: 450; }
p { margin: 0 0 var(--s3); }
small, .muted { color: var(--ink-soft); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
::selection { background: var(--aqua); color: var(--night); }
.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-family: var(--serif); font-style: italic; color: var(--teal); font-size: 15px; margin: 0 0 var(--s1); display: block; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* 4 ── układ ────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 2px;
  background: radial-gradient(120% 60% at 20% 0%, var(--night-3) 0%, var(--night) 55%) var(--night);
  color: #d9e7ea; padding: var(--s5) var(--s3) var(--s3); overflow-y: auto; scrollbar-width: thin;
}
.rail > * { flex-shrink: 0; }
.brand { display: block; padding: 0 var(--s2) var(--s4); text-decoration: none; }
.brand img { width: 148px; height: auto; display: block; }
.brand-text { font-family: var(--serif); color: #fff; font-size: 17px; line-height: 1.2; }
.rail .group { display: block; padding: var(--s4) var(--s3) var(--s1); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(217, 231, 234, .5); }
.rail a.nav {
  display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-sm);
  text-decoration: none; color: rgba(225, 238, 241, .78); font-size: 14.5px; font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.rail a.nav .ic { width: 19px; height: 19px; opacity: .8; }
.rail a.nav:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.rail a.nav.on { color: #fff; background: rgba(138, 207, 220, .14); }
.rail a.nav.on .ic { color: var(--aqua); opacity: 1; }
.rail a.nav.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--aqua); }
.rail .searchbtn {
  display: flex; align-items: center; gap: var(--s2); height: 40px; padding: 0 var(--s3); margin: 0 0 var(--s2);
  border-radius: var(--r-pill); background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1);
  color: rgba(225, 238, 241, .7); text-decoration: none; font-size: 14px;
}
.rail .searchbtn:hover { color: #fff; border-color: rgba(138, 207, 220, .5); }
.acct { margin-top: auto; display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s2) 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: var(--aqua); color: var(--night); font-size: 12.5px; font-weight: 800; letter-spacing: .02em; text-decoration: none;
}
.acct-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-decoration: none; color: #fff; }
.acct-name b { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-name small { font-size: 11.5px; color: rgba(225, 238, 241, .6); }
.acct form { display: contents; }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-pill);
  background: transparent; color: inherit; cursor: pointer; text-decoration: none; opacity: .8;
}
.icon-btn:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.main { padding: var(--s8) var(--s10) var(--s12); width: 100%; max-width: var(--main-max); margin: 0 auto; min-width: 0; }
.topbar, .tabbar { display: none; }

/* nagłówek strony */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.head > div:first-child { min-width: 0; }
.head .sub { color: var(--ink-soft); margin-top: var(--s1); }
.head .actions { margin-left: auto; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-soft); text-decoration: none; margin-bottom: var(--s2); }
.back::before { content: "←"; }
.back:hover { color: var(--teal); }

/* 5 ── kontrolki ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--ctl); padding: 0 var(--s5);
  border-radius: var(--r-pill); border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink);
  font: 700 14px/1 var(--sans); letter-spacing: .005em; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--night); border-color: var(--night); color: #fff; box-shadow: 0 10px 22px -14px rgba(14, 42, 48, .8); }
.btn.primary:hover { background: var(--night-3); border-color: var(--night-3); color: #fff; }
.btn.aqua { background: var(--aqua); border-color: var(--aqua); color: var(--night); }
.btn.aqua:hover { background: var(--aqua-2); border-color: var(--aqua-2); color: var(--night); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--teal); }
.btn.ghost:hover { background: var(--aqua-soft); }
.btn.danger { color: var(--bad); border-color: rgba(178, 67, 58, .35); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn.small { height: var(--ctl-sm); padding: 0 var(--s4); font-size: 13px; }
.btn.sq { width: var(--ctl); padding: 0; font-size: 18px; }
.btn .ic { width: 18px; height: 18px; }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.actions.end { justify-content: flex-end; }
form.inline { display: inline-flex; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .lbl { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 12.5px; color: var(--faint); line-height: 1.4; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="month"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; min-height: var(--ctl); padding: 0 var(--s3); border: 1.5px solid var(--field-border); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); font: 500 15px/1.3 var(--sans); transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
select {
  padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5d61' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
select[multiple] { padding: 6px; background-image: none; min-height: 120px; }
textarea { padding: var(--s3); min-height: 96px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="file"] { font: 500 14px var(--sans); max-width: 100%; }
.money { position: relative; display: block; }
.money input { padding-right: 36px; text-align: right; }
.money i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--faint); font-size: 14px; pointer-events: none; }
.check { display: flex; align-items: flex-start; gap: var(--s2); min-height: 32px; cursor: pointer; font-size: 14.5px; padding: 4px 0; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--teal); flex: 0 0 auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px var(--s4); }
.form { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.row.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4); margin: 0; min-width: 0; }
legend { padding: 0 var(--s2); font-weight: 700; font-size: 13.5px; color: var(--ink-soft); }
.formbar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; padding-top: var(--s2); }

/* segmenty / zakładki — jak przełącznik „Dzieci i rodzice / Dorośli / Firmy” na stronie */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--sand); border-radius: var(--r-pill); flex-wrap: wrap; }
.seg a, .seg button { display: inline-flex; align-items: center; height: calc(var(--ctl) - 8px); padding: 0 var(--s4); border-radius: var(--r-pill);
  font: 700 13.5px var(--sans); color: var(--ink-soft); text-decoration: none; border: 0; background: transparent; cursor: pointer; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--night); color: #fff; }
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin: 0 0 var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: var(--s3) var(--s4); text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--teal); }

.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); }
.filters select, .filters input { width: auto; min-width: 150px; flex: 0 1 auto; }
.filters input[type="search"] { flex: 1 1 260px; }
.pager { display: inline-flex; align-items: center; gap: var(--s1); }
.pager-label { font-family: var(--serif); font-size: 18px; padding: 0 var(--s2); min-width: 9ch; text-align: center; }

/* 6 ── powierzchnie i komunikaty ─────────────────────────────────────────── */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s6); box-shadow: var(--shadow-1); min-width: 0; }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid { margin-top: var(--s5); }
.panel > h2, .panel > .ph h2 { font-size: 19px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.ph h2 { margin: 0; }
.panel.sand { background: var(--sand); border-color: transparent; box-shadow: none; }
.panel.night { background: var(--night); color: #e6f0f2; border-color: transparent; }
.panel.night h2, .panel.night h3 { color: #fff; }
.panel.tight { padding: var(--s4); }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > .ph { padding: var(--s5) var(--s6) 0; }
.grid { display: grid; gap: var(--s5); }
.grid > .panel + .panel, .stack > .panel + .panel, .stack > .panel + .grid, .stack > .grid + .panel, .stack > .grid + .grid,
.grid > .grid + .panel, .grid > .panel + .grid, .stack > * + details.panel, .grid > * + details.panel { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
.actions input, .actions select { width: auto; flex: 0 1 auto; }
.filters input[type="checkbox"], .actions input[type="checkbox"] { min-width: 0; width: 20px; flex: 0 0 auto; }
.tbl.compact th, .tbl.compact td { padding: var(--s2) 6px; font-size: 13.5px; }
.stack { display: flex; flex-direction: column; gap: var(--s5); }

.flash { padding: var(--s3) var(--s4); border-radius: var(--r-md); margin-bottom: var(--s4); font-weight: 500; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: rgba(47, 122, 91, .25); color: #1f5a42; }
.flash.error { background: var(--bad-soft); border-color: rgba(178, 67, 58, .25); color: #8a2f28; }
.flash.warn { background: var(--warn-soft); border-color: rgba(168, 100, 28, .25); color: #7d4a12; }
.flash.info { background: var(--info-soft); border-color: rgba(26, 100, 114, .2); color: var(--night-3); }
.flash ul { margin: var(--s2) 0 0; padding-left: 20px; }
.note { font-size: 13.5px; color: var(--ink-soft); background: var(--sand); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.note b { color: var(--ink); }

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700;
  background: var(--sand); color: var(--ink-soft); white-space: nowrap; letter-spacing: .01em; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.muted { background: #eef0ef; color: var(--faint); }
.pill.gold { background: var(--gold-soft); color: #7a5f27; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--teal)); flex: 0 0 auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); display: flex; flex-direction: column; gap: 2px;
  text-decoration: none; color: inherit; min-width: 0; transition: transform .2s var(--ease), box-shadow .2s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: inherit; }
.stat small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.stat b { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
.stat span { font-size: 13px; color: var(--faint); }
.stat.night { background: var(--night); border-color: transparent; color: #e6f0f2; }
.stat.night small, .stat.night span { color: rgba(230, 240, 242, .7); }
.stat.night b { color: #fff; }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: var(--s2) var(--s4); margin: 0; font-size: 14.5px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; min-width: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); min-width: 0; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .meta { font-size: 13px; color: var(--ink-soft); }
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--ink-soft); }
.empty p { margin-bottom: var(--s4); }

/* 7 ── tabele ───────────────────────────────────────────────────────────── */
.tblwrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fcfbf8; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--ink-soft); }
.tbl td.num, .tbl th.num { text-align: right; }
.panel.flush .tbl th:first-child, .panel.flush .tbl td:first-child { padding-left: var(--s6); }
.panel.flush .tbl th:last-child, .panel.flush .tbl td:last-child { padding-right: var(--s6); }
table.pnl { width: 100%; border-collapse: collapse; font-size: 15px; }
.pnl td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); }
.pnl td:last-child { text-align: right; white-space: nowrap; }
.pnl tr.sum td { font-weight: 800; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--line-2); }
.pnl tr.big td { font-family: var(--serif); font-size: 20px; font-weight: 400; background: var(--sand); }
.pnl tr.sub td:first-child { padding-left: var(--s8); color: var(--ink-soft); }
.pnl a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.pnl a:hover { color: var(--teal); border-bottom-color: var(--teal); }

/* 8 ── kalendarz ────────────────────────────────────────────────────────── */
.calbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.calbar .filters { margin: 0; }
.cal { --hour: 64px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(130px, 1fr)); min-width: calc(56px + var(--cols) * 130px); }
.cal-head { display: contents; }
.cal-head > div { position: sticky; top: 0; z-index: 2; background: var(--paper); border-bottom: 1px solid var(--line-2); padding: var(--s2) var(--s3);
  font-size: 13px; font-weight: 700; color: var(--ink-soft); min-height: 48px; display: flex; flex-direction: column; justify-content: center; }
.cal-head > div b { font-family: var(--serif); font-weight: 400; font-size: 18px; color: var(--ink); }
.cal-head > div.today { color: var(--teal); }
.cal-head > div.today b { color: var(--teal); }
.cal-times { position: relative; border-right: 1px solid var(--line); }
.cal-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11.5px; color: var(--faint); }
.cal-col { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour)); }
.cal-col:last-child { border-right: 0; }
.cal-col.today { background-color: #f7fbfb; }
.cal-col .avail { position: absolute; left: 0; right: 0; background: rgba(138, 207, 220, .12); border-left: 3px solid rgba(95, 184, 201, .5); }
.cal-col .absent { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(178, 67, 58, .06) 0 6px, transparent 6px 12px); }
.ev {
  position: absolute; left: 4px; right: 4px; border-radius: var(--r-sm); padding: 5px 8px; font-size: 12.5px; line-height: 1.3; overflow: hidden;
  background: color-mix(in srgb, var(--c, var(--teal)) 14%, white); border-left: 4px solid var(--c, var(--teal)); color: var(--ink);
  text-decoration: none; box-shadow: 0 1px 2px rgba(14, 42, 48, .08); transition: box-shadow .15s, transform .15s;
}
.ev:hover { box-shadow: var(--shadow-2); z-index: 3; color: var(--ink); }
.ev b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev small { display: block; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.ev.held { opacity: .78; }
.ev.no_show, .ev.cancelled_client, .ev.cancelled_center { opacity: .55; text-decoration: line-through; }
.ev .flag { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.ev.paid .flag { display: none; }
.nowline { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 4; }
.nowline::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .dh { padding: var(--s2) var(--s3); font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line-2); }
.month .day { min-height: 120px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.month .day:nth-child(7n) { border-right: 0; }
.month .day.out { background: #fbfaf8; color: var(--faint); }
.month .day.today .dn { background: var(--night); color: #fff; }
.month .dn { align-self: flex-start; font-weight: 700; font-size: 13px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; text-decoration: none; color: inherit; }
.month .mi { display: flex; gap: 6px; align-items: center; font-size: 12px; text-decoration: none; color: var(--ink); padding: 2px 4px; border-radius: 6px; min-width: 0; }
.month .mi:hover { background: var(--aqua-soft); }
.month .mi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month .more { font-size: 12px; color: var(--teal); text-decoration: none; padding-left: 4px; }
.agenda .list > li { align-items: flex-start; }
.agenda .t { width: 64px; flex: 0 0 auto; font-weight: 700; }
.agenda .t small { display: block; font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: 12.5px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* 9 ── ekrany ───────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: var(--s8); margin-bottom: var(--s6); color: #e6f0f2;
  background: radial-gradient(90% 120% at 85% 0%, rgba(138, 207, 220, .28), transparent 60%), linear-gradient(160deg, var(--night-2), var(--night));
}
.hero h1 { color: #fff; font-size: 36px; }
.hero .sub { color: rgba(230, 240, 242, .78); margin-top: var(--s2); }
.hero .eyebrow { color: var(--aqua); }
.hero .actions { margin-top: var(--s5); }
.hero .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .16); border-color: var(--aqua); color: #fff; }
.hero .btn.aqua { background: var(--aqua); border-color: var(--aqua); color: var(--night); }
.peak { position: absolute; right: -40px; bottom: -2px; width: 340px; height: 120px; opacity: .14; pointer-events: none;
  background: linear-gradient(to top right, transparent 49.5%, var(--aqua) 50%); }
.visitrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.visitrow:first-child { border-top: 0; }
.visitrow:hover { color: inherit; }
.visitrow:hover b { color: var(--teal); }
.visitrow .t { font-family: var(--serif); font-size: 19px; }
.visitrow .t small { display: block; font-family: var(--sans); font-size: 12px; color: var(--faint); }
.visitrow .w { min-width: 0; }
.visitrow .w b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitrow .w span { font-size: 13px; color: var(--ink-soft); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitrow .s { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.avail-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); font-size: 14px; }
.avail-row:first-child { border-top: 0; }
.avail-row .grow { flex: 1; min-width: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.quick a { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--paper);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; transition: border-color .15s, transform .15s; }
.quick a .ic { color: var(--teal); }
.quick a:hover { border-color: var(--teal); transform: translateY(-1px); color: var(--ink); }
.person { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.person .avatar { background: var(--aqua-soft); color: var(--teal); }
.dup { border: 1.5px solid var(--warn); background: var(--warn-soft); border-radius: var(--r-md); padding: var(--s4); margin-bottom: var(--s4); }
.dup h3 { color: var(--warn); margin-bottom: var(--s2); }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.lock .ic { width: 16px; height: 16px; }
.clinical { border-left: 4px solid var(--gold); }
.note-item { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.note-item:first-child { border-top: 0; }
.note-item .meta { font-size: 12.5px; color: var(--faint); margin-bottom: 4px; }
.note-item p { white-space: pre-wrap; margin: 0; }
.alloc td input { max-width: 140px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: var(--s3); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--night); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--teal); list-style: none; padding: var(--s2) 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; }
details.more[open] > summary::before { content: "− "; }
.ts-total { font-family: var(--serif); font-size: 32px; }
.bar { height: 8px; background: var(--sand); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }

/* logowanie */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s6) var(--s4);
  background: radial-gradient(80% 60% at 70% 10%, rgba(138, 207, 220, .3), transparent 60%), linear-gradient(160deg, var(--night-2), var(--night)); }
.login .box { width: 100%; max-width: 420px; }
.login .brand { display: block; margin: 0 auto var(--s6); width: 220px; padding: 0; }
.login .brand img { width: 100%; }
.login .card { background: var(--paper); border-radius: var(--r-xl); padding: var(--s8); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .6); }
.login h1 { font-size: 28px; margin-bottom: var(--s5); }
.login .foot { color: rgba(230, 240, 242, .7); text-align: center; font-size: 13px; margin-top: var(--s5); }
.plain { max-width: 720px; margin: 0 auto; padding: var(--s10) var(--s4); }

/* dialog wyszukiwania */
.searchdlg { border: 0; border-radius: var(--r-lg); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: var(--shadow-2); margin-top: 10vh; }
.searchdlg::backdrop { background: rgba(14, 42, 48, .45); }
.sd-form { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.sd-form input { border: 0; box-shadow: none; font-size: 17px; }
.sd-form input:focus { box-shadow: none; }
.sd-results { list-style: none; margin: 0; padding: var(--s2); max-height: 50vh; overflow-y: auto; }
.sd-results a { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.sd-results a:hover, .sd-results a.on { background: var(--aqua-soft); }
.sd-results small { color: var(--ink-soft); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 12px 18px; border-radius: var(--r-pill); z-index: 60; font-weight: 600; box-shadow: var(--shadow-2); }

/* przycisk „+” (telefon) */
.fab { display: none; }

/* 10 ── responsywność ───────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .main { padding: var(--s6) var(--s6) var(--s10); }
  .g-side { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .rail { display: none; }
  .main { padding: var(--s5) var(--s4) calc(var(--tabbar-h) + var(--s10) + env(safe-area-inset-bottom)); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3); height: 58px; padding: 0 var(--s4);
    padding-top: env(safe-area-inset-top); box-sizing: content-box; position: sticky; top: 0; z-index: 20; background: var(--night); color: #fff;
  }
  .topbar .brand { padding: 0; }
  .topbar .brand img { height: 38px; width: auto; }
  .topbar .tools { display: flex; align-items: center; gap: var(--s2); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar-h);
    text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 700; }
  .tabbar a .ic { width: 23px; height: 23px; }
  .tabbar a.on { color: var(--teal); }
  .fab { display: block; position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 31; }
  .fab > summary { list-style: none; width: 56px; height: 56px; border-radius: 50%; background: var(--night); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-2); cursor: pointer; }
  .fab > summary::-webkit-details-marker { display: none; }
  .fab > summary .ic { width: 26px; height: 26px; }
  .fab[open] > summary { background: var(--teal); }
  .fab-menu { position: absolute; right: 0; bottom: 66px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--s2); min-width: 230px; border: 1px solid var(--line); }
  .fab-menu a { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--ink); font-weight: 600; }
  .fab-menu a:hover { background: var(--aqua-soft); }
  .fab-menu .ic { color: var(--teal); }
  h1 { font-size: 28px; }
  .hero { padding: var(--s6) var(--s5); border-radius: var(--r-lg); }
  .hero h1 { font-size: 28px; }
  .head { margin-bottom: var(--s4); }
  .head .actions { margin-left: 0; width: 100%; }
  .panel { padding: var(--s4); border-radius: var(--r-md); }
  .panel.flush > .ph { padding: var(--s4) var(--s4) 0; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .row.r2, .row.r3, .row.r4 { grid-template-columns: minmax(0, 1fr); }
  .row.r4.keep, .row.r3.keep, .row.r2.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .stat { padding: var(--s4); }
  .stat b { font-size: 24px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .kv dt { font-size: 12.5px; margin-top: var(--s2); }
  .filters select, .filters input { flex: 1 1 140px; min-width: 0; }
  /* tabele → karty */
  table.cards, .cards thead, .cards tbody, .cards tr, .cards td, .cards tfoot { display: block; width: 100%; }
  .cards thead { display: none; }
  .cards tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .cards td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: var(--s3); text-align: right; }
  .cards td::before { content: attr(data-label); color: var(--faint); font-size: 12.5px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  .cards td:first-child { display: block; text-align: left; font-weight: 600; padding-bottom: 4px; }
  .cards td:first-child::before { display: none; }
  .cards td.num { text-align: right; }
  .panel.flush .cards td:first-child, .panel.flush .cards td:last-child { padding-left: 0; padding-right: 0; }
  .cards tfoot tr { background: var(--sand); }
  .month .day { min-height: 76px; padding: 4px; }
  .cal-head > div { padding: 6px 8px; font-size: 11.5px; }
  .cal-head > div b, .cal-head > div span b { font-size: 14px !important; line-height: 1.2; }
  .month .mi span { display: none; }
  .month .mi { padding: 2px; }
  .calbar { flex-direction: column; align-items: stretch; }
  .visitrow { grid-template-columns: 56px minmax(0, 1fr); }
  .visitrow .s { grid-column: 2; justify-content: flex-start; }
  .login .card { padding: var(--s6); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .rail, .topbar, .tabbar, .fab, .actions, .filters, .btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}

/* przyciski w kolumnach formularzy nie rozciągają się */
.form > .btn, .form > button, .form > form.inline, .stack > .btn, .stack > form.inline { align-self: flex-start; }
.checks.days { display: flex; flex-wrap: wrap; gap: 0 var(--s4); }
