/* ===========================================================
   LifePlanner — themable vanilla CSS.
   Themes apply by setting `data-theme` on <html>.
   Default = light-purple (declared in :root).
   =========================================================== */

/* ---------- DEFAULT THEME: light purple ---------- */
:root,
:root[data-theme="light-purple"] {
  --bg: #f7f3ff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3edff;
  --surface-3: #e7defc;
  --border: #e5dcfa;
  --text: #2e1f4a;
  --text-dim: #6b5b8a;
  --text-mute: #9b8fb5;
  --accent: #a78bfa;
  --accent-dark: #8b5cf6;
  --accent-deep: #ede9fe;
  --accent-on: #ffffff;
  --shadow: 0 1px 2px rgba(40, 20, 90, 0.04), 0 4px 12px rgba(40, 20, 90, 0.06);
  --shadow-hover: 0 4px 12px rgba(40, 20, 90, 0.1);
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  color-scheme: light;
}

/* ---------- Dark purple ---------- */
:root[data-theme="dark-purple"] {
  --bg: #0f0a1f;
  --bg-2: #15102a;
  --surface: #1c1638;
  --surface-2: #251d47;
  --surface-3: #2e2456;
  --border: #352a63;
  --text: #ece6ff;
  --text-dim: #a899d6;
  --text-mute: #7c6ba0;
  --accent: #a78bfa;
  --accent-dark: #8b5cf6;
  --accent-deep: #2d1f5e;
  --accent-on: #0f0a1f;
  --shadow: none;
  --shadow-hover: none;
  color-scheme: dark;
}

/* ---------- LifeForge green (the original) ---------- */
:root[data-theme="lifeforge"] {
  --bg: #0b0f0a;
  --bg-2: #11160f;
  --surface: #161c14;
  --surface-2: #1c2419;
  --surface-3: #232c1e;
  --border: #2a3424;
  --text: #e8efe1;
  --text-dim: #98a48c;
  --text-mute: #6a7560;
  --accent: #b6f24a;
  --accent-dark: #95c93b;
  --accent-deep: #1e2a13;
  --accent-on: #0b0f0a;
  --shadow: none;
  --shadow-hover: none;
  color-scheme: dark;
}

/* ---------- Ocean (light blue) ---------- */
:root[data-theme="ocean"] {
  --bg: #f0f7ff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #e6f0fc;
  --surface-3: #d4e3f7;
  --border: #d2e0f3;
  --text: #102a4d;
  --text-dim: #4a6a8e;
  --text-mute: #8a9cb6;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-deep: #dbeafe;
  --accent-on: #ffffff;
  --shadow: 0 1px 2px rgba(20, 50, 100, 0.04), 0 4px 12px rgba(20, 50, 100, 0.06);
  --shadow-hover: 0 4px 12px rgba(20, 50, 100, 0.1);
  color-scheme: light;
}

/* ---------- Rose (light pink) ---------- */
:root[data-theme="rose"] {
  --bg: #fff5f8;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffe9f0;
  --surface-3: #ffd6e2;
  --border: #fbd5e1;
  --text: #4a1e30;
  --text-dim: #8a5567;
  --text-mute: #b88597;
  --accent: #ec4899;
  --accent-dark: #db2777;
  --accent-deep: #fce7f3;
  --accent-on: #ffffff;
  --shadow: 0 1px 2px rgba(120, 30, 60, 0.04), 0 4px 12px rgba(120, 30, 60, 0.06);
  --shadow-hover: 0 4px 12px rgba(120, 30, 60, 0.1);
  color-scheme: light;
}

/* ---------- Slate (neutral dark) ---------- */
:root[data-theme="slate"] {
  --bg: #0f1419;
  --bg-2: #161c23;
  --surface: #1c242d;
  --surface-2: #232d38;
  --surface-3: #2c3744;
  --border: #2f3a47;
  --text: #e6ebf1;
  --text-dim: #a0acba;
  --text-mute: #6b7886;
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --accent-deep: #0b3a52;
  --accent-on: #0f1419;
  --shadow: none;
  --shadow-hover: none;
  color-scheme: dark;
}

/* ---------- Sunset (warm cream) ---------- */
:root[data-theme="sunset"] {
  --bg: #fff8f0;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #fff0dd;
  --surface-3: #ffe2bc;
  --border: #ffe0bd;
  --text: #3f2710;
  --text-dim: #88684a;
  --text-mute: #b69874;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-deep: #ffedd5;
  --accent-on: #ffffff;
  --shadow: 0 1px 2px rgba(120, 60, 10, 0.04), 0 4px 12px rgba(120, 60, 10, 0.06);
  --shadow-hover: 0 4px 12px rgba(120, 60, 10, 0.1);
  color-scheme: light;
}

