:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --ok: #059669;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.16);
  --radius: 10px;
  --radius-sm: 7px;
}

html.dark {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-hover: #1e293b;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --accent-text: #a5b4fc;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar-semester-box { display: none; }

/* ========== TOPBAR (3 elementy) ========== */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  z-index: 20;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
}
.semester-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color .12s, background .12s, color .12s;
}
.semester-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.admin-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.search-trigger {
  flex: 1;
  max-width: 440px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger span { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  transition: background .12s, border-color .12s;
}
.profile-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.avatar {
  width: 24px; height: 24px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* ========== LAYOUT ========== */
.shell { flex: 1; display: flex; overflow: hidden; }

.sidebar {
  width: 248px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  flex-shrink: 0;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.icon-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--text-2);
  display: grid;
  place-items: center;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

.nav-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}
.nav-item {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  transition: background .1s, color .1s;
}
.nav-row:hover .nav-item { background: var(--surface-hover); color: var(--text); }
.nav-row.active .nav-item {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.nav-row.drop-target .nav-item {
  outline: 2px dashed var(--accent);
  background: var(--accent-soft);
}
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.urgent-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--danger);
  margin-left: auto;
}
.nav-more {
  position: absolute;
  right: 4px;
  opacity: 0;
  width: 24px; height: 24px;
  border-radius: 5px;
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.nav-row:hover .nav-more { opacity: 1; }
.nav-more:hover { background: var(--border); color: var(--text); }

/* ========== MAIN WORKSPACE ========== */
.workspace {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 72px;
  position: relative;
}
.workspace-inner { max-width: 1120px; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.page-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-meta { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* Buttons */
.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* Category tabs */
.tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tabs { display: flex; align-items: center; gap: 2px; }
.tab {
  padding: 9px 13px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.tab.drop-target { background: var(--accent-soft); border-radius: 6px 6px 0 0; }
.tab-count {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 600;
}
.tab.active .tab-count { color: var(--accent-text); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.toolbar-right, .toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  padding: 2px;
  border-radius: 7px;
  border: 1px solid var(--border);
}
.segmented button {
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.select-sm {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 600;
}

/* ========== RESOURCE LIST (domyślny widok) ========== */
.res-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.res-row {
  display: grid;
  grid-template-columns: 28px 28px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background .08s;
  user-select: none;
}
.res-row.ro-row {
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
}
.res-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
a.icon-btn {
  text-decoration: none;
}
a.icon-btn:hover {
  text-decoration: none;
}
.action-dl {
  color: var(--text-2);
}
.action-dl:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.res-row:last-child { border-bottom: none; }
.res-row:hover { background: var(--surface-hover); }
.res-row.selected { background: var(--accent-soft); }
.res-row[draggable="true"] { cursor: grab; }

.row-check {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  opacity: 0;
  cursor: pointer;
}
.res-row:hover .row-check, .res-row.selected .row-check, .has-selection .row-check { opacity: 1; }

.res-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
}
.res-main { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.res-title:hover { color: var(--accent-text); }
.res-subname {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-chip {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
}
.tag-chip:hover { background: var(--accent-soft); color: var(--accent-text); }

.res-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.pill-neutral {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}
.subj-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}
.res-date { font-size: 12px; color: var(--text-3); min-width: 72px; text-align: right; }

.inline-rename {
  font-size: 14px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1.5px solid var(--accent);
  background: var(--surface);
  width: min(420px, 100%);
  outline: none;
}

/* ========== GRID (kafelki – opcjonalny widok) ========== */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.res-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .12s, box-shadow .12s;
  position: relative;
}
.res-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.res-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.res-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.res-card-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.res-card-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}

/* ========== DROP STRIP & EMPTY STATE ========== */
.drop-strip {
  margin-top: 12px;
  padding: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.drop-strip:hover, .drop-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.empty-box {
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
}
.empty-box h3 { font-size: 15.5px; font-weight: 600; margin: 10px 0 4px; }
.empty-box p { font-size: 13.5px; color: var(--text-2); margin: 0 auto 16px; max-width: 380px; }

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.10);
  backdrop-filter: blur(2px);
  border: 3px dashed var(--accent);
  z-index: 60;
  display: none;
  place-items: center;
  pointer-events: none;
}
.drop-overlay.show { display: grid; }
.drop-overlay-card {
  background: var(--surface);
  padding: 22px 32px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========== START VIEW & PROJECT BANNER ========== */
.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.simple-list { display: flex; flex-direction: column; }
.simple-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 13.5px;
  cursor: pointer;
}
.simple-item:hover { background: var(--surface-hover); }

.project-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.progress-bar {
  width: 96px; height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar > div { height: 100%; background: var(--ok); transition: width .2s; }

/* ========== KANBAN (widok projektu) ========== */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 860px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}
.k-task {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.k-task-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}
.quick-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  font-size: 13px;
}
.quick-input:focus { border-style: solid; border-color: var(--accent); background: var(--surface); outline: none; }

/* ========== DRAWER (szuflada z prawej zamiast modali) ========== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.drawer.wide { width: min(960px, 98vw); }
.drawer.open { transform: translateX(0); }

/* Kafelki przedmiotów na pulpicie Start */
.start-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.start-sub-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  text-decoration: none;
}
.start-sub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}
.start-sub-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}
.start-sub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.start-sub-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
}
.start-sub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.start-sub-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.start-sub-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.start-sub-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
}
.start-sub-alert {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.09);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 5px;
  padding: 3px 8px;
}

