/* ====== Base / Theme ====== */
*{ box-sizing:border-box; }
html:focus-within{ scroll-behavior:smooth; }

:root{
  --brand:#7c3aed;
  --brand-2:#22c55e;

  --radius: 18px;
  --radius-2: 26px;
  --max: 1200px;

  /* DOMYŚLNIE: DARK (szybszy “pierwszy paint” zanim JS ustawi motyw) */
  --bg:#0b1020;

  /* KLUCZ: ciemne, mniej przezroczyste powierzchnie -> czytelność */
  --surface: rgba(15,23,42,0.78);
  --surface-2: rgba(15,23,42,0.92);

  --border: rgba(148,163,184,0.22);

  /* czytelniejszy tekst */
  --text: rgba(248,250,252,0.96);
  --muted: rgba(226,232,240,0.78);

  --shadow: 0 12px 30px rgba(0,0,0,0.38);
}

/* jeśli ktoś ma preferencję jasnego motywu, zanim JS zadziała */
@media (prefers-color-scheme: light){
  :root{
    --bg:#f6f7fb;
    --surface: rgba(255,255,255,0.92);
    --surface-2: rgba(255,255,255,0.98);
    --border: rgba(15,23,42,0.14);
    --text: rgba(15,23,42,0.92);
    --muted: rgba(15,23,42,0.68);
    --shadow: 0 18px 40px rgba(10,18,32,0.12);
  }
}

/* JS ustawia data-theme -> to jest źródło prawdy */
html[data-theme="dark"]{
  --bg:#0b1020;
  --surface: rgba(15,23,42,0.78);
  --surface-2: rgba(15,23,42,0.92);
  --border: rgba(148,163,184,0.22);
  --text: rgba(248,250,252,0.96);
  --muted: rgba(226,232,240,0.78);
  --shadow: 0 12px 30px rgba(0,0,0,0.38);
}

html[data-theme="light"]{
  --bg:#f6f7fb;
  --surface: rgba(255,255,255,0.92);
  --surface-2: rgba(255,255,255,0.98);
  --border: rgba(15,23,42,0.14);
  --text: rgba(15,23,42,0.92);
  --muted: rgba(15,23,42,0.68);
  --shadow: 0 18px 40px rgba(10,18,32,0.12);
}

html{ font-size: calc(16px * var(--font-scale, 1)); }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height:1.6;
  color: var(--text);

  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(124,58,237,0.28), transparent 55%),
    radial-gradient(900px 600px at 80% 0%, rgba(34,197,94,0.18), transparent 50%),
    radial-gradient(700px 500px at 50% 110%, rgba(59,130,246,0.14), transparent 55%),
    var(--bg);

  min-height: 100dvh;
}

img{ max-width:100%; display:block; }
a{ color:inherit; }

/* Skip link */
.skip-link{
  position:absolute;
  left:10px; top:10px;
  transform: translateY(-140%);
  background: var(--surface-2);
  border:1px solid var(--border);
  padding:10px 12px;
  border-radius:12px;
  text-decoration:none;
  box-shadow: var(--shadow);
}
.skip-link:focus{
  transform: translateY(0);
  outline: 2px solid rgba(124,58,237,0.60);
}

/* Header */
.header{
  position: sticky;
  top:0;
  z-index:50;
  backdrop-filter: blur(14px);
  border-bottom:1px solid var(--border);

  /* fallback */
  background: rgba(11,16,32,0.86);
}
@supports (background: color-mix(in srgb, black 50%, transparent)) {
  .header{
    background: color-mix(in srgb, var(--bg) 86%, transparent);
  }
}

.header__bar{
  max-width: var(--max);
  margin:0 auto;
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:12px;
}
.header__actions{
  display:flex;
  gap:10px;
  align-items:center;
}

/* Brand */
.brand{
  display:flex;
  gap:12px;
  align-items:center;
  min-width: 220px;
  text-decoration:none;
}
.brand__mark{
  width:44px; height:44px;
  border-radius:14px;
  display:grid;
  place-items:center;
  font-weight:800;
  background: linear-gradient(135deg, rgba(124,58,237,0.95), rgba(34,197,94,0.85));
  box-shadow: 0 12px 25px rgba(124,58,237,0.25);
}
.brand__title{ font-weight:800; letter-spacing:.2px; }
.brand__sub{ color: var(--muted); font-size:13px; margin-top:-2px; display:block; }