/* ===========================================================
   Base layout
   =========================================================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  background: var(--bg);
  transition: grid-template-columns 0.2s ease;
}
.app.sidebar-collapsed { grid-template-columns: 64px 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 14px;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 6px;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.2px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--surface);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-deep);
  color: var(--accent-dark);
}
.nav-item svg { flex-shrink: 0; }

/* Collapsed sidebar */
.sidebar.collapsed { padding: 18px 8px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed #themeBtn,
.sidebar.collapsed .nav-item span {
  display: none;
}
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

/* ---------- Main ---------- */
.main {
  overflow-y: auto;
  padding: 24px 32px;
}

.view { display: none; animation: fadeIn 0.2s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-deep);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
}

.page-title-block h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.page-title-block p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-mute);
}

/* ---------- Buttons ---------- */
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  transition: filter 0.15s, transform 0.05s;
}
.primary-btn:hover { filter: brightness(1.05); }
.primary-btn:active { transform: scale(0.98); }

.ghost-btn {
  background: var(--surface-2);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.ghost-btn:hover { background: var(--surface-3); color: var(--text); }

.text-btn {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
}
.text-btn:hover { background: var(--surface-2); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ---------- Dashboard ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  align-items: start;
}

.card-mini-cal { padding: 22px; }
.card-tasks {
  display: flex;
  flex-direction: column;
  min-height: 460px;
}

.mini-cal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mini-cal-month {
  font-size: 15px;
  font-weight: 600;
}
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 13px;
}
.mc-weekday {
  text-align: center;
  color: var(--text-mute);
  font-size: 11px;
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.mc-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-dim);
  position: relative;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}
.mc-day:not(.dim) { cursor: pointer; }
.mc-day:not(.dim):hover { background: var(--surface-2); }
.mc-day.dim { color: var(--text-mute); opacity: 0.35; }

/* Today: accent circle on the number only */
.mc-day.today { font-weight: 700; }
.mc-day.today > span:first-child {
  background: var(--accent);
  color: var(--accent-on);
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

/* Selected: outline around cell + accent-colored number */
.mc-day.selected {
  outline: 2px solid var(--accent);
  border-radius: 10px;
  font-weight: 700;
}
.mc-day.selected > span:first-child { color: var(--accent-dark); }

/* Today + selected: keep the filled circle */
.mc-day.today.selected > span:first-child {
  background: var(--accent);
  color: var(--accent-on);
}
.mc-dots {
  display: flex;
  gap: 3px;
  height: 6px;
}
.mc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dash-task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.dash-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 13px;
  border-left: 3px solid;
  cursor: pointer;
  transition: background 0.15s;
}
.dash-task-item:hover { background: var(--surface-3); }
.dash-task-item .dt-title { flex: 1; }
.dash-task-item .dt-date { font-size: 11px; color: var(--text-mute); }
.dash-task-item.done .dt-title { text-decoration: line-through; color: var(--text-mute); }

.dash-day-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-mute);
  padding: 4px 2px 2px;
  margin-top: 4px;
}
.dash-day-header:first-child { margin-top: 0; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-mute);
  flex: 1;
}
.empty-title { font-weight: 600; color: var(--text-dim); margin-bottom: 4px; font-size: 14px; }
.empty-sub { font-size: 12px; }

/* ---------- Calendar View ---------- */
.cal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-month-title {
  font-size: 16px;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}

.big-cal-card { padding: 0; overflow: hidden; }
.big-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.big-cal-weekdays > div {
  padding: 10px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  text-align: center;
}
.big-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, 1fr);
}
.bc-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 110px;
  position: relative;
}
.bc-day:nth-child(7n) { border-right: none; }
.bc-day.dim { background: var(--bg-2); opacity: 0.55; }
.bc-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  align-self: flex-start;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.bc-day.today .bc-day-num {
  background: var(--accent);
  color: var(--accent-on);
}
.bc-tasks {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.bc-task {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  cursor: pointer;
}
.bc-task.done { opacity: 0.5; text-decoration: line-through; }

/* ---------- Todo View ---------- */
/* ---------- Sort bar ---------- */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sort-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 2px;
}
.sort-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sort-btn:hover { border-color: var(--accent); color: var(--text); }
.sort-btn.active {
  background: var(--accent-deep);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 600;
}
.sort-btn.diff-active {
  background: rgba(255, 120, 30, 0.15);
  border-color: #ff781e;
  color: #ff781e;
  font-weight: 600;
}