/* Harmonogram zajęć tabela i szuflada */
.sched-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}
.sched-table-inner {
  min-width: 760px;
}
.sched-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.4fr) 105px 115px 76px 76px 125px minmax(65px, 0.8fr) 40px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sched-row:last-child {
  border-bottom: none;
}
.sched-row-head {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 10px;
}
.sch-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
.sch-del-btn:hover {
  background: var(--danger, #ef4444);
  color: #fff;
  border-color: var(--danger, #ef4444);
}

/* Nowy czytelny i responsywny harmonogram zajęć */
.sched-form-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}
.sched-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.sched-day-group {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sched-day-header {
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sched-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.sched-day-count {
  font-size: 12px;
  color: var(--text-3);
  font-weight: normal;
}
.sched-slots-list {
  display: flex;
  flex-direction: column;
}
.sched-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.sched-slot-card:last-child {
  border-bottom: none;
}
.sched-slot-card:hover {
  background: var(--surface-2);
}
.sched-slot-card.is-editing {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--accent);
}
.sched-slot-time-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
}
.sched-slot-time {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sched-slot-freq {
  font-size: 11px;
  color: var(--text-2);
}
.sched-slot-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sched-slot-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sched-slot-sub {
  font-size: 13.5px;
  color: var(--text);
}
.sched-slot-room {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.sched-slot-notes {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.sched-slot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .sched-slot-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .sched-slot-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px dashed var(--border);
    padding-top: 6px;
    margin-top: 2px;
  }
}
.drawer-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 700; margin: 0; min-width: 0; flex: 1; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Form elements */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.input, .textarea, .select {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  outline: none;
  transition: border-color .12s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }
.textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.55; resize: vertical; }

.radio-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-pill {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.radio-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 999px;
  border: 2px solid transparent;
}
.swatch.active { outline: 2px solid var(--text); outline-offset: 2px; }

/* ========== CONTEXT MENU & POPOVER ========== */
.ctx-menu {
  position: fixed;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 5px;
  z-index: 70;
  display: none;
}
.ctx-menu.open { display: block; }
.ctx-item {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}
.ctx-item span { display: inline-flex; align-items: center; gap: 9px; }
.ctx-item:hover { background: var(--surface-hover); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger-soft); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }
.ctx-label {
  padding: 5px 10px 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

/* ========== BULK BAR (akcje masowe) ========== */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 130%);
  background: #0f172a;
  color: #f8fafc;
  padding: 8px 12px 8px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 35;
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.bulk-bar.show { transform: translate(-50%, 0); }
.bulk-bar .btn-bulk {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: #f8fafc;
  background: rgba(255,255,255,0.1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bulk-bar .btn-bulk:hover { background: rgba(255,255,255,0.2); }
.bulk-bar .btn-bulk.danger { background: rgba(239,68,68,0.25); color: #fecaca; }

/* ========== TOASTS (z "Cofnij") ========== */
.toasts {
  position: fixed;
  left: 24px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}
.toast {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  pointer-events: none;
}
.toast-action {
  color: #a5b4fc;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  pointer-events: auto;
}
.toast-action:hover { background: rgba(255,255,255,0.12); }

/* ========== OMNISEARCH & SHORTCUTS MODAL ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 65;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 16px;
}
.modal-backdrop.open { display: flex; }
.omni-box {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.omni-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.omni-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
}
.omni-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.omni-item {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  text-align: left;
}
.omni-item:hover, .omni-item.active { background: var(--accent-soft); color: var(--accent-text); }

/* ========== MARKDOWN PROSE ========== */
.prose { font-size: 14.5px; line-height: 1.65; color: var(--text); }
.prose h1 { font-size: 1.35rem; margin: 0.6em 0 0.4em; }
.prose h2 { font-size: 1.15rem; margin: 0.8em 0 0.35em; }
.prose h3 { font-size: 1.02rem; margin: 0.7em 0 0.3em; }
.prose p { margin: 0 0 0.75em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 0.75em; }
.prose code {
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.88em;
}
.prose pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 0.9em;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  margin: 0 0 0.75em;
  padding-left: 12px;
  color: var(--text-2);
}

.note-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 360px;
}
@media (max-width: 720px) { .note-split { grid-template-columns: 1fr; } }

.lucide { width: 16px; height: 16px; stroke-width: 1.9; flex-shrink: 0; }
.lucide-sm { width: 14px; height: 14px; }


/* ========== FOLDERS & BREADCRUMBS (kategoria Pomocnicze) ========== */
.folder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.crumb {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.crumb:hover { background: var(--surface-hover); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 700; }
.crumb.drop-target { outline: 2px dashed var(--accent); background: var(--accent-soft); }
.crumb-sep { color: var(--text-3); font-size: 12px; }

.folder-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.folder-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .08s;
}
.folder-row:last-child { border-bottom: none; }
.folder-row:hover { background: var(--surface-hover); }
.folder-row.drop-target, .folder-card.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}
.folder-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
html.dark .folder-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.folder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.folder-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }

