* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  color-scheme: light;
  /* ===== System wizualny MotoZebra ===== */
  /* płaszczyzny (chłodne, jasne) */
  --page: #f6f7fb; --surface: #ffffff; --surface-2: #eef1f7;
  /* tekst */
  --ink: #111827; --ink-2: #374151; --muted: #6b7280;
  /* linie */
  --divider: #eef0f4; --grid: #e5e7eb; --base: #c7cbd4; --border: rgba(17,24,39,.08);
  /* akcenty (wypełnienia) — indygo */
  --s1: #4f46e5; --s2: #eb6834;
  /* akcenty (tekst) */
  --s1-ink: #4338ca; --crit-ink: #b91c1c; --good-ink: #15803d;
  /* statusy */
  --good: #16a34a; --warn: #f59e0b; --serious: #f97316; --crit: #ef4444;
  --track: #eef1f7; --radius: 12px;
  --card-sh: 0 1px 2px rgba(17,24,39,.04);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* mostki do dotychczasowych nazw używanych w kodzie */
  --bg: var(--page);
  --sidebar-bg: var(--surface);
  --accent: var(--s1);
  --accent-dark: var(--s1-ink);
  --text: var(--ink);
  --mine: color-mix(in srgb, var(--good) 12%, var(--surface));  /* moje wiadomości — jasna zieleń (jak dawniej) */
  --theirs: var(--surface);
  --online: var(--good);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a9891;
  --divider: #262624; --grid: #2c2c2a; --base: #4a4a46; --border: rgba(255,255,255,.09);
  --s1: #3987e5; --s2: #d95926; --s1-ink: #6da7ec; --crit-ink: #e66767; --good-ink: #0ca30c;
  --track: #2c2c2a;
}
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------- logowanie ---------- */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
}
.auth-box {
  background: #fff; padding: 40px 36px; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 360px; max-width: 92vw;
}
.auth-box h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.auth-box input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px; outline: none;
}
.auth-box input:focus { border-color: var(--accent); }
.auth-box button[type=submit] {
  width: 100%; padding: 12px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.auth-box button[type=submit]:hover { background: var(--accent-dark); }
.auth-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- układ główny ---------- */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 300px; min-width: 240px; background: var(--sidebar-bg);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.brand {
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border); text-align: center;
}
.brand img { max-width: 160px; width: 100%; height: auto; display: block; margin: 0 auto; }
.brand-sub {
  margin-top: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}

