/* ════════════════════════════════════════════
   Kalendarz Zadań – style.css
   ════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f0f2f5;
  --surface:    #ffffff;
  --surface2:   #f8f9fa;
  --border:     #e2e8f0;
  --text:       #1a202c;
  --text-muted: #718096;
  --primary:    #4A90D9;
  --primary-dk: #357abd;
  --danger:     #E74C3C;
  --danger-dk:  #c0392b;
  --success:    #27AE60;
  --warning:    #F39C12;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 4px 20px rgba(0,0,0,.14);
  --nav-h:      58px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* ─── Navbar ──────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 8px; margin-right: 16px; }
.nav-icon  { font-size: 22px; }
.nav-title { font-size: 16px; font-weight: 700; color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link  {
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 13px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { background: var(--bg); color: var(--primary); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-logout { color: var(--danger) !important; }
.user-dot  { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.user-dot-sm { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ─── Main Content ────────────────────────── */
.main-content { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* ─── Page Header ─────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.today-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--primary); color: #fff; vertical-align: middle; margin-left: 6px;
}

/* ─── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600; transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.93); }
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--border);  color: var(--text); }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-success   { background: #22c55e;        color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn-full      { width: 100%; justify-content: center; }
.btn-group     { display: flex; gap: 6px; }

/* ─── Alerts & Flash ──────────────────────── */
.alert { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-error   { background: #fde8e8; color: #c0392b; border: 1px solid #f5b7b1; }
.alert-success { background: #e8f8f0; color: #1e8449; border: 1px solid #a9dfbf; }
.flash-messages { margin-bottom: 16px; }

/* ─── Forms ───────────────────────────────── */
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-row    { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; }
label        { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
input[type="text"], input[type="password"], input[type="date"], input[type="email"],
input[type="color"], select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,144,217,.15);
}
input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }
.input-disabled { opacity: .55; cursor: not-allowed; }
textarea { resize: vertical; min-height: 70px; }
.color-row      { display: flex; align-items: center; gap: 10px; }
.color-presets  { display: flex; gap: 6px; flex-wrap: wrap; }
.color-preset   { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.color-preset:hover { border-color: var(--text); }
.form-card { background: var(--surface); border-radius: var(--radius); padding: 28px; max-width: 560px; box-shadow: var(--shadow); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-note  { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.divider    { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ─── User checkboxes in modal ────────────── */
.user-checkbox-label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); cursor: pointer; margin: 2px;
  font-size: 13px; transition: border-color .15s, background .15s;
}
.user-checkbox-label:hover { border-color: var(--primary); background: #f0f6ff; }
.user-checkbox-label input { width: auto; }
.user-checkboxes { display: flex; flex-wrap: wrap; gap: 4px; }

/* ─── Modal ───────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
  position: relative; background: var(--surface);
  border-radius: var(--radius); padding: 0;
  width: 90%; max-width: 580px; max-height: 90vh;
  box-shadow: var(--shadow-md); display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-box > form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.modal-box .modal-body { flex: 1; overflow-y: auto; padding: 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.modal-footer { display: flex; flex-direction: column; gap: 6px; padding: 10px 24px; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.modal-footer .btn { font-size: 13px; padding: 6px 12px; }
.footer-row { display: flex; justify-content: flex-end; gap: 6px; }
.modal-detail { max-width: 480px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px 10px; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.modal-title  { font-size: 17px; font-weight: 700; }
.modal-close  {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--text-muted); width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg); }
.detail-grid { display: flex; flex-direction: column; gap: 8px; }
.detail-row  { display: flex; gap: 12px; font-size: 14px; }
.detail-row.full { flex-direction: column; }
.detail-label { font-weight: 600; color: var(--text-muted); min-width: 110px; }

/* ─── Modal edycji zadania ─────────────────── */
.modal-edit { border-top: 4px solid #E67E22; max-width: 600px; }
.modal-header-edit { background: #fff8f2; padding: 16px 28px; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header-edit .modal-title { color: #E67E22; }
.field-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ─── Auth ────────────────────────────────── */
.auth-page { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-page-inner { display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { background: var(--surface); border-radius: var(--radius); padding: 36px 40px; width: 400px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 14px; }
.auth-logo       { font-size: 40px; text-align: center; }
.auth-title      { font-size: 22px; font-weight: 700; text-align: center; }
.auth-subtitle   { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 4px; }
.auth-footer     { font-size: 13px; text-align: center; color: var(--text-muted); }

/* ─── User Legend ─────────────────────────── */
.user-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; background: var(--surface); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); }

/* ─── Calendar Grid ───────────────────────── */
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; background: var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.cal-cell { background: var(--surface); min-width: 0; overflow: hidden; }
.cal-header {
  background: var(--surface2); font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-align: center; padding: 10px 0;
  letter-spacing: .05em; text-transform: uppercase;
}
.cal-header.fri-sat { color: var(--primary); }

.day-cell {
  min-height: 110px; padding: 6px; cursor: pointer;
  position: relative; transition: background .12s;
  display: flex; flex-direction: column;
}
.day-cell:hover { background: #f0f6ff; }
.day-cell.other-month { background: var(--surface2); opacity: .7; }
.day-cell.today { background: #fffde7; }
.day-cell.today .day-number > span { background: #FFEB3B; color: #333; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; }
.day-cell.weekend { background: #fdf8f0; }
.day-cell.drop-target { background: #dbeafe; outline: 2px dashed var(--primary); }

.day-number { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; position: relative; }
.day-number > span { font-size: 14px; font-weight: 600; color: var(--text); }
.day-number .spacer { flex: 1; }
.task-count-badge { font-size: 10px; background: var(--primary); color: #fff; border-radius: 20px; padding: 1px 6px; font-weight: 700; position: absolute; left: 50%; transform: translateX(-50%); }
.day-hours-badge  { font-size: 10px; background: #e2edff; color: #1a5cb8; border-radius: 20px; padding: 1px 6px; font-weight: 600; white-space: nowrap; }
.day-hours-badge.day-hours-warn { background: #fff3cd; color: #856404; }
.day-alert-undone { font-size: 10px; background: #fee2e2; color: #b91c1c; border-radius: 20px; padding: 1px 6px; font-weight: 700; white-space: nowrap; cursor: default; }
.day-alert-overlap { font-size: 13px; cursor: default; }
.overlap-badge { font-size: 13px; background: #ff6f00; color: #fff; border-radius: 6px; padding: 2px 8px; font-weight: 600; margin-left: 8px; vertical-align: middle; }

/* Subtelna ramka na komorce z problemem */
.day-cell.day-has-undone  { outline: 2px solid #fca5a5; outline-offset: -2px; }
.day-cell.day-short-hours { outline: 2px solid #fde68a; outline-offset: -2px; }
.day-cell.day-has-undone.day-short-hours { outline: 2px solid #fca5a5; outline-offset: -2px; }

/* ─── Statusy dni (poza biurem / urlop / chory) ─── */
.day-cell.day-status-poza_biurem { background: #edfbf0; }
.day-cell.day-status-urlop       { background: #f2f2f2; }
.day-cell.day-status-chory       { background: #fff0f5; }
.day-cell.day-status-swieto      { background: #f3eeff; }

/* Tło całego widoku dziennego wg statusu */
.day-page { min-height: 100%; }
.day-page.day-page-poza_biurem { background: #f0fdf5; border-left: 5px solid #2ecc71; padding-left: 12px; }
.day-page.day-page-urlop       { background: #f5f5f5; border-left: 5px solid #999;    padding-left: 12px; }
.day-page.day-page-chory       { background: #fff5f8; border-left: 5px solid #e85a8a; padding-left: 12px; }
.day-page.day-page-swieto      { background: #f8f0ff; border-left: 5px solid #8e44ad; padding-left: 12px; }

/* Pasek statusu w widoku dziennym */
.day-status-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; border-radius: 8px; margin-bottom: 12px;
  background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.1);
}
.day-status-bar.day-status-banner { padding: 8px 14px; }
.day-status-bar-label { font-size: 14px; font-weight: 600; margin-right: 4px; }
.day-status-bar-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.day-status-btn {
  background: #fff; border: 1.5px solid #ccc; color: #444;
  padding: 4px 12px; border-radius: 20px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.day-status-btn:hover { border-color: #888; background: #f7f7f7; }
.day-status-btn.active { font-weight: 700; border-width: 2px; }
.day-page-poza_biurem .day-status-btn.active,
.day-status-btn.active[onclick*="poza_biurem"] { border-color: #2ecc71; color: #1a6b3c; background: #e8f8ee; }
.day-page-urlop .day-status-btn.active,
.day-status-btn.active[onclick*="urlop"]       { border-color: #888; color: #444; background: #f0f0f0; }
.day-page-chory .day-status-btn.active,
.day-status-btn.active[onclick*="chory"]       { border-color: #e85a8a; color: #9b1e4a; background: #fff0f5; }
.day-page-swieto .day-status-btn.active,
.day-status-btn.active[onclick*="swieto"]      { border-color: #8e44ad; color: #5b2d8e; background: #f3eeff; }
.day-status-btn-remove {
  background: transparent; border: 1.5px solid #e88; color: #b00;
  padding: 4px 12px; border-radius: 20px; font-size: 13px; cursor: pointer;
}
.day-status-btn-remove:hover { background: #fff0f0; }

/* Baner statusu (tylko do odczytu, bez uprawnień) */
.day-status-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 8px; margin-bottom: 14px;
  font-size: 15px; font-weight: 600; border-left: 5px solid;
}
.day-status-banner.status-poza_biurem { background: #e8f8ee; border-color: #2ecc71; color: #1a6b3c; }
.day-status-banner.status-urlop       { background: #f0f0f0; border-color: #888;    color: #444; }
.day-status-banner.status-chory       { background: #fff0f5; border-color: #e85a8a; color: #9b1e4a; }
.day-status-banner.status-swieto      { background: #f3eeff; border-color: #8e44ad; color: #5b2d8e; }
.day-status-badge {
  font-size: 14px; cursor: pointer; border-radius: 4px;
  padding: 0 2px; transition: transform .1s; line-height: 1;
}
.day-status-badge:hover { transform: scale(1.3); }
.day-status-add {
  font-size: 12px; opacity: 0.35; cursor: pointer;
  transition: opacity .15s, font-size .1s; line-height: 1;
  filter: grayscale(80%);
}
.day-status-add:hover { opacity: 1; font-size: 15px; filter: none; }

.month-hours-badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: #1a5cb8; background: #e2edff; border-radius: 20px; padding: 3px 12px; white-space: nowrap; }
.month-amount-badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: #1a6b3c; background: #d4f5e0; border-radius: 20px; padding: 3px 12px; white-space: nowrap; }

.day-status-chip {
  font-size: 11px; font-weight: 600; border-radius: 4px;
  padding: 2px 6px; margin-bottom: 2px; cursor: default;
  display: inline-block; white-space: nowrap;
}
.day-status-chip[onclick] { cursor: pointer; }
.day-status-chip-poza_biurem { background: #d4f5e0; color: #1a6b3c; }
.day-status-chip-urlop       { background: #e8e8e8; color: #444; }
.day-status-chip-chory       { background: #ffe0ec; color: #9b1e4a; }
.day-status-chip-swieto      { background: #eddeff; color: #5b2d8e; }

/* Popup wyboru statusu */
.status-picker {
  position: absolute; z-index: 9999;
  background: #fff; border: 1px solid #ddd; border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 150px;
}
.status-picker.hidden { display: none; }
.status-picker button {
  text-align: left; background: none; border: none; padding: 7px 12px;
  border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.status-picker button:hover { background: #f0f0f0; }
.status-picker button.active { font-weight: 700; background: #f0f8ff; }
.status-picker button.remove { color: #c00; }
.status-picker button.remove:hover { background: #fff0f0; }

.day-tasks { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.cal-task-chip {
  border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 500;
  color: #fff; cursor: grab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .1s;
}
.cal-task-chip:hover { opacity: .85; }
.chip-time { font-size: 10px; opacity: .85; margin-right: 4px; }
/* done chip */
.task-chip-done { opacity: .65; text-decoration: line-through; }
.task-chip-done .chip-time { text-decoration: none; }
/* extra tasks (>3) hidden by default; JS shows when fit mode active */
.cal-task-extra:not(.cal-task-normal) { display: none; }
.cal-more { font-size: 11px; color: var(--primary); font-weight: 600; cursor: pointer; margin-top: 2px; }
.cal-more:hover { text-decoration: underline; }

.add-btn {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  font-size: 14px; line-height: 1; display: none; align-items: center; justify-content: center;
}
.day-cell:hover .add-btn { display: flex; }

/* ─── Sekcja BUFOR ────────────────────────── */
.buffer-section {
  margin-top: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 2px dashed var(--border);
  overflow: hidden;
}
.buffer-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.buffer-title { font-size: 13px; font-weight: 700; color: var(--text); }
.buffer-subtitle { font-size: 11px; color: var(--text-muted); }
.buffer-tasks {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px; min-height: 52px;
}
.buffer-tasks.drop-target { background: #dbeafe; outline: 2px dashed var(--primary); }
.buffer-empty { font-size: 12px; color: var(--text-muted); align-self: center; }

/* ─── Day View ────────────────────────────── */
.day-view { display: grid; grid-template-columns: 1fr 240px; gap: 16px; }

.day-timeline {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}

/* ─── Absolute-positioning timeline ─── */
.timeline-wrapper {
  display: grid; grid-template-columns: 56px 1fr;
}
.timeline-labels {
  background: var(--surface2); border-right: 1px solid var(--border);
}
.time-label-row {
  height: 80px; padding: 4px 10px 0; font-size: 12px; font-weight: 600;
  color: var(--text-muted); display: flex; align-items: flex-start;
  justify-content: flex-end; border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.timeline-canvas {
  position: relative;
}
.time-row {
  position: absolute; left: 0; right: 0; height: 80px;
  border-bottom: 1px solid var(--border); box-sizing: border-box;
  cursor: pointer; transition: background .12s;
}
.time-row:hover:not(.time-row-blocked) { background: #f0f6ff; }
.time-row.drop-target { background: #dbeafe; }
.time-row-blocked {
  cursor: not-allowed;
  background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 8px,
    rgba(0,0,0,.03) 8px, rgba(0,0,0,.03) 16px
  );
}
.time-row-blocked:hover { background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 8px,
    rgba(239,68,68,.06) 8px, rgba(239,68,68,.06) 16px
  );
}
.blocked-label {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #ef4444; opacity: .55; pointer-events: none;
  user-select: none;
}

/* Zoom controls */
.zoom-controls { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.zoom-btn { min-width: 28px; padding: 0 6px; font-size: 14px; font-weight: 700; }
.zoom-indicator { font-size: 11px; color: var(--text-muted); min-width: 38px; text-align: center; }

.day-task {
  position: absolute; left: 4px; right: 4px;
  border-radius: var(--radius-sm); padding: 8px 10px; cursor: grab;
  color: #fff; user-select: none; overflow: hidden; z-index: 2;
  box-sizing: border-box;
  border: none;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.75), 0 0 0 1px rgba(0,0,0,0.18), 0 2px 5px rgba(0,0,0,0.25);
}
.day-task:active { cursor: grabbing; }
.day-task-header { display: flex; align-items: center; margin-bottom: 4px; padding-right: 58px; }

/* Compact single-line layout for short tasks (≤ ~30min) */
.day-task.short-task {
  padding: 0 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.short-time   { flex-shrink: 0; font-size: 11px; opacity: .9; white-space: nowrap; }
.short-title  { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; padding-right: 58px; }
.short-actions { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: flex; gap: 3px; align-items: center; }
.day-task-time   { font-size: 11px; opacity: .85; flex: 1; min-width: 0; }
.day-task-title  { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 58px; }
.day-task-desc-inline { font-size: 11px; font-weight: 400; opacity: .8; }
.day-task-desc   { font-size: 12px; opacity: .8; margin-top: 2px; white-space: pre-line; }

/* Done (executed) task */
.task-done { opacity: .72; }
.task-done .day-task-title,
.task-done .short-title { text-decoration: line-through; opacity: .75; }
.task-done::after {
  content: '✔';
  position: absolute; top: 4px; left: 6px;
  font-size: 10px; opacity: .9;
}
.day-task-users  { display: flex; gap: 3px; margin-top: 4px; }
.day-task-actions { position: absolute; top: 5px; right: 6px; display: flex; gap: 4px; }

.task-btn {
  background: rgba(255,255,255,.2); border: none; cursor: pointer;
  border-radius: 4px; font-size: 12px; padding: 2px 5px;
  color: #fff; transition: background .12s;
}
.task-btn:hover { background: rgba(255,255,255,.4); }

.resize-handle {
  position: absolute; bottom: 2px; right: 6px;
  cursor: ns-resize; font-size: 14px; opacity: .6;
  user-select: none;
}
.resize-handle:hover { opacity: 1; }

/* Sidebar */
.day-sidebar { display: flex; flex-direction: column; gap: 1px; }
.sidebar-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.sidebar-task {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow);
  margin-bottom: 6px; transition: box-shadow .12s;
}
.sidebar-task:hover { box-shadow: var(--shadow-md); }
.sidebar-task-time  { font-size: 11px; color: var(--text-muted); }
.sidebar-task-title { font-size: 13px; font-weight: 600; margin: 2px 0; }
.sidebar-task-users { display: flex; gap: 3px; }
.empty-msg  { color: var(--text-muted); font-size: 13px; line-height: 1.8; }

/* ─── Table ───────────────────────────────── */
.table-wrapper { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table th { background: var(--surface2); font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8faff; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ─── Detail modal tabs ─────────────────────── */
.detail-tabs { display: flex; border-bottom: 2px solid var(--border); margin: 0 0 12px; }
.detail-tab  { background: none; border: none; padding: 8px 18px; font-size: 13px; font-weight: 600;
               color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
               margin-bottom: -2px; transition: color .15s, border-color .15s; }
.detail-tab:hover  { color: var(--text); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Task history list (inside detail modal) ─ */
.th-list   { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 8px; max-height: 340px; overflow-y: auto; }
.th-entry  { display: flex; gap: 10px; padding: 8px 6px; border-radius: 6px; }
.th-entry:nth-child(odd) { background: var(--surface2); }
.th-icon   { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; padding-top: 1px; }
.th-body   { flex: 1; min-width: 0; }
.th-main   { font-size: 13px; font-weight: 600; }
.th-label  { color: var(--text); }
.th-meta   { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.th-user   { font-weight: 500; }
.th-det    { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.th-det em { color: var(--text); font-style: normal; font-weight: 500; }

/* ─── History ─────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-group { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.filter-group select { width: auto; }

.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-entry {
  display: flex; gap: 14px; padding: 12px 16px;
  background: var(--surface); border-radius: var(--radius-sm);
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow);
}
.action-created  { border-color: var(--success); }
.action-edited   { border-color: var(--warning); }
.action-moved    { border-color: var(--primary); }
.action-deleted  { border-color: var(--danger); }
.action-restored { border-color: var(--success); }
.action-permdel  { border-color: #777; }

.history-icon { font-size: 18px; flex-shrink: 0; line-height: 1.5; }
.history-body { flex: 1; }
.history-main { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.history-action-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--surface2); padding: 1px 7px; border-radius: 20px; }
.history-task-title   { font-size: 14px; font-weight: 600; }
.history-meta   { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.history-user   { font-weight: 600; }
.history-details { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.history-details .arrow { font-weight: 700; color: var(--primary); }

/* ─── Users ───────────────────────────────── */
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 12px; }
.user-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); border: 2px solid transparent;
}
.user-card-me  { border-color: var(--primary); }
.user-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700;
}
.user-info    { flex: 1; }
.user-name    { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.user-username { font-size: 12px; }
.user-since   { font-size: 11px; }
.badge-me { font-size: 10px; padding: 1px 7px; border-radius: 20px; background: var(--primary); color: #fff; }

/* ─── Empty State ─────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon  { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }

/* ─── Utilities ───────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }

/* ─── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0bec5; }

/* ─── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .day-view { grid-template-columns: 1fr; }
  .day-sidebar { order: -1; }
  .calendar-grid { font-size: 11px; }
  .day-cell { min-height: 70px; }
  .cal-task-chip { font-size: 10px; padding: 1px 4px; }
}
@media (max-width: 600px) {
  .main-content { padding: 10px; }
  .page-header  { flex-direction: column; align-items: flex-start; }
  .navbar       { padding: 0 12px; gap: 6px; }
  .nav-title    { display: none; }
  .auth-card    { width: 95%; padding: 24px 20px; }
}
/* ─── Role badges ─────────────────────────────── */
.role-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  font-weight: 600; letter-spacing: .02em; vertical-align: middle; margin-left: 4px;
}
.role-admin  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.role-user   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* ─── Admin nav link ──────────────────────────── */
.nav-link-admin { color: #92400e !important; background: #fef3c7; }
.nav-link-admin:hover, .nav-link-admin.active { background: #fde68a; color: #78350f !important; }

/* ─── Admin info box ──────────────────────────── */
.admin-info-box {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-size: 13px; color: #1e40af; margin-bottom: 20px;
}
.admin-info-box ul { margin: 6px 0 0 18px; }
.admin-info-box li { margin-bottom: 3px; }

/* ─── Admin users list ────────────────────────── */
.admin-users-list { display: flex; flex-direction: column; gap: 14px; }
.admin-user-card  {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.admin-user-top {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.admin-user-info  { flex: 1; }
.admin-user-name  { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-user-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-perms-section {
  padding: 14px 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.admin-perms-section.admin-perms-admin { background: var(--surface2); }
.admin-perms-label { font-size: 13px; font-weight: 600; width: 100%; margin-bottom: 4px; }
.perm-hint { font-weight: 400; }

.perm-checkbox-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); cursor: pointer;
  font-size: 13px; transition: border-color .15s, background .15s;
}
.perm-checkbox-label:hover { border-color: var(--primary); background: #f0f6ff; }
.perm-checkbox-label input { width: auto; }
.perm-checkboxes { display: flex; flex-wrap: wrap; gap: 6px; }
.save-perms-btn  { margin-left: 4px; }
.perm-saved-msg  { margin-left: 6px; }

/* ─── Task readonly badge ─────────────────────── */
.task-readonly-badge {
  font-size: 12px; opacity: .7; cursor: default;
}

/* ─── User tabs (zakładki kalendarzy) ─────────── */
.user-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 4px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.user-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.user-tab:hover {
  background: var(--surface-hover, #f0f0f0);
  color: var(--text-primary);
  border-color: var(--primary);
}
.user-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
.user-tab .user-dot-sm {
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   RAPORT AKTYWNOŚCI
   ════════════════════════════════════════════ */
.report-table th            { white-space: nowrap; font-size: 12px; text-align: center; vertical-align: bottom; }
.report-table td            { text-align: center; vertical-align: middle; }
.report-table td:first-child{ text-align: left; }
.report-col-header          { padding: 6px 8px; color: #555; }
.report-col-total           { background: #f0f4ff; font-weight: 700; color: var(--primary); }
.report-cell                { font-size: 13px; padding: 8px 10px; }
.report-cell-nonzero        { background: #f0fdf4; color: #166534; font-weight: 600; }
.report-cell-total          { background: #f0f4ff; font-weight: 700; color: var(--primary); }
.report-cell-alert-red      { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.report-cell-alert-yellow   { background: #fef9c3; color: #854d0e; font-weight: 700; }
.report-count               { font-size: 15px; font-weight: 700; }
.report-zero                { color: #ccc; }
.report-user-row:hover      { background: #f8faff; }
.report-total-row           { background: #eef2ff; border-top: 2px solid #c7d2fe; }
.report-total-row td        { font-size: 13px; }

/* Słupki */
.report-bars            { display: flex; flex-direction: column; gap: 10px; max-width: 600px; }
.report-bar-row         { display: flex; align-items: center; gap: 10px; }
.report-bar-label       { width: 180px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.report-bar-track       { flex: 1; background: #e5e7eb; border-radius: 6px; height: 18px; overflow: hidden; }
.report-bar-fill        { height: 100%; border-radius: 6px; transition: width .4s ease; min-width: 4px; }
.report-bar-value       { width: 30px; text-align: right; font-size: 13px; font-weight: 700; color: #374151; }