/* ========== TEAMS & MEMBER CHIPS ========== */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.team-card:hover { border-color: var(--border-strong); }
.member-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
}
.member-chip .mini-av {
  width: 18px; height: 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
}

/* ========== GITHUB & GITLAB INTEGRATION ========== */
.git-accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.git-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.git-card.connected {
  background: var(--surface);
  border-color: var(--border-strong);
}
.repo-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 48vh;
  overflow-y: auto;
}
.repo-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 170px 150px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.repo-row:last-child { border-bottom: none; }
.repo-row:hover { background: var(--surface-hover); }
.repo-row.checked { background: var(--accent-soft); }
@media (max-width: 720px) {
  .repo-row { grid-template-columns: 24px minmax(0, 1fr); }
}


/* ========== GOŚĆ, HARMONOGRAM ZAJĘĆ & KALENDARZ TERMINÓW ========== */
.guest-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.schedule-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.schedule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.schedule-chip strong { color: var(--text); font-weight: 600; }

.sched-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-row {
  display: grid;
  grid-template-columns: 125px 125px 86px 86px 135px minmax(75px, 1fr) 30px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
@media (max-width: 780px) {
  .sched-row { grid-template-columns: 1fr 1fr; }
}

.auto-time-banner {
  margin-top: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.cal-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-month-title {
  font-size: 15px;
  font-weight: 700;
  min-width: 155px;
  text-align: center;
  text-transform: capitalize;
}
.cal-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cal-filter-pill {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .12s;
}
.cal-filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.cal-filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.cal-filter-pill.active-danger,
.cal-filter-pill.exam-only.active {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.24), 0 2px 8px rgba(220, 38, 38, 0.34);
}
.cal-filter-pill.active-danger:hover,
.cal-filter-pill.exam-only.active:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #ffffff;
}
.cal-filter-pill.active-danger .dot,
.cal-filter-pill.exam-only.active .dot {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.cal-filter-pill.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.cal-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-weekday {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.cal-weekday.is-weekend {
  background: #e0f2fe;
  color: #0369a1;
  border-left: 1px solid rgba(14, 165, 233, 0.22);
}
html.dark .cal-weekday.is-weekend {
  background: rgba(14, 165, 233, 0.16);
  color: #38bdf8;
  border-left-color: rgba(56, 189, 248, 0.2);
}
.cal-wd-free {
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0;
  opacity: 0.85;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-cell {
  min-height: 118px;
  padding: 6px 7px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background .1s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--surface-hover); }
.cal-cell.is-weekend {
  background: linear-gradient(180deg, #f0f9ff 0%, #e6f4fe 100%);
}
.cal-cell.is-weekend:hover {
  background: #e0f2fe;
}
html.dark .cal-cell.is-weekend {
  background: rgba(14, 165, 233, 0.085);
}
html.dark .cal-cell.is-weekend:hover {
  background: rgba(14, 165, 233, 0.13);
}
.cal-cell.other-month {
  background: var(--surface-2);
  opacity: 0.58;
}
.cal-cell.is-weekend.other-month {
  background: #e4eff8;
  opacity: 0.62;
}
html.dark .cal-cell.is-weekend.other-month {
  background: rgba(14, 165, 233, 0.045);
}
.cal-cell.today {
  background: rgba(79, 70, 229, 0.04);
}
.cal-cell.is-weekend.today {
  background: linear-gradient(180deg, #e0f2fe 0%, #dbeafe 100%);
}
html.dark .cal-cell.is-weekend.today {
  background: rgba(56, 189, 248, 0.14);
}
.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}
.cal-day-num {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.cal-cell.is-weekend .cal-day-num {
  color: #0369a1;
  font-weight: 700;
}
html.dark .cal-cell.is-weekend .cal-day-num {
  color: #38bdf8;
}
.cal-cell.today .cal-day-num,
html.dark .cal-cell.today .cal-day-num {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.cal-weekend-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.3);
}
html.dark .cal-weekend-tag {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.32);
}
.cal-day-add {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: var(--text-3);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity .12s, background .12s;
}
.cal-cell:hover .cal-day-add { opacity: 1; }
.cal-day-add:hover { background: var(--surface-2); color: var(--text); }

.cal-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-dots-row {
  display: none;
}
.cal-mobile-agenda {
  display: none;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.cal-dot.exam { background: var(--danger, #ef4444); }
.cal-dot.deadline { background: #3b82f6; }
.cal-dot.lab { background: #10b981; }
.cal-dot.lecture { background: #6366f1; }
.cal-dot.proj { background: #f59e0b; }
.cal-dot.holiday { background: #06b6d4; }
.cal-ev {
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.3;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  color: var(--text);
  transition: filter .1s, transform .08s;
  text-align: left;
}
.cal-ev:hover { filter: brightness(0.96); }
.cal-ev.exam {
  background: #fee2e2;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-left: 3.5px solid #dc2626;
  color: #7f1d1d;
  font-weight: 600;
}
html.dark .cal-ev.exam {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(248, 113, 113, 0.38);
  border-left-color: #f87171;
  color: #fee2e2;
}
.cal-ev.deadline {
  background: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-left: 3.5px solid #d97706;
  color: #78350f;
  font-weight: 600;
}
html.dark .cal-ev.deadline {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.35);
  border-left-color: #fbbf24;
  color: #fef3c7;
}
.cal-ev.done,
.cal-ev.exam.done {
  opacity: 0.55;
  text-decoration: line-through;
}
.cal-ev.lesson {
  background: var(--surface-2);
  font-weight: 500;
}
.cal-ev-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  color: var(--text-2);
}
.cal-ev.exam .cal-ev-top {
  color: #b91c1c;
  font-weight: 700;
}
html.dark .cal-ev.exam .cal-ev-top {
  color: #fca5a5;
}
.cal-ev.deadline .cal-ev-top {
  color: #b45309;
  font-weight: 700;
}
html.dark .cal-ev.deadline .cal-ev-top {
  color: #fcd34d;
}
.cal-ev-kind {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
}
html.dark .cal-ev-kind {
  background: rgba(248, 113, 113, 0.24);
  color: #fecaca;
}
.cal-ev.deadline .cal-ev-kind {
  background: rgba(217, 119, 6, 0.16);
  color: #92400e;
}
html.dark .cal-ev.deadline .cal-ev-kind {
  background: rgba(251, 191, 36, 0.22);
  color: #fde68a;
}
.cal-ev-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pasek informacyjny oficjalnego kalendarza akademickiego PŚk */
.acad-info-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.acad-info-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.acad-badge-p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.acad-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.acad-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  flex-wrap: wrap;
}
.acad-sub .sep {
  color: var(--text-3);
  font-size: 10px;
}
.acad-info-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cal-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.cal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
.cal-legend-dot.weekend {
  background: #0ea5e9;
}
.cal-legend-dot.holiday {
  background: #f59e0b;
}
.cal-legend-dot.shift {
  background: #8b5cf6;
}

/* Plakietki parzystości tygodnia w kalendarzu */
.cal-parity-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.cal-parity-tag.tn {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.28);
}
.cal-parity-tag.tp {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.28);
}
html.dark .cal-parity-tag.tp {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

/* Plakietka dni wolnych / świąt / ferii */
.cal-holiday-pill {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px dashed rgba(245, 158, 11, 0.45);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
}
html.dark .cal-holiday-pill {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
}
.cal-cell.is-holiday {
  background: rgba(245, 158, 11, 0.025);
}

/* Plakietka sesji egzaminacyjnej */
.cal-session-pill {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
}
.cal-cell.is-session {
  background: rgba(239, 68, 68, 0.03);
}

/* Plakietka przesunięcia rektorskiego */
.cal-shift-pill {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 9.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
html.dark .cal-shift-pill {
  color: #c084fc;
  background: rgba(139, 92, 246, 0.2);
}

/* Plakietka sali zajęć w lekcji */
.room-pill {
  display: inline-block;
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-2);
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
}
html.dark .room-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Kolorowanie kategorii zajęć w kalendarzu */
.cal-ev.lesson-wyklad {
  border-left-color: #6366f1;
}
.cal-ev.lesson-laboratorium {
  border-left-color: #10b981;
}
.cal-ev.lesson-projekt {
  border-left-color: #f59e0b;
}
.cal-ev.lesson-cwiczenia {
  border-left-color: #10b981;
}
.cal-ev.ev-projekt,
.cal-ev.proj {
  background: #fef3c7;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 3.5px solid #f59e0b;
  color: #78350f;
  font-weight: 600;
}
html.dark .cal-ev.ev-projekt,
html.dark .cal-ev.proj {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.35);
  border-left-color: #fbbf24;
  color: #fef3c7;
}
.cal-ev.ev-inne,
.cal-ev.term {
  background: #eff6ff;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-left: 3.5px solid #3b82f6;
  color: #1e3a8a;
  font-weight: 600;
}
html.dark .cal-ev.ev-inne,
html.dark .cal-ev.term {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
  border-left-color: #60a5fa;
  color: #dbeafe;
}
@media (max-width: 860px) {
  .cal-cell { min-height: 88px; padding: 4px; }
  .cal-ev { font-size: 10.5px; padding: 3px 4px; }
}

/* ==========================================================================
   DOSTOSOWANIE DLA URZĄDZEŃ MOBILNYCH (SMARTFONY, TABLETY, TOUCH UX)
   ========================================================================== */

.dl-row {
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto 32px;
}
.dl-row.ro-dl-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

/* Ukrycie elementów mobilnych na standardowych ekranach komputerowych */
.mobile-toggle-btn { display: none !important; }
.sidebar-backdrop { display: none !important; }
.sidebar-mobile-head { display: none !important; }
.mobile-nav { display: none !important; }

/* Optymalizacja dotykowa */
button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* MEDIA QUERY: Ekrany tabletowe i mobilne (<= 768px) */
@media (max-width: 768px) {
  /* Główne kontenery */
  body {
    overflow-x: hidden;
  }
  .shell {
    position: relative;
    overflow-x: hidden;
  }

  /* 1. TOPBAR MOBILNY */
  .topbar {
    height: 52px;
    padding: 0 8px;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .topbar-left {
    gap: 4px;
    min-width: 0;
    flex-shrink: 0;
  }
  .mobile-toggle-btn {
    display: inline-flex !important;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text);
    flex-shrink: 0;
  }
  .mobile-toggle-btn:active {
    background: var(--surface-2);
  }
  .brand {
    gap: 6px;
    font-size: 14px;
    flex-shrink: 0;
  }
  .brand-text {
    display: none; /* Na małych ekranach zostawiamy sam znaczek dla maksymalnej przestrzeni */
  }
  @media (min-width: 480px) and (max-width: 768px) {
    .brand-text {
      display: inline !important;
    }
  }
  .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }
  /* Usunięcie przycisku semestru i wielkiego logowania z paska na telefonie */
  .topbar .semester-btn {
    display: none !important;
  }
  #topbarLoginBtn {
    display: none !important;
  }
  .sidebar-semester-box {
    display: block !important;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-semester-box .semester-btn {
    display: flex !important;
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
  }
  .search-trigger {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    height: 36px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  .search-trigger kbd {
    display: none !important;
  }
  .search-trigger span {
    font-size: 12px;
    gap: 6px;
  }
  .profile-btn {
    padding: 3px 6px;
    gap: 5px;
    font-size: 12.5px;
    flex-shrink: 0;
  }
  #profileName {
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #profileGuestBadge, #profileAdminBadge {
    display: none !important;
  }

  /* 2. MENU BOCZNE OFF-CANVAS Z TŁEM BACKDROP */
  .sidebar-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
    z-index: 59;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .sidebar-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    z-index: 60;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 12px 14px 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-mobile-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .sidebar-mobile-title {
    font-weight: 700;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
  }

  /* 3. MOBILNY DOLNY PASEK NAWIGACJI (BOTTOM NAV) */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    z-index: 35;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: center;
    justify-content: space-around;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
    position: relative;
    transition: color .12s;
    user-select: none;
  }
  .mobile-nav-item i {
    width: 20px;
    height: 20px;
  }
  .mobile-nav-item .urgent-dot {
    position: absolute;
    top: 7px;
    right: calc(50% - 15px);
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--danger, #ef4444);
    border: 2px solid var(--surface);
    margin: 0;
    pointer-events: none;
    z-index: 2;
  }
  .mobile-nav-item.active {
    color: var(--accent);
    font-weight: 700;
  }
  .mobile-nav-item:active {
    transform: scale(0.96);
  }
  .mobile-nav-add {
    position: relative;
  }
  .mobile-add-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    margin-top: -16px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
    transition: transform .12s;
  }
  .mobile-add-circle i {
    width: 22px;
    height: 22px;
  }
  .mobile-nav-item:active .mobile-add-circle {
    transform: scale(0.92);
  }

  /* 4. OBSZAR ROBOCZY WORKSPACE */
  .workspace {
    padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .workspace-inner {
    max-width: 100%;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
  }
  .page-head > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-head > div:last-child .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
  }
  .page-title {
    font-size: 20px;
    line-height: 1.25;
  }
  .page-meta {
    font-size: 12.5px;
    gap: 6px;
  }

  /* 5. WIDOK PRZEDMIOTU I KATEGORII */
  .tabs-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px 12px;
    padding: 0 12px;
  }
  .tabs-bar::-webkit-scrollbar {
    display: none;
  }
  .tabs {
    flex-shrink: 0;
  }
  .tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 13px;
  }
  .schedule-summary-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  .schedule-chips {
    flex-wrap: wrap;
    gap: 4px;
  }
  .folder-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  /* 6. LISTA MATERIAŁÓW I ZASOBÓW */
  .res-row {
    grid-template-columns: 24px 28px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 8px;
  }
  .res-row.ro-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }
  .dl-row {
    grid-template-columns: 24px minmax(0, 1fr) auto 32px !important;
    gap: 8px;
    padding: 10px 8px;
  }
  .dl-row.ro-dl-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  .dl-row .subj-pill,
  .dl-row .dl-subj-slot {
    display: none !important;
  }
  .cal-wd-free {
    display: none;
  }
  .ctx-menu {
    max-width: calc(100vw - 16px);
    z-index: 85;
  }
  .res-meta, .res-date {
    display: none;
  }
  .row-check {
    opacity: 0.7;
    width: 18px;
    height: 18px;
  }
  .res-title {
    font-size: 14px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35;
  }
  .res-actions .btn-sm {
    padding: 0 7px;
    height: 30px;
  }
  .res-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 7. WIDOK START I PANELE */
  .start-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .teams-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 8. KALENDARZ TERMINÓW NA TELEFONIE */
  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .cal-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
    width: 100%;
  }
  .cal-filters::-webkit-scrollbar {
    display: none;
  }
  .cal-filter-pill {
    flex-shrink: 0;
  }
  .cal-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .cal-controls-left, .cal-controls-right {
    width: 100%;
    justify-content: space-between;
  }
  .cal-grid {
    gap: 2px;
    background: var(--border);
  }
  .cal-head, .cal-weekday {
    font-size: 11px;
    padding: 6px 2px;
    text-align: center;
  }
  .cal-cell {
    min-height: 48px;
    padding: 4px 2px;
    cursor: pointer;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-radius: 6px;
    transition: background .12s, outline .12s;
  }
  .cal-cell.is-selected-day {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: rgba(99, 102, 241, 0.12) !important;
  }
  .cal-cell-head {
    margin-bottom: 2px;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .cal-cell .cal-parity-tag,
  .cal-cell .cal-weekend-tag,
  .cal-cell .cal-day-add {
    display: none !important;
  }
  .cal-day-num {
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
  .cal-cell.today .cal-day-num {
    background: var(--accent);
    color: #fff;
  }
  .cal-events {
    display: none !important;
  }
  .cal-dots-row {
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 32px;
    margin-top: 2px;
  }
  .cal-mobile-agenda {
    display: block;
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
  }
  .cal-agenda-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .cal-agenda-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
  }
  .cal-agenda-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    background: var(--surface-2);
  }
  .cal-agenda-card.exam {
    border-left: 4px solid var(--danger) !important;
    background: rgba(239, 68, 68, 0.06);
  }
  .cal-agenda-card.proj,
  .cal-agenda-card.lesson-projekt {
    border-left: 4px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.08);
  }
  .cal-agenda-card.lab,
  .cal-agenda-card.lesson-laboratorium {
    border-left: 4px solid #10b981 !important;
    background: rgba(16, 185, 129, 0.06);
  }
  .cal-agenda-card.cwiczenia,
  .cal-agenda-card.lesson-cwiczenia {
    border-left: 4px solid #10b981 !important;
    background: rgba(16, 185, 129, 0.06);
  }
  .cal-agenda-card.wyklad,
  .cal-agenda-card.lesson-wyklad {
    border-left: 4px solid #6366f1 !important;
    background: rgba(99, 102, 241, 0.05);
  }
  .cal-agenda-card.term {
    border-left: 4px solid #3b82f6 !important;
    background: rgba(59, 130, 246, 0.06);
  }
  .cal-agenda-card.lesson {
    border-left: 4px solid var(--accent);
  }

  /* 9. SZUFLADY (DRAWERY) NA CAŁY EKRAN */
  .drawer {
    width: 100vw;
    max-width: 100vw;
    left: 0;
    right: 0;
    border-left: none;
    z-index: 70;
  }
  .drawer.wide {
    width: 100vw;
    max-width: 100vw;
  }
  .drawer-head {
    padding: 12px 14px;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
  }
  .drawer-title {
    font-size: 15px;
  }
  .drawer-body {
    padding: 16px 14px;
    -webkit-overflow-scrolling: touch;
  }
  .drawer-foot {
    padding: 10px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 10;
    flex-wrap: wrap;
  }
  .drawer-foot .btn {
    flex: 1 1 40%;
    min-height: 42px;
    justify-content: center;
  }

  /* Formularze dotykowe (bez zoomowania iOS Safari) */
  .field-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .input, .select, .textarea {
    font-size: 16px !important;
    min-height: 42px;
  }
  .radio-pill {
    min-height: 36px;
    padding: 6px 12px;
  }

  /* 10. PASEK AKCJI MASOWYCH I POWIADOMIENIA */
  .bulk-bar {
    left: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    transform: translateY(140%);
    width: auto;
    max-width: none;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 10px;
    padding: 6px 10px;
  }
  .bulk-bar::-webkit-scrollbar {
    display: none;
  }
  .bulk-bar.show {
    transform: translateY(0);
  }
  .btn-bulk {
    flex-shrink: 0;
  }
  .toasts {
    left: 12px;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    width: 100%;
  }

  /* 11. OMNISEARCH NA TELEFONIE */
  .omni-box {
    width: 95vw;
    max-width: 95vw;
    margin: 10px auto 0;
    border-radius: 12px;
  }
  .omni-input {
    font-size: 16px !important;
  }
}