/* Buttons */
.icon-btn, .menu-btn{
  border:1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,0.10);
}
.icon-btn:hover, .menu-btn:hover{ background: var(--surface-2); }
.icon-btn:focus-visible, .menu-btn:focus-visible{
  outline:2px solid rgba(124,58,237,0.60);
  outline-offset:2px;
}
.icon-btn--font{
  font-weight: 950;
  min-width: 44px;
  justify-content: center;
  letter-spacing:.2px;
}
.menu-btn__label{ font-weight:700; font-size:14px; }
.menu-btn__lines{ width:18px; height:12px; display:inline-block; position:relative; }
.menu-btn__lines::before, .menu-btn__lines::after{
  content:"";
  position:absolute;
  left:0; right:0;
  height:2px;
  border-radius:2px;
  background: currentColor;
}
.menu-btn__lines::before{ top:0; }
.menu-btn__lines::after{ bottom:0; }

/* Top nav */
.topnav{
  max-width: var(--max);
  margin:0 auto;
  padding: 0 16px 14px;
  display:none;
  gap:8px;
  flex-wrap:wrap;
}
.topnav.is-open{ display:flex; }
.topnav__link{
  text-decoration:none;
  padding:10px 12px;
  border-radius: 999px;
  background: var(--surface);
  border:1px solid var(--border);
  color: var(--text);
  font-weight:700;
  font-size:14px;
}
.topnav__link:hover{ background: var(--surface-2); }
.topnav__link.is-active{
  background: rgba(124,58,237,0.22);
  border-color: rgba(124,58,237,0.38);
}
@supports (background: color-mix(in srgb, black 50%, transparent)) {
  .topnav__link.is-active{
    background: color-mix(in srgb, var(--brand) 22%, var(--surface));
    border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  }
}
.topnav__hint{ font-weight:600; color: var(--muted); }

/* Layout */
.layout{
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px;
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:16px;
}
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ order:2; }
  .content{ order:1; }
}