.sidebar-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0; text-transform: uppercase;
}
.icon-btn {
  background: none; border: none; font-size: 17px; cursor: pointer; color: var(--muted);
  padding: 6px 8px; border-radius: 8px;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.labeled {
  font-size: 12.5px; font-weight: 600; border: 1px solid var(--border);
  padding: 6px 10px; white-space: nowrap;
}
.icon-btn.labeled:hover { border-color: var(--accent); color: var(--accent); background: #fff; }

/* panel wyboru dźwięku powiadomienia */
.sound-wrap { position: relative; display: inline-block; }
.sound-panel {
  position: absolute; top: 38px; right: -60px; z-index: 60; width: 230px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  display: flex; flex-direction: column; gap: 2px;
}
.sound-panel button {
  background: none; border: none; cursor: pointer; text-align: left;
  font-size: 13px; padding: 7px 10px; border-radius: 8px; color: var(--text);
}
.sound-panel button:hover { background: var(--bg); }
.snd-toggle { font-weight: 600; border-bottom: 1px solid var(--border); }
.snd-label { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; }
.snd-item.active { background: #e8effd; font-weight: 600; color: var(--accent); }

.notif-banner {
  margin: 12px 16px 0; padding: 9px 12px; background: #fef9c3; border: 1px solid #fde047;
  border-radius: 8px; font-size: 12.5px; color: #713f12;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.notif-banner button {
  background: #ca8a04; color: #fff; border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.notif-banner button:hover { background: #a16207; }

.new-room-btn {
  margin: 12px 16px; padding: 10px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.new-room-btn:hover { background: var(--accent-dark); }

.conv-list { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.conv-section h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 14px 16px 6px;
}
.conv-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer;
  position: relative;
}
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: #e8effd; }
.conv-item .conv-info { flex: 1; min-width: 0; }
.conv-item .conv-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-last { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; flex-shrink: 0;
}
.status-dot {
  position: absolute; left: 40px; bottom: 8px; width: 10px; height: 10px;
  border-radius: 50%; background: #cbd5e1; border: 2px solid #fff;
}
.status-dot.online { background: var(--online); }
.room-avatar { background: #c3b5f0; } /* blady fiolet — konferencje */

/* ---------- czat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; font-size: 15px; line-height: 1.6;
}
.chat-empty-icon { font-size: 52px; margin-bottom: 10px; }
.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
}
.chat-title { font-weight: 700; font-size: 16px; }
.chat-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-actions { display: flex; gap: 4px; }

.messages { flex: 1; overflow-y: auto; padding: 18px 22px; }
.load-more {
  display: block; margin: 0 auto 14px; background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 16px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }

.msg { display: flex; margin-bottom: 10px; justify-content: flex-start; gap: 10px; }
.msg.mine { margin-left: 15%; } /* moje wiadomości lekko wychylone w prawo */
.msg-avatar { width: 32px; height: 32px; font-size: 12px; margin-top: 2px; }
.msg .bubble {
  width: 55%; min-width: 280px; max-width: calc(100% - 42px);
  padding: 7px 14px 9px; border-radius: 10px; font-size: 14px;
  background: var(--theirs); border: 1px solid #c3cfdd;
  word-wrap: break-word;
}
.msg.mine .bubble { background: var(--mine); border-color: #a7dfa7; width: 64.7%; } /* 55% pełnej szerokości po odjęciu wcięcia */
.bhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.msg .from { font-size: 12px; font-weight: 700; color: var(--accent); }
.btime { font-size: 11px; color: var(--muted); white-space: nowrap; }
.btext { white-space: pre-wrap; margin-top: 1px; }
.msg-link { color: #1d4ed8; text-decoration: underline; word-break: break-all; }
.msg-link:hover { color: #1e3a8a; }
.tick { font-weight: 700; color: #9ca3af; }
.tick.read { color: #15803d; }

/* edycja / usuwanie wiadomości */
.msg-actions { display: none; gap: 2px; margin-right: 6px; }
.msg:hover .msg-actions { display: inline-flex; }
.act-btn {
  background: none; border: none; cursor: pointer; font-size: 13px;
  padding: 0 3px; opacity: .7; line-height: 1;
}
.act-btn:hover { opacity: 1; }
.edited { font-size: 10px; color: var(--muted); font-style: italic; }
.deleted-text { color: var(--muted); font-style: italic; }
.edit-area { margin-top: 4px; }
.edit-input {
  width: 100%; resize: vertical; border: 1px solid var(--accent); border-radius: 8px;
  padding: 7px 10px; font-size: 14px; font-family: inherit; outline: none; min-height: 44px;
}
.edit-buttons { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }

/* odpowiedź z cytatem */
.reply-bar {
  display: flex; align-items: center; gap: 8px;
  background: #f3f4f6; border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 6px 10px; margin-bottom: 8px;
}
.reply-info { flex: 1; min-width: 0; }
.reply-author { font-size: 11.5px; font-weight: 700; color: var(--accent); }
.reply-text { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-box {
  border-left: 3px solid var(--accent); background: rgba(0,0,0,.05);
  border-radius: 6px; padding: 5px 10px; margin: 3px 0 6px; cursor: pointer;
}
.quote-box:hover { background: rgba(0,0,0,.09); }
.quote-author { font-size: 11px; font-weight: 700; color: var(--accent); }
.quote-text { font-size: 12.5px; color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes flash-msg { 0% { box-shadow: 0 0 0 3px #fbbf24; } 100% { box-shadow: 0 0 0 3px transparent; } }
.msg.flash .bubble { animation: flash-msg 1.6s ease-out; }

/* pasek nieprzeczytanych z poprzednich dni */
.old-unread {
  margin: 10px 22px 0; padding: 9px 14px; background: #fef9c3; border: 1px solid #fde047;
  border-radius: 8px; font-size: 13px; color: #713f12;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.old-unread button {
  background: #ca8a04; color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.old-unread button:hover { background: #a16207; }

/* materiały rozmowy */
.modal.modal-materials { width: 1020px; max-width: 96vw; }
.materials-side-btn {
  margin: 8px 16px 0; padding: 8px; background: #fff; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.materials-side-btn:hover { border-color: var(--accent); color: var(--accent); }
.changelog-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #ef4444; margin-left: 4px; vertical-align: 1px;
}
.changelog-row {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; font-size: 13.5px; line-height: 1.45;
}
.mat-conv {
  font-size: 11.5px; font-weight: 600; color: #1e40af; background: #e8effd;
  padding: 3px 10px; border-radius: 10px; white-space: nowrap; flex-shrink: 0;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.mat-add { display: flex; gap: 8px; margin-bottom: 12px; }
.mat-add input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; outline: none;
}
.mat-add input:focus { border-color: var(--accent); }
.mat-add .btn-primary { padding: 8px 16px; }
.mat-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: 13.5px;
}
.mat-icon { font-size: 15px; flex-shrink: 0; }
.mat-main { flex: 1; min-width: 0; overflow-wrap: anywhere; text-decoration: none; color: inherit; }
a.mat-main.msg-link { text-decoration: underline; }
.mat-main:hover { color: var(--accent); }
.mat-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mat-who {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0;
}

/* archiwum */
.archive-body { max-height: 55vh; overflow-y: auto; margin-bottom: 14px; }
.archive-empty { padding: 24px 10px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.archive-day {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.archive-day:hover { border-color: var(--accent); background: #f8fafc; }
.archive-day .sub { color: var(--muted); font-size: 12.5px; }
.day-count {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--bg); padding: 3px 10px; border-radius: 10px; white-space: nowrap;
}
.archive-msgs { background: var(--bg); border-radius: 10px; padding: 14px 16px; }
.archive-msgs .msg.mine { margin-left: 10%; }
.archive-msgs .bubble { min-width: 200px; }

.new-badge {
  font-size: 10px; font-weight: 700; background: #ef4444; color: #fff;
  padding: 1px 7px; border-radius: 8px; margin-left: 4px; vertical-align: 1px;
}
.new-sep { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.new-sep::before, .new-sep::after { content: ''; flex: 1; height: 1px; background: #ef4444; }
.new-sep span {
  font-size: 11px; font-weight: 700; color: #b91c1c; background: #fee2e2;
  padding: 3px 12px; border-radius: 12px;
}
.msg.system { justify-content: center; margin: 10px 0; }
.msg.system .sys-text {
  font-size: 12px; color: var(--muted); background: #e5e7eb;
  padding: 3px 12px; border-radius: 12px;
}
.date-sep { text-align: center; margin: 16px 0 10px; }
.date-sep span {
  font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg);
  border: 1px solid var(--border); padding: 3px 12px; border-radius: 12px;
}

.file-msg {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: inherit; margin-top: 4px; background: rgba(0,0,0,.05);
  padding: 8px 10px; border-radius: 8px;
}
.msg.mine .file-msg { background: rgba(0,0,0,.05); }
.file-msg .file-icon { font-size: 22px; }
.file-msg .file-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.file-msg .file-size { font-size: 11px; opacity: .75; }
.file-msg:hover { background: rgba(0,0,0,.1); }

/* podgląd załączników */
.file-img { display: block; background: none !important; padding: 0; margin-top: 6px; }
.msg-thumb {
  max-width: 260px; max-height: 200px; border-radius: 10px; cursor: zoom-in;
  border: 1px solid rgba(0,0,0,.12); display: block; object-fit: cover;
}
.msg-thumb:hover { filter: brightness(.93); }
.file-under {
  display: inline-block; margin-top: 4px; font-size: 12px; color: inherit;
  opacity: .8; text-decoration: none;
}
.file-under:hover { opacity: 1; text-decoration: underline; }
.file-preview-btn {
  display: inline-block; margin-top: 5px; font-size: 12.5px; font-weight: 600;
  color: var(--accent); text-decoration: none; background: rgba(0,0,0,.05);
  padding: 5px 12px; border-radius: 8px;
}
.file-preview-btn:hover { background: rgba(0,0,0,.1); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.lightbox img {
  max-width: 90vw; max-height: 80vh; border-radius: 8px; cursor: zoom-out;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.lightbox-bar { display: flex; align-items: center; gap: 12px; }
.lightbox-bar span { color: #e5e7eb; font-size: 13.5px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar a { text-decoration: none; }

.typing { min-height: 20px; padding: 0 24px 2px; font-size: 12px; color: var(--muted); font-style: italic; }

.composer {
  margin: 8px 16px 30px; background: #fff; border: 1px solid #d1d5db;
  border-radius: 12px; padding: 12px 14px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  width: 100%; resize: none; border: none; font-size: 14px; font-family: inherit;
  outline: none; min-height: 62px; max-height: 190px; line-height: 1.45;
}
.composer-bar {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 6px;
}
.composer-bar .icon-btn { font-size: 13px; color: var(--muted); }
.composer-left { display: flex; align-items: center; gap: 4px; }
.emoji-wrap { position: relative; }
.emoji-panel {
  position: absolute; bottom: 38px; left: 0; z-index: 50;
  display: flex; gap: 2px; flex-wrap: wrap; width: 232px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.emoji-panel button {
  background: none; border: none; font-size: 22px; cursor: pointer;
  padding: 4px 6px; border-radius: 8px; line-height: 1;
}
.emoji-panel button:hover { background: var(--bg); transform: scale(1.15); }
.send-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 22px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.send-btn:hover { background: var(--accent-dark); }
.upload-status {
  padding: 6px 20px; font-size: 13px; color: var(--accent); background: #eff6ff;
  border-top: 1px solid var(--border);
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 14px; padding: 26px; width: 420px; max-width: 92vw;
  max-height: 85vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal input[type=text] {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 14px;
}
.modal input[type=text]:focus { border-color: var(--accent); }
.modal-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.admin-create { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.admin-create input { flex: 1; min-width: 150px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; }
.admin-create input:focus { border-color: var(--accent); }
.admin-create .admin-new-admin { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.admin-create button { flex-shrink: 0; }

/* ---------- Planer zadań ---------- */
.planner-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.planner-form input[type=text],
.planner-form textarea,
.planner-form select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; font-family: inherit;
}
.planner-form textarea { resize: vertical; }
.planner-form input:focus, .planner-form textarea:focus, .planner-form select:focus { border-color: var(--accent); }
.planner-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.planner-form-row select { flex: 1; min-width: 140px; }
.planner-form-buttons { display: flex; gap: 8px; }

.planner-section { margin-bottom: 18px; }
.planner-section-title { font-size: 14px; font-weight: 700; color: var(--text, #111827); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.planner-count { font-size: 12px; font-weight: 600; color: var(--muted); background: #f3f4f6; border-radius: 999px; padding: 1px 9px; }
.planner-empty { font-size: 13px; color: var(--muted); padding: 4px 2px 8px; }

.task-card {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; background: #fff;
}
.task-card.prio-important { border-left-color: #ef4444; }
.task-card.prio-normal    { border-left-color: #f59e0b; }
.task-card.prio-queue     { border-left-color: #9ca3af; }
.task-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title { font-weight: 600; font-size: 14px; }
.prio-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.prio-badge.prio-important { background: #fef2f2; color: #b91c1c; }
.prio-badge.prio-normal    { background: #fffbeb; color: #b45309; }
.prio-badge.prio-queue     { background: #f3f4f6; color: #4b5563; }
.task-desc { font-size: 13px; color: #374151; margin-top: 6px; white-space: pre-wrap; }
.task-meta { font-size: 13px; color: #374151; margin-top: 6px; }
.task-unassigned { color: var(--muted); font-style: italic; }
.task-notes { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }
.task-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.task-status-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.task-status-select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* ---------- Planer — widok listy w stylu Asany ---------- */
.planner-thead, .task-row, .task-add-row { display: flex; align-items: stretch; gap: 0; }
/* każda komórka: równe wcięcie + pionowa linia kraty */
.planner-thead > span, .task-row > * {
  box-sizing: border-box; display: flex; align-items: center;
  padding: 9px 10px; border-left: 1px solid #e6eaef;
}
.planner-thead > span:first-child, .task-row > *:first-child { border-left: none; }
.planner-thead > span:nth-child(1), .task-row > .task-num           { flex: 0 0 44px; justify-content: center; }
.planner-thead > span:nth-child(2), .task-row > .task-date          { flex: 0 0 90px; }
.planner-thead > span:nth-child(3), .task-row > .task-name          { flex: 1 1 auto; min-width: 0; }
.planner-thead > span:nth-child(4), .task-row > .dept-cell          { flex: 0 0 175px; }
.task-row > .dept-cell { overflow: hidden; }
.planner-thead > span:nth-child(5), .task-row > .task-assignee-cell { flex: 0 0 130px; }
.planner-thead > span:nth-child(6), .task-row > .author-cell        { flex: 0 0 130px; }
.planner-thead > span:nth-child(7), .task-row > .status-cell, .task-row > .done-cell { flex: 0 0 128px; }
.planner-thead > span:nth-child(8), .task-row > .prio-cell          { flex: 0 0 92px; }
.author-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.done-cell { font-size: 13px; font-weight: 600; color: var(--good-ink); }
.task-num { color: var(--muted); font-size: 13px; }
.task-date { color: #6b7280; font-size: 12.5px; white-space: nowrap; }
.task-name > .status-dot { flex: 0 0 15px; }
.dept-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 10px 2px 5px; border-radius: 999px; background: #eef2f6; color: #475569; white-space: nowrap; }
.dept-ic { font-size: 13px; line-height: 1; }
.dept-mark { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 4px; font-size: 11px; font-weight: 800; color: #fff; }
.dept-mark.dept-allegro { background: #ff5a00; }
.dept-logo { width: 17px; height: 17px; object-fit: contain; border-radius: 3px; background: #fff; display: inline-block; vertical-align: middle; }
/* znaki działów także na guzikach filtra DZIAŁ */
.seg-btn .dept-mark, .seg-btn .dept-logo { width: 16px; height: 16px; }

/* pasek filtrów — karta z kafelkami działów (styl dashboardu) */
#planner-filters { background: #f8fafc; border: 1px solid #e6eaef; border-radius: 12px; padding: 14px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
#planner-filters .filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* kafelki działów — kompaktowe: [ikona] Nazwa … [liczba po prawej], jedna linia */
.dept-tiles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.dept-tile { display: flex; align-items: center; gap: 8px; min-width: 132px; padding: 7px 12px; border: 1px solid #e6eaef; border-radius: 8px; background: #fff; cursor: pointer; transition: border-color .12s, background .12s; }
.dept-tile:hover { border-color: #cbd5e1; background: #f9fafb; }
.dept-tile.active { border-color: var(--accent); background: #f5f8ff; }
.dept-tile .tile-head { display: flex; align-items: center; gap: 6px; }
.tile-ic { font-size: 15px; line-height: 1; display: inline-flex; align-items: center; }
.tile-ic .dept-mark { width: 18px; height: 18px; font-size: 11px; border-radius: 4px; }
.tile-ic .dept-logo { width: 18px; height: 18px; }
.tile-ic .dept-ic { font-size: 15px; }
.tile-label { font-size: 13px; font-weight: 600; color: #374151; white-space: nowrap; }
.tile-count { margin-left: auto; font-size: 12.5px; font-weight: 700; color: #334155; background: #eef2f6; border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center; }
.dept-tile.active .tile-count { background: var(--accent); color: #fff; }

/* slim pasek: Status + Szukaj + Wyczyść */
.filter-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-search-wrap { position: relative; flex: 0 1 280px; min-width: 180px; }
.filter-search-wrap .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .55; pointer-events: none; }
.clear-filters { margin-left: auto; border: 1px solid #e6eaef; background: #fff; border-radius: 8px; padding: 7px 12px; font-size: 13px; color: #b91c1c; cursor: pointer; white-space: nowrap; }
.clear-filters:hover { background: #fef2f2; border-color: #fecaca; }
.clear-filters.hidden { display: none; }

/* belka planera + guziki „Nowe zadanie" (na belce i pod listą) */
.planner-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.planner-head h2 { margin-bottom: 0; }
#planner-new-btn, .task-add-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
#planner-new-btn:hover, .task-add-btn:hover { filter: brightness(.94); }
.task-add-btn { margin: 12px 2px 2px; }
.tb-req { font-weight: 400; color: #9ca3af; font-size: 11px; }
.seg-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { border: none; border-right: 1px solid var(--border); background: #fff; padding: 6px 12px; font-size: 13px; color: #374151; cursor: pointer; white-space: nowrap; }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: #eef2f6; }
.seg-btn.active { background: var(--accent); color: #fff; }
.filter-search { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; box-sizing: border-box; }
.filter-search:focus { border-color: var(--accent); }
.people-bar { display: flex; gap: 6px; overflow-x: auto; flex: 1 1 auto; padding-bottom: 3px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 3px 11px 3px 4px; font-size: 13px; color: #374151; cursor: pointer; white-space: nowrap; }
.pchip.pchip-all { padding: 5px 12px; }
.pchip:hover { background: #eef2f6; }
.pchip.active { background: #eef2ff; border-color: var(--accent); color: #1e3a8a; font-weight: 600; }
.pchip .mini-avatar { width: 22px; height: 22px; font-size: 10px; }
.pchip-count { font-size: 11px; font-weight: 700; background: #eef2f6; color: #334155; border-radius: 999px; padding: 0 6px; min-width: 16px; text-align: center; display: inline-block; }
.pchip.active .pchip-count { background: rgba(255,255,255,.55); color: #1e3a8a; }
/* data wykonania zadania */
.done-date { font-size: 11.5px; font-weight: 600; color: #15803d; margin-left: 8px; white-space: nowrap; }
.tb-done-info { margin-top: 10px; font-size: 13px; font-weight: 600; color: #15803d; }

/* kolumna statusu — interaktywny select w kształcie plakietki */
.status-cell .status-select { width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: #fff; }
.status-select.status-sel-todo  { color: #475569; border-color: #cbd5e1; }
.status-select.status-sel-doing { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.status-select.status-sel-done  { color: #15803d; border-color: #86efac; background: #f0fdf4; }

/* wiersz „+ Dodaj zadanie" (jak w Asanie) */
.task-add-row { padding: 8px 10px; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-add-row .add-plus { flex: 0 0 auto; color: #9ca3af; font-weight: 700; font-size: 15px; }
.task-add-row .add-title { flex: 1 1 240px; min-width: 180px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 13.5px; outline: none; box-sizing: border-box; }
.task-add-row select { padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: #fff; cursor: pointer; box-sizing: border-box; }
.task-add-row .add-title:focus, .task-add-row select:focus { border-color: var(--accent); }
.task-add-row .add-title::placeholder { color: #9ca3af; }
.planner-thead {
  font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid #d7dde4;
}
/* klikalne nagłówki — sortowanie */
.planner-thead .th-sortable { cursor: pointer; user-select: none; }
.planner-thead .th-sortable:hover { color: #111827; background: #f1f3f5; }
.planner-thead .th-active { color: #111827; font-weight: 700; }
.sort-arrow { font-size: 9px; margin-left: 3px; vertical-align: middle; }
/* jedna wspólna ramka na nagłówek + wiersze — gwarantuje wyrównanie kolumn */
#planner-board { border: 1px solid #e6eaef; border-radius: 8px; overflow: hidden; }
.planner-section { margin-top: 20px; }
.planner-section-title {
  font-size: 14.5px; font-weight: 700; color: #111827;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.planner-count { font-size: 12px; font-weight: 600; color: var(--muted); background: #f1f3f5; border-radius: 999px; padding: 1px 9px; }
.planner-empty { font-size: 13px; color: var(--muted); padding: 6px 14px; }

.task-list { }
.task-item { border-bottom: 1px solid #e6eaef; }
.task-row { cursor: pointer; font-size: 14px; }
.task-row:hover { background: #f7f8fa; }

.status-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; box-sizing: border-box; }
.status-dot.status-doing { border-color: #f59e0b; background: #fef3c7; }
.status-dot.status-done  { border-color: #16a34a; background: #16a34a; }

.task-name { display: flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.task-name .tn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-name .row-caret { color: #9ca3af; font-size: 11px; flex-shrink: 0; }

.task-assignee-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-transform: uppercase; }
.assignee-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.prio-cell .prio-badge { font-size: 12px; }

/* rozwinięty wiersz — szczegóły / edycja */
.task-body { padding: 12px 16px 6px 40px; background: #fbfbfd; border-top: 1px dashed var(--border); }
.task-body .tb-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 8px 0 3px; }
.task-body input[type=text], .task-body textarea, .task-body select {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13.5px; font-family: inherit; outline: none; box-sizing: border-box;
}
.task-body textarea { resize: vertical; }
.task-body input:focus, .task-body textarea:focus, .task-body select:focus { border-color: var(--accent); }
.task-body .planner-form-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.task-body .planner-form-row select { flex: 1; min-width: 130px; width: auto; }
.task-body .task-desc { font-size: 13.5px; color: #374151; white-space: pre-wrap; margin-bottom: 4px; }
.task-body-actions { display: flex; gap: 8px; margin-top: 12px; }

/* archiwum */
.archive-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; border-top: 1px solid var(--border);
  margin-top: 18px; padding: 12px; font-size: 13px; font-weight: 700; color: #374151; cursor: pointer;
}
.archive-toggle:hover { background: #f7f8fa; }
.archive-toggle .task-caret { color: #9ca3af; font-size: 11px; }
/* tabela archiwum (wykonane) — własna ramka + nagłówek (Dodano / Wykonano) */
.archive-box { border: 1px solid #e6eaef; border-radius: 8px; margin: 4px 0 8px; overflow: hidden; }
.archive-box .task-item:last-child { border-bottom: none; }
.archive-box .status-dot.status-done { opacity: .9; }
.archive-box .task-name .tn-text { text-decoration: line-through; color: #6b7280; }
.member-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; }
.member-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 14px;
}
.member-item:hover { background: var(--bg); }
.member-item input { accent-color: var(--accent); width: 16px; height: 16px; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 20px; font-size: 14px; cursor: pointer;
}
.btn-secondary:hover { background: var(--bg); }

/* ---------- panel administratora ---------- */
.modal-wide { width: 560px; }
/* planer: stała szerokość startowa (responsywnie ograniczona do ekranu), ale można poszerzyć uchwytem */
.modal.modal-planner { width: 1320px; min-width: 700px; max-width: 98vw; scrollbar-gutter: stable; resize: horizontal; }
.modal.modal-task { width: 720px; max-width: 94vw; }   /* podgląd zadania — nieco szerszy */
#admin-modal > .modal { width: 1320px; max-width: 96vw; }   /* panel admina szeroki jak planer */
#archive-modal > .modal { width: 920px; max-width: 96vw; }  /* archiwum korespondencji — szersze pole do czytania historii */
#archive-modal .archive-body { max-height: 68vh; }
/* stały obszar listy — nie zwija się przy braku zadań ani przy filtrach */
#planner-board { min-height: 340px; }

/* moduły w panelu admina */
.admin-row { flex-wrap: wrap; }
.admin-features { flex-basis: 100%; display: flex; align-items: center; gap: 16px; margin-top: 8px; padding-left: 42px; font-size: 13px; color: #374151; }
.admin-features label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.admin-features input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }

/* konto z wyłączonym czatem — chowamy interfejs rozmów */
.app.chat-off .conv-list,
.app.chat-off .new-room-btn,
.app.chat-off .materials-side-btn { display: none; }

/* okno pojedynczego zadania — formularz bez inline-owego wcięcia/tła */
#task-modal-body .task-body { padding: 0; border-top: none; background: none; }
#task-modal-body .task-body-actions { margin-top: 16px; }
.tb-readrow { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.admin-list { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; max-height: 240px; overflow-y: auto; }
.admin-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.admin-row:last-child { border-bottom: none; }
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row .sub { font-size: 12px; color: var(--muted); }
.role-tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: #ede9fe; color: #6d28d9;
}
.pending-tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: #fef3c7; color: #92400e;
}
.btn-small.approve { border-color: #16a34a; color: #15803d; }
.btn-small.approve:hover { background: #f0fdf4; }
.btn-small {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-small.danger:hover { border-color: #ef4444; color: #ef4444; }

/* ---------- responsywność ---------- */
@media (max-width: 700px) {
  .sidebar { width: 220px; min-width: 180px; }
  .msg .bubble { max-width: 85%; }
}

/* =================================================================
   System wizualny MotoZebra — warstwa komponentów (cały komunikator + planer)
   ================================================================= */

/* dostępność: fokus i ograniczenie ruchu */
:focus-visible { outline: 3px solid var(--s1-ink); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- płaszczyzny / karty ---- */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); }
.chat, .chat-empty { background: var(--page); }
.chat-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.composer { background: var(--surface); border-top: 1px solid var(--border); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--card-sh), 0 24px 60px rgba(11,11,11,.20); }
.modal h2 { color: var(--ink); letter-spacing: -.01em; }
.modal-backdrop { background: rgba(0,0,0,.42); }
.auth-screen { background: var(--page); }
.auth-box { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-sh); border-radius: 14px; }
.auth-box h1 { color: var(--ink); }
.auth-sub, .auth-switch { color: var(--muted); }

/* ---- przyciski ---- */
.new-room-btn, .send-btn, #auth-submit, .btn-primary, #planner-new-btn {
  background: var(--s1); color: #fff; border: 1px solid var(--s1);
  border-radius: 10px; font-weight: 600; box-shadow: 0 1px 2px rgba(79,70,229,.25);
}
.new-room-btn:hover, .send-btn:hover, #auth-submit:hover, .btn-primary:hover, #planner-new-btn:hover { background: var(--s1-ink); border-color: var(--s1-ink); opacity: 1; filter: none; }
.btn-secondary, .materials-side-btn, .task-add-btn {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; font-weight: 500; box-shadow: none;
}
.btn-secondary:hover, .materials-side-btn:hover, .task-add-btn:hover { background: var(--surface-2); filter: none; }
.btn-small { background: var(--surface); border: 1px solid var(--border); color: var(--ink); border-radius: 7px; }
.btn-small:hover { background: var(--surface-2); }
.btn-small.approve { background: var(--s1); color: #fff; border-color: var(--s1); }
.btn-small.approve:hover { background: var(--s1-ink); opacity: 1; }
.btn-small.danger { background: var(--surface); color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.btn-small.danger:hover { background: color-mix(in srgb, var(--crit) 8%, var(--surface)); }
.icon-btn { color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---- pola formularzy ---- */
input[type=text], input[type=password], select, textarea,
.modal input, .modal select, .modal textarea, #msg-input, .filter-search,
.auth-box input, .task-body input, .task-body select, .task-body textarea,
.task-add-row .add-title, .task-add-row select, .planner-form input, .planner-form select, .planner-form textarea,
.admin-create input {
  background: var(--surface); border: 1px solid var(--border); color: var(--ink); border-radius: 8px;
}
input:focus, select:focus, textarea:focus, #msg-input:focus { border-color: var(--s1); }
.modal-label, .field label, .tb-label, .filter-label { text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

/* ---- czat ---- */
.brand-sub { color: var(--muted); }
.conv-item:hover { background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
.conv-item.active { background: var(--surface-2); }
.msg.theirs .bubble { background: var(--surface); border: 1px solid var(--border); }
.msg.mine .bubble { background: var(--mine); border: 1px solid color-mix(in srgb, var(--good) 34%, var(--surface)); }
.bubble { border-radius: 10px; }
.btime, .conv-last { color: var(--muted); }

/* ---- pigułki / chipy (spójne w całej apce) ---- */
.dept-chip, .pchip-count, .planner-count, .role-tag, .pending-tag, .day-count {
  background: var(--surface-2); color: var(--ink-2); border-radius: 999px; font-weight: 600;
}
.role-tag { background: color-mix(in srgb, var(--s1) 12%, var(--surface)); color: var(--s1-ink); }
.pending-tag { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--ink); }

/* ---- planer: pasek filtrów / kafelki ---- */
#planner-filters { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-sh); border-radius: 12px; }
.dept-tile { background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
.dept-tile:hover { background: var(--surface-2); border-color: var(--base); box-shadow: none; }
.dept-tile.active { border-color: var(--s1); background: color-mix(in srgb, var(--s1) 8%, var(--surface)); box-shadow: none; }
.tile-label { color: var(--ink-2); }
.tile-count { background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dept-tile.active .tile-count { background: var(--s1); color: #fff; }
.seg-group { border: 1px solid var(--border); background: var(--surface); }
.seg-btn { color: var(--ink-2); border-right: 1px solid var(--border); }
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.active { background: var(--s1); color: #fff; }
.pchip { background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); }
.pchip:hover { background: var(--surface-2); }
.pchip.active { background: color-mix(in srgb, var(--s1) 12%, var(--surface)); border-color: var(--s1); color: var(--s1-ink); }
.pchip.active .pchip-count { background: color-mix(in srgb, var(--s1) 22%, var(--surface)); color: var(--s1-ink); }
.clear-filters { background: none; border-color: transparent; color: var(--muted); }
.clear-filters:hover { background: var(--surface-2); border-color: transparent; color: var(--crit-ink); }

/* ---- planer: tabela ---- */
#planner-board, .archive-box { border: 1px solid var(--grid); background: var(--surface); box-shadow: var(--card-sh); }
.planner-thead { color: var(--muted); border-bottom: 1px solid var(--grid); text-transform: uppercase; letter-spacing: .05em; }
.planner-thead > span, .task-row > * { border-left: 1px solid var(--grid); }
.planner-thead > span:first-child, .task-row > *:first-child { border-left: none; }
.task-item { border-bottom: 1px solid var(--divider); }
.task-row:hover { background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
.task-num, .task-date, .done-cell, .tile-count, .pchip-count { font-variant-numeric: tabular-nums; }
.task-num, .task-date { color: var(--muted); }
.tn-text { color: var(--ink); }
.th-sortable:hover { background: var(--surface-2); color: var(--ink); }
.th-active { color: var(--ink); }

/* ---- wskaźnik stanu w planerze (okrągły, nie kwadrat) — zawężone, by nie ruszać kropki „online" ---- */
.task-name .status-dot { width: 16px; height: 16px; border: 1.5px solid var(--base); background: var(--surface-2); }
.task-name .status-dot.status-doing { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 28%, var(--surface)); }
.task-name .status-dot.status-done { border-color: var(--good); background: var(--good); }

/* ---- priorytet i status jako miękkie pigułki ---- */
.prio-badge { border-radius: 999px; font-weight: 600; }
.prio-badge.prio-important { background: color-mix(in srgb, var(--crit) 13%, var(--surface)); color: var(--crit-ink); }
.prio-badge.prio-normal { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: var(--ink); }
.prio-badge.prio-queue { background: var(--surface-2); color: var(--ink-2); }
.status-select { border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); }
.status-select.status-sel-doing { background: color-mix(in srgb, var(--s1) 12%, var(--surface)); color: var(--s1-ink); border-color: color-mix(in srgb, var(--s1) 35%, transparent); }
.status-select.status-sel-done { background: color-mix(in srgb, var(--good) 12%, var(--surface)); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 35%, transparent); }

/* ---- daty wykonania (dobrze = zielony-ink) ---- */
.done-cell, .done-date, .tb-done-info { color: var(--good-ink); }

/* ---- nagłówek sekcji (archiwum) ---- */
.archive-toggle { color: var(--ink-2); text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; font-weight: 700; border-top: 1px solid var(--divider); }
.archive-toggle:hover { background: var(--surface-2); }

/* ---- listy panelu admina ---- */
.admin-list, .member-list { border: 1px solid var(--border); }
.admin-row { border-bottom: 1px solid var(--divider); }

/* ---- awatary: szare kółko, kolorowe inicjały (kolor z inline style) ---- */
.avatar:not(.room-avatar), .mini-avatar {
  background: #eceef3; border: 1px solid var(--border); color: var(--ink-2); font-weight: 700;
}

/* podtytuł nagłówka planera (styl z projektu) */
.planner-head { align-items: center; }
.planner-title h2 { margin-bottom: 0; }
.planner-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* materiały: podgląd grafiki (miniatura) zamiast od razu pobierania */
.mat-img { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; text-decoration: none; color: var(--ink); }
.mat-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); flex-shrink: 0; background: var(--surface-2); }
.mat-img-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-img:hover .mat-img-name { text-decoration: underline; }

/* przyciski akcji w nagłówku planera */
.planner-actions { display: flex; align-items: center; gap: 8px; }
.tb-readrow .mut { color: var(--muted); }

/* planer w osobnym oknie (adres z #planner) — pełna strona, bez czatu */
body.planner-window #app { display: none; }
body.planner-window #planner-modal { position: fixed; inset: 0; background: var(--page); padding: 0; display: block; overflow: auto; }
body.planner-window #planner-modal > .modal { width: 100%; max-width: none; min-width: 0; height: 100vh; max-height: 100vh; margin: 0; border: none; border-radius: 0; box-shadow: none; resize: none; }
body.planner-window #planner-close, body.planner-window #planner-popout { display: none; }
body.planner-window #planner-modal .modal-buttons { display: none; }

/* guzik Archiwum aktywny + podgląd zarchiwizowanego zadania (tylko odczyt) */
#planner-archive-btn.active { background: var(--s1); color: #fff; border-color: var(--s1); }
.status-badge-done { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--good) 12%, var(--surface)); color: var(--good-ink); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 10px 0; }
.detail-grid > div > div { font-size: 14px; color: var(--ink); margin-top: 2px; }
.good-text { color: var(--good-ink); font-weight: 600; }
