@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import 'tokens.css';

/* ================= LAYOUT SHELL ================= */
.app-shell { min-height: 100vh; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 0 20px;
  z-index: 40;
}
.topbar__logo {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  display: none; align-items: baseline; gap: 1px;
  color: var(--ink);
}
.topbar__logo .dot { color: var(--accent); }
.topbar__actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); transition: background .15s;
}
.icon-btn:hover { background: var(--paper-dim); }
.icon-btn svg { width: 19px; height: 19px; }
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: var(--radius-sm);
  border: none; background: var(--paper-dim);
  color: var(--text); font-size: 13.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.logout-btn:hover { background: var(--ink); color: var(--text-on-ink); }
.logout-btn svg { width: 17px; height: 17px; }

.topbar__school { font-size: 13.5px; font-weight: 600; color: var(--muted); margin-left: 4px; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--paper);
  display: flex; flex-direction: column;
  z-index: 50;
  border-right: 1px solid var(--line);
}
.sidebar__brand {
  height: var(--header-h); display: flex; align-items: center; padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar__brand-mark {
  font-family: var(--font-logo); font-weight: 900; font-size: 22px; color: var(--ink);
  letter-spacing: -0.02em;
}
.sidebar__brand-mark .dot { color: var(--accent);}

.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  background: transparent; text-align: left; width: 100%;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--accent); color: var(--ink); }
.nav-item.active {
  background: var(--accent); color: var(--ink);
}
.nav-item.active svg { opacity: 1; }
.nav-item .badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 20px; padding: 1px 6px; font-weight: 600;
}

.sidebar__footer {
  padding: 16px 20px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.5;
}
.sidebar__footer strong { color: var(--ink); font-family: var(--font-mono); }

.main {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
}
.main__inner { padding: 28px 32px 60px; max-width: 1280px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.015em; }
.page-head__sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; display: block;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; border: 1px solid transparent;
  transition: transform .1s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: var(--text-on-ink); }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(0.96); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-dim); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-dim); }
.btn-danger:hover { background: var(--danger-dim); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ================= CARDS ================= */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }
.grid-cards .card + .card { margin-top: 0; }
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap;
}
.card__head h2 { font-size: 15.5px; font-weight: 700; }
.card__head h3 { font-size: 14px; font-weight: 700; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.stat-card { padding: 18px 20px; }
.stat-card .num { font-family: var(--font-mono); font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat-card .trend { display:inline-flex; align-items:center; gap:4px; font-size:11.5px; font-family: var(--font-mono); margin-top: 8px; color: var(--success); }

/* ================= TABLE ================= */
.table-wrap { overflow-x: auto; background: var(--paper); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--paper); }
table.data th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
  padding: 10px 20px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; cursor: pointer; }
table.data tbody tr:hover { background: var(--paper-dim); }
.cell-muted { color: var(--muted); }
.cell-strong { font-weight: 600; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--text-on-ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  font-family: var(--font-mono); flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row-person { display: flex; align-items: center; gap: 10px; }

/* ================= PILL / BADGE / TAG ================= */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; font-family: var(--font-mono); }
.pill-accent { background: var(--accent-dim); color: #3a4a0e; }
.pill-danger { background: var(--danger-dim); color: #a4271f; }
.pill-neutral { background: var(--paper-dim); color: var(--muted); border: 1px solid var(--line); }
.pill-ink { background: var(--ink); color: var(--text-on-ink); }
.dot-status { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-status.ok { background: var(--success); }
.dot-status.due { background: var(--danger); }

.tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 12px; background: var(--paper-dim); border: 1px solid var(--line); color: var(--text); }
.tag + .tag { margin-left: 6px; }

/* ================= FORMS ================= */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field input[type=text], .field input[type=password], .field input[type=email], .field input[type=tel],
.field input[type=number], .field input[type=date], .field input[type=time], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--paper); font-size: 13.5px; color: var(--text); transition: border-color .15s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 8px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; margin: 0; }

.schedule-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }

/* ================= MODAL ================= */
.overlay {
  position: fixed; inset: 0; background: rgba(11,12,10,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 20px;
  z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--paper); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-pop); animation: pop .15s ease-out;
}
.modal.modal-lg { max-width: 720px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 16px; font-weight: 700; }
.modal__body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ================= EMPTY STATE ================= */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; margin-bottom: 12px; opacity: .5; }
.empty .btn { margin-top: 14px; }