.todo-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left-width: 4px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.2s cubic-bezier(0.2,0,0.2,1);
}
.task-card:hover { box-shadow: var(--shadow-hover); }
.task-card { cursor: pointer; user-select: none; }
.task-card.selected {
  background: var(--accent-deep);
  box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow);
}
.task-card.dragging { opacity: 0.4; }
.task-card.drag-over-top { box-shadow: 0 -3px 0 var(--accent), var(--shadow); }
.task-card.drag-over-bottom { box-shadow: 0 3px 0 var(--accent), var(--shadow); }

/* Drag handle */
.drag-handle {
  flex-shrink: 0;
  width: 18px;
  margin-right: 2px;
  cursor: grab;
  color: var(--text-mute);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}
.task-card:hover .drag-handle { opacity: 1; }

/* ---------- Selection toolbar ---------- */
/* Floats over the viewport (fixed) so showing it never reflows the task list —
   that keeps selection instant and double-click reliable (the cards don't shift
   out from under the cursor between the two clicks). */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 14px 10px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}
.selection-bar[hidden] { display: none; }
.sel-count { font-size: 13px; font-weight: 700; color: var(--text); }
.sel-actions { display: flex; gap: 8px; }
.sel-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
}
.sel-btn:hover { filter: brightness(1.05); border-color: var(--accent); }
.sel-btn.danger { background: #e5484d; border-color: #e5484d; color: #fff; }
.sel-btn.ghost { background: transparent; color: var(--text-dim); }
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.task-checkbox svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  display: block;
}
.task-checkbox.checked svg { opacity: 1; }

.task-main { flex: 1; min-width: 0; }
.task-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
@media (hover: none) {
  .task-title { user-select: text; }
}
.task-card.done .task-title { text-decoration: line-through; color: var(--text-mute); }
.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  cursor: ew-resize;
  user-select: none;
}

.due-time-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-deep);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  cursor: ew-resize;
  user-select: none;
}

.card-assignees {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  cursor: pointer;
}
.card-assignees-add {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-mute);
  border: 1px dashed var(--border);
  gap: 3px;
}
.card-assignees-add:hover { color: var(--accent); border-color: var(--accent); }

.card-assignee-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  z-index: 9999;
  min-width: 180px;
  max-width: 260px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-assignee-search {
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.card-assignee-list {
  overflow-y: auto;
  max-height: 200px;
}
.card-assignee-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.card-assignee-opt:hover { background: var(--surface-2); }
.card-assignee-opt .card-assignee-check {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
}
.card-assignee-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-mute);
}

/* ---------- Undo toast ---------- */
.undo-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-hover);
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
  animation: undo-toast-in 0.15s ease;
}
@keyframes undo-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.task-actions .icon-btn { width: 30px; height: 30px; }

.subtasks {
  margin-top: 10px;
  padding-left: 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subtask {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.subtask:hover { background: var(--surface-2); }
.subtask-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.subtask-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.subtask-checkbox.checked::after {
  content: '✓';
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.subtask-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-dim);
}
.subtask.done .subtask-text { text-decoration: line-through; color: var(--text-mute); }
.subtask-remove {
  color: var(--text-mute);
  font-size: 16px;
  align-self: stretch;
  width: 10%;
  flex-shrink: 0;
  margin: -6px -8px -6px 0;
  border-radius: 0 8px 8px 0;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.subtask:hover .subtask-remove { opacity: 1; }
.subtask-remove:hover { background: var(--surface-3); color: var(--danger); }

.subtask-add {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
}
.subtask-add input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}
.subtask-add input:focus { border-color: var(--accent); }
.subtask-add button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.subtask-add button:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Archive ---------- */
.archive {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.archive[hidden] { display: none; }
.archive-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  list-style: none;
  transition: background 0.15s;
}
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary:hover { background: var(--surface-2); color: var(--text); }
.archive-count {
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.archive-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-mute);
}
.archive[open] .archive-chevron { transform: rotate(180deg); }
.archive .todo-wrap { margin-top: 10px; }
.archive .task-card { opacity: 0.75; }

