:root{
  /* iOS corporate glass (dark) */
  --bg:#0b1220;

  --text:rgba(255,255,255,.94);
  --muted:rgba(167,182,204,.92);

  --line:rgba(255,255,255,.10);
  --line2:rgba(255,255,255,.07);

  --surface:rgba(17,24,39,.62);
  --surface2:rgba(17,24,39,.52);
  --surface3:rgba(255,255,255,.06);

  --accent:#2f6bff;
  --accent2:#7bb0ff;

  --danger:#ef4444;
  --safeB:env(safe-area-inset-bottom,0px);
  --safeT:env(safe-area-inset-top,0px);

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
html{-webkit-text-size-adjust:100%}
html, body{touch-action:manipulation}

body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(47,107,255,.18), transparent 60%),
    radial-gradient(700px 520px at 10% 0%, rgba(255,255,255,.06), transparent 65%),
    radial-gradient(900px 700px at 40% 120%, rgba(123,176,255,.08), transparent 70%),
    linear-gradient(180deg, rgba(11,18,32,1), rgba(9,14,26,1));
}

/* helpers */
.is-hidden{display:none!important}
.screen{min-height:100vh}
.w100{width:100%}
.muted{color:var(--muted)}
h1{margin:0 0 6px 0}
h2,h3{margin:0}
a{color:inherit}

/* login screen */
.screen--login{
  position:fixed; inset:0; z-index:999;
  display:grid; place-items:center;
  padding:16px;
  background:
    radial-gradient(900px 600px at 80% 0%, rgba(47,107,255,.18), transparent 60%),
    radial-gradient(700px 520px at 10% 10%, rgba(255,255,255,.06), transparent 65%),
    linear-gradient(180deg, rgba(9,14,26,.96), rgba(11,18,32,.98));
}
.screen--app{display:flex; flex-direction:column}

/* panel / cards (glass) */
.panel{
  width:min(680px, 100%);
  border-radius:24px;
  background: var(--surface);
  border:1px solid var(--line2);
  box-shadow:
    0 18px 60px rgba(0,0,0,.40),
    inset 0 1px 0 rgba(255,255,255,.08);
  padding:18px;
  backdrop-filter: blur(24px);
}
.panel--login{text-align:center; padding:22px; width:min(520px,100%)}

/* logo */
.logo{
  width:64px;height:64px;border-radius:20px;
  margin:0 auto 12px auto;
  display:grid; place-items:center;
  background:
    radial-gradient(70% 70% at 30% 20%, rgba(255,255,255,.25), transparent 60%),
    linear-gradient(145deg, rgba(47,107,255,.95), rgba(123,176,255,.55));
  font-weight:900;
  box-shadow: 0 14px 34px rgba(0,0,0,.25);
}

/* labels / inputs */
.label{
  display:block;
  text-align:left;
  font-size:12px;
  color:var(--muted);
  margin-top:12px;
}