/* Ekstra małe ekrany (poniżej 420px) */
@media (max-width: 420px) {
  .brand-text {
    display: none !important;
  }
  .search-hint-text {
    display: none !important;
  }
}

/* ========== PEŁNOEKRANOWA PRZEGLĄDARKA PDF ========== */
.pdf-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f8fafc;
}
.pdf-viewer-overlay[hidden] {
  display: none !important;
}
.pdf-viewer-bar {
  height: 52px;
  min-height: 52px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  user-select: none;
}
.pdf-viewer-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.pdf-viewer-badge {
  background: #ef4444;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.pdf-viewer-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 440px;
}
.pdf-viewer-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}
.pdf-viewer-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn-outline-light {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}
.pdf-viewer-close-btn {
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: all 0.15s ease;
}
.pdf-viewer-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}
.pdf-viewer-body {
  flex: 1;
  position: relative;
  background: #334155;
  width: 100%;
  height: calc(100% - 52px);
}
.pdf-viewer-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #525659;
}

/* Baner informacyjny i akcje wewnątrz szuflady */
.pdf-preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  margin-bottom: 12px;
}
.pdf-preview-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pdf-banner-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
}
.pdf-banner-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.pdf-preview-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.drawer-pdf-frame {
  width: 100%;
  height: 58vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #525659;
}