/* Panels */
.panel{
  border:1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.panel--soft{ background: var(--surface); }

.panel__head{
  padding:14px 14px 10px;
  border-bottom:1px solid var(--border);
}
.panel__title{ font-weight:800; }
.panel__meta{ color: var(--muted); font-size:13px; margin-top:2px; }
.muted{ color: var(--muted); }

/* Sidebar groups */
.sidegroups{ padding: 10px; display:grid; gap:10px; }
.sgrp{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  overflow: clip;
}
.sgrp__sum{
  list-style:none;
  cursor:pointer;
  padding: 12px 12px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:10px;
  font-weight: 900;
}
.sgrp__sum::-webkit-details-marker{ display:none; }
.sgrp__title{ font-size: 13px; letter-spacing:.2px; }
.sgrp__chev{
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display:grid;
  place-items:center;
  position:relative;
}
.sgrp__chev::before{
  content:"";
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -2px;
}
.sgrp[open] .sgrp__chev::before{ transform: rotate(-135deg); margin-top: 2px; }
.sgrp__content{
  padding: 6px 8px 10px;
  display:grid;
  gap:6px;
  border-top: 1px solid var(--border);
}
.sidenav__link{
  text-decoration:none;
  padding: 10px 10px;
  border-radius: 14px;
  border:1px solid transparent;
  background: transparent;
  font-weight: 800;
  font-size: 14px;
}
.sidenav__link:hover{
  background: var(--surface-2);
  border-color: var(--border);
}
.sidenav__link.is-active{
  background: rgba(124,58,237,0.22);
  border-color: rgba(124,58,237,0.38);
}
@supports (background: color-mix(in srgb, black 50%, transparent)) {
  .sidenav__link.is-active{
    background: color-mix(in srgb, var(--brand) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  }
}

/* Hero */
.hero{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap:14px;
  margin-bottom: 16px;
}
@media (max-width: 980px){ .hero{ grid-template-columns: 1fr; } }

.hero__text{
  border:1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding:18px;
}
.hero h1{
  margin:0 0 6px;
  font-size: clamp(22px, 2vw + 14px, 34px);
  letter-spacing:.2px;
}
.lead{ margin: 0 0 12px; color: var(--muted); }

.mini-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 12px;
}

.hero__card{
  border:1px solid var(--border);
  background: linear-gradient(135deg, rgba(124,58,237,0.22), rgba(34,197,94,0.12));
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 14px;
  display:grid;
  gap:12px;
  align-content:start;
}

/* Buttons */
.btn{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(124,58,237,0.22);
  color: var(--text);
  font-weight: 900;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
@supports (background: color-mix(in srgb, black 50%, transparent)) {
  .btn{ background: color-mix(in srgb, var(--brand) 22%, var(--surface)); }
  .btn:hover{ background: color-mix(in srgb, var(--brand) 28%, var(--surface-2)); }
}
.btn:hover{ filter: brightness(1.05); }
.btn--ghost{ background: var(--surface); }
.btn--ghost:hover{ background: var(--surface-2); }

/* Story */
.story__body{
  padding: 14px;
  color: var(--text);
}
.story__body h2{
  margin: 18px 0 8px;
  font-size: 18px;
  letter-spacing:.2px;
}
.story__body p{
  margin: 0 0 12px;
  text-align: justify;
  font-size: 16px;
  line-height: 1.75;
}

/* Footer */
.footer{
  margin: 18px 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.footer__grid{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.footer__title{ font-weight: 950; }
.footer__links{ display:flex; gap: 12px; flex-wrap:wrap; }
.footer__links a{
  color: var(--muted);
  text-decoration:none;
  font-weight: 900;
}
.footer__links a:hover{ color: var(--text); text-decoration: underline; }

/* Cookie */
.cookie{
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: var(--max);
  margin: 0 auto;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow);
  padding: 12px 12px;
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content: space-between;
}
.cookie__text{ display:grid; gap: 4px; }
.cookie__text a{ color: var(--muted); font-weight: 900; }
.cookie__text a:hover{ color: var(--text); }
.cookie__actions{ display:flex; gap: 10px; }

/* To top */
.to-top{
  position: fixed;
  right: 16px;
  bottom: 86px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor:pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.to-top.is-visible{ opacity: 1; pointer-events: auto; }
.to-top:hover{ background: var(--surface-2); }

/* SR only */
.sr-only{
  position:absolute !important;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border:0;
}

/* ===== Theme toggle: rozmiar przycisku + widoczność ikon ===== */
#themeToggle{
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#themeToggle .theme-ico{
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor !important;
  stroke: none;
}

/* domyślnie księżyc */
#themeToggle .theme-ico--sun{ display: none; }
#themeToggle .theme-ico--moon{ display: block; }

html[data-theme="light"] #themeToggle .theme-ico--sun{ display: none; }
html[data-theme="light"] #themeToggle .theme-ico--moon{ display: block; }

html[data-theme="dark"]  #themeToggle .theme-ico--sun{ display: block; }
html[data-theme="dark"]  #themeToggle .theme-ico--moon{ display: none; }

/* ====== DODATKI: Rada Rodziców (strona) ====== */
.rr-badge{
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 18px;
  padding: 12px;
  display:grid;
  gap:2px;
  text-align:center;
}
.rr-badge__big{
  font-weight: 950;
  letter-spacing:.6px;
  font-size: 28px;
}
.rr-badge__small{
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}

.rr-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 10px;
}
@media (max-width: 900px){
  .rr-grid{ grid-template-columns: 1fr; }
}
.rr-card{
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 18px;
  padding: 12px 12px;
}
.rr-card__role{
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
  letter-spacing:.2px;
}
.rr-card__name{
  font-weight: 950;
  margin-top: 4px;
  font-size: 16px;
}
.rr-note{
  margin: 10px 0 0;
  padding: 12px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(124,58,237,0.14), rgba(34,197,94,0.10));
  font-weight: 800;
}

.iban{
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
}
.iban__head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.iban__label{
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}
.iban__num{
  font-weight: 950;
  font-size: 18px;
  letter-spacing: .6px;
  margin-top: 2px;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.iban__hint{ padding: 12px 14px; }
.iban__footer{
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  font-weight: 800;
}

/* lepszy fokus dla przycisku kopiowania */
#copyIban:focus-visible,
#copyIban2:focus-visible{
  outline:2px solid rgba(34,197,94,0.70);
  outline-offset:2px;
}

/* ====== TŁO: przyjemniejszy LIGHT + fioletowa poświata w DARK ====== */

/* 1) delikatnie “nie-białe” tło w jasnym motywie + trochę mniej “szpitalna” biel kart */
/* ====== LIGHT: mniej “biało”, więcej przyjemnego tła na panelach ====== */
html[data-theme="light"]{
  /* tło strony (już poprawione, zostawiamy) */
  --bg: #eef0f8;

  /* KLUCZ: to steruje bocznym menu i kafelkami */
  --surface: rgba(245,246,252,0.92);   /* zamiast “czystej bieli” */
  --surface-2: rgba(240,242,250,0.98); /* trochę ciemniejsze niż white */
  --border: rgba(15,23,42,0.14);
}

/* delikatny “tint” na powierzchniach w LIGHT – żeby nie było rażąco białe */
html[data-theme="light"] .panel,
html[data-theme="light"] .sgrp,
html[data-theme="light"] .hero__text,
html[data-theme="light"] .sidebar.panel--soft,
html[data-theme="light"] .rr-card,
html[data-theme="light"] .iban,
html[data-theme="light"] .rr-badge{
  background:
    linear-gradient(135deg, rgba(124,58,237,0.06), rgba(34,197,94,0.04)),
    var(--surface);
}

/* mocniejsze “kafelki” (np. hero card / iban head) – też z lekkim tintem */
html[data-theme="light"] .hero__card,
html[data-theme="light"] .rr-card,
html[data-theme="light"] .iban__head{
  background:
    linear-gradient(135deg, rgba(124,58,237,0.08), rgba(34,197,94,0.05)),
    var(--surface-2);
}

/* linki w sidebarze: żeby nie wyglądały jak białe “plamy” po hoverze */
html[data-theme="light"] .sidenav__link:hover{
  background: rgba(124,58,237,0.06);
  border-color: rgba(124,58,237,0.18);
}

/* ====== FIX: LIGHT nadal za biały na panelach (sidebar + kafelki) ====== */
html[data-theme="light"]{
  /* tło strony (może zostać takie) */
  --bg: #eef0f8;

  /* KLUCZ: powierzchnie NIE mogą być prawie białe */
  --surface: rgba(233,236,248,0.96);   /* lawendowy “papier” */
  --surface-2: rgba(222,227,245,0.98); /* nieco ciemniejsze kafelki */
  --border: rgba(15,23,42,0.16);
}

/* WYMUSZENIE na panelach (żeby nic nie przebiło) */
html[data-theme="light"] .panel,
html[data-theme="light"] .sgrp,
html[data-theme="light"] .hero__text,
html[data-theme="light"] .sidebar.panel--soft,
html[data-theme="light"] .rr-card,
html[data-theme="light"] .iban,
html[data-theme="light"] .rr-badge,
html[data-theme="light"] .footer{
  background:
    radial-gradient(900px 480px at 20% 0%, rgba(124,58,237,0.14), transparent 60%),
    radial-gradient(700px 420px at 90% 10%, rgba(34,197,94,0.09), transparent 60%),
    var(--surface) !important;
}

/* “mocniejsze” kafelki / główki – też z tintem */
html[data-theme="light"] .hero__card,
html[data-theme="light"] .iban__head{
  background:
    radial-gradient(900px 480px at 15% 0%, rgba(124,58,237,0.18), transparent 60%),
    radial-gradient(700px 420px at 95% 10%, rgba(34,197,94,0.10), transparent 60%),
    var(--surface-2) !important;
}

/* żeby hover w sidebarze nie robił białej “plamy” */
html[data-theme="light"] .sidenav__link:hover{
  background: rgba(124,58,237,0.10) !important;
  border-color: rgba(124,58,237,0.22) !important;
}
