:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --line: #2a3340;
  --txt: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4f9cf9;
  --accent-2: #36c98e;
  --warn: #f0a330;
  --webinar: #4f9cf9;
  --spotkanie: #36c98e;
  --konsultacja: #b07cf0;
  --requested: #f0a330;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); }

/* ── Nagłówek ─────────────────────────────────────────────── */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); flex-wrap: wrap;
}
header.top h1 { font-size: 19px; margin: 0; }
header.top .sub { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  background: var(--panel-2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 13px; cursor: pointer; font-size: 13px;
  text-decoration: none; line-height: 1; display: inline-flex; align-items: center; gap: 4px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #06101f; border-color: var(--accent); font-weight: 600; }
select.btn { appearance: auto; }

/* ── Układ ────────────────────────────────────────────────── */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card h2 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Lista terminów ───────────────────────────────────────── */
.termin {
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--panel-2);
}
.termin.webinar { border-left-color: var(--webinar); }
.termin.spotkanie { border-left-color: var(--spotkanie); }
.termin.konsultacja { border-left-color: var(--konsultacja); }
.termin.requested { border-left-color: var(--requested); }
.termin .when { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.termin .title { font-weight: 600; margin: 4px 0; }
.termin .desc { color: var(--muted); font-size: 13px; }
.termin .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pill { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.plat { color: var(--txt); }
.pill.status-confirmed { color: var(--accent-2); border-color: var(--accent-2); }
.pill.status-tentative { color: var(--warn); border-color: var(--warn); }
.pill.status-requested { color: var(--requested); border-color: var(--requested); }
.pill.status-cancelled { color: #e06a6a; border-color: #e06a6a; text-decoration: line-through; }
.mini-link { font-size: 12px; padding: 7px 10px; }

/* ── Kalendarz miesięczny ─────────────────────────────────── */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.cal-head strong { font-size: 15px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; color: var(--muted); font-size: 11px; padding: 4px 0; }
.cal-cell {
  min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px;
  background: var(--panel-2); font-size: 12px; overflow: hidden;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { outline: 2px solid var(--accent); }
.cal-cell .num { color: var(--muted); }
.cal-dot { display: block; margin-top: 3px; border-radius: 4px; padding: 1px 4px; font-size: 10px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #06101f; }
.cal-dot.webinar { background: var(--webinar); }
.cal-dot.spotkanie { background: var(--spotkanie); }
.cal-dot.konsultacja { background: var(--konsultacja); }
.cal-dot.requested { background: var(--requested); }

.empty-state { color: var(--muted); text-align: center; padding: 24px; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); padding: 10px 16px;
  border-radius: 8px; display: none; max-width: 90vw; text-align: center; z-index: 50; }

/* ── Tablet ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  main { padding: 18px; }
  .grid { grid-template-columns: 1fr; gap: 18px; }
}

/* ── Telefon ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 14px; }
  header.top { padding: 12px 14px; gap: 10px; }
  header.top h1 { font-size: 17px; }
  header.top .sub { font-size: 12px; }
  /* pasek narzędzi: przyciski rozciągnięte, łatwe do kliknięcia kciukiem */
  .toolbar { width: 100%; gap: 8px; }
  .toolbar > * { flex: 1 1 auto; justify-content: center; min-height: 40px; }
  select.btn { flex-basis: 100%; }

  main { padding: 12px; }
  .card { padding: 12px; border-radius: 10px; }

  .termin .row { gap: 6px; }
  /* linki „dodaj do kalendarza" jako siatka — duże cele dotykowe */
  .termin .row:last-child { display: grid; grid-template-columns: 1fr 1fr; }
  .termin .row:last-child .mini-link { justify-content: center; min-height: 38px; }

  /* kalendarz: zwarty; wydarzenia jako kolorowe paski (bez ściśniętego tekstu) */
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 46px; padding: 3px; font-size: 11px; }
  .cal-grid .dow { font-size: 10px; }
  .cal-dot { font-size: 0; line-height: 0; height: 6px; margin-top: 3px; padding: 0; border-radius: 3px; }
}

/* ── Bardzo wąsko ─────────────────────────────────────────── */
@media (max-width: 380px) {
  .cal-cell { min-height: 40px; }
  .termin .row:last-child { grid-template-columns: 1fr; }
}