@media (max-width: 640px) {
  .pdf-viewer-bar {
    height: 48px;
    min-height: 48px;
    padding: 0 10px;
  }
  .pdf-viewer-title {
    font-size: 13px;
    max-width: 140px;
  }
  .pdf-viewer-meta {
    display: none;
  }
  .btn-outline-light .btn-text {
    display: none;
  }
  .btn-outline-light {
    padding: 6px 8px;
  }
  .pdf-preview-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .pdf-preview-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
}


/* ==================== AKTUALNOŚCI I OGŁOSZENIA ==================== */

/* ==================== AKTUALNOŚCI (Czysty, minimalistyczny feed) ==================== */
.announcements-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 4px 0;
}

.announcements-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ann-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.ann-filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-2);
}

.ann-filter-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.announcements-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ann-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
}

.announcements-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 780px;
  margin-bottom: 40px;
}

.ann-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
  position: relative;
}

.ann-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.ann-card-pinned {
  border-left: 3px solid var(--accent);
}

.ann-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ann-author-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ann-author-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ann-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  flex-wrap: wrap;
}

.ann-author-name {
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ann-meta-line .ann-sep {
  color: var(--border-strong);
  font-size: 9px;
}

.ann-post-date {
  color: var(--text-3);
  font-size: 12px;
}

.ann-cat-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 4px;
}