.input{
  width:100%;
  margin-top:8px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
  color: var(--text);
  padding:12px 14px;
  outline:none;
  font-size:16px;
  -webkit-text-size-adjust:100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.input:focus{
  border-color: rgba(47,107,255,.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 0 0 4px rgba(47,107,255,.14);
}

.hint{
  min-height:18px;
  margin-top:10px;
  font-size:12px;
  color:rgba(239,68,68,.92);
}

/* buttons */
.btn{
  border:1px solid rgba(47,107,255,.38);
  background:
    radial-gradient(70% 70% at 30% 20%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(145deg, rgba(47,107,255,.95), rgba(47,107,255,.68));
  color:white;
  padding:12px 14px;
  border-radius:16px;
  cursor:pointer;
  font-weight:800;
  min-height:46px;
  margin-top:10px;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition: transform .15s ease, filter .15s ease;
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.btn:active{transform:scale(.985)}
.btn--ghost{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.12);
  color:var(--text);
  box-shadow:none;
}
.btn--ghost:active{transform:scale(.99)}

/* topbar */
.topbar{
  position:sticky; top:0; z-index:50;
  padding: calc(12px + var(--safeT)) 14px 12px 14px;
  border-bottom:1px solid rgba(255,255,255,.06);
  background: rgba(10,16,28,.58);
  backdrop-filter: blur(26px);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}

.brand{display:flex; gap:12px; align-items:center; min-width:0}
.brand__logo{
  width:44px;height:44px;border-radius:16px;
  display:grid; place-items:center;
  background:
    radial-gradient(70% 70% at 30% 20%, rgba(255,255,255,.16), transparent 60%),
    rgba(47,107,255,.14);
  border:1px solid rgba(47,107,255,.18);
  font-weight:900;
}
.brand__text{min-width:0}
.brand__title{font-weight:900; letter-spacing:.2px}
.brand__sub{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.topbar__actions{position:relative; display:flex; gap:10px; align-items:center}

/* icon buttons */
.iconBtn{
  width:46px;height:46px;border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(70% 70% at 30% 20%, rgba(255,255,255,.10), transparent 60%),
    rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-size:26px;
  font-weight:900;
  cursor:pointer;
  display:grid; place-items:center;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition: transform .12s ease, filter .12s ease;
}
.iconBtn:active{transform:scale(.96)}
.iconBtn.small{width:40px;height:40px;font-size:18px;border-radius:14px}

/* menu */
.menu{
  position:absolute;
  right:0;
  top: 54px;
  width: min(260px, calc(100vw - 28px));
  border-radius:18px;
  background: rgba(17,24,39,.72);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
  overflow:hidden;
  z-index: 120;
  backdrop-filter: blur(24px);
}
.menuItem{
  width:100%;
  text-align:left;
  padding:14px 14px;
  background:transparent;
  border:0;
  color: rgba(255,255,255,.92);
  font-weight:900;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.menuItem + .menuItem{border-top:1px solid rgba(255,255,255,.08)}
.menuItem:active{background: rgba(47,107,255,.14)}
.menuItem.danger:active{background: rgba(239,68,68,.16)}

/* content */
.content{
  padding:14px;
  padding-bottom: calc(110px + var(--safeB)); /* floating tabbar + safe area */
  display:flex; flex-direction:column; gap:14px;
}
.view{display:none}
.view.is-active{display:block}

/* hero (unused sometimes, keeps style consistent) */
.hero{
  padding:14px;
  border-radius:22px;
  background: var(--surface2);
  border:1px solid var(--line2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
}

/* grid / tiles */
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}

.tile{
  border:1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(70% 70% at 30% 10%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(145deg, rgba(31,41,55,.70), rgba(17,24,39,.56));
  border-radius:22px;
  padding:16px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  text-align:left;
  min-height:92px;
  color:var(--text);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  -webkit-tap-highlight-color:transparent;
  box-shadow:
    0 10px 26px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.06);
}
.tile:hover{
  transform: translateY(-2px);
  box-shadow:
    0 16px 34px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.tile:active{transform: scale(.985)}
.tile small{display:block; color:var(--muted)}

/* list */
.list{display:flex; flex-direction:column; gap:10px}

.msgItem{
  padding:12px;
  border-radius:18px;
  background: var(--surface2);
  border:1px solid rgba(255,255,255,.10);
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition: transform .14s ease, box-shadow .14s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.msgItem:active{transform:scale(.99)}
.msgItem b{display:block}
.msgItem .meta{
  display:flex; justify-content:space-between; gap:10px;
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
}

/* badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  font-weight:900;
  font-size:12px;
}
.badge.unread{border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.10)}
.badge.read{border-color: rgba(34,197,94,.25); background: rgba(34,197,94,.10)}

/* floating iOS tabbar */
.tabbar{
  position:fixed;
  left:12px; right:12px;
  bottom: calc(12px + var(--safeB));
  height:74px;
  padding:8px;
  background: rgba(17,24,39,.58);
  border:1px solid rgba(255,255,255,.10);
  border-radius:26px;
  backdrop-filter: blur(26px);
  display:flex;
  justify-content:space-around;
  gap:8px;
  z-index:60;
  box-shadow:
    0 18px 60px rgba(0,0,0,.40),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.tab{
  flex:1;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  border-radius:18px;
  padding:10px 8px;
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-weight:800;
  min-height:56px;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.tab span{font-size:11px; color:var(--muted); font-weight:700}
.tab:active{transform:scale(.985)}
.tab.is-active{
  background: rgba(47,107,255,.16);
  border-color: rgba(47,107,255,.22);
}

/* modal */
.modal{
  position:fixed; inset:0; z-index:200;
  background: rgba(0,0,0,.58);
  display:grid; place-items:center;
  padding:16px;
}
.row{display:flex; gap:12px; margin-top:10px}

/* toasts */
.toasts{
  position:fixed; right:14px; bottom: calc(110px + var(--safeB));
  display:flex; flex-direction:column; gap:10px; z-index:300;
}
.toast{
  width:min(360px, calc(100vw - 28px));
  border-radius:18px;
  padding:12px 14px;
  background: rgba(17,24,39,.74);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  backdrop-filter: blur(22px);
}
.toast b{display:block}
.toast small{color:var(--muted)}

/* PIN PAD */
.pin-display{
  margin:18px 0;
  font-size:28px;
  letter-spacing:12px;
  text-align:center;
  font-weight:900;
}
.pin-pad{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  margin-top:10px;
}
.pin-key{
  height:64px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(70% 70% at 30% 15%, rgba(255,255,255,.10), transparent 60%),
    rgba(17,24,39,.58);
  color:var(--text);
  font-size:22px;
  font-weight:900;
  cursor:pointer;
  transition: transform .15s ease, background .15s ease, filter .15s ease;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.pin-key:active{
  background: rgba(47,107,255,.22);
  transform: scale(.96);
}
.pin-clear{ background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.22); }
.pin-del{ background: rgba(255,255,255,.06); }

/* pickers/chips */
.pickers{margin-top:8px}
.picker{margin-top:10px}
.pickerHead{display:flex; align-items:center; justify-content:space-between; gap:10px}

.btn.mini{min-height:38px; padding:8px 12px; margin-top:0; border-radius:14px}
.miniInput{margin-top:0; padding:10px 12px; border-radius:14px}

.chips{display:flex; flex-wrap:wrap; gap:10px; margin-top:10px}
.chip{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  border-radius:999px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:900;
  color:var(--text);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color:transparent;
}
.chip:active{transform:scale(.985)}
.chip.on{border-color: rgba(47,107,255,.28); background: rgba(47,107,255,.14)}
.chip small{display:block; font-weight:700; color:var(--muted)}

/* message modal */
.msgHead{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.msgBody{margin-top:12px; white-space:pre-wrap; color:var(--text); line-height:1.4}
.attachments{display:flex; flex-direction:column; gap:10px; margin-top:14px}
.att{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px;
  border-radius:18px;
  background: var(--surface2);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.att a{color:var(--text); text-decoration:none; font-weight:900}
.att small{color:var(--muted)}
.attImg{
  width:100%;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  overflow:hidden;
  background: rgba(0,0,0,.12);
}
.attImg img{width:100%; height:auto; display:block}

/* readers */
.readersBox{margin-top:14px; border-top:1px solid rgba(255,255,255,.08); padding-top:12px}
.readers{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.readerRow{
  display:flex; justify-content:space-between; gap:10px;
  padding:10px 12px;
  border-radius:16px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}
.readerRow small{color:var(--muted)}

/* komunikaty header (CLEAN FINAL) */
.viewhead{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.viewhead__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
}
.viewhead__actions{
  display:flex;
  gap:8px;
  flex-shrink:0;
}
.viewhead__actions .iconBtn.small{
  width:36px;
  height:36px;
  font-size:18px;
  border-radius:12px;
  padding:0;
}
.viewhead h2{margin:0}

/* selection / tap behavior */
.pin-pad, .pin-key, .pin-display, .tile, .tab, .iconBtn, .menuItem, .chip{
  user-select:none;
  -webkit-user-select:none;
}

/* responsive */
@media (max-width: 360px){
  .grid{grid-template-columns: 1fr}
}
/* --- DODATEK CSS: Grafik (wklej do style.css) --- */
.grafikWrap{display:grid;grid-template-columns:1fr;gap:12px;margin-top:12px}
@media(min-width:900px){.grafikWrap{grid-template-columns:1fr 1fr}}
.grafikCol{min-width:0}
.grafikCalendar{margin-top:10px}
.grafikGrid{display:grid;grid-template-columns:repeat(7,1fr);gap:8px}
.grafikDow{font-size:12px;opacity:.7;text-align:center}
.grafikCell{border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:8px;min-height:92px;background:rgba(255,255,255,.03);cursor:pointer}
.grafikCell.is-empty{border:none;background:transparent;cursor:default}
.grafikDayNum{font-weight:700;margin-bottom:6px}
.grafikBtns{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.gbtn{border:1px solid rgba(255,255,255,.12);background:transparent;border-radius:10px;padding:6px 8px;font-size:12px;cursor:pointer}
.gbtn.is-on{background:rgba(255,255,255,.12)}
.gbtn.v-OFF.is-on{background:rgba(255,0,0,.18)}
.gbtn.v-RANO.is-on{background:rgba(0,255,0,.12)}
.gbtn.v-POPO.is-on{background:rgba(0,140,255,.14)}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.segBtn{border:1px solid rgba(255,255,255,.12);background:transparent;border-radius:999px;padding:8px 10px;font-size:13px;cursor:pointer}
.segBtn.is-active{background:rgba(255,255,255,.12)}
.chipLegend{display:inline-block;border-radius:999px;padding:4px 8px;border:1px solid rgba(255,255,255,.12);margin-left:6px;font-size:12px}
.chipLegend.off{background:rgba(255,0,0,.12)}
.chipLegend.rano{background:rgba(0,255,0,.08)}
.chipLegend.popo{background:rgba(0,140,255,.10)}
.grafikSchedule{margin-top:10px}
.schDay{border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:10px;margin-bottom:10px;background:rgba(255,255,255,.03)}
.schShift{margin-top:6px;padding-top:6px;border-top:1px dashed rgba(255,255,255,.10)}
.h3{margin:0 0 8px 0;font-size:16px}
/* --- GRAFIK addon --- */
#grafikTabs{ display:flex; gap:8px; margin:8px 0 12px; }
#grafikTabs .tabBtn{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  color:inherit;
  padding:10px 12px;
  border-radius:12px;
  font-size:14px;
}
#grafikTabs .tabBtn.is-active{ background:rgba(255,255,255,.10); }

.grafikPanel.is-hidden{ display:none; }

.grafikGrid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:8px;
}
.grafikGrid .dow{
  font-size:12px;
  opacity:.8;
  text-align:center;
  padding:6px 0;
}
.grafikGrid .day{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  color:inherit;
  border-radius:14px;
  padding:10px;
  min-height:64px;
  text-align:left;
}
.grafikGrid .day.empty{
  background:transparent;
  border:0;
}
.grafikGrid .day .num{ font-weight:700; }
.grafikGrid .day .badge{ margin-top:6px; }

.st{
  display:inline-block;
  font-size:12px;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  opacity:.95;
}
.st.ok{ background:rgba(255,255,255,.06); }
.st.off{ background:rgba(255,0,0,.18); }
.st.rano{ background:rgba(0,180,255,.18); }
.st.popo{ background:rgba(255,180,0,.18); }

.pubDay{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  border-radius:14px;
  padding:10px 12px;
  margin:10px 0;
}
.pubRow{
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:13px;
  opacity:.95;
  margin-top:6px;
}

.issue{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  border-radius:12px;
  padding:10px 12px;
  margin:8px 0;
}
.issue.error{ border-color: rgba(255,0,0,.25); }
.issue.warn{ border-color: rgba(255,180,0,.25); }

.grafikTableWrap{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}

.grafikTable{
  width:100%;
  border-collapse: collapse;
  font-size: 14px;
}

.grafikTable th,
.grafikTable td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  vertical-align: top;
}

.grafikTable thead th{
  position: sticky;
  top: 0;
  background: rgba(20,20,20,.9);
  z-index: 2;
  text-align: left;
  font-weight: 700;
}

.grafikTable .colDate{
  white-space: nowrap;
}

.dateMain{
  font-weight: 800;
}

.dateSub{
  opacity:.6;
  font-size: 12px;
  margin-top: 2px;
}

.cellWarn{
  background: rgba(255, 204, 0, .10);
  border-left: 3px solid rgba(255, 204, 0, .7);
}

.grafikLegend{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:10px;
  opacity:.8;
  font-size: 12px;
}

.dot{
  width:10px;height:10px;border-radius:50%;
  display:inline-block;
}
.dot.warn{ background: rgba(255, 204, 0, .85); }
/* === GRAFIK: KALENDARZ BEZ SCROLLA === */

#grafikCalendar{
  width: 100%;
  overflow: hidden;        /* blokuje poziomy scroll */
}

#grafikCalendar .grafikGrid{
  display: grid;
  grid-template-columns: repeat(7, 1fr); /* 7 dni = zawsze równo */
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

/* komórka dnia */
#grafikCalendar .day,
#grafikCalendar .dow{
  min-width: 0;           /* bardzo ważne na mobile */
  width: 100%;
  box-sizing: border-box;
}

/* nagłówki dni */
#grafikCalendar .dow{
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  opacity: .8;
}

/* dzień */
#grafikCalendar .day{
  aspect-ratio: 1 / 1;    /* kwadrat */
  padding: 4px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* numer dnia */
#grafikCalendar .day .num{
  font-size: 13px;
  font-weight: 700;
}

/* status */
#grafikCalendar .day .badge{
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  padding: 2px 3px;
  border-radius: 6px;
}

/* mniejsze na bardzo małych ekranach */
@media (max-width: 360px){
  #grafikCalendar .day{
    padding: 2px;
  }
  #grafikCalendar .day .num{
    font-size: 11px;
  }
  #grafikCalendar .day .badge{
    font-size: 9px;
  }
}
/* Grafik DRAFT: 2 kolumny (pionowy podział) */
.draftGrid2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 420px){
  .draftGrid2{
    grid-template-columns: 1fr; /* na bardzo małych ekranach spada do 1 kolumny */
  }
}

/* chip klikany */
.chip{
  cursor: pointer;
  user-select: none;
}
/* === PLANOWANIE / DRAFT: 2 kolumny zawsze (1 zmiana | 2 zmiana) === */
.draftGrid2{
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px;
  align-items: start;
}

/* chip klikany + double tap */
.chip{
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.draftShiftBtn{
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
/* większe odstępy między dniami */
.draftDay{
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* odstęp między datą a blokiem zmian */
.draftHead{
  margin-bottom: 10px;
}

/* odstęp w środku slotu */
.draftSlot{
  padding-top: 6px;
}

/* typ zmiany (klikany nagłówek) ma mieć przestrzeń */
.draftSlotHead{
  padding: 6px 0 10px 0;
}

/* chipsy nie mogą wchodzić w nagłówek */
.draftChips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* chipy trochę mniejsze i czytelne */
.chip{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
}
.iconWarnBtn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:0;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(255, 193, 7, 0.18);
  color: inherit;
  cursor:pointer;
}

.warnCount{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 193, 7, 0.35);
  font-weight: 700;
  font-size: 12px;
  padding: 0 6px;
}

.issuesModalList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}

.issueRow{
  padding:10px 12px;
  border-radius:12px;
  background: rgba(255,255,255,0.06);
}

.issueRow.error{
  background: rgba(220, 53, 69, 0.14);
}

.issueRow.warn{
  background: rgba(255, 193, 7, 0.14);
}

.issueType{
  font-weight: 800;
  margin-bottom: 4px;
}

.issueMsg{
  opacity: .9;
}
/* === GRAFIK: jednolity toolbar przycisków (autoplan / błędy / publikuj / odśwież) === */

.grafikToolbar{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items:center;
}

/* bazowy wygląd dla wszystkich przycisków w planowaniu */
.grafikToolbar .btn,
.grafikToolbar .iconWarnBtn{
  height: 44px;
  border-radius: 14px;
  padding: 0 14px;
  font-weight: 700;
  letter-spacing: .2px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: inherit;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  cursor:pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}

.grafikToolbar .btn:hover,
.grafikToolbar .iconWarnBtn:hover{
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
}

.grafikToolbar .btn:active,
.grafikToolbar .iconWarnBtn:active{
  transform: translateY(1px);
}

.grafikToolbar .btn:disabled,
.grafikToolbar .iconWarnBtn:disabled{
  opacity: .55;
  cursor: default;
}

/* wyróżnienie akcji "Publikuj" */
.grafikToolbar .btn--primary{
  background: rgba(46, 213, 115, 0.16);
  border-color: rgba(46, 213, 115, 0.28);
}

.grafikToolbar .btn--primary:hover{
  background: rgba(46, 213, 115, 0.20);
  border-color: rgba(46, 213, 115, 0.34);
}

/* wyróżnienie "Sprawdź błędy" / ostrzeżenia */
.grafikToolbar .btn--warn{
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.28);
}

