:root{
  color-scheme:light;

  --navy:#0b2545;
  --navy-2:#143f69;
  --blue:#005ea8;
  --blue-dark:#004b87;

  --page-bg:#f4f7fb;
  --surface:#ffffff;
  --surface-2:#f6f8fb;
  --surface-accent:#f3f8ff;
  --today-head:#d6e9ff;

  --text:#172033;
  --text-strong:#101828;
  --muted:#475467;
  --muted-2:#667085;

  --line:#c7d2df;
  --button-border:#8796a8;
  --button-bg:#ffffff;
  --button-hover:#eaf2fa;
  --button-active:#e0efff;

  --focus:#f5b301;

  /* Aktualna lekcja — czerwone wyróżnienie, WCAG AA */
  --current-bg:#FDE7E7;
  --current-bg-soft:#FFF1F1;
  --current-border:#B42318;
  --current-text:#7A271A;

  --shadow:0 8px 28px rgba(38,55,77,.10);
  --link-bg:rgba(0,94,168,.10);
  --link-hover:rgba(0,94,168,.20);
  --current-glow:rgba(180,35,24,.22);

  --sidebar-text:#ffffff;
  --sidebar-muted:#d8e6f3;
  --sidebar-line:rgba(255,255,255,.35);
  --sidebar-item-hover:rgba(255,255,255,.15);
}

html[data-theme="dark"]{
  color-scheme:dark;

  --navy:#07182d;
  --navy-2:#0b2545;
  --blue:#69b7ff;
  --blue-dark:#9bd2ff;

  --page-bg:#0a101b;
  --surface:#111827;
  --surface-2:#172235;
  --surface-accent:#122a43;
  --today-head:#1b4167;

  --text:#f5f7fb;
  --text-strong:#ffffff;
  --muted:#c5ceda;
  --muted-2:#aeb9c8;

  --line:#40516a;
  --button-border:#71829a;
  --button-bg:#111827;
  --button-hover:#203047;
  --button-active:#173a5e;

  --focus:#ffd84d;

  /* Aktualna lekcja — czerwone wyróżnienie, WCAG AA */
  --current-bg:#4A1118;
  --current-bg-soft:#351015;
  --current-border:#FF8A8A;
  --current-text:#FFE4E6;

  --shadow:0 10px 30px rgba(0,0,0,.34);
  --link-bg:rgba(105,183,255,.14);
  --link-hover:rgba(105,183,255,.24);
  --current-glow:rgba(255,138,138,.28);

  --sidebar-text:#ffffff;
  --sidebar-muted:#d8e6f3;
  --sidebar-line:rgba(255,255,255,.35);
  --sidebar-item-hover:rgba(255,255,255,.13);
}

html,body{background:var(--page-bg);color:var(--text)}
.app{
  display:grid;
  grid-template-columns:340px minmax(0,1fr);
  min-height:100vh;
  background:var(--page-bg);
  transition:grid-template-columns .2s ease;
}
.app.sidebar-hidden{grid-template-columns:0 minmax(0,1fr)}
.sidebar{
  background:linear-gradient(180deg,var(--navy),var(--navy-2));
  color:var(--sidebar-text);
  padding:0;
  position:sticky;
  top:0;
  height:100vh;
  min-width:340px;
  width:340px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition:transform .2s ease, opacity .2s ease;
  z-index:30;
}
.app.sidebar-hidden .sidebar{
  transform:translateX(-105%);
  opacity:0;
  pointer-events:none;
}
.sidebar-fixed{
  position:relative;
  flex:0 0 auto;
  padding:20px 20px 14px;
  background:linear-gradient(180deg,var(--navy),var(--navy-2));
  z-index:2;
}
.sidebar-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:0 20px 20px;
  scrollbar-gutter:stable;
}

.brand-logo{
  display:flex;
  flex-direction:column;
  gap:8px;
  background:#fff;
  color:#0b2545;
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:18px;
  min-height:96px;
  text-decoration:none;
}
.brand-logo:hover{box-shadow:0 0 0 3px rgba(255,255,255,.30)}
.brand-main{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  width:100%;
}
.brand-shield{
  display:block;
  width:68px;
  height:76px;
  flex:0 0 68px;
  overflow:hidden;
  position:relative;
}
.brand-shield img{
  display:block;
  width:168px;
  height:76px;
  max-width:none;
  max-height:none;
  position:absolute;
  left:0;
  top:0;
}
.brand-copy{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-width:0;
  line-height:1.25;
}
.brand-title{
  display:block;
  font-size:17px;
  line-height:1.1;
  font-weight:900;
  letter-spacing:.04em;
  color:#0b2545;
  margin-bottom:7px;
}
.brand-validity{
  display:block;
  color:#344054;
  font-size:11.5px;
  line-height:1.3;
  font-weight:650;
}
.brand-author{
  display:block;
  width:100%;
  padding-top:7px;
  border-top:1px solid #d7dee8;
  color:#344054;
  font-size:11.5px;
  line-height:1.3;
  font-weight:650;
}
.sidebar-close{
  display:block;
  position:absolute;
  top:20px;
  right:12px;
  z-index:3;
  width:42px;
  height:42px;
  border:2px solid rgba(255,255,255,.65);
  border-radius:10px;
  background:#fff;
  color:#0b2545;
}
.sidebar-close:hover{
  background:#eef4fa;
}

.close-icon{
  display:block;
  width:22px;
  height:22px;
  margin:auto;
  background:currentColor;
  -webkit-mask:url('../shared/icons/close.svg') center/contain no-repeat;
  mask:url('../shared/icons/close.svg') center/contain no-repeat;
}
.brand-logo{
  width:calc(100% - 52px);
  margin-right:52px;
}


