/* ============================================================
   Sistemic - Stiluri (branding stil Notion)
   ============================================================ */

:root {
  --bg: #f7f6f3;            /* off-white cald, fundalul aplicatiei */
  --surface: #ffffff;       /* carduri, modale */
  --list-bg: #f1f0ee;       /* fundal liste (coloane) */
  --text: #37352f;          /* negru-carbune Notion */
  --text-soft: #5f5e5b;
  --muted: #9b9a97;         /* gri Notion */
  --primary: #37352f;       /* buton principal: aproape negru */
  --primary-hover: #2a2925;
  --accent: #2383e2;        /* albastru Notion, folosit punctual */
  --danger: #e03e3e;
  --border: #e9e8e5;
  --border-strong: #dcdbd7;
  --hover: #efeeec;
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.06);
  --shadow-md: 0 2px 6px rgba(15, 15, 15, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 15, 15, 0.14);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- Butoane ---------- */
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { width: 100%; padding: 11px; }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-ghost.danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
.btn-ghost.danger:hover { background: #fdecec; border-color: #f3c9c9; }

/* ---------- Ecran autentificare ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 26px;
}
.brand-mark { display: block; flex-shrink: 0; border-radius: 24%; }
.auth-logo .brand-mark { width: 36px; height: 36px; }
.brand-name { white-space: nowrap; }
.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  transition: border 0.15s, box-shadow 0.15s;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.15);
}
.auth-error { color: var(--danger); font-size: 13px; min-height: 16px; text-align: center; }

/* ---------- Topbar ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
}
.topbar-logo {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
}
.topbar-logo .brand-mark { width: 26px; height: 26px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { color: var(--text-soft); font-size: 14px; font-weight: 500; }

/* ---------- Lista de board-uri ---------- */
.boards-view { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.page-title { color: var(--text); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 22px; }

/* ---------- Sidebar proiecte ---------- */
.folders-sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.folders-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 10px 10px;
}
.folders-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.folder-item:hover { background: var(--hover); color: var(--text); }
.folder-item.active { background: #eaf1fb; color: var(--text); font-weight: 600; }
.folder-item.active .folder-count { background: #d6e6fb; color: var(--accent); }
.folder-item.drop-target {
  background: #eaf1fb;
  box-shadow: inset 0 0 0 2px var(--accent);
  color: var(--text);
}

/* separator sub folderul "Nesortate" (grupeaza "Toate" + "Nesortate" sus) */
.folder-item.folder-unsorted { margin-bottom: 6px; position: relative; }
.folder-item.folder-unsorted::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -4px;
  height: 1px; background: var(--border);
}

.folder-item .folder-dot {
  width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.folder-item .folder-glyph { width: 14px; text-align: center; flex-shrink: 0; opacity: 0.65; }
.folder-item.folder-trash { margin-top: 8px; position: relative; }
.folder-item.folder-trash::before {
  content: ''; position: absolute; left: 10px; right: 10px; top: -4px;
  height: 1px; background: var(--border);
}
.folder-item .folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-item .folder-name-input {
  flex: 1; border: 1px solid var(--accent); border-radius: 5px;
  padding: 3px 6px; font-size: 14px; font-family: inherit; min-width: 0;
}
.folder-item .folder-name-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.folder-item .folder-count {
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg);
  border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center; flex-shrink: 0;
}
.folder-item .folder-del {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 0 2px; border-radius: 4px;
  opacity: 0; flex-shrink: 0; transition: opacity 0.12s, color 0.12s;
}
.folder-item:hover .folder-del { opacity: 0.8; }
.folder-item .folder-del:hover { color: var(--danger); opacity: 1; }

.add-folder-btn {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.add-folder-btn:hover { background: var(--hover); color: var(--text); }
.add-folder-btn .add-folder-plus {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px; background: var(--bg);
  font-size: 15px; line-height: 1; color: var(--text-soft);
}
.add-folder-input {
  margin-top: 10px; width: 100%;
  border: 1px solid var(--accent); border-radius: 6px;
  padding: 9px 10px; font-size: 14px; font-family: inherit;
}
.add-folder-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }

/* ---------- Continut board-uri ---------- */
.boards-content { flex: 1; min-width: 0; padding: 32px 32px; overflow-y: auto; }
.board-folder-tag {
  font-size: 11px; font-weight: 600; opacity: 0.85;
  display: inline-flex; align-items: center; gap: 5px;
}
.board-folder-tag::before {
  content: ''; width: 7px; height: 7px; border-radius: 2px; background: currentColor; opacity: 0.7;
}
.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.board-tile {
  height: 110px;
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
/* voal-gradient pentru ca textul sa fie lizibil peste orice fundal (ca la Trello) */
.board-tile::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 72%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.18) 45%, rgba(0, 0, 0, 0));
  pointer-events: none;
}
.board-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-tile.dragging { opacity: 0.45; transform: scale(0.98); cursor: grabbing; }
.board-title-tile {
  position: relative; z-index: 1;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.board-tile .board-meta {
  position: relative; z-index: 1;
  margin-top: 5px;
  font-size: 12px; font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.board-tile .tile-delete {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(255,255,255,0.7); border: 1px solid var(--border); color: var(--text-soft);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer;
  font-size: 16px; line-height: 1; opacity: 0; transition: opacity 0.12s;
}
.board-tile:hover .tile-delete { opacity: 1; }
.board-tile .tile-delete:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.board-tile .tile-actions {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.12s;
}
.board-tile:hover .tile-actions { opacity: 1; }
.board-tile .tile-btn {
  background: rgba(255,255,255,0.85); border: 1px solid var(--border);
  color: var(--text-soft); width: 26px; height: 26px; border-radius: 6px;
  cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.board-tile .tile-btn:hover { background: #fff; color: var(--text); }
.board-tile .tile-btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.board-tile-add {
  height: 110px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.board-tile-add:hover { background: var(--hover); color: var(--text); }

/* ---------- Vizualizare board ---------- */
.board-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.board-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px 12px;
}
.board-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.board-title-text {
  color: var(--text); font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-rename-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer; color: inherit;
  opacity: 0; transition: opacity 0.12s, background 0.12s;
}
.board-title-wrap:hover .board-rename-btn { opacity: 0.7; }
.board-rename-btn:hover { opacity: 1 !important; }
.board-view.on-dark .board-rename-btn { color: #fff; }
.board-view.on-dark .board-rename-btn:hover { background: rgba(255, 255, 255, 0.22); }
.board-view.on-light .board-rename-btn { color: var(--text); }
.board-view.on-light .board-rename-btn:hover { background: rgba(0, 0, 0, 0.07); }
.board-title-input {
  flex: 1; min-width: 0;
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  color: inherit; background: transparent;
  border: none; border-bottom: 2px solid currentColor;
  padding: 0 2px 2px; outline: none;
}
.board-view.on-dark .board-title-input { color: #fff; }
.board-view.on-light .board-title-input { color: var(--text); }

.lists-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 0 22px 22px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
}

/* ---------- Liste ---------- */
.list {
  background: var(--list-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 280px;
  flex-shrink: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.list-header {
  display: flex;
  align-items: center;
  padding: 10px 8px 6px 12px;
}
.list-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 4px;
  border-radius: 4px;
}
.list-title:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); background: var(--surface); }
.list-delete {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; padding: 2px 6px; border-radius: 4px;
}
.list-delete:hover { background: var(--border); color: var(--danger); }
.cards {
  list-style: none;
  padding: 4px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 8px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  transition: background 0.1s, border-color 0.1s;
}
.card:hover { background: var(--hover); border-color: var(--border-strong); }
.card.sortable-ghost { opacity: 0.4; }
.card.sortable-chosen { box-shadow: var(--shadow-lg); }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.card-label-dot { height: 8px; width: 36px; border-radius: 4px; }
.card-desc-preview {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400;
}
.card-badges { display: flex; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.card-badge { display: inline-flex; align-items: center; gap: 4px; }
.card-badge.due { background: var(--border); padding: 2px 6px; border-radius: 4px; color: var(--text-soft); }
.card-badge.due.overdue { background: #fdecec; color: var(--danger); }

.add-card-btn {
  margin: 4px 8px 10px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.add-card-btn:hover { background: var(--border); color: var(--text); }
.add-card-form { padding: 4px 8px 10px; }
.add-card-form textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.add-card-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.add-card-form .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* lista pentru adaugare lista noua */
.add-list {
  width: 280px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  transition: background 0.12s;
}
.add-list:hover { background: rgba(255, 255, 255, 0.24); }
.add-list-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
}
/* pe fundal deschis folosim nuante intunecate translucide */
.board-view.on-light .add-list { background: rgba(0, 0, 0, 0.04); }
.board-view.on-light .add-list:hover { background: rgba(0, 0, 0, 0.07); }
.board-view.on-light .add-list-btn { color: var(--text-soft); }
.add-list-form input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
.add-list-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.add-list-form .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 15, 15, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-small { max-width: 400px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 26px; cursor: pointer;
  color: var(--muted); line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-heading { margin-bottom: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-title-input {
  width: 100%;
  font-size: 18px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  margin-bottom: 18px;
  background: var(--bg);
}
.modal-title-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
/* lasa loc pentru butonul X, sa nu se suprapuna peste caseta titlului */
#card-modal-title { width: calc(100% - 34px); }
.modal-close { z-index: 2; }
.modal-section { margin-bottom: 18px; }
.modal-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.modal-textarea, .modal-date {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--surface);
}
.modal-textarea:focus, .modal-date:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.modal-select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.modal-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Termen limita (minimalist) ---------- */
.due-wrap { display: flex; }
.due-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px dashed var(--border-strong); border-radius: 8px;
  padding: 8px 12px; color: var(--muted); font-size: 14px; cursor: pointer; font-family: inherit;
}
.due-add:hover { background: var(--hover); color: var(--text); }
.due-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 5px 8px 5px 12px;
}
.due-chip.overdue { background: #fdecec; border-color: #f3c9c9; }
.due-chip .due-text {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 500; color: var(--text); padding: 0;
}
.due-chip.overdue .due-text { color: var(--danger); }
.due-chip .due-clear {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 17px; line-height: 1; padding: 0 2px; border-radius: 4px;
}
.due-chip .due-clear:hover { color: var(--danger); }
.due-input {
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px;
  font-size: 14px; font-family: inherit;
}
.due-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }

.label-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.label-swatch {
  width: 44px; height: 28px; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.1s;
}
.label-swatch:hover { transform: scale(1.08); }
.label-swatch.selected { border-color: var(--text); }

.color-picker {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px;
  max-height: 188px; overflow-y: auto; padding: 2px;
}
.color-swatch {
  width: 48px; height: 36px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--border);
  background-size: cover; background-position: center;
}
.color-swatch.selected { border-color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; box-shadow: var(--shadow-lg);
  z-index: 200;
}

/* ---------- Scrollbar ---------- */
.lists-container::-webkit-scrollbar, .cards::-webkit-scrollbar { height: 10px; width: 8px; }
.lists-container::-webkit-scrollbar-thumb, .cards::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 8px;
}

.empty-state { color: var(--muted); font-size: 15px; padding: 20px 0; }

/* ---------- Contrast antet board in functie de fundal ---------- */
.board-view.on-dark .board-title-text { color: #fff; }
.board-view.on-light .board-title-text { color: var(--text); }
.board-view.on-dark .board-header .btn-ghost {
  background: rgba(255,255,255,0.18); color: #fff; border-color: transparent;
}
.board-view.on-dark .board-header .btn-ghost:hover { background: rgba(255,255,255,0.30); color: #fff; }
.board-view.on-light .board-header .btn-ghost {
  background: rgba(0,0,0,0.04); color: var(--text); border-color: var(--border-strong);
}
.board-view.on-light .board-header .btn-ghost:hover { background: rgba(0,0,0,0.08); }

/* ---------- Selector fundal board ---------- */
.btn-icon {
  padding: 7px; display: inline-flex; align-items: center; justify-content: center;
  line-height: 0;
}
.board-bg-wrap { position: relative; }
.bg-popover {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: repeat(4, 42px); gap: 8px; width: max-content;
  max-height: 280px; overflow-y: auto;
}
.bg-swatch {
  width: 42px; height: 32px; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.1s;
  background-size: cover; background-position: center;
}
.bg-swatch:hover { transform: scale(1.07); }
.bg-swatch.selected { border-color: var(--text); }

/* ---------- Bifa "Done" pe card ---------- */
.card-row { display: flex; align-items: flex-start; gap: 8px; }
.card-row .card-text { flex: 1; }
.card-check {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: transparent;
  cursor: pointer; font-size: 11px; line-height: 1; color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1px; opacity: 0;
  transition: opacity 0.12s, background 0.12s, border-color 0.12s;
}
.card:hover .card-check { opacity: 1; }
.card-check:hover { border-color: #4f9768; }
.card-check.done { opacity: 1; background: #4f9768; border-color: #4f9768; color: #fff; }
.card.card-done { background: #eaf7ee; border-color: #cfe9d6; }
.card.card-done:hover { background: #e2f3e8; }

/* ---------- Editor descriere (rich text) ---------- */
.rt-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.rt-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text);
  font-family: inherit;
}
.rt-btn:hover { background: var(--hover); }
.modal-richtext {
  min-height: 110px; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 10px; font-size: 14px; line-height: 1.5; overflow-y: auto; background: var(--surface);
}
.modal-richtext:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35,131,226,0.15); }
.modal-richtext.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.modal-richtext.is-empty:focus::before { content: ''; }
.modal-richtext ul, .modal-richtext ol { padding-left: 22px; margin: 4px 0; }
.modal-richtext li { margin: 2px 0; }

/* ============================================================
   MOBIL
   ============================================================ */
@media (max-width: 700px) {
  /* board: o coloana pe ecran, cu swipe (scroll-snap) */
  .lists-container {
    scroll-snap-type: x mandatory;
    scroll-padding-left: 16px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 0 16px 16px;
    gap: 14px;
  }
  .list, .add-list {
    width: calc(100vw - 48px);
    max-width: 440px;
    scroll-snap-align: start;
  }
  .board-header { padding: 12px 14px 10px; }
  .board-title-text { font-size: 18px; }
  .topbar { padding: 0 12px; }

  /* dashboard: sidebar mai ingust + grila mai compacta */
  .folders-sidebar { width: 168px; padding: 16px 8px; }
  .boards-content { padding: 20px 16px; }
  .boards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

  /* modale pe tot ecranul, mai aproape de sus */
  .modal-overlay { padding: 24px 12px; }

  /* IMPORTANT: pe iOS, un camp cu font sub 16px declanseaza auto-zoom la focus.
     Fortam minim 16px ca sa nu mai dea zoom browserul cand intri intr-un camp. */
  input, textarea, select,
  .modal-richtext, [contenteditable] {
    font-size: 16px !important;
  }
}

@media (max-width: 420px) {
  .list, .add-list { width: calc(100vw - 40px); }
  .boards-grid { grid-template-columns: 1fr 1fr; }
  .folders-sidebar { width: 150px; }
}

/* ============================================================
   Auth: Google Sign-In + reCAPTCHA
   ============================================================ */
.recaptcha-holder { display: flex; justify-content: center; min-height: 0; }
.recaptcha-holder:empty { display: none; }

.auth-divider {
  display: flex; align-items: center; text-align: center;
  color: #9b978d; font-size: 12px; margin: 18px 0 14px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: #e6e3dc;
}
.auth-divider span { padding: 0 12px; }

.google-area { margin-top: 6px; }
#google-btn { display: flex; justify-content: center; }

/* ============================================================
   Partajare board (Share)
   ============================================================ */
.board-share-wrap { position: relative; }

.share-popover {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 300px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid #e6e3dc; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 16px; z-index: 60; color: #2b2b2b;
}
.share-head { font-weight: 600; font-size: 14px; margin-bottom: 12px; }

.share-toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; cursor: pointer; margin-bottom: 12px;
}
.share-toggle input { width: 16px; height: 16px; cursor: pointer; }

.share-link-row { display: flex; gap: 8px; margin-bottom: 10px; }
.share-link {
  flex: 1; min-width: 0; padding: 8px 10px; font-size: 12px;
  border: 1px solid #e1ddd4; border-radius: 8px; background: #faf9f6; color: #555;
}
.share-copy { padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.share-hint { font-size: 11.5px; color: #9b978d; line-height: 1.4; }

/* ---------- Mutare board in alt proiect ---------- */
.board-folder-wrap { position: relative; }
.folder-popover {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 240px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid #e6e3dc; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 10px; z-index: 60; color: #2b2b2b;
}
.folder-pop-head {
  font-weight: 600; font-size: 12px; color: #9b978d;
  padding: 2px 8px 8px; text-transform: uppercase; letter-spacing: 0.04em;
}
.folder-pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow-y: auto; }
.folder-pop-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 8px; border: none; background: transparent;
  border-radius: 8px; cursor: pointer; font-size: 13.5px; color: #2b2b2b; text-align: left;
}
.folder-pop-item:hover { background: #f3f1ec; }
.folder-pop-item.active { background: #efede7; font-weight: 600; }
.folder-pop-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.folder-pop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-pop-check { color: #4f9768; font-weight: 700; }

/* ============================================================
   Mod public (read-only)
   ============================================================ */
.public-mode .topbar-right > *:not(.public-badge),
.public-mode #back-btn,
.public-mode .board-rename-btn,
.public-mode .board-share-wrap,
.public-mode .board-folder-wrap,
.public-mode .board-bg-wrap { display: none !important; }

.public-badge {
  font-size: 12px; color: #6b675f; padding: 4px 12px;
  border: 1px solid #e6e3dc; border-radius: 999px; background: #fff;
}
.card-check.readonly { cursor: default; pointer-events: none; }
.list-title-static {
  font-weight: 600; font-size: 14px; padding: 2px 4px; color: inherit;
}
.public-error {
  margin: 60px auto; max-width: 420px; text-align: center;
  color: #fff; font-size: 15px; background: rgba(0, 0, 0, 0.25);
  padding: 24px; border-radius: 12px;
}