.grafikToolbar .btn--warn:hover{
  background: rgba(255, 193, 7, 0.20);
  border-color: rgba(255, 193, 7, 0.34);
}


/* wyróżnienie akcji destrukcyjnej (np. czyszczenie szkicu) */
.grafikToolbar .btn--danger{
  background: rgba(220, 53, 69, 0.16);
  border-color: rgba(220, 53, 69, 0.28);
}

.grafikToolbar .btn--danger:hover{
  background: rgba(220, 53, 69, 0.20);
  border-color: rgba(220, 53, 69, 0.34);
}

/* ikonka ostrzeżeń obok odświeżania - dopasowana do reszty */
.iconWarnBtn{
  border-radius: 14px;
  padding: 0 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.warnCount{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 193, 7, 0.22);
  border: 1px solid rgba(255, 193, 7, 0.28);
  font-weight: 800;
  font-size: 12px;
  padding: 0 7px;
}

/* === MODAL: lista błędów jednolita i czytelna === */
.issuesModalList{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 12px;
}

.issueRow{
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
}

.issueRow.error{
  background: rgba(220, 53, 69, 0.14);
  border-color: rgba(220, 53, 69, 0.22);
}

.issueRow.warn{
  background: rgba(255, 193, 7, 0.14);
  border-color: rgba(255, 193, 7, 0.22);
}