.search{
  display:flex;gap:8px;align-items:center;
  background:#fff;border:2px solid #fff;border-radius:12px;
  padding:10px 12px;margin:0 0 12px;color:#0b2545
}
.search input{width:100%;border:0;outline:0;background:transparent;color:#111827;min-height:24px}
.search input::placeholder{color:#667085;opacity:1}

.search-icon{
  display:block;
  width:21px;
  height:21px;
  flex:0 0 21px;
  background:#0b2545;
  -webkit-mask:url('../shared/icons/search.svg') center/contain no-repeat;
  mask:url('../shared/icons/search.svg') center/contain no-repeat;
}
.search:focus-within .search-icon{
  background:#005ea8;
}


.tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:16px}
.tabs button{
  min-height:44px;border:2px solid rgba(255,255,255,.52);
  background:rgba(255,255,255,.08);color:#fff;
  border-radius:9px;padding:8px 5px;font-size:.78rem;font-weight:800
}
.tabs button:hover{background:var(--sidebar-item-hover)}
.tabs button.active{background:#fff;color:#0b2545;border-color:#fff;font-weight:900}

.favorites-panel{
  background:rgba(255,255,255,.13);
  border:1px solid rgba(255,255,255,.48);
  border-radius:12px;
  padding:12px;
  margin:4px 0 18px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.10);
}
.section-heading{display:flex;align-items:center;justify-content:space-between}
.section-heading h2{
  font-size:.95rem;
  margin:0 0 10px;
  color:#fff;
  font-weight:900;
  letter-spacing:.02em;
}
.section-heading h2::before{
  content:'';
  display:inline-block;
  width:15px;
  height:15px;
  margin-right:7px;
  vertical-align:-2px;
  background:#ffd84d;
  -webkit-mask:url('../shared/icons/star-filled.svg') center/contain no-repeat;
  mask:url('../shared/icons/star-filled.svg') center/contain no-repeat;
}
.favorites-list{display:grid;gap:7px}
.favorite-item{
  width:100%;
  border:2px solid rgba(255,255,255,.52);
  background:rgba(7,24,45,.26);
  color:#fff;
  text-align:left;
  padding:9px 10px;
  border-radius:9px;
  min-height:44px;
}
.favorite-item:hover,.favorite-item.active{
  background:#fff;
  color:#0b2545;
  border-color:#fff;
}
.favorite-item strong{display:block;font-size:.88rem}
.favorite-item small{display:block;margin-top:2px;color:var(--sidebar-muted);font-size:.72rem}
.favorite-item:hover small,.favorite-item.active small{color:#344054}
.favorites-empty{
  font-size:.78rem;
  color:#fff;
  margin:0;
  line-height:1.4;
  opacity:.92;
}

.navlist{display:grid;gap:5px}
.navitem{
  border:2px solid transparent;background:transparent;color:#fff;
  text-align:left;padding:10px;border-radius:9px;min-height:44px
}
.navitem:hover,.navitem.active{background:var(--sidebar-item-hover);border-color:rgba(255,255,255,.38)}
.navitem strong{font-size:.9rem}
.navitem small{display:block;color:var(--sidebar-muted);margin-top:2px;font-size:.76rem}

.main{min-width:0;background:var(--page-bg)}
.topbar{
  background:var(--surface);
  border-bottom:1px solid var(--line);
  padding:18px 24px;
  display:flex;align-items:center;gap:16px;
  position:sticky;top:0;z-index:10
}
.heading-wrap{flex:1;min-width:180px}
.eyebrow{font-size:.72rem;letter-spacing:.12em;color:var(--blue-dark);font-weight:900;margin:0 0 4px}
.topbar h1{margin:0;font-size:1.55rem;line-height:1.2;color:var(--text-strong)}
.topbar p#meta{margin:5px 0 0;color:var(--muted);font-size:.82rem}
.top-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}

.font-controls{
  display:flex;align-items:center;border:1px solid var(--line);
  border-radius:10px;overflow:hidden;background:var(--button-bg)
}
.font-label{font-size:.75rem;font-weight:800;color:var(--muted);padding:0 8px}
.font-controls button{
  min-width:42px;min-height:42px;border:0;border-left:1px solid var(--line);
  background:var(--button-bg);color:var(--text);font-weight:900
}
.font-controls button:hover,
.font-controls button[aria-pressed="true"]{background:var(--button-active);color:var(--text-strong)}

.action-button,.icon-button{
  min-height:44px;border:2px solid var(--button-border);
  background:var(--button-bg);color:var(--text);
  border-radius:10px;padding:8px 11px;font-weight:800
}
.action-button:hover,.icon-button:hover{background:var(--button-hover);border-color:var(--blue)}
.action-button[aria-pressed="true"]{
  background:var(--button-active);border-color:var(--blue);color:var(--text-strong)
}

.action-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
}
.action-icon{
  display:inline-block;
  width:20px;
  height:20px;
  flex:0 0 20px;
  background-color:currentColor;
  -webkit-mask-position:center;
  mask-position:center;
  -webkit-mask-repeat:no-repeat;
  mask-repeat:no-repeat;
  -webkit-mask-size:contain;
  mask-size:contain;
}
.icon-moon{
  -webkit-mask-image:url('../shared/icons/moon.svg');
  mask-image:url('../shared/icons/moon.svg');
}
.icon-sun{
  -webkit-mask-image:url('../shared/icons/sun.svg');
  mask-image:url('../shared/icons/sun.svg');
}
.icon-home{
  -webkit-mask-image:url('../shared/icons/home.svg');
  mask-image:url('../shared/icons/home.svg');
}
.icon-star{
  -webkit-mask-image:url('../shared/icons/star-outline.svg');
  mask-image:url('../shared/icons/star-outline.svg');
}
#fav[aria-pressed="true"] .icon-star{
  -webkit-mask-image:url('../shared/icons/star-filled.svg');
  mask-image:url('../shared/icons/star-filled.svg');
}
.theme-toggle{white-space:nowrap}
.menu{display:block;width:46px;padding:0;font-size:1.35rem}