.ann-pinned-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
}

.ann-card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Pojedyncze zdjęcie w ogłoszeniu */
.ann-single-image-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ann-single-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
}

.ann-single-image-wrap:hover .ann-single-image {
  transform: scale(1.015);
}

.ann-zoom-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity .15s ease;
}

.ann-single-image-wrap:hover .ann-zoom-hint {
  opacity: 1;
}

/* Galeria wielu zdjęć (2-6) w ogłoszeniu */
.ann-gallery-grid {
  display: grid;
  gap: 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ann-gallery-grid.count-2 {
  grid-template-columns: 1fr 1fr;
}

.ann-gallery-grid.count-3 {
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.ann-gallery-grid.count-3 .ann-gallery-item:first-child {
  grid-row: span 2;
}

.ann-gallery-grid.count-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.ann-gallery-item {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

.ann-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
}

.ann-gallery-item:hover .ann-gallery-img {
  transform: scale(1.03);
}

.ann-gallery-more {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* Pole uploadu zdjęć w szufladzie */
.ann-img-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .16s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
}

.ann-img-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.ann-img-previews {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ann-img-thumb-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.ann-img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ann-img-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.ann-img-remove-btn:hover {
  background: var(--danger);
}

/* Wydarzenie */
.ann-event-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.ann-event-val {
  font-weight: 700;
  color: var(--text);
}

.ann-card-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: break-word;
}

.ann-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}

.ann-reactions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ann-reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .14s ease;
  user-select: none;
}