.issueType{
  font-weight: 900;
  margin-bottom: 4px;
}

.issueMsg{
  opacity: .9;
  line-height: 1.25;
}

/* opcjonalnie: przycisk tytułu zmiany w szkicu (żeby był "jak reszta") */
.draftShiftBtn{
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
/* === STATYSTYKI: tabela + brakujące sloty === */
.grafikStatsWrap{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.grafikStatsCard{
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 12px;
}

.grafikStatsHead{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.statsTableWrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

.statsTable{
  width:100%;
  border-collapse: collapse;
  min-width: 520px;
}

.statsTable th, .statsTable td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
}

.statsTable thead th{
  font-weight: 900;
  background: rgba(255,255,255,0.05);
}

.statsTable .stName{
  font-weight: 800;
}

.statsTable .stNum{
  text-align:center;
  font-weight: 900;
}

.missingList{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.missingRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px 12px;
}

.missingDate{
  display:flex;
  flex-direction:column;
  gap: 2px;
  font-weight: 900;
}

.missingChip{
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
}

.missingChip.rano{
  border-color: rgba(0, 200, 255, 0.25);
  background: rgba(0, 200, 255, 0.10);
}

.missingChip.popo{
  border-color: rgba(255, 120, 0, 0.25);
  background: rgba(255, 120, 0, 0.10);
}
.statsTableWrap{
  overflow:auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

.statsTable{
  width:100%;
  border-collapse: collapse;
  min-width: 560px;
}

.statsTable th, .statsTable td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
}

.statsTable thead th{
  font-weight: 900;
  background: rgba(255,255,255,0.05);
}

.statsTable .stName{ font-weight: 800; }
.statsTable .stNum{ text-align:center; font-weight: 900; }

.cellPos{ color: #7dffb0; }
.cellNeg{ color: #ff8b8b; }
/* ===== POPUP STATYSTYKI: tabela mieści się na ekranie ===== */

/* panel w modalu ma limit wysokości i własny scroll */
#grafikStatsModal .panel{
  width: min(920px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  overflow: hidden; /* żeby scroll był tylko w środku */
}

/* ciało modala przewija się pionowo */
#grafikStatsModal #grafikStatsModalBody{
  overflow: auto;
  max-height: calc(78vh - 130px); /* zostaw miejsce na h3 i przycisk zamknij */
  padding-right: 2px;
}

/* wrapper tabeli: bez poziomego scrolla */
#grafikStatsModal .statsTableWrap{
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

/* tabela: dopasowana do szerokości */
#grafikStatsModal .statsTable{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* najważniejsze: kolumny się mieszczą */
}

/* komórki: kompaktowe i czytelne */
#grafikStatsModal .statsTable th,
#grafikStatsModal .statsTable td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
  font-size: 14px;
}

/* sticky header */
#grafikStatsModal .statsTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(20,20,20,0.92);
  backdrop-filter: blur(10px);
  font-weight: 900;
}

