:root {
  --bg: #f4f7fb;
  --text: #121722;
  --muted: #687386;
  --line: rgba(15, 23, 42, 0.09);
  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --shadow: 0 24px 70px rgba(35, 48, 76, 0.13), 0 4px 18px rgba(35, 48, 76, 0.06);
  --green: #22b86a;
  --green-soft: rgba(34, 184, 106, 0.14);
  --red: #ee5f66;
  --red-soft: rgba(238, 95, 102, 0.14);
  --martyna: #ff5e8a;
  --weronika: #7c6cff;
  --szymon: #2f9bff;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(137, 185, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 85% 28%, rgba(199, 175, 255, 0.18), transparent 25rem),
    linear-gradient(180deg, #f7f9fc 0%, #edf3f8 100%);
  overflow-x: hidden;
}

button { font: inherit; }
button, .day-card { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(8px);
  opacity: .55;
  pointer-events: none;
}
.ambient--one { width: 360px; height: 360px; background: rgba(79, 157, 255, .22); top: -120px; left: -110px; }
.ambient--two { width: 430px; height: 430px; background: rgba(172, 115, 255, .16); top: 30vh; right: -220px; }
.ambient--three { width: 330px; height: 330px; background: rgba(66, 210, 170, .14); bottom: -150px; left: 22vw; }

.glass-panel {
  background: linear-gradient(145deg, rgba(255,255,255,.84), rgba(255,255,255,.54));
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 18px 0;
  pointer-events: none;
}
.topbar {
  width: min(1180px, 100%);
  margin: 0 auto;
  border-radius: 22px;
  min-height: 72px;
  padding: 11px 12px 11px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: auto;
}
.brand, .person-switcher {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
}
.brand { display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.brand-icon, .app-mark {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  gap: 3px;
  align-items: end;
}
.brand-icon { width: 33px; height: 33px; padding: 7px; border-radius: 10px; background: #111826; }
.brand-icon i, .app-mark span { display: block; width: 100%; border-radius: 999px; }
.brand-icon i:nth-child(1), .app-mark span:nth-child(1) { height: 11px; background: var(--martyna); }
.brand-icon i:nth-child(2), .app-mark span:nth-child(2) { height: 17px; background: var(--weronika); }
.brand-icon i:nth-child(3), .app-mark span:nth-child(3) { height: 14px; background: var(--szymon); }

.person-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 15px;
  padding: 8px 10px;
  transition: background .2s ease, transform .2s ease;
}
.person-switcher:hover { background: rgba(255,255,255,.62); }
.person-switcher:active { transform: scale(.985); }
.person-dot { width: 30px; height: 30px; border-radius: 50%; background: #c7ced9; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.person-switcher-copy { text-align: left; min-width: 108px; }
.person-switcher-copy small { display: block; font-size: 10px; color: var(--muted); }
.person-switcher-copy strong { display: block; font-size: 13px; margin-top: 1px; }
.chevron { color: var(--muted); margin-left: 2px; transform: translateY(-2px); }

.page-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 54px 0 46px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .65fr);
  gap: 38px;
  align-items: end;
  padding: 22px 5px 42px;
}
.eyebrow { margin: 0 0 10px; font-size: 11px; line-height: 1; font-weight: 750; letter-spacing: .16em; color: #718097; }
.hero h2 { max-width: 760px; margin: 0; font-size: clamp(34px, 5.5vw, 68px); line-height: .98; letter-spacing: -.055em; font-weight: 750; }
.hero > div > p:last-child { max-width: 720px; margin: 22px 0 0; font-size: clamp(15px, 1.8vw, 18px); line-height: 1.6; color: var(--muted); }
.hero-status { border-radius: 24px; padding: 18px; }
.status-pill { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 650; }
.status-pill + .status-pill { margin-top: 10px; }
.status-pill span { width: 10px; height: 10px; border-radius: 50%; }
.status-pill--available span { background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.status-pill--unavailable span { background: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }
.hero-status p { margin: 14px 0 0; padding-top: 13px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

.calendar-section, .summary-section { padding-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h3 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.035em; }
.section-hint { margin: 0 0 4px; color: var(--muted); font-size: 13px; }

.calendars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.calendar-card {
  border-radius: var(--radius-xl);
  padding: 18px;
  background: rgba(255,255,255,.69);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: 0 18px 60px rgba(40,52,78,.10);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.calendar-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 16px; }
.calendar-head strong { font-size: 19px; letter-spacing: -.025em; }
.calendar-head span { font-size: 11px; color: var(--muted); }
.weekdays, .days-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays { margin-bottom: 6px; }
.weekdays span { text-align: center; font-size: 10px; color: #8a95a7; font-weight: 700; text-transform: uppercase; }
.weekdays span:nth-child(5), .weekdays span:nth-child(6), .weekdays span:nth-child(7) { color: #53647e; }
.day-empty { aspect-ratio: 1 / 1.18; }
.day-card {
  position: relative;
  appearance: none;
  border: 1px solid transparent;
  background: rgba(245,247,250,.78);
  color: var(--text);
  border-radius: 12px;
  aspect-ratio: 1 / 1.18;
  min-width: 0;
  padding: 6px 5px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.day-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.95); box-shadow: 0 9px 20px rgba(42,52,70,.09); }
.day-card:focus-visible { outline: 3px solid rgba(47,155,255,.25); outline-offset: 2px; }
.day-card.is-weekend { background: rgba(255,255,255,.96); border-color: rgba(89,112,150,.10); }
.day-card.is-friday::after, .day-card.is-saturday::after, .day-card.is-sunday::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  opacity: .65;
}
.day-card.is-friday::after { background: #9b8cff; }
.day-card.is-saturday::after { background: #5ba5ff; }
.day-card.is-sunday::after { background: #52c9a0; }
.day-number { display: block; font-size: 13px; font-weight: 700; }
.day-label { display: block; margin-top: 2px; font-size: 8px; color: #8c97a8; text-transform: uppercase; letter-spacing: .04em; }
.day-statuses { position: absolute; left: 5px; right: 5px; bottom: 5px; display: flex; gap: 3px; flex-wrap: wrap; }
.mini-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  border: 2px solid var(--person-color);
  box-shadow: 0 2px 7px rgba(15,23,42,.12);
}
.mini-avatar.available { background: var(--green); }
.mini-avatar.unavailable { background: var(--red); }

.summary-section { padding-top: 70px; }
.summary-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 14px; font-size: 11px; color: var(--muted); }
.summary-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot--available { background: var(--green); }
.legend-dot--unavailable { background: var(--red); }
.legend-dot--empty { background: #cad1dc; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.summary-card {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.68);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: 0 10px 34px rgba(41,52,76,.07);
}
.summary-date { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.summary-date strong { font-size: 14px; letter-spacing: -.02em; }
.summary-date span { font-size: 10px; font-weight: 700; color: #7b8799; text-transform: uppercase; }
.summary-people { display: grid; gap: 8px; margin-top: 10px; }
.person-row { display: grid; grid-template-columns: 23px 1fr auto; align-items: center; gap: 8px; }
.person-badge { width: 23px; height: 23px; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 800; border-radius: 50%; background: var(--person-color); }
.person-row strong { font-size: 11px; font-weight: 650; }
.person-status { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.person-status i { width: 7px; height: 7px; border-radius: 50%; background: #cbd2dd; }
.person-status.available i { background: var(--green); }
.person-status.unavailable i { background: var(--red); }

.save-panel { margin-top: 22px; border-radius: 26px; padding: 18px 19px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.save-panel strong { font-size: 15px; }
.save-panel p { margin: 5px 0 0; font-size: 11px; color: var(--muted); }
.save-button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  background: #121926;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(18,25,38,.18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.save-button:hover { transform: translateY(-1px); box-shadow: 0 13px 28px rgba(18,25,38,.24); }
.save-button:active { transform: scale(.98); }
.save-button-icon { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.14); }

footer { padding: 12px 18px 36px; text-align: center; color: #8b96a7; font-size: 10px; }

.identity-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(238, 243, 250, .64);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
  transition: opacity .25s ease, visibility .25s ease;
}
.identity-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.identity-card { width: min(520px, 100%); border-radius: 34px; padding: 30px; text-align: center; }
.app-mark { width: 58px; height: 58px; margin: 0 auto 20px; grid-template-columns: repeat(3, 10px); gap: 4px; background: #111826; border-radius: 18px; padding: 13px; }
.app-mark span:nth-child(1) { height: 16px; }
.app-mark span:nth-child(2) { height: 26px; }
.app-mark span:nth-child(3) { height: 21px; }
.identity-card h1 { margin: 0; font-size: clamp(30px, 7vw, 48px); line-height: 1; letter-spacing: -.05em; }
.identity-copy { max-width: 410px; margin: 16px auto 22px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.identity-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.identity-button {
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px;
  padding: 17px 8px;
  cursor: pointer;
  background: rgba(255,255,255,.58);
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.identity-button:hover { transform: translateY(-2px); background: rgba(255,255,255,.92); box-shadow: 0 10px 25px rgba(39,50,73,.09); }
.identity-avatar { width: 42px; height: 42px; margin: 0 auto 9px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--person-color); box-shadow: 0 8px 20px color-mix(in srgb, var(--person-color) 30%, transparent); }
.identity-button strong { display: block; font-size: 12px; }
.privacy-note { margin: 16px 0 0; font-size: 10px; color: #8b96a7; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16,24,38,.20);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.modal-backdrop[hidden] { display: none; }
.status-modal { position: relative; width: min(420px, 100%); border-radius: 30px; padding: 25px; }
.modal-close { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(16,24,38,.07); color: #596577; font-size: 22px; cursor: pointer; }
.status-modal h3 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.modal-date { margin: 7px 0 19px; color: var(--muted); font-size: 13px; }
.status-options { display: grid; gap: 9px; }
.status-option { border: 1px solid rgba(255,255,255,.75); border-radius: 18px; padding: 12px; background: rgba(255,255,255,.56); display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; color: inherit; transition: transform .16s ease, background .16s ease; }
.status-option:hover { transform: translateY(-1px); background: rgba(255,255,255,.94); }
.status-option-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px; font-weight: 850; font-size: 18px; }
.status-option strong, .status-option small { display: block; }
.status-option strong { font-size: 12px; }
.status-option small { margin-top: 2px; font-size: 10px; color: var(--muted); }
.status-option--available .status-option-icon { background: var(--green-soft); color: var(--green); }
.status-option--unavailable .status-option-icon { background: var(--red-soft); color: var(--red); }
.status-option--clear .status-option-icon { background: rgba(111,124,145,.11); color: #6f7c91; }

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translate(-50%, 22px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(17,24,39,.92);
  color: #fff;
  box-shadow: 0 12px 34px rgba(17,24,39,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  font-size: 12px;
  font-weight: 650;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--green); font-size: 11px; }

@media (max-width: 980px) {
  .calendars { grid-template-columns: 1fr; }
  .calendar-card { padding: 20px; }
  .day-card { aspect-ratio: 1 / .86; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-status { max-width: 420px; }
}

@media (max-width: 640px) {
  .topbar-wrap { padding: 8px 8px 0; }
  .topbar { min-height: 64px; border-radius: 19px; padding: 8px 8px 8px 12px; }
  .brand small { display: none; }
  .brand strong { font-size: 13px; }
  .brand-icon { width: 30px; height: 30px; }
  .person-switcher-copy { min-width: 0; }
  .person-switcher-copy small { display: none; }
  .person-switcher-copy strong { max-width: 78px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .person-dot { width: 26px; height: 26px; }
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 35px; }
  .hero { padding: 18px 4px 30px; }
  .hero h2 { font-size: clamp(38px, 12vw, 54px); }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .summary-legend { justify-content: flex-start; }
  .calendar-card { padding: 12px; border-radius: 24px; }
  .calendar-head { padding: 4px 5px 12px; }
  .weekdays, .days-grid { gap: 4px; }
  .day-card { aspect-ratio: 1 / 1.12; border-radius: 10px; padding: 5px 4px; }
  .day-number { font-size: 12px; }
  .day-label { display: none; }
  .day-statuses { left: 4px; right: 4px; bottom: 4px; gap: 2px; }
  .mini-avatar { width: 16px; height: 16px; font-size: 7px; border-width: 1px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-section { padding-top: 52px; }
  .save-panel { align-items: stretch; flex-direction: column; }
  .save-button { justify-content: center; }
  .identity-card { padding: 26px 18px 20px; border-radius: 28px; }
  .identity-buttons { grid-template-columns: 1fr; }
  .identity-button { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; text-align: left; padding: 10px 13px; }
  .identity-avatar { margin: 0; }
  .status-modal { align-self: end; border-radius: 28px 28px 22px 22px; padding: 24px 18px calc(18px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Stan błędu zapisu online */
.toast.error .toast-icon { background: var(--red); }
.save-button:disabled { opacity: .62; cursor: wait; transform: none; }