/* ---------- To-do groups (Verify / Assigned / My tasks) ---------- */
.todo-group { margin-bottom: 18px; }
.todo-group[hidden] { display: none; }
.todo-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.todo-group-title[hidden] { display: none; }
#personalTitle { margin-top: 4px; }
.todo-group-count {
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.verify-group .todo-group-title { color: var(--accent-dark); }
.verify-group .todo-group-count { background: var(--accent-deep); color: var(--accent-dark); }

/* Assigned-to-me cards get an accent rail; rejected ones go red. */
.task-card.assigned-card { background: var(--surface-2); }
.task-card.verify-card { background: var(--surface-2); }
.task-card.rejected-card { box-shadow: inset 2px 0 0 var(--danger); }

/* Relationship / status badges */
.task-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.rel-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.rel-badge.assigned-by, .rel-badge.completed-by {
  background: var(--accent-deep);
  color: var(--accent-dark);
}
.rel-badge.rejected { background: var(--danger); color: #fff; }
.reject-reason {
  margin: 4px 0 2px;
  font-size: 12px;
  color: var(--danger);
  white-space: pre-wrap;
}

/* Verify / Reject actions */
.verify-btn, .reject-btn {
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.verify-btn { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.verify-btn:hover { filter: brightness(1.05); }
.reject-btn { background: var(--surface-2); color: var(--text-dim); }
.reject-btn:hover { background: var(--surface-3); color: var(--danger); }

/* Inline reject reason form */
.reject-form {
  display: flex;
  gap: 8px;
  margin: 8px 0 0 32px;
}
.reject-form[hidden] { display: none; }
.reject-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
}
.reject-input.error { border-color: var(--danger); }
.reject-submit {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.reject-submit:hover { filter: brightness(1.05); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: pop 0.18s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}
.modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  min-width: 0;
  flex: 1;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: -6px;
  outline: none;
  cursor: text;
  word-break: break-word;
  transition: background 0.15s;
}
.modal-header h2:focus {
  background: var(--surface-2);
}
.modal-header h2:empty::before {
  content: 'What needs doing?';
  color: var(--text-mute);
  pointer-events: none;
  font-weight: 400;
}
.modal-body {
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label, .field-label-row {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}
.difficulty-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.field input[type="text"],
.field input[type="date"],
.field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input[type="text"]:focus,
.field input[type="date"]:focus,
.field input[type="password"]:focus,
.field input[type="email"]:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }
.notes-field { flex: 1; min-height: 0; }
.notes-field textarea { flex: 1; min-height: 100px; height: 100%; }
.field input[type="password"],
.field input[type="email"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  color: var(--text);
  font-family: inherit;
}

/* Override the browser's autofill yellow/cream background so inputs
   keep the theme background even when Edge/Chrome pre-fills them. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  caret-color: var(--text);
  border-color: var(--border) !important;
  transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
}

.field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-deep) 0%, var(--accent-dark) 100%);
  outline: none;
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.field input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  cursor: pointer;
}

/* ---------- Quick-date buttons ---------- */
.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.quick-date-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}
.quick-date-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}
.quick-date-n { padding: 4px 8px; }
.quick-date-n input[type="number"] {
  width: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  outline: none;
  font-family: inherit;
  -moz-appearance: textfield;
}
.quick-date-n input[type="number"]:focus { border-color: var(--accent); }
.quick-date-n input[type="number"]::-webkit-inner-spin-button,
.quick-date-n input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Attachments: modal ---------- */
.attach-dropzone {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attach-list[hidden] { display: none; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px 6px 6px;
  max-width: 100%;
}
.attach-chip.uploading { opacity: 0.65; }
.attach-chip-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-dim);
}
.attach-chip-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-chip-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.attach-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.attach-chip-size { font-size: 11px; color: var(--text-mute); }
.attach-chip-remove {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.attach-chip-remove:hover { color: var(--text); }
.attach-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.attach-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.attach-add-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.attach-hint { font-size: 11px; color: var(--text-mute); }

/* Drag-over overlay covering the modal panel */
.modal-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent-deep);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}
.modal-drop-overlay.active { display: flex; }

/* ---------- Attachments: task card ---------- */
.attach-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0 32px;
}
.card-attach-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-3);
  padding: 0;
  cursor: zoom-in;
}
.card-attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  max-width: 180px;
}
.card-attach-file:hover { border-color: var(--accent); color: var(--accent-dark); }
.card-attach-file span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-attach-more {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.card-attach-more:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ---------- Image lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

/* ---------- Theme picker ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.theme-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.05s;
  text-align: left;
}
.theme-swatch:hover { border-color: var(--accent); }
.theme-swatch:active { transform: scale(0.98); }
.theme-swatch.active {
  border-color: var(--accent);
  background: var(--accent-deep);
}
.swatch-circles {
  display: flex;
  gap: 0;
  flex-shrink: 0;
}
.swatch-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -6px;
}
.swatch-circle:first-child { margin-left: 0; }
.swatch-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.custom-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.custom-color-row input[type="color"] {
  width: 44px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
}
.custom-color-hint {
  font-size: 11px;
  color: var(--text-mute);
}

/* ---------- Responsive ---------- */
/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 49;
}
.sidebar-backdrop.active { display: block; }