/* 1 kolumna (Pracownik) – szeroka i ucinanie */
#grafikStatsModal .statsTable th:first-child,
#grafikStatsModal .statsTable td:first-child{
  width: 5%;
}

#grafikStatsModal .statsTable td:first-child{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
}

/* pozostałe kolumny: równe i małe */
#grafikStatsModal .statsTable th.stNum,
#grafikStatsModal .statsTable td.stNum{
  width: calc(95% / 4/* ===== POPUP STATYSTYKI: 1 kolumna sticky, reszta przewijana ===== */

#grafikStatsModal .panel{
  width: min(920px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  overflow: hidden;
}

#grafikStatsModal #grafikStatsModalBody{
  overflow: auto;
  max-height: calc(78vh - 130px);
  padding-right: 2px;
}

/* tu włączamy poziome przewijanie */
#grafikStatsModal .statsTableWrap{
  overflow: auto;              /* <-- poziomy i pionowy w razie potrzeby */
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

/* tabela może być szersza niż popup */
#grafikStatsModal .statsTable{
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;            /* <-- gwarantuje sensowną szerokość kolumn */
}

/* komórki */
#grafikStatsModal .statsTable th,
#grafikStatsModal .statsTable td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
  font-size: 14px;
  white-space: nowrap;         /* <-- żeby nie łamało kolumn */
}