.ann-reaction-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.ann-reaction-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.ann-reaction-btn .rx-emoji {
  font-size: 13.5px;
  line-height: 1;
}

.ann-reaction-btn .rx-count {
  font-size: 12px;
  min-width: 6px;
  font-variant-numeric: tabular-nums;
}

/* ==================== UNIWERSALNY PODGLĄD OBRAZÓW (ImageViewer) ==================== */
.img-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  user-select: none;
  animation: fadeInViewer .16s ease-out;
}

@keyframes fadeInViewer {
  from { opacity: 0; }
  to { opacity: 1; }
}

.img-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.img-viewer-topbar {
  position: relative;
  z-index: 2;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.img-viewer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.img-viewer-title {
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 380px;
}

.img-viewer-counter {
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 2px 7px;
  border-radius: 999px;
}

.img-viewer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.img-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: all .14s ease;
}

.img-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.img-action-btn.close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.img-zoom-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  min-width: 40px;
  text-align: center;
}

.img-viewer-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: default;
}

.img-viewer-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  transition: transform .12s cubic-bezier(0.2, 0, 0, 1), opacity .2s ease;
  transform-origin: center center;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

.img-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  backdrop-filter: blur(8px);
}

.img-nav-btn:hover {
  background: var(--accent);
  transform: translateY(-50%) scale(1.06);
}