/* Mobile top bar */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 40;
}
.mobile-topbar-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.2px;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .app { height: 100dvh; grid-template-rows: 1fr; }
  .main { min-height: 0; overflow-y: scroll; padding: 68px 16px 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .card-tasks { min-height: 280px; }
  .theme-grid { grid-template-columns: 1fr; }
  /* Calendar on mobile */
  .cal-month-title { min-width: 120px; font-size: 14px; }
  .big-cal-grid { grid-auto-rows: minmax(64px, 1fr); }
  .bc-day { padding: 4px; min-height: 64px; gap: 2px; }
  .bc-day-num { font-size: 11px; width: 20px; height: 20px; }
  /* Page headers on mobile */
  .page-header { margin-bottom: 16px; }
  .page-title-block p { display: none; }
  .page-icon { width: 36px; height: 36px; border-radius: 10px; }
  .page-title-block h1 { font-size: 18px; }
}

/* ===========================================================
   Login screen
   =========================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 200;
  padding: 24px;
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(40, 20, 90, 0.12);
}
.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}
.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin-bottom: 12px;
}
.auth-brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.auth-tagline {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-mute);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field-label { text-transform: none; letter-spacing: 0; font-size: 12px; }
.auth-submit { justify-content: center; padding: 12px 16px; font-size: 14px; margin-top: 4px; }
.auth-toggle { align-self: center; margin-top: 2px; }
.auth-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #b91c1c;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
}
.auth-error[hidden] { display: none; }
.auth-hint {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
}
.auth-hint code {
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ===========================================================
   Sidebar user card
   =========================================================== */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  position: relative;
}
.user-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.user-card:hover { background: var(--surface-2); }
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chevron {
  color: var(--text-mute);
  transform: rotate(90deg);
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-footer { padding-top: 8px; }
.sidebar.collapsed .user-card { padding: 4px; justify-content: center; }
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-chevron { display: none; }

.user-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 10;
}
.user-menu[hidden] { display: none; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.user-menu-item:hover { background: var(--surface-2); color: var(--text); }

/* ===========================================================
   Assignee chip + select
   =========================================================== */
.field select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239b8fb5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field select:focus { border-color: var(--accent); }

.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.assignee-chip .mini-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.assignee-chip.assigned-to-me {
  background: var(--accent-deep);
  color: var(--accent-dark);
}
.assignee-chip.more {
  background: var(--surface-2);
  color: var(--text-mute);
}

/* Multi-select dropdown (assignee picker) */
.multi-select { position: relative; }
.multi-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  min-height: 42px;
  transition: border-color 0.15s;
}
.multi-select-trigger:hover { border-color: var(--accent); }
.multi-select.open .multi-select-trigger { border-color: var(--accent); }
.multi-select-chips {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 22px;
}
.multi-select-placeholder { color: var(--text-mute); font-size: 13px; }
.multi-select-chevron {
  color: var(--text-mute);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.multi-select.open .multi-select-chevron { transform: rotate(180deg); }
.multi-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.multi-select-menu[hidden] { display: none; }
.multi-select-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  background: transparent;
  color: var(--text-dim);
  transition: background 0.12s, color 0.12s;
}
.multi-select-option:hover { background: var(--surface-2); color: var(--text); }
.multi-select-option.selected {
  background: var(--accent-deep);
  color: var(--accent-dark);
}
.multi-select-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.multi-select-option.selected .multi-select-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.multi-select-option.selected .multi-select-check::after {
  content: '✓';
  font-size: 11px;
  font-weight: 700;
}
.multi-select-option .mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.multi-select-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-empty {
  padding: 14px;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
}

/* Scrollbar polish (works in Chromium/Edge — the desktop-app target) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ===========================================================
   Notifications / Telegram settings
   =========================================================== */
.tg-connect {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.tg-intro { margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.tg-connect .primary-btn { align-self: flex-start; }
.tg-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.tg-status.connected { color: var(--text); }
.tg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.tg-disconnect { align-self: flex-start; }
.tg-waiting { font-size: 13px; color: var(--text-dim); }
.tg-waiting.error { color: var(--danger); }

.tg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 480px) { .tg-grid { grid-template-columns: 1fr; } }

.tg-toggles { display: flex; flex-direction: column; gap: 4px; }
.tg-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.tg-toggle:hover { background: var(--surface-2); }
.tg-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.tg-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.tg-toggle-title { font-size: 14px; font-weight: 600; color: var(--text); }
.tg-toggle-sub { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.tg-prefs.disabled { opacity: 0.55; pointer-events: none; }