/* sticky header */
#grafikStatsModal .statsTable thead th{
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(20,20,20,0.92);
  backdrop-filter: blur(10px);
  font-weight: 900;
}

/* ===== sticky FIRST COLUMN (Pracownik) ===== */
#grafikStatsModal .statsTable th:first-child,
#grafikStatsModal .statsTable td:first-child{
  position: sticky;
  left: 0;
  z-index: 4; /* nad resztą */
  background: rgba(20,20,20,0.96);
  backdrop-filter: blur(10px);
  min-width: 240px;
  max-width: 320px;
}

/* ucinanie długich nazw */
#grafikStatsModal .statsTable td:first-child{
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
}

/* kolumny liczbowe */
#grafikStatsModal .statsTable th.stNum,
#grafikStatsModal .statsTable td.stNum{
  text-align: center;
  font-weight: 900;
}

/* balans kolor */
#grafikStatsModal .cellPos{ color: #7dffb0; }
#grafikStatsModal .cellNeg{ color: #ff8b8b; }

/* na telefonie: mniejsza minimalna szerokość tabeli */
@media (max-width: 520px){
  #grafikStatsModal .panel{
    width: calc(100vw - 14px);
    max-height: 82vh;
  }
  #grafikStatsModal #grafikStatsModalBody{
    max-height: calc(82vh - 128px);
  }
  #grafikStatsModal .statsTable{
    min-width: 760px;
  }
  #grafikStatsModal .statsTable th,
  #grafikStatsModal .statsTable td{
    padding: 9px 8px;
    font-size: 13px;
  }
  #grafikStatsModal .statsTable th:first-child,
  #grafikStatsModal .statsTable td:first-child{
    min-width: 150px;
  }
}
); /* 6 kolumn liczbowych */
  text-align: center;
  font-weight: 900;
  white-space: nowrap;
}