.img-nav-btn.prev { left: 14px; }
.img-nav-btn.next { right: 14px; }

.img-viewer-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

@media (max-width: 768px) {
  .img-viewer-title { max-width: 140px; font-size: 13px; }
  .img-zoom-label { display: none; }
  #imgZoomOut, #imgZoomIn { display: none; }
  .img-nav-btn { width: 36px; height: 36px; }
  .img-nav-btn.prev { left: 8px; }
  .img-nav-btn.next { right: 8px; }
}

@media (max-width: 640px) {
  .announcements-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .announcements-sort {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
  .ann-card {
    padding: 16px 14px;
    border-radius: 12px;
  }
  .ann-card-title {
    font-size: 17px;
  }
}


/* ==================== NOWY CZYTNIK PDF (PDF.JS + MULTI-PAGE DLA IOS) ==================== */

.pdf-canvas-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 12px 90px 12px;
  background: #0b1120;
  width: 100%;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

.pdf-pages-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.pdf-page-wrapper {
  position: relative;
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 100%;
  transition: width .15s ease;
  box-sizing: border-box;
}

.pdf-page-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.pdf-page-num-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.5px;
}

.pdf-page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  width: 100%;
  background: #1e293b;
  color: #94a3b8;
  font-size: 13px;
  gap: 12px;
  border-radius: 4px;
}

.pdf-page-skeleton {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.pdf-page-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: pdfSpin .8s linear infinite;
}

.pdf-loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 260px;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 600;
  padding: 40px 16px;
}

.pdf-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: pdfSpin .8s linear infinite;
}

@keyframes pdfSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pdf-viewer-toolbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.07);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-page-controls,
.pdf-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdf-page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 600;
  padding: 0 4px;
}

.pdf-page-indicator input {
  width: 44px;
  height: 26px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 0;
  -moz-appearance: textfield;
}

.pdf-page-indicator input::-webkit-outer-spin-button,
.pdf-page-indicator input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pdf-toolbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 4px;
}

.pdf-mobile-bottom-bar {
  display: none;
}

.pdf-ios-drawer-card {
  background: var(--bg-hover);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 16px;
  margin-top: 10px;
  text-align: left;
}

@media (max-width: 768px) {
  .pdf-viewer-toolbar-center {
    display: none !important;
  }

  .pdf-mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 6px 14px;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    user-select: none;
  }

  .pdf-mobile-page-pill {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    min-width: 52px;
    text-align: center;
  }

  .pdf-canvas-container {
    padding: 12px 6px 90px 6px;
  }
}


/* ==================== PWA & OFFLINE STYLES ==================== */

.offline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  animation: pulse-offline 2.2s infinite ease-in-out;
}

@keyframes pulse-offline {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.97); }
}

.pwa-install-guide {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.pwa-install-app-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pwa-preview-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
  object-fit: cover;
}

.pwa-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.pwa-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pwa-step-num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.pwa-step-content {
  flex: 1;
  min-width: 0;
}

.pwa-step-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

/* Wygodne wsparcie dla urządzeń z wcięciem (notchem) w trybie PWA Standalone */
@media all and (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
  }
  @media (max-width: 768px) {
    .topbar {
      height: calc(52px + env(safe-area-inset-top, 0px));
      padding-top: env(safe-area-inset-top, 0px);
    }
  }
  .drawer-panel {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
}


/* ==================== BAZAPŚK: LIVE WIDGET ZAJĘĆ & ODLICZANIE NA START ==================== */

.start-today-section {
  margin-bottom: 22px;
}

.start-today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.today-widget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.today-widget-card:hover {
  border-color: var(--accent);
}

.today-widget-card.running {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, var(--bg-surface) 60%, rgba(16, 185, 129, 0.06) 100%);
}

.today-widget-card.upcoming-today {
  border-color: rgba(99, 102, 241, 0.35);
}

.today-widget-card.exam-card {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, var(--bg-surface) 60%, rgba(245, 158, 11, 0.05) 100%);
}

.today-widget-card.exam-urgent {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, var(--bg-surface) 60%, rgba(239, 68, 68, 0.08) 100%);
}

.widget-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.widget-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 9999px;
}

.widget-status-badge.running {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.widget-status-badge.upcoming {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.widget-status-badge.future {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.widget-status-badge.exam {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.widget-status-badge.exam-urgent {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: live-pulse 1.8s infinite;
}

@keyframes live-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.widget-main-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.35;
}

.widget-sub-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.widget-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 9999px;
  overflow: hidden;
  margin: 10px 0 12px;
}

.widget-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.widget-footer-line {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Podświetlenie głębokiego linku */
@keyframes ann-pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); border-color: #6366f1; }
  50% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0.15); border-color: #818cf8; }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); border-color: var(--border-color); }
}

.ann-highlight-pulse {
  animation: ann-pulse-glow 2.5s ease-out;
}

/* Wyszukiwarka w aktualnościach */
.announcements-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}

.announcements-search-bar input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
  outline: none;
}

/* Ustawienia powiadomień Web Push w drawerze */
.push-settings-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
}