.content{padding:24px 30px;background:var(--page-bg)}
.welcome{max-width:560px;margin:12vh auto;text-align:center;color:var(--muted)}
.welcome-icon{
  margin:auto;width:76px;height:76px;border-radius:22px;
  background:var(--button-active);color:var(--blue-dark);
  display:grid;place-items:center;font-size:2.5rem
}
.welcome h2{color:var(--text-strong)}

.table-wrap{
  overflow:auto;border:1px solid var(--line);border-radius:16px;
  background:var(--surface);box-shadow:var(--shadow)
}
.schedule{width:100%;border-collapse:separate;border-spacing:0;min-width:1000px;background:var(--surface)}
.schedule th{
  background:var(--surface-2);color:var(--text);
  font-size:.8rem;text-transform:uppercase;letter-spacing:.03em;
  position:sticky;top:0;z-index:2
}
.schedule th,.schedule td{
  padding:12px;border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);vertical-align:top
}
.schedule th:last-child,.schedule td:last-child{border-right:0}
.schedule tr:last-child td{border-bottom:0}
.schedule .nr{
  width:48px;text-align:center;font-weight:900;color:var(--text);
  position:sticky;left:0;background:var(--surface);z-index:1
}
.schedule .time{width:100px;white-space:nowrap;color:var(--muted);font-size:.82rem}
.schedule .today-head{background:var(--today-head);color:var(--text-strong)}
.schedule .today{background:var(--surface-accent)}

/* Aktualna lekcja: wyróżniamy godzinę oraz komórkę dzisiejszego dnia,
   zamiast rysować cienką kreskę przy każdej komórce całego tygodnia. */
.schedule tr.now .nr,
.schedule tr.now .time{
  background:var(--current-bg-soft);
  color:var(--current-text);
  font-weight:900
}
.schedule tr.now .today{
  position:relative;
  background:var(--current-bg);
  color:var(--current-text);
  box-shadow:inset 0 0 0 3px var(--current-border)
}
.schedule tr.now .today .plan-cell,
.schedule tr.now .today a{color:inherit}
.now-badge{
  display:inline-block;
  margin:0 0 5px 0;
  padding:3px 7px;
  border-radius:999px;
  background:var(--current-border);
  color:#fff;
  font-size:.68rem;
  line-height:1.2;
  font-weight:900;
  letter-spacing:.05em
}
html[data-theme="dark"] .now-badge{color:#3B0A0A}

.plan-cell{font-size:.84rem;line-height:1.55;min-width:155px;color:var(--text)}
.plan-cell:empty:after{content:'—';color:var(--muted-2)}
.plan-cell a{
  color:var(--blue-dark);
  background:var(--link-bg)
}
.plan-cell a:hover{background:var(--link-hover)}

.legend{display:flex;gap:10px;align-items:center;margin-bottom:12px;color:var(--muted);font-size:.78rem}
.dot{width:9px;height:9px;border-radius:50%;background:var(--blue);display:inline-block}
.mobile-day{display:none}

/* Przy średniej szerokości chowamy wyłącznie panel boczny.
   Nadal pokazujemy pełną tabelę tygodniową. */
@media(max-width:1200px){
  .app,
  .app.sidebar-hidden{grid-template-columns:1fr}

  .sidebar{
    position:fixed;
    left:0;
    top:0;
    width:min(340px,88vw);
    min-width:0;
    transform:translateX(-105%);
    opacity:1;
    pointer-events:none;
    box-shadow:none;
  }

  .sidebar.open{
    transform:none;
    pointer-events:auto;
    box-shadow:10px 0 40px rgba(0,0,0,.40);
  }

  .app.sidebar-hidden .sidebar{
    transform:translateX(-105%);
    opacity:1;
    pointer-events:none;
  }

  .sidebar-close{display:block}

  .brand-logo{
    width:calc(100% - 52px);
    margin-top:0;
    margin-right:52px;
  }

  .menu{display:block}
  .content{padding:20px}
  .schedule{min-width:900px}
  .plan-cell{min-width:130px}
}

@media(max-width:1100px){
  .action-text{display:none}
  .action-button{min-width:44px;padding:8px}
  .font-label{display:none}
}

/* Dopiero od 900 px przechodzimy z pełnego tygodnia na karty jednego dnia. */
@media(max-width:900px){
  .topbar{padding:10px 12px;align-items:flex-start}
  .heading-wrap{padding-top:2px}
  .top-actions{gap:5px}
  .font-controls button{min-width:38px;min-height:40px}
  .action-button{min-height:40px;min-width:40px}
  .content{padding:14px}

  .legend{display:none}
  .table-wrap{display:none}
  .mobile-day{display:block}

  .day-tabs{display:flex;gap:6px;overflow:auto;margin-bottom:12px;padding:2px}
  .day-tabs button{
    border:2px solid var(--button-border);
    background:var(--button-bg);color:var(--text);
    border-radius:999px;padding:8px 13px;white-space:nowrap;
    min-width:48px;min-height:42px;font-weight:900
  }
  .day-tabs button:hover{background:var(--button-hover)}
  .day-tabs button.active{
    background:var(--navy);border-color:var(--navy);color:#fff
  }

  .lesson-card{
    display:grid;grid-template-columns:72px 1fr;gap:12px;
    background:var(--surface);border:1px solid var(--line);
    border-radius:14px;padding:12px;margin-bottom:9px;
    color:var(--text)
  }
  .lesson-card .slot{font-weight:900;color:var(--text)}
  .lesson-card .slot small{display:block;font-weight:600;color:var(--muted);margin-top:4px;font-size:.75rem}
  .lesson-card.now{
    background:var(--current-bg);
    border:3px solid var(--current-border);
    box-shadow:0 0 0 3px var(--current-glow)
  }
  .lesson-card.now .slot,
  .lesson-card.now .slot small,
  .lesson-card.now .plan-cell{color:var(--current-text)}
}

@media(max-width:380px){
  .brand-logo{gap:7px;padding:9px}
  .brand-main{gap:9px}
  .brand-shield{width:60px;height:67px;flex-basis:60px}
  .brand-shield img{width:148px;height:67px}
  .brand-title{font-size:15px}
  .brand-author,.brand-validity{font-size:10.5px}
}

@media(max-width:560px){
  .topbar{flex-wrap:wrap}
  .heading-wrap{order:2;flex-basis:calc(100% - 58px)}
  .top-actions{order:3;width:100%;justify-content:flex-start}
  .eyebrow{display:none}
  .topbar h1{font-size:1.25rem}
  .topbar p#meta{font-size:.75rem}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    transition:none!important;
    animation:none!important
  }
  .app,.sidebar{transition:none!important}
}
@media(prefers-contrast:more){
  :root{--line:#778494;--button-border:#4b596b}
  .navitem,.favorite-item,.tabs button{border-width:2px}
  .schedule tr.now .today{box-shadow:inset 0 0 0 4px var(--current-border)}
}

/* =========================================================
   AKTYWNE STANY PRZYCISKÓW — reguły końcowe
   ========================================================= */

/* Ulubione: żółto-pomarańczowe */
button#fav[aria-pressed="true"]{
  background:#f6c453 !important;
  border-color:#b86b00 !important;
  color:#4b2d00 !important;
  box-shadow:0 0 0 1px rgba(184,107,0,.18);
}
button#fav[aria-pressed="true"]:hover{
  background:#eeb33a !important;
  border-color:#965700 !important;
  color:#382000 !important;
}
button#fav[aria-pressed="true"] .action-icon{
  background-color:#4b2d00 !important;
}