/* balans kolor */
#grafikStatsModal .cellPos{ color: #7dffb0; }
#grafikStatsModal .cellNeg{ color: #ff8b8b; }

/* na telefonie bardziej kompaktowo */
@media (max-width: 520px){
  #grafikStatsModal .panel{
    width: calc(100vw - 14px);
    max-height: 82vh;
  }
  #grafikStatsModal #grafikStatsModalBody{
    max-height: calc(82vh - 128px);
  }
  #grafikStatsModal .statsTable th,
  #grafikStatsModal .statsTable td{
    padding: 9px 8px;
    font-size: 13px;
  }
  #grafikStatsModal .statsTable th:first-child,
  #grafikStatsModal .statsTable td:first-child{
    width: 14%;
  }
}
/* ================================
   MODAL (overlay) – STATYSTYKI
   ================================ */

.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
}

.modal.is-hidden{
  display: none !important;
}

/* Panel w modalu */
#grafikStatsModal .panel{
  width: min(980px, calc(100vw - 24px));
  max-height: min(82vh, 760px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(18,18,18,0.92);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}

/* body modala przewija się w pionie */
#grafikStatsModal #grafikStatsModalBody{
  overflow: auto;
  max-height: calc(82vh - 140px); /* miejsce na tytuł + przycisk */
  padding-right: 2px;
}