/* ================= LOGIN ================= */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink); background-image: radial-gradient(circle at 20% 10%, rgba(215,255,63,0.08), transparent 45%);
  padding: 24px;
}
.login-card { width: 100%; max-width: 380px; background: var(--paper); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-pop); }
.login-card__logo { font-family: var(--font-logo); font-weight: 700; font-size: 30px; margin-bottom: 4px; }
.login-card__logo .dot { color: var(--accent); }
.login-card__tag { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 26px; text-transform: uppercase; letter-spacing: .05em; }
.login-error { background: var(--danger-dim); color: #a4271f; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* ================= CALENDAR ================= */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.cal-toolbar__nav { display: flex; align-items: center; gap: 8px; }
.cal-range { font-family: var(--font-mono); font-size: 13px; font-weight: 600; min-width: 190px; text-align: center; }

.week-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--paper); }
.week-grid__corner { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--paper-dim); }
.week-grid__day-head {
  padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--paper-dim);
}
.week-grid__day-head:last-child { border-right: none; }
.week-grid__day-head .dname { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.week-grid__day-head .ddate { font-size: 14px; font-weight: 700; margin-top: 2px; }
.week-grid__day-head.is-free { background: var(--danger-dim); }
.week-grid__day-head.is-free .dname, .week-grid__day-head.is-free .ddate { color: #a4271f; }

.week-grid__hours { border-right: 1px solid var(--line); }
.week-grid__hour-label {
  padding: 2px 8px; font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  border-bottom: 1px solid var(--line); text-align: right; box-sizing: border-box;
}
.week-grid__day {
  position: relative; border-right: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 100%);
}
.week-grid__day:last-child { border-right: none; }
.cal-event {
  position: absolute; border-radius: 6px; padding: 4px 7px; overflow: hidden;
  font-size: 11px; line-height: 1.3; border-left: 3px solid; box-shadow: 0 1px 2px rgba(11,12,10,.08);
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.cal-event:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(11,12,10,.14); z-index: 2; }
.cal-event .t { font-family: var(--font-mono); font-size: 9.5px; display: block; margin-bottom: 1px; opacity: .75; }
.cal-event.type-group { background: var(--accent-dim); border-left-color: #7a9c1e; color: #1c2b06; }
.cal-event.type-training { background: #ffe3c9; border-left-color: #e2761f; color: #7a3c0a; }
.cal-event.type-individual { background: #d8f0ff; border-left-color: #2f8fce; color: #0b3350; }
.cal-event.type-camp { background: #f3d9ff; border-left-color: #9b3fc4; color: #3d1052; }
.cal-event.type-booking { background: #fff3b8; border-left-color: #cc9a00; color: #5c4600; }

/* ================= YEAR CALENDAR (Dni wolne) ================= */
.year-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.year-toolbar__nav { display: flex; align-items: center; gap: 8px; }
.year-range { font-family: var(--font-mono); font-size: 15px; font-weight: 700; min-width: 60px; text-align: center; }
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 1180px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }
.year-month { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; background: var(--paper); }
.year-month__head { font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; text-align: center; }
.year-month__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.year-month__dow { font-size: 9px; color: var(--muted); text-align: center; font-family: var(--font-mono); padding-bottom: 2px; }
.year-month__day { font-size: 11px; text-align: center; padding: 3px 0; border-radius: 4px; cursor: default; }
.year-month__day.is-free { background: var(--danger-dim); color: #a4271f; font-weight: 700; }
.year-month__day.empty { visibility: hidden; }

/* ================= LOGO UPLOAD (Konto) ================= */
.logo-upload { position: relative; width: 108px; height: 108px; border-radius: 18px; overflow: hidden; cursor: pointer; background: var(--paper-dim); border: 1px solid var(--line); flex-shrink: 0; display: block; }
.logo-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo-upload__placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.logo-upload__overlay { position: absolute; inset: 0; background: rgba(11,12,10,0.55); display: flex; align-items: center; justify-content: center; color: #fff; opacity: 0; transition: opacity .15s; }
.logo-upload:hover .logo-upload__overlay { opacity: 1; }

/* ================= DETAIL SUBPAGE (Grupy, Szkolenia, Uczestnicy, Instruktorzy, Sale…) ================= */
.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.detail-back:hover { color: var(--text); }
.detail-back svg { width: 15px; height: 15px; }
.detail-layout { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
@media (max-width: 880px) { .detail-layout { grid-template-columns: 1fr; } }
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.detail-header .avatar { width: 64px; height: 64px; font-size: 22px; flex-shrink: 0; }
.detail-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.015em; }
.detail-header .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.detail-price { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.detail-section { margin-bottom: 22px; }
.detail-section__title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 88px; }
.detail-actions .btn { justify-content: flex-start; width: 100%; }
.term-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; background: var(--paper);
}
.term-row .day { font-weight: 700; min-width: 90px; }
.term-row .time { font-family: var(--font-mono); color: var(--muted); }
.term-row .meta { color: var(--muted); margin-left: auto; display: flex; gap: 14px; }

/* ================= TILES (Grupy, Szkolenia, Obozy, Sale) ================= */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; cursor: pointer; transition: box-shadow .15s, transform .1s; box-shadow: var(--shadow-card); }
.tile:hover { box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.tile__title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.tile__level { display: inline-block; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.tile__row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.tile__row svg { width: 14px; height: 14px; flex-shrink: 0; opacity: .7; }
.tile__price { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; color: var(--text); }
.tile__photo { width: 100%; aspect-ratio: 4/3; border-radius: var(--radius-sm); object-fit: cover; margin-bottom: 10px; background: var(--paper-dim); }
.tile__badge { position: absolute; top: 12px; right: 12px; }
.tile { position: relative; }

/* ================= TYPEAHEAD (dodawanie uczestników) ================= */
.typeahead { position: relative; }
.typeahead input { width: 100%; }
.typeahead__results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
  max-height: 220px; overflow-y: auto; z-index: 20;
}
.typeahead__item { padding: 9px 12px; font-size: 13.5px; cursor: pointer; }
.typeahead__item:hover { background: var(--paper-dim); }
.typeahead__empty { padding: 9px 12px; font-size: 12.5px; color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; background: var(--paper-dim); border: 1px solid var(--line); border-radius: 20px; font-size: 12.5px; }
.chip button { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--danger-dim); color: #a4271f; }

/* ================= MINI WEEKLY CALENDAR (Instruktorzy, Sale) ================= */
.mini-week { display: grid; grid-template-columns: 44px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--paper); font-size: 11px; }
.mini-week__corner, .mini-week__head { padding: 6px 4px; text-align: center; background: var(--paper-dim); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.mini-week__head:last-child { border-right: none; }
.mini-week__hours { border-right: 1px solid var(--line); }
.mini-week__hour-label { font-family: var(--font-mono); font-size: 9px; color: var(--muted); text-align: right; padding: 1px 5px; border-bottom: 1px solid var(--line); box-sizing: border-box; }
.mini-week__day { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 100%); }
.mini-week__day:last-child { border-right: none; }
.mini-event { position: absolute; left: 2px; right: 2px; background: var(--accent-dim); border-left: 2px solid #7a9c1e; border-radius: 3px; padding: 1px 3px; font-size: 9px; overflow: hidden; line-height: 1.2; }

/* ================= TOASTS ================= */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--ink); color: var(--text-on-ink); padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 10px;
  border-left: 3px solid var(--accent); animation: toastin .18s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

/* ================= LOADING ================= */
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); gap: 10px; font-size: 13px; }

/* ================= RESPONSIVE ================= */
.mobile-toggle { display: none; }
@media (max-width: 880px) {
  :root { --sidebar-w: 224px; }
  .main__inner { padding: 20px 16px 50px; }
  .field-row, .field-row3 { grid-template-columns: 1fr; }
  .topbar__logo { padding-left: 0; }
  .mobile-toggle { display: flex; }
  .topbar__logo { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 60; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(11,12,10,0.4); z-index: 55; }
  .sidebar-backdrop.open { display: block; }
  .main { margin-left: 0; }
  .week-grid { grid-template-columns: 40px repeat(7, minmax(110px,1fr)); overflow-x: auto; }
}

/* ================= PRINT (Listy obecności, Kalendarz) ================= */
.print-only-title { display: none; }
@media print {
  .no-print { display: none !important; }
  .main { margin-left: 0; padding-top: 0; }
  .main__inner { padding: 0; max-width: none; }
  body { background: #fff; }
  .attendance-sheet { page-break-after: always; padding: 14mm; }
  .attendance-sheet:last-child { page-break-after: auto; }

  @page { size: landscape; margin: 10mm; }
  .print-only-title { display: block; font-size: 18px; margin-bottom: 10px; }
  .week-grid { grid-template-columns: 44px repeat(7, 1fr); border-color: #999; }
  .week-grid__day-head, .week-grid__corner { background: #fff !important; border-color: #999; }
  .week-grid__day-head.is-free { background: #f3f3f3 !important; }
  .week-grid__hour-label { border-color: #ccc; }
  .week-grid__day { border-color: #ccc; background-image: repeating-linear-gradient(to bottom, #ccc 0, #ccc 1px, transparent 1px, transparent 100%) !important; }
  .cal-event { box-shadow: none; border: 1px solid rgba(0,0,0,0.15); }
  .cal-event:hover { transform: none; }
}

.attendance-sheet { max-width: 210mm; margin: 0 auto 24px; background: #fff; border: 1px solid var(--line); padding: 16px 20px; }
.attendance-sheet__head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.attendance-sheet__head h2 { font-size: 36px; }
.attendance-sheet__meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.attendance-sheet table { width: 100%; border-collapse: collapse; }
.attendance-sheet th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px 6px; font-family: var(--font-mono); }
.attendance-sheet td { padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 13px; }
.attendance-sheet .signature-col { width: 140px; }