/* Plan startowy: wyraźniejsza, ciemniejsza zieleń */
button#startPlan[aria-pressed="true"]{
  background:#2f7d46 !important;
  border-color:#1f5f33 !important;
  color:#ffffff !important;
  box-shadow:0 0 0 1px rgba(31,95,51,.20);
}
button#startPlan[aria-pressed="true"]:hover{
  background:#256b3a !important;
  border-color:#184d29 !important;
  color:#ffffff !important;
}
button#startPlan[aria-pressed="true"] .action-icon{
  background-color:#ffffff !important;
}

/* Tryb nocny */
html[data-theme="dark"] button#fav[aria-pressed="true"]{
  background:#8a5a00 !important;
  border-color:#f2bd4d !important;
  color:#fff3c4 !important;
}
html[data-theme="dark"] button#fav[aria-pressed="true"]:hover{
  background:#9c6700 !important;
}
html[data-theme="dark"] button#fav[aria-pressed="true"] .action-icon{
  background-color:#fff3c4 !important;
}

html[data-theme="dark"] button#startPlan[aria-pressed="true"]{
  background:#245d36 !important;
  border-color:#67c27c !important;
  color:#eaffef !important;
}
html[data-theme="dark"] button#startPlan[aria-pressed="true"]:hover{
  background:#2b6d40 !important;
}
html[data-theme="dark"] button#startPlan[aria-pressed="true"] .action-icon{
  background-color:#eaffef !important;
}


@media(max-height:600px){
  .sidebar-fixed{padding:10px 14px 8px}
  .sidebar-scroll{padding:0 14px 12px}
  .brand-logo{
    min-height:72px;
    padding:7px 9px;
    margin-bottom:9px;
    gap:5px;
  }
  .brand-main{gap:8px}
  .brand-shield{width:52px;height:58px;flex-basis:52px}
  .brand-shield img{width:128px;height:58px}
  .brand-title{font-size:14px;margin-bottom:4px}
  .brand-validity,.brand-author{font-size:9.5px}
  .brand-author{padding-top:4px}
  .search{padding:7px 9px;margin-bottom:7px}
  .tabs{margin-bottom:6px}
  .tabs button{min-height:38px;padding:5px 4px}
  .sidebar-close{top:10px;right:8px;width:38px;height:38px}
}