/* ================================
   TABELA – 1 kolumna sticky, reszta scroll X
   ================================ */

#grafikStatsModal .statsTableWrap{
  overflow: auto;                 /* <-- poziomy scroll */
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
}

/* tabela może być szersza niż ekran -> wtedy działa scroll */
#grafikStatsModal .statsTable{
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;               /* <-- żeby wszystkie kolumny były czytelne */
}

#grafikStatsModal .statsTable th,
#grafikStatsModal .statsTable td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
  font-size: 14px;
  white-space: nowrap;            /* <-- nie łamie kolumn */
}

/* sticky header */
#grafikStatsModal .statsTable thead th{
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(18,18,18,0.96);
  backdrop-filter: blur(10px);
  font-weight: 900;
}

/* sticky FIRST COLUMN */
#grafikStatsModal .statsTable th:first-child,
#grafikStatsModal .statsTable td:first-child{
  position: sticky;
  left: 0;
  z-index: 4;
  background: rgba(18,18,18,0.98);
  backdrop-filter: blur(10px);
  min-width: 240px;
  max-width: 320px;
}

/* cień separatora (żeby było widać „przyklejoną” kolumnę) */
#grafikStatsModal .statsTable th:first-child::after,
#grafikStatsModal .statsTable td:first-child::after{
  content: "";
  position: absolute;
  top: 0;
  right: -10px;
  width: 10px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.35), rgba(0,0,0,0));
}

/* ucinanie długich nazw */
#grafikStatsModal .statsTable td:first-child{
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
}

#grafikStatsModal .statsTable th.stNum,
#grafikStatsModal .statsTable td.stNum{
  text-align: center;
  font-weight: 900;
}

#grafikStatsModal .cellPos{ color: #7dffb0; }
#grafikStatsModal .cellNeg{ color: #ff8b8b; }

/* Mobile */
@media (max-width: 520px){
  #grafikStatsModal .panel{
    width: calc(100vw - 14px);
    max-height: 86vh;
  }
  #grafikStatsModal #grafikStatsModalBody{
    max-height: calc(86vh - 138px);
  }
  #grafikStatsModal .statsTable{
    min-width: 820px;
  }
  #grafikStatsModal .statsTable th:first-child,
  #grafikStatsModal .statsTable td:first-child{
    min-width: 150px;
  }
}
/* ✅ Zielone podświetlenie całej komórki gdy to moja zmiana */
.meShiftCell{
  background: rgba(34,197,94,.16);
  box-shadow: inset 0 0 0 2px rgba(34,197,94,.35);
}

/* ✅ Zielone podświetlenie samego imienia */
.meShiftName{
  background: rgba(34,197,94,.22);
  color: #15803d;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
}
/* ===== WNIOSKI ===== */
.wnItem{
  padding:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius:16px;
  margin-bottom:10px;
  cursor:pointer;
  transition: transform .14s ease, box-shadow .14s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.wnItem:active{transform:scale(.99)}
.wnItem b{display:block}
.wnProp{margin-top:8px; color: rgba(255,255,255,.86); font-size:13px; line-height:1.35}
.wnDecision{margin-top:8px; font-size:12px; color: var(--muted)}

.badge.wn.pending{border-color: rgba(234,179,8,.25); background: rgba(234,179,8,.10)}
.badge.wn.approved{border-color: rgba(34,197,94,.25); background: rgba(34,197,94,.10)}
.badge.wn.rejected{border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.10)}

.btn.is-on{outline:2px solid rgba(255,255,255,.20)}
.attRow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  margin-top:8px;
  background: rgba(255,255,255,.04);
}
.attLink{
  color: rgba(255,255,255,.92);
  text-decoration:none;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.rcpQrWrap{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:240px;
  padding: 10px;
}
.rcpToken{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  opacity: .9;
  word-break: break-all;
}
.pill{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
  white-space: nowrap;
}