/* Potwierdzenie zmiany / wyłączenia planu startowego */
.modal[hidden]{display:none!important}
.modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px}
.modal-backdrop{position:absolute;inset:0;background:rgba(4,12,24,.68);backdrop-filter:blur(2px)}
.modal-dialog{
  position:relative;z-index:1;width:min(520px,100%);
  max-height:calc(100vh - 40px);overflow:auto;
  background:var(--surface);color:var(--text);
  border:2px solid var(--line);border-radius:16px;
  box-shadow:0 24px 70px rgba(0,0,0,.38);padding:22px
}
.modal-dialog h2{margin:0 0 10px;color:var(--text-strong);font-size:1.3rem}
.modal-dialog p{margin:0;color:var(--muted);line-height:1.55}
.modal-details{display:grid;gap:9px;margin:18px 0 20px}
.modal-plan-row{
  display:grid;grid-template-columns:95px minmax(0,1fr);
  gap:10px;align-items:start;padding:10px 12px;
  border:1px solid var(--line);border-radius:10px;background:var(--surface-2)
}
.modal-plan-row span{color:var(--muted);font-size:.82rem;font-weight:800}
.modal-plan-row strong{color:var(--text-strong);overflow-wrap:anywhere}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}
.modal-button{
  min-height:44px;border-radius:10px;border:2px solid var(--button-border);
  padding:9px 15px;font-weight:850
}
.modal-cancel{background:var(--button-bg);color:var(--text)}
.modal-cancel:hover{background:var(--button-hover)}
.modal-confirm{background:#2f7d46;border-color:#1f5f33;color:#fff}
.modal-confirm:hover{background:#256b3a;border-color:#184d29}
.modal-confirm.is-danger{background:#a61b1b;border-color:#7f1010;color:#fff}
.modal-confirm.is-danger:hover{background:#8d1515;border-color:#690b0b}
html[data-theme="dark"] .modal-backdrop{background:rgba(0,0,0,.78)}
html[data-theme="dark"] .modal-confirm{background:#2b6d40;border-color:#67c27c;color:#effff3}
html[data-theme="dark"] .modal-confirm.is-danger{background:#742020;border-color:#df7777;color:#fff3f3}
body.modal-open{overflow:hidden}
@media(max-width:560px){
  .modal{padding:12px}
  .modal-dialog{padding:18px}
  .modal-plan-row{grid-template-columns:1fr;gap:3px}
  .modal-actions{display:grid;grid-template-columns:1fr 1fr}
  .modal-button{width:100%}
}


/* =========================================================
   NAGŁÓWEK PRZY LOGO — USTAWIENIA DOCELOWE
   ========================================================= */
.brand-title{
  font-size:20px !important;
  line-height:1.1;
}

.brand-validity{
  display:flex !important;
  flex-direction:column;
  align-items:flex-start;
  gap:1px;
  font-size:14px !important;
  line-height:1.22;
  font-weight:650;
}

.brand-validity-label{
  display:block;
  font-size:14px;
  white-space:nowrap;
}

.brand-validity-date{
  display:block;
  color:#7a1414;
  font-size:14px;
  line-height:1.2;
  font-weight:650;
  white-space:nowrap;
  letter-spacing:-.01em;
}

.brand-author{
  display:block;
  width:100%;
  font-weight:400 !important;
  text-align:justify;
  text-justify:inter-word;
  line-height:1.35;
}

.brand-author > span{
  display:block;
  width:100%;
}

.brand-author > span:first-child{
  text-align:justify;
}

.brand-author > span:last-child{
  margin-top:2px;
  text-align:justify;
}

/* Nie zmniejszamy tych wartości w kompaktowym widoku panelu. */
@media(max-width:380px), (max-height:600px){
  .brand-title{font-size:20px !important}
  .brand-validity,
  .brand-validity-label,
  .brand-validity-date{font-size:14px !important}
  .brand-author{font-weight:400 !important}
}


/* =========================================================
   MOBILE: TRYB KOMPAKTOWY PODCZAS WYSZUKIWANIA / KLAWIATURY
   ========================================================= */

/* Nadal zachowujemy sensowne cele dotykowe. */
@media (max-width:900px){
  .sidebar-fixed button,
  .sidebar-fixed .tab,
  .sidebar-fixed input{
    min-height:44px;
  }

  body.search-compact .sidebar-fixed{
    padding-top:6px !important;
    padding-bottom:6px !important;
  }

  body.search-compact .brand{
    min-height:0 !important;
    padding-top:5px !important;
    padding-bottom:5px !important;
    gap:6px !important;
  }

  body.search-compact .brand-logo,
  body.search-compact .brand-shield{
    width:34px !important;
    height:42px !important;
    min-width:34px !important;
  }

  body.search-compact .brand-copy{
    gap:1px !important;
  }

  body.search-compact .brand-author{
    display:none !important;
  }

  body.search-compact .brand-title{
    font-size:20px !important;
    line-height:1.05 !important;
  }

  body.search-compact .brand-validity{
    margin-top:0 !important;
    gap:0 !important;
    line-height:1.1 !important;
  }

  body.search-compact .brand-validity-label{
    display:none !important;
  }

  body.search-compact .brand-validity-date{
    font-size:13px !important;
    line-height:1.1 !important;
    white-space:nowrap !important;
  }

  body.search-compact .search{
    margin-top:4px !important;
    margin-bottom:4px !important;
  }

  body.search-compact .tabs{
    margin-top:4px !important;
    margin-bottom:0 !important;
    gap:4px !important;
  }

  body.search-compact .tabs button,
  body.search-compact .tab{
    padding-top:7px !important;
    padding-bottom:7px !important;
    min-height:44px !important;
  }

  body.search-compact .sidebar-scroll{
    scrollbar-gutter:stable;
  }
}

/* Jeszcze ciaśniej przy naprawdę małej wysokości viewportu po otwarciu klawiatury. */
@media (max-width:900px) and (max-height:520px){
  body.search-compact .sidebar-fixed{
    padding-top:4px !important;
    padding-bottom:4px !important;
  }

  body.search-compact .brand-logo,
  body.search-compact .brand-shield{
    width:30px !important;
    height:38px !important;
    min-width:30px !important;
  }

  body.search-compact .search{
    margin-top:2px !important;
    margin-bottom:2px !important;
  }
}

/* =========================================================
   INFORMACJA O LOCALSTORAGE
   ========================================================= */

.storage-info-button{
  display:inline-grid;
  place-items:center;
  width:32px;
  height:32px;
  min-width:32px;
  min-height:32px;
  margin-left:auto;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--button-bg);
  color:var(--text-strong);
  font-weight:800;
  font-size:16px;
  line-height:1;
  cursor:pointer;
}

.storage-info-button:hover{
  background:var(--button-hover);
}

.storage-info-button:focus-visible{
  outline:3px solid #005ea8;
  outline-offset:2px;
}

.storage-info-inline{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}

.storage-info-inline-label{
  font-weight:800;
}

.storage-modal-dialog{
  width:min(560px,100%);
}

.storage-feature-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin:18px 0 14px;
}

.storage-feature-list span{
  display:block;
  padding:9px 11px;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--surface-2);
  color:var(--text-strong);
  font-weight:650;
}

.storage-note{
  margin-top:12px !important;
  padding:10px 12px;
  border-left:4px solid #8a6d1d;
  border-radius:6px;
  background:var(--surface-2);
}

.storage-modal-dialog.is-warning .storage-note{
  border-left-color:#a61b1b;
}

@media(max-width:560px){
  .storage-feature-list{
    grid-template-columns:1fr;
  }
}


/* =========================================================
   MOBILE COMPACT FIX — poprawiona wersja
   ========================================================= */
@media (max-width:900px){

  /* WCAG: celem dotykowym jest całe pole wyszukiwania,
     nie sam wewnętrzny input. */
  .sidebar-fixed input{
    min-height:24px !important;
  }

  .search{
    min-height:48px;
    box-sizing:border-box;
  }

  body.search-compact .sidebar{
    height:var(--visual-viewport-height, 100dvh) !important;
    max-height:var(--visual-viewport-height, 100dvh) !important;
  }

  body.search-compact .sidebar-fixed{
    padding:6px 10px 5px !important;
  }

  /* NIE zmniejszamy już całego białego bloku do szerokości tarczy. */
  body.search-compact .brand-logo{
    width:calc(100% - 52px) !important;
    height:auto !important;
    min-width:0 !important;
    min-height:0 !important;
    margin:0 52px 5px 0 !important;
    padding:5px 8px !important;
    gap:0 !important;
    border-radius:10px !important;
  }

  body.search-compact .brand-main{
    gap:7px !important;
    min-height:43px;
  }

  body.search-compact .brand-shield{
    width:38px !important;
    height:43px !important;
    min-width:38px !important;
    flex:0 0 38px !important;
  }

  body.search-compact .brand-shield img{
    width:95px !important;
    height:43px !important;
    max-width:none !important;
  }

  body.search-compact .brand-copy{
    min-width:0 !important;
    gap:0 !important;
  }

  body.search-compact .brand-title{
    font-size:20px !important;
    line-height:1.02 !important;
    margin:0 0 1px !important;
    white-space:nowrap;
  }

  body.search-compact .brand-author{
    display:none !important;
  }

  body.search-compact .brand-validity{
    margin:0 !important;
    gap:0 !important;
    line-height:1.05 !important;
  }

  body.search-compact .brand-validity-label{
    display:none !important;
  }

  body.search-compact .brand-validity-date{
    font-size:13px !important;
    line-height:1.05 !important;
    white-space:nowrap !important;
  }

  body.search-compact .sidebar-close{
    top:6px !important;
    right:6px !important;
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    border-radius:10px !important;
  }

  body.search-compact .search{
    min-height:48px !important;
    padding:6px 10px !important;
    margin:0 0 5px !important;
    border-radius:10px !important;
    gap:8px !important;
  }

  body.search-compact .search input{
    min-height:24px !important;
    padding:0 !important;
    line-height:1.25 !important;
  }

  body.search-compact .search-icon{
    width:20px !important;
    height:20px !important;
    flex-basis:20px !important;
  }

  body.search-compact .tabs{
    margin:0 !important;
    gap:4px !important;
  }

  body.search-compact .tabs button{
    min-height:44px !important;
    padding:5px 4px !important;
    border-radius:8px !important;
  }

  body.search-compact .sidebar-scroll{
    min-height:0 !important;
    padding:5px 10px 10px !important;
    overflow-y:auto !important;
    scrollbar-gutter:stable;
  }

  body.search-compact .favorites-panel{
    margin-top:0 !important;
  }
}

/* Na bardzo niskim obszarze nad klawiaturą nadal zachowujemy 44 px
   dla przycisków; redukujemy wyłącznie odstępy. */
@media (max-width:900px) and (max-height:520px){
  body.search-compact .sidebar-fixed{
    padding-top:4px !important;
    padding-bottom:4px !important;
  }

  body.search-compact .brand-logo{
    margin-bottom:4px !important;
    padding-top:4px !important;
    padding-bottom:4px !important;
  }

  body.search-compact .brand-main{
    min-height:40px !important;
  }

  body.search-compact .brand-shield{
    width:35px !important;
    height:40px !important;
    min-width:35px !important;
    flex-basis:35px !important;
  }

  body.search-compact .brand-shield img{
    width:88px !important;
    height:40px !important;
  }

  body.search-compact .search{
    margin-bottom:4px !important;
  }
}

/* Przycisk informacji jest częścią nagłówka Ulubione,
   więc renderowanie listy ulubionych już go nie usuwa. */
.section-heading{
  gap:8px;
}

.storage-info-button{
  flex:0 0 36px;
  width:36px;
  height:36px;
  min-width:36px;
  min-height:36px;
  margin:0 0 6px auto;
}


.icon-print{
  -webkit-mask:url('../shared/icons/print.svg') center/contain no-repeat;
  mask:url('../shared/icons/print.svg') center/contain no-repeat;
}

.print-button:disabled{
  opacity:.48;
  cursor:not-allowed;
}

.print-button:disabled:hover{
  background:var(--button-bg);
  border-color:var(--button-border);
}

.print-header{
  display:none;
}



/* =========================================================
   DRUK PLANU — A4 POZIOMO
   ========================================================= */
@page{
  size:A4 landscape;
  margin: 12mm;
}

@media print{
  html,
  body{
    margin:0 !important;
    padding:0 !important;
    background:#fff !important;
    color:#111 !important;
    font-size:9pt !important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  body{
    overflow:visible !important;
  }

  .sidebar,
  .topbar,
  .legend,
  .mobile-day,
  .modal,
  .skip-link,
  #statusMessage{
    display:none !important;
  }

  .app,
  .app.sidebar-hidden{
    display:block !important;
    min-height:0 !important;
  }

  .main{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:0 !important;
    overflow:visible !important;
  }

  .print-header{
    display:block !important;
    margin:0 0 5mm !important;
    padding:0 0 3mm !important;
    border-bottom:1.5pt solid #1f3655;
    color:#111;
    text-align:center;
  }

  .print-brand{
    margin:0 0 1.5mm;
    color:#1f3655;
    font-size:8.5pt;
    font-weight:700;
    letter-spacing:.08em;
  }

  .print-header h1{
    margin:0;
    color:#111;
    font-size:16pt;
    line-height:1.15;
    font-weight:800;
  }

  .print-meta-row{
    display:flex;
    justify-content:center;
    gap:8mm;
    flex-wrap:wrap;
    margin-top:1.5mm;
    color:#444;
    font-size:8.5pt;
  }

  #printValidFrom{
    color:#6f1515;
    font-weight:700;
  }

  .content{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:0 !important;
    overflow:visible !important;
  }

  .table-wrap{
    display:block !important;
    width:100% !important;
    overflow:visible !important;
    border:1pt solid #555 !important;
    border-radius:0 !important;
    box-shadow:none !important;
    background:#fff !important;
  }

  .schedule{
    display:table !important;
    width:100% !important;
    min-width:0 !important;
    table-layout:fixed !important;
    border-collapse:collapse !important;
    border-spacing:0 !important;
    background:#fff !important;
    color:#111 !important;
  }

  .schedule thead{
    display:table-header-group;
  }

  .schedule tr{
    break-inside:avoid;
    page-break-inside:avoid;
  }

  .schedule th,
  .schedule td{
    position:static !important;
    padding:2.2mm 1.7mm !important;
    border:0 !important;
    border-right:.6pt solid #777 !important;
    border-bottom:.6pt solid #777 !important;
    background:#fff !important;
    color:#111 !important;
    vertical-align:top !important;
    line-height:1.2 !important;
    box-shadow:none !important;
  }

  .schedule th:last-child,
  .schedule td:last-child{
    border-right:0 !important;
  }

  .schedule tr:last-child td{
    border-bottom:0 !important;
  }

  .schedule th{
    background:#e9edf2 !important;
    color:#111 !important;
    font-size:8pt !important;
    font-weight:800 !important;
    text-transform:none !important;
    letter-spacing:0 !important;
    text-align:center !important;
  }

  .schedule th:nth-child(1),
  .schedule td:nth-child(1){
    width:5% !important;
  }

  .schedule th:nth-child(2),
  .schedule td:nth-child(2){
    width:10% !important;
  }

  .schedule th:nth-child(n+3),
  .schedule td:nth-child(n+3){
    width:17% !important;
  }

  .schedule .nr{
    width:auto !important;
    text-align:center !important;
    font-weight:700 !important;
    background:#f7f7f7 !important;
  }

  .schedule .time{
    width:auto !important;
    white-space:nowrap !important;
    color:#222 !important;
    font-size:7.7pt !important;
    font-weight:600 !important;
  }

  .plan-cell{
    min-width:0 !important;
    color:#111 !important;
    font-size:7.7pt !important;
    line-height:1.25 !important;
    overflow-wrap:anywhere;
  }

  .plan-cell a,
  .schedule a{
    color:#111 !important;
    background:transparent !important;
    text-decoration:none !important;
  }

  .plan-cell:empty:after{
    content:'';
  }

  .schedule .today,
  .schedule .today-head,
  .schedule tr.now .nr,
  .schedule tr.now .time,
  .schedule tr.now .today{
    background:inherit !important;
    color:#111 !important;
    box-shadow:none !important;
    border-color:#777 !important;
  }

  .schedule th{
    background:#e9edf2 !important;
  }

  .now-badge{
    display:none !important;
  }

  /* Nie drukujemy pustej otoczki widoku mobilnego. */
  .mobile-day{
    display:none !important;
  }

  /* Gdyby przeglądarka próbowała dodać adres URL do linków. */
  a[href]::after{
    content:none !important;
  }
}


/* =========================================================
   PRZYCISK DRUKU PRZY NAZWIE BIEŻĄCEGO PLANU
   ========================================================= */
.title-line{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.title-line h1{
  min-width:0;
  flex:0 1 auto;
}

.title-print{
  display:inline-grid;
  place-items:center;
  flex:0 0 44px;
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  padding:0;
  border:2px solid var(--button-border);
  border-radius:10px;
  background:var(--button-bg);
  color:var(--blue-dark);
  cursor:pointer;
}

.title-print:hover:not(:disabled){
  background:var(--button-hover);
  border-color:var(--blue);
  color:var(--blue);
}

.title-print:focus-visible{
  outline:3px solid #005ea8;
  outline-offset:2px;
}

.title-print:disabled{
  opacity:.42;
  cursor:not-allowed;
}

.title-print-svg{
  display:block;
  width:23px;
  height:23px;
  fill:currentColor;
}

html[data-theme="dark"] .title-print{
  color:var(--text-strong);
}

@media(max-width:560px){
  .title-line{
    gap:7px;
  }

  .title-line h1{
    flex:1 1 auto;
  }

  .title-print{
    flex-basis:44px;
    width:44px;
    height:44px;
  }

  .title-print-svg{
    width:22px;
    height:22px;
  }
}

@media print{
  .title-print{
    display:none !important;
  }
}


/* =========================================================
   DRUK — WERSJA CZYSTO BIAŁA + INFORMACJA DLA KOGO
   ========================================================= */
@media print{

  html,
  body,
  .app,
  .main,
  .content,
  .print-header,
  .table-wrap,
  .schedule,
  .schedule thead,
  .schedule tbody,
  .schedule tr,
  .schedule th,
  .schedule td,
  .schedule .nr,
  .schedule .time,
  .plan-cell,
  .plan-cell a,
  .schedule a{
    background:#fff !important;
    background-image:none !important;
    box-shadow:none !important;
  }

  html,
  body,
  .app,
  .main,
  .content,
  .print-header,
  .table-wrap,
  .schedule,
  .schedule th,
  .schedule td,
  .schedule a,
  .plan-cell,
  .plan-cell a{
    color:#111 !important;
  }

  .print-header{
    border:0 !important;
    border-bottom:1.2pt solid #111 !important;
    padding-bottom:3.2mm !important;
    margin-bottom:4.5mm !important;
  }

  .print-brand{
    color:#111 !important;
    font-size:8.5pt !important;
    font-weight:600 !important;
    letter-spacing:.07em !important;
    margin-bottom:1.2mm !important;
  }

  .print-header h1{
    color:#111 !important;
    font-size:17pt !important;
    font-weight:800 !important;
    margin:0 !important;
  }

  .print-target{
    display:flex !important;
    justify-content:center;
    align-items:baseline;
    gap:2.5mm;
    margin-top:2.3mm !important;
    color:#111 !important;
    font-size:11pt !important;
    line-height:1.2 !important;
  }

  .print-target span{
    color:#111 !important;
    font-weight:600 !important;
  }

  .print-target strong{
    color:#111 !important;
    font-size:12pt !important;
    font-weight:800 !important;
  }

  .print-meta-row{
    margin-top:2mm !important;
    color:#111 !important;
    font-size:8.5pt !important;
  }

  .print-meta-row span{
    color:#111 !important;
  }

  #printValidFrom{
    color:#6f1515 !important;
    font-weight:800 !important;
  }

  .table-wrap{
    border:1pt solid #111 !important;
  }

  .schedule th{
    background:#fff !important;
    color:#111 !important;
    border-right:.65pt solid #111 !important;
    border-bottom:1pt solid #111 !important;
    font-weight:800 !important;
  }

  .schedule td{
    background:#fff !important;
    color:#111 !important;
    border-right:.55pt solid #555 !important;
    border-bottom:.55pt solid #777 !important;
  }

  .schedule .nr,
  .schedule .time{
    background:#fff !important;
    color:#111 !important;
  }

  .schedule .today,
  .schedule .today-head,
  .schedule tr.now td,
  .schedule tr.now th,
  .schedule tr.now .nr,
  .schedule tr.now .time,
  .schedule tr.now .today{
    background:#fff !important;
    color:#111 !important;
    box-shadow:none !important;
  }

  .schedule a,
  .plan-cell a{
    color:#111 !important;
    text-decoration:none !important;
  }

  /* Żaden kolor tła z motywu ekranowego nie może wejść na wydruk. */
  *{
    text-shadow:none !important;
  }
}



/* Ostateczny bezpieczny margines wydruku */
@page{
  size:A4 landscape;
  margin:12mm;
}


/* =========================================================
   DRUK — WIĘKSZA CZCIONKA DLA LEPSZEJ CZYTELNOŚCI
   ========================================================= */
@media print{
  html,
  body{
    font-size:10pt !important;
  }

  .print-brand{
    font-size:9pt !important;
  }

  .print-header h1{
    font-size:18pt !important;
  }

  .print-target{
    font-size:11.5pt !important;
  }

  .print-target strong{
    font-size:12.5pt !important;
  }

  .print-meta-row{
    font-size:9pt !important;
  }

  .schedule th{
    font-size:8.8pt !important;
    line-height:1.2 !important;
  }

  .schedule .time{
    font-size:8.5pt !important;
    line-height:1.25 !important;
  }

  .plan-cell{
    font-size:8.8pt !important;
    line-height:1.28 !important;
  }

  .schedule .nr{
    font-size:8.6pt !important;
  }

  .schedule th,
  .schedule td{
    padding:2.4mm 1.8mm !important;
  }
}


/* =========================================================
   DRUK — FIX DLA MOBILNYCH PRZEGLĄDAREK / PUSTEJ 2. STRONY
   ========================================================= */
@media print{

  html,
  body,
  .app,
  .app.sidebar-hidden,
  .main,
  .content,
  .table-wrap{
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
    position:static !important;
  }

  html,
  body{
    width:auto !important;
  }

  .app,
  .app.sidebar-hidden{
    grid-template-columns:none !important;
  }

  .main,
  .content,
  .print-header,
  .table-wrap,
  .schedule{
    break-before:auto !important;
    page-break-before:auto !important;
    break-after:avoid-page !important;
    page-break-after:avoid !important;
  }

  .content{
    margin-bottom:0 !important;
    padding-bottom:0 !important;
  }

  .table-wrap{
    margin:0 !important;
    padding:0 !important;
  }

  .schedule{
    margin:0 !important;
    padding:0 !important;
  }

  /* Zachowujemy większą czcionkę, ale odzyskujemy wysokość
     przez mniejsze pionowe odstępy w komórkach. */
  .schedule th,
  .schedule td{
    padding-top:1.75mm !important;
    padding-bottom:1.75mm !important;
  }

  .print-header{
    margin-bottom:3.2mm !important;
    padding-bottom:2.3mm !important;
  }

  .print-target{
    margin-top:1.6mm !important;
  }

  .print-meta-row{
    margin-top:1.4mm !important;
  }

  /* Elementy niewidoczne nie mogą uczestniczyć w paginacji. */
  .sidebar,
  .topbar,
  .legend,
  .mobile-day,
  .modal,
  .skip-link,
  #statusMessage{
    display:none !important;
    height:0 !important;
    min-height:0 !important;
    max-height:0 !important;
    margin:0 !important;
    padding:0 !important;
  }

  body::before,
  body::after,
  .app::before,
  .app::after,
  .main::before,
  .main::after,
  .content::before,
  .content::after{
    display:none !important;
    content:none !important;
  }
}