/* ════════════════════════════════════════════════════════════
   Time.Blocking — "Soft B" warm light design
   ════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg:           #FAF7F5;
  --surface:      #FFFFFF;
  --surface-tint: #F4EEF7;
  --overlay:      rgba(27,21,48,0.45);

  /* Borders */
  --border:       rgba(27,21,48,0.08);
  --border-h:     rgba(27,21,48,0.05);

  /* Text */
  --text:         #1B1530;
  --text-2:       #3A3450;
  --text-3:       #6E6680;
  --text-4:       #9D96AA;

  /* Accent — warm indigo */
  --accent:       #6D4CF2;
  --accent-soft:  #EEE7FE;
  --danger:       #D6385A;
  --danger-soft:  #FCE4EA;
  --now-line:     #F0466A;

  /* Block palette — Fixe */
  --fixe-bg:     #FFDDE2;
  --fixe-fg:     #7E1F32;
  --fixe-accent: #E5536D;

  /* Block palette — Producció Profunda */
  --profunda-bg:     #DCD9FB;
  --profunda-fg:     #2B257A;
  --profunda-accent: #6D4CF2;

  /* Block palette — Gestió */
  --gestio-bg:     #FDE9C2;
  --gestio-fg:     #714210;
  --gestio-accent: #D4892B;

  /* Block palette — Coordinació */
  --coord-bg:     #CDEBD6;
  --coord-fg:     #1F5236;
  --coord-accent: #3FA365;

  /* Block palette — Buffer */
  --buffer-bg:     #D6E6F2;
  --buffer-fg:     #1F4670;
  --buffer-accent: #5392CB;

  /* Legacy color names mapped to new palette */
  --rose-bg:    #FFDDE2; --rose-fg:    #7E1F32; --rose-bd:    #E5536D;
  --indigo-bg:  #DCD9FB; --indigo-fg:  #2B257A; --indigo-bd:  #6D4CF2;
  --amber-bg:   #FDE9C2; --amber-fg:   #714210; --amber-bd:   #D4892B;
  --emerald-bg: #CDEBD6; --emerald-fg: #1F5236; --emerald-bd: #3FA365;
  --sky-bg:     #D6E6F2; --sky-fg:     #1F4670; --sky-bd:     #5392CB;
  --violet-bg:  #DCD9FB; --violet-fg:  #2B257A; --violet-bd:  #6D4CF2;
  --coral-bg:   #FFE4D6; --coral-fg:   #7A2E0E; --coral-bd:   #E07348;
  --lime-bg:    #E4F0C8; --lime-fg:    #3A5212; --lime-bd:    #7BAF28;
  --orange-bg:  #FDE9C2; --orange-fg:  #7A3506; --orange-bd:  #E07348;
  --teal-bg:    #CCEDE8; --teal-fg:    #1A4F4A; --teal-bd:    #2E9B8E;

  /* GCal read-only events */
  --gcal-bg: rgba(109,76,242,0.07);
  --gcal-bd: rgba(109,76,242,0.35);
  --gcal-fg: #6D4CF2;

  /* Energy */
  --energy-high: #E5536D;
  --energy-med:  #D4892B;
  --energy-low:  #3FA365;

  /* Legacy compat (still referenced inline by JS — keep mapped) */
  --surface-2: var(--surface-tint);
  --red:       var(--danger);

  /* Dimensions */
  --slot-h:    20px;
  --gutter-w:  68px;
  --col-min:   110px;
  --sidebar-w: 400px;

  /* Radii */
  --radius:  10px;
  --r-xs:    4px;
  --r-sm:    8px;
  --r-md:    10px;
  --r-lg:    14px;
  --r-xl:    20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(27,21,48,0.04), 0 1px 1px rgba(27,21,48,0.03);
  --shadow-md: 0 4px 12px rgba(27,21,48,0.06), 0 2px 4px rgba(27,21,48,0.04);
  --shadow-lg: 0 12px 32px rgba(27,21,48,0.10), 0 4px 12px rgba(27,21,48,0.06);
  --shadow-xl: 0 30px 80px rgba(27,21,48,0.25);

  /* Mono font */
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ─── BASE ───────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11','ss01';
}

.mono { font-family: var(--mono); font-feature-settings: 'zero','tnum'; }

/* ─── HEADER ─────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  z-index: 100;
  gap: 12px;
}

#logo {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Logo icon — indigo square with two white squares */
#logo-icon {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
  flex-shrink: 0;
}
#logo-icon::before {
  content: '';
  position: absolute;
  left: 5px; top: 5px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: #fff;
  opacity: 0.9;
}
#logo-icon::after {
  content: '';
  position: absolute;
  right: 5px; bottom: 5px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: #fff;
  opacity: 0.55;
}

#logo em { font-style: normal; color: var(--accent); }

#app-ver {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-4);
  font-weight: 400;
  margin-left: 4px;
  align-self: flex-end;
  padding-bottom: 2px;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

#week-label {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
  min-width: 200px;
  text-align: center;
  letter-spacing: -0.01em;
}

.action-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.action-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 8px 2px;
}

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 32px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
  flex: 0 0 auto;
}

.btn-ghost {
  background: var(--surface-tint);
  color: var(--text);
}
.btn-ghost:hover { background: #EAE3F9; }

/* Segmented view toggle (Setmana | Dia) */
.view-toggle {
  display: inline-flex;
  background: var(--surface-tint, rgba(27,21,48,0.05));
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.view-toggle-btn {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(27,21,48,0.08);
}

.btn-accent {
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent); }
.btn-accent:active { transform: translateY(0.5px); }

.btn-icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
  flex: 0 0 auto;
}
.btn-icon:hover { background: var(--surface-tint); color: var(--text); }

/* Badge on icon button (e.g. inbox count) */
.btn-icon .badge {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.btn-danger {
  background: var(--danger-soft);
  border: none;
  color: var(--danger);
  padding: 0 14px;
  height: 32px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-danger:hover { background: #F9D0D8; }

/* Small danger button (settings type delete) */
.btn-danger-sm {
  background: transparent;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.btn-danger-sm:hover { background: var(--danger-soft); color: var(--danger); }

kbd {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  height: 16px;
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
}
.btn-ghost kbd {
  background: rgba(27,21,48,0.07);
  border-color: rgba(27,21,48,0.12);
  color: var(--text-3);
}

/* ─── WEEK SUMMARY BAR ───────────────────────────────────── */
#week-summary {
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

#week-summary-hours {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

#week-summary-label {
  font-size: 11.5px;
  color: var(--text-4);
  font-weight: 500;
}

#week-summary-bar-wrap {
  flex: 1;
  max-width: 360px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-tint);
  overflow: hidden;
}

#week-summary-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

#week-summary-right {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

#week-summary-right .cal-dot {
  width: 8px; height: 8px;
  border-radius: 3px;
  background: var(--accent);
}

/* Summary pills (current JS-rendered markup) */
.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.summary-pill strong { color: var(--text); font-weight: 700; }
.summary-pill .sdot {
  width: 8px; height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}
.summary-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 0 2px;
}
.summary-total {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 500;
}
.summary-total strong { color: var(--text); font-weight: 700; }
.summary-empty {
  font-size: 11.5px;
  color: var(--text-4);
  font-weight: 500;
}
.summary-warn {
  font-size: 11.5px;
  color: var(--energy-med);
  font-weight: 600;
}

/* ─── MAIN LAYOUT ────────────────────────────────────────── */
#main-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── Vista DIA: només avui, a tot l'ample; sidebar més ample ── */
body.view-day .nav-cluster #btn-prev,
body.view-day .nav-cluster #btn-next,
body.view-day .nav-cluster #week-label,
body.view-day .nav-cluster #btn-today { display: none; }

body.view-day #cal-header .day-hcell:not(.today),
body.view-day #days-area .day-col:not(.today-col) { display: none; }

/* La franja "tot el dia" posiciona les barres en fraccions de la setmana
   (calc(... * startDay / 7)), no dins de cap cel·la; en vista dia no es pot
   reposicionar a una sola columna sense JS, així que s'amaga sencera. */
body.view-day #allday-lane { display: none; }

/* La columna/capçalera d'avui ocupa tot l'ample disponible */
body.view-day #cal-header .day-hcell.today,
body.view-day #days-area .day-col.today-col { flex: 1 1 auto; }

/* Repartiment flexible sidebar/calendari (valors ajustables) */
body.view-day #task-sidebar { flex: 4 1 0; width: auto; min-width: 320px; }
body.view-day #calendar-wrapper { flex: 5 1 0; }

/* ─── TASK SIDEBAR (LEFT — INBOX) ────────────────────────── */
#task-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-top {
  padding: 16px 14px 0 16px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sidebar-badge {
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Pending count badge (JS-rendered) */
.sidebar-pending-badge {
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
}

/* Segmented mode toggle: Actives / Arxiu */
.sidebar-modes {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.sidebar-mode-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: none;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.sidebar-mode-btn:hover { color: var(--text-1); }
.sidebar-mode-btn.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(15 18 33 / 8%);
}
.sidebar-mode-count {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 10px; font-weight: 700;
  color: var(--text-4);
  background: rgb(0 0 0 / 6%);
  padding: 1px 6px;
  border-radius: 999px;
}
.sidebar-mode-btn.is-active .sidebar-mode-count { color: var(--accent); background: var(--accent-soft); }

/* Empty state for whole sidebar */
.sidebar-empty {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 22px 18px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-tint);
  margin-top: 4px;
}
.sidebar-empty-hint {
  font-size: 11px; color: var(--text-4); font-style: italic;
  display: inline-block; margin-top: 6px; line-height: 1.4;
}

/* Quick add input */
.task-add-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  margin-bottom: 10px;
  -webkit-user-select: text;
  user-select: text;
}
.task-add-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.task-add-input::placeholder { color: var(--text-4); }

/* Filter pills */
.sidebar-filters {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  background: var(--surface);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.filter-pill.active {
  background: var(--text);
  color: #fff;
  border-color: transparent;
}

#sidebar-tasks {
  flex: 1;
  overflow-y: auto;
  padding: 2px 14px 16px 16px;
}

#sidebar-tasks::-webkit-scrollbar { width: 4px; }
#sidebar-tasks::-webkit-scrollbar-track { background: transparent; }
#sidebar-tasks::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Task group title (JS-rendered) */
.task-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin: 14px 0 7px;
  display: flex;
  align-items: center;
}
.task-group-title:first-child { margin-top: 4px; }

/* Inline "new task" inside block detail */
.block-newtask { margin: 4px 0 8px; }
.block-newtask-trigger {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  background: var(--surface-tint);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.block-newtask-trigger:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  border-style: solid;
}
.block-newtask-input {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.block-newtask-input::placeholder { color: var(--text-4); }

/* Task cards (compact rows) */
.task-card {
  padding: 8px 9px;
  background: transparent;
  border: none;
  border-radius: 9px;
  margin-bottom: 1px;
  cursor: grab;
  transition: background 0.12s, box-shadow 0.12s;
  display: flex;
  gap: 9px;
  align-items: center;
}
.task-card:hover {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.task-card.dragging {
  cursor: grabbing;
  opacity: 0.75;
  box-shadow: var(--shadow-md);
  background: var(--surface);
}
.task-card.assigned { opacity: 0.7; }

.task-card-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.task-card-row .task-card-title { flex: 1; min-width: 0; }

.task-card-body { flex: 1; min-width: 0; }

.task-card-priority-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.priority-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.priority-dot.alta    { background: var(--energy-high); }
.priority-dot.mitja   { background: var(--energy-med); }
.priority-dot.baix    { background: var(--energy-low); }

.priority-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.priority-label.alta  { color: var(--energy-high); }
.priority-label.mitja { color: var(--energy-med); }
.priority-label.baix  { color: var(--energy-low); }

.task-card-assigned-badge {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.task-card-title {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.35;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-area {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--text-4);
  font-weight: 500;
}

/* ── Task check + new card meta ─────────────────────────── */
.task-check {
  width: 18px; height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; color: #fff;
  margin-top: 1px;
  transition: background 0.12s, border-color 0.12s;
}
.task-check:hover { border-color: var(--accent); }
.task-check.checked { background: var(--accent); border-color: var(--accent); }

.task-card-main { flex: 1; min-width: 0; }
.task-card.is-done .task-card-title { text-decoration: line-through; color: var(--text-3); }

.task-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 5px;
}
.task-deadline {
  font-size: 10px; font-weight: 600;
  color: var(--text-3);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 999px;
  white-space: nowrap;
}
.task-deadline.overdue { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
/* Compact deadline inside a task-card row: mono, no pill */
.task-card-row .task-deadline {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-4);
  background: transparent;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.task-card-row .task-deadline.overdue { color: var(--energy-high); background: transparent; }
.task-tag-chip {
  font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  white-space: nowrap;
}

/* ── Task sections (inbox + types) — boxed cards w/ tinted header ─ */
.task-section {
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 1px 2px rgb(15 18 33 / 4%);
  transition: box-shadow 0.12s, border-color 0.12s;
}
.task-section:hover { border-color: rgba(27,21,48,0.12); }
.task-section.drop-hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.task-section-header {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  -webkit-user-select: none; user-select: none;
  border-bottom: 1px solid rgb(0 0 0 / 6%);
}
.task-section-caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  font-size: 12px; font-weight: 700;
  color: inherit; opacity: 0.85;
  border: none; cursor: pointer;
  border-radius: 5px;
  background: rgb(0 0 0 / 8%);
  transition: transform 0.18s ease, background 0.12s;
  flex-shrink: 0;
}
.task-section-caret:hover { background: rgb(0 0 0 / 14%); }
.task-section-caret.collapsed { transform: rotate(-90deg); }
.task-section-label { font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; flex: 1; }
.task-section-label.is-clickable {
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  /* font:inherit resets the shorthand, so re-declare the label's type scale */
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
  cursor: pointer;
}
.task-section-label.is-clickable:hover { text-decoration: underline; }

.task-section-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  padding: 0 2px;
  flex-shrink: 0;
}
.task-section-add:hover { opacity: 1; }

.section-add-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.section-add-input:focus { border-color: var(--accent); }

.task-section-count {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 11px; font-weight: 700;
  opacity: 0.7;
  padding: 1px 7px; border-radius: 999px;
  background: rgb(0 0 0 / 8%);
}
.task-section-open {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  font-size: 15px; font-weight: 700; line-height: 1;
  color: inherit; opacity: 0.55;
  border: none; cursor: pointer; background: transparent;
  border-radius: 5px; flex-shrink: 0;
  transition: opacity 0.12s, background 0.12s;
}
.task-section-open:hover { opacity: 1; background: rgb(0 0 0 / 10%); }
.task-section-body { padding: 8px 10px 10px; min-height: 2px; }
.task-section-body:empty { padding: 0; }
.task-section-empty { font-size: 11.5px; color: var(--text-4); padding: 4px 6px 2px; font-style: italic; }

/* Archive buckets (Avui / Ahir / Setmana / Anteriors) */
.archive-bucket { margin-bottom: 14px; }
.archive-bucket-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.archive-bucket-label { flex: 1; }
.archive-bucket-count {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 10.5px; font-weight: 700;
  color: var(--text-4);
  background: var(--surface-tint);
  padding: 1px 7px; border-radius: 999px;
}
.archive-bucket-body { display: flex; flex-direction: column; gap: 0; }

/* Day summary footer ("Fet avui") */
.day-summary {
  margin-top: 18px;
  border-top: 2px solid var(--border);
  padding-top: 14px;
}
.day-summary-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-2);
  padding: 0 4px 8px;
}
.day-summary-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--emerald-bg);
  color: var(--emerald-fg);
  font-size: 11px; font-weight: 700;
}
.day-summary-label { flex: 1; }
.day-summary-count {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 11px; font-weight: 700;
  color: var(--emerald-fg);
  background: var(--emerald-bg);
  padding: 1px 8px; border-radius: 999px;
}
.day-summary-body { display: flex; flex-direction: column; gap: 0; }
.day-summary-empty {
  font-size: 11.5px;
  color: var(--text-4);
  font-style: italic;
  text-align: center;
  padding: 8px 4px;
}

/* Block detail header (sidebar) — tinted with the block type color */
.block-detail-head { border-radius: 11px; padding: 11px 12px; }
.block-detail-title { font-size: 14px; font-weight: 700; }
.tipus-description {
  margin: 8px 2px 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
}
.block-detail-sub { font-family: var(--mono); font-size: 11px; opacity: 0.8; margin-top: 2px; }

/* Action row under the block-detail-head (Edit / Delete) */
.block-detail-actions {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
}
.block-detail-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-tint);
  color: var(--text-2);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.block-detail-action:hover {
  background: #EAE3F9;
  color: var(--text);
}
.block-detail-action.danger { color: var(--danger); }
.block-detail-action.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* "Veure totes" link inside an inbox section */
.task-section-more {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.task-section-more:hover {
  background: var(--surface-tint);
  color: var(--text);
}

/* Count chip inside task-group-title (e.g. "Tasques 12") */
.task-group-count {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-tint);
  color: var(--text-3);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Task detail panel ──────────────────────────────────── */
.task-detail { display: flex; flex-direction: column; gap: 14px; }
.td-titlerow { display: flex; align-items: flex-start; gap: 10px; }
.td-title-input {
  flex: 1; font-size: 15px; font-weight: 700; color: var(--text);
  border: none; background: transparent; outline: none; padding: 0;
  font-family: inherit; line-height: 1.3;
}
.td-title-input.is-done { text-decoration: line-through; color: var(--text-3); }
.td-field { display: flex; flex-direction: column; gap: 6px; }
.td-prio-grid { display: flex; gap: 5px; }
.td-prio-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; font-family: inherit;
  padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-3); cursor: pointer;
}
.td-prio-btn.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.td-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.task-tag-chip.removable { display: inline-flex; align-items: center; gap: 4px; }
.td-tag-remove { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 10px; padding: 0; opacity: 0.7; }
.td-tag-remove:hover { opacity: 1; }

/* ── ICE prioritization ───────────────────────────────────── */
/* Score badge on a task card row */
.task-ice {
  font-family: var(--mono);
  font-feature-settings: 'tnum';
  font-size: 10px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px; border-radius: 6px;
  flex-shrink: 0;
}
.td-sched {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-3);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
.td-sched span { flex: 1; }
.td-unschedule { border: none; background: transparent; color: var(--text-3); cursor: pointer; font-size: 13px; flex-shrink: 0; }

/* Task item (current JS-rendered markup) */
.task-item {
  padding: 9px 11px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: grab;
  transition: box-shadow 0.12s, border-color 0.12s;
}
.task-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(27,21,48,0.12);
}
.task-item.dragging-task {
  cursor: grabbing;
  opacity: 0.75;
  box-shadow: var(--shadow-md);
}
.task-item.scheduled { opacity: 0.7; cursor: default; }

.task-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.task-priority {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.task-priority.alta  { color: var(--energy-high); }
.task-priority.media { color: var(--energy-med); }
.task-priority.baixa { color: var(--energy-low); }

.task-title {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.35;
  font-weight: 500;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.task-area-tag {
  font-size: 10px;
  color: var(--text-4);
  font-weight: 500;
}

/* Schedule badge + dropdown (JS-rendered) */
.task-schedule-wrap { position: relative; margin-left: auto; }
.task-schedule-badge {
  font-size: 9.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.task-schedule-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 60;
  display: none;
  min-width: 150px;
}
.task-schedule-dropdown.open { display: block; }
.task-schedule-option {
  font-size: 12px;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.task-schedule-option:hover { background: var(--surface-tint); }

.task-scheduled-badge {
  font-size: 9.5px;
  color: var(--text-3);
  font-weight: 500;
}

/* Area filter buttons (block detail pool) */
.area-filter-btn { font-family: inherit; }

/* Sidebar block detail view (when block is selected) */
.sidebar-block-detail {
  padding: 12px 14px 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-block-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sidebar-block-detail-color {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sidebar-block-detail-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-block-detail-close {
  background: none;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
}

#sidebar-empty {
  text-align: center;
  color: var(--text-4);
  font-size: 12px;
  line-height: 1.6;
  padding: 24px 16px;
}

/* ─── CALENDAR WRAPPER ───────────────────────────────────── */
#calendar-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--surface);
}

#calendar-wrapper::-webkit-scrollbar { width: 5px; height: 5px; }
#calendar-wrapper::-webkit-scrollbar-track { background: var(--bg); }
#calendar-wrapper::-webkit-scrollbar-thumb { background: rgba(27,21,48,0.15); border-radius: 3px; }

#calendar { display: flex; flex-direction: column; }

/* Sticky day-name row */
#cal-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 64px;
}
.day-hcell.weekend { background: rgba(27,21,48,0.025); }

/* ── All-day events lane (read-only) ────────────────────── */
#allday-lane {
  display: flex;
  position: sticky;
  top: 64px;
  z-index: 49;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 26px;
  max-height: 78px;
  overflow-y: auto;
}
.allday-gutter {
  width: var(--gutter-w); flex-shrink: 0;
  border-right: 1px solid var(--border-h);
  font-size: 8.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-4);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 4px 8px;
}
.allday-cell {
  flex: 1; min-width: var(--col-min);
  border-right: 1px solid var(--border-h);
  padding: 3px 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.allday-cell.weekend-col { background: rgba(27,21,48,0.025); }
.allday-cell:last-child { border-right: none; }
.allday-bar {
  position: absolute;
  height: 18px;
  font-size: 10px; font-weight: 600;
  line-height: 18px;
  padding: 0 7px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  z-index: 2;
  pointer-events: none;
}

.corner {
  width: var(--gutter-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border-h);
}

.day-hcell {
  flex: 1;
  min-width: var(--col-min);
  padding: 0 8px;
  border-right: 1px solid var(--border-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.day-hcell:last-child { border-right: none; }

.dh-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-3);
  text-transform: uppercase;
}
.day-hcell.today .dh-name { color: var(--accent); }

.dh-date-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.dh-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.day-hcell.today .dh-date { color: var(--accent); }
.dh-month {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-4);
}
.deadline-flag { vertical-align: top; }

/* ─── CALENDAR BODY ──────────────────────────────────────── */
#cal-body { display: flex; flex: 1; }

#time-gutter {
  width: var(--gutter-w);
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--border-h);
}

.hour-label {
  position: absolute;
  right: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-4);
  font-weight: 500;
  transform: translateY(-50%);
  white-space: nowrap;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

#days-area { display: flex; flex: 1; }

.day-col {
  flex: 1;
  min-width: var(--col-min);
  position: relative;
  border-right: 1px solid var(--border-h);
  cursor: crosshair;
}
.day-col.today-col { background: rgba(109,76,242,0.025); }
.day-col.weekend-col { background: rgba(27,21,48,0.035); }
.day-col.weekend-col.today-col { background: rgba(109,76,242,0.05); }
.day-col:last-child { border-right: none; }

.slot-line {
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
}
.slot-line.is-hour { border-top: 1px solid var(--border-h); }
.slot-line.is-half { border-top: 1px dashed var(--border-h); opacity: 0.6; }
.slot-line.is-qtr  { border-top: none; }

/* Current time indicator */
.now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--now-line);
  z-index: 30;
  pointer-events: none;
  border-radius: 2px;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -5px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--now-line);
  box-shadow: 0 0 0 3px var(--bg);
}

/* ─── BLOCKS ─────────────────────────────────────────────── */
/* Draw preview */
.block-preview {
  position: absolute;
  left: 5px; right: 5px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1.5px dashed var(--accent);
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  gap: 4px;
  opacity: 0.9;
}

.block {
  position: absolute;
  left: 5px; right: 5px;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: grab;
  z-index: 10;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.12s ease;
  box-shadow: 0 1px 2px rgba(27,21,48,0.04);
  border-left: 3px solid var(--block-accent);
}
.block:hover {
  box-shadow: 0 4px 14px rgba(27,21,48,0.10), 0 1px 4px rgba(27,21,48,0.06);
  z-index: 20;
}
.block.dragging {
  cursor: grabbing;
  opacity: 0.85;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.block.block-selected {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  z-index: 25;
}
.block-body {
  flex: 1;
  padding: 7px 11px 5px;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.block-title {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.block-time-label {
  font-family: var(--mono);
  font-size: 10.5px;
  opacity: 0.75;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.block-notes-preview {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

/* Task chips inside block */
.block-task-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.block-task-chip {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.block-task-chip.done { text-decoration: line-through; opacity: 0.6; }

.resize-handle {
  height: 6px;
  cursor: ns-resize;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.12s;
}
.block:hover .resize-handle { opacity: 1; }
.resize-handle::after {
  content: '';
  width: 18px; height: 2px;
  background: currentColor;
  opacity: 0.25;
  border-radius: 1px;
}

/* Energy dot */
.energy-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 0 2px currentColor;
}

/* Recurrence icon */
.recur-icon {
  position: absolute;
  bottom: 5px; right: 6px;
  font-size: 9px;
  opacity: 0.35;
  pointer-events: none;
  line-height: 1;
  z-index: 5;
}

/* GCal background events — dashed indigo (spec class) */
.gcal-event {
  position: absolute;
  left: 5px; right: 5px;
  background: var(--gcal-bg);
  border: 1.5px dashed var(--gcal-bd);
  border-radius: var(--r-md);
  padding: 4px 10px;
  font-size: 10.5px;
  color: var(--gcal-fg);
  font-weight: 500;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  z-index: 8;
}

/* GCal events — current JS-rendered markup (.cal-event-block) */
.cal-event-block {
  position: absolute;
  left: 5px; right: 5px;
  border: 1.5px dashed var(--gcal-bd);
  border-radius: var(--r-md);
  padding: 4px 10px;
  overflow: hidden;
  cursor: pointer;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.cal-event-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-time {
  font-family: var(--mono);
  font-size: 9.5px;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
/* Ghost (read-only) GCal events from non-Timeblocking calendars */
.cal-event-block.ghost {
  cursor: default;
  justify-content: flex-start;
  z-index: 11;
  pointer-events: none;
}
.cal-event-block.ghost .cal-event-title {
  background: rgba(255,255,255,0.6);
  padding: 1px 5px;
  border-radius: 4px;
  align-self: flex-start;
  max-width: 100%;
  box-sizing: border-box;
}
.cal-event-block.ghost .cal-event-time {
  background: rgba(255,255,255,0.55);
  padding: 0 4px;
  border-radius: 3px;
  align-self: flex-start;
  white-space: nowrap;
}

/* ─── MODAL ──────────────────────────────────────────────── */
#modal-overlay,
#gcal-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
#modal-overlay.open,
#gcal-modal-overlay.open { opacity: 1; pointer-events: all; }

#modal,
#gcal-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 520px;
  box-shadow: var(--shadow-xl);
  transform: translateY(8px) scale(0.99);
  transition: transform 0.18s ease;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#modal-overlay.open #modal,
#gcal-modal-overlay.open #gcal-modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-type-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.modal-title-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-time-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}
.modal-header-spacer { flex: 1; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-4);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-user-select: text;
  user-select: text;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--text-4); }
textarea.form-input { resize: vertical; min-height: 60px; line-height: 1.4; }

.form-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
}

/* Tipus/Calendari grid in modal */
.tipus-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg);
  border-radius: 12px;
  padding: 5px;
}

.tipus-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: filter 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.tipus-btn:hover { filter: brightness(0.96); }
.tipus-btn.active {
  border-color: var(--block-accent);
  box-shadow: inset 0 0 0 1px var(--block-accent);
}
.tipus-btn-emoji { font-size: 14px; line-height: 1; flex-shrink: 0; }

.tipus-dot {
  width: 12px; height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.tipus-label {
  font-size: 13px;
  font-weight: 600;
}
.tipus-btn.active .tipus-label { font-weight: 700; }

.tipus-gcal-hint {
  font-size: 10.5px;
  color: var(--text-4);
  font-weight: 500;
}

.tipus-selected-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* Energia selector */
.energia-grid {
  display: flex;
  gap: 5px;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
}

.energia-btn {
  flex: 1;
  padding: 7px 6px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  transition: background 0.1s, color 0.1s, box-shadow 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.energia-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.energia-btn.active.alta  { color: var(--energy-high); }
.energia-btn.active.mitja { color: var(--energy-med); }
.energia-btn.active.baix  { color: var(--energy-low); }

.edot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Color swatches (spec class .color-swatch + JS-rendered .cswatch) */
.color-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatch,
.cswatch {
  width: 22px; height: 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  border: none;
  padding: 0;
}
.color-swatch.active,
.cswatch.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}
.color-swatch:hover,
.cswatch:hover { transform: scale(1.1); }

/* Warn box */
.warn-text {
  padding: 8px 12px;
  background: #FFF6E0;
  border-radius: 10px;
  font-size: 12px;
  color: #8C5C0F;
  line-height: 1.4;
}

/* Recurrence section */
#recur-section {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
}

.recur-section-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

#day-pills-section { margin-top: 10px; }

.day-pills {
  display: flex;
  gap: 4px;
}

.day-pill {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
  background: var(--surface);
  color: var(--text-4);
}
.day-pill.active {
  background: var(--accent);
  color: #fff;
}

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--surface-tint);
  transition: background 0.15s;
  display: block;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(27,21,48,0.15);
  transition: left 0.15s;
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-switch input:checked ~ .toggle-thumb { left: 18px; }

/* Modal footer */
.modal-footer {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ─── CHOICE MODAL ───────────────────────────────────────── */
#choice-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
#choice-overlay.open { opacity: 1; pointer-events: all; }

#choice-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 360px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#choice-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

#choice-subtitle {
  font-size: 12.5px;
  color: var(--text-3);
}

.choice-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

/* Spec class + current JS-rendered .choice-opt */
.choice-option-btn,
.choice-opt {
  padding: 12px 14px;
  background: var(--bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.choice-option-btn:hover,
.choice-opt:hover { background: var(--surface-tint); }
.choice-opt.danger { color: var(--danger); }
.choice-opt.danger:hover { background: var(--danger-soft); }

.choice-cancel {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  transition: background 0.1s;
}
.choice-cancel:hover { background: var(--bg); }

/* ─── SETTINGS MODAL ─────────────────────────────────────── */
#settings-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
#settings-overlay.open { opacity: 1; pointer-events: all; }

#settings-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

#settings-modal h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  margin-bottom: 12px;
}

/* Settings rows — full-row tint matches the real block color */
.settings-type-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 1.5px solid var(--block-accent, var(--border));
  background: var(--bg);
  transition: filter 0.12s;
}
.settings-type-row:hover { filter: brightness(0.97); }
.settings-type-emoji { font-size: 15px; line-height: 1; }
.settings-type-label {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

/* Editing row uses a neutral form-like background (not the tinted color) */
.settings-type-row.editing {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px 10px;
  align-items: center;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  padding: 14px;
  filter: none;
}
.settings-type-row.editing:hover { filter: none; }
.settings-type-row.editing .settings-edit-emoji { width: 100%; text-align: center; border-radius: 10px; }
.settings-type-row.editing .settings-edit-label { width: 100%; border-radius: 10px; }
.settings-type-row.editing .settings-edit-description {
  grid-row: 2; grid-column: 1 / -1;
  width: 100%; border-radius: 10px; border-color: var(--border);
}
.settings-edit-actions {
  display: flex; gap: 6px;
  align-items: center;
  justify-self: end;
}
.settings-type-row.editing .settings-edit-color {
  grid-row: 3; grid-column: 1 / -1;
  margin-top: 2px;
}

/* Add row — looks like a clean form section */
#settings-add-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px dashed var(--border);
}
#settings-add-emoji { grid-row: 1; grid-column: 1; width: 100%; text-align: center; border-radius: 10px; border-color: var(--border); }
#settings-add-label { grid-row: 1; grid-column: 2; width: 100%; border-radius: 10px; border-color: var(--border); }
.settings-type-row.editing .settings-edit-emoji,
.settings-type-row.editing .settings-edit-label { border-color: var(--border); }
#settings-add-btn   {
  grid-row: 1; grid-column: 3;
  justify-self: end; align-self: center;
  width: auto; flex: 0 0 auto;
}
#settings-add-description {
  grid-row: 2; grid-column: 1 / -1;
  width: 100%; border-radius: 10px; border-color: var(--border);
}
#settings-add-color {
  grid-row: 3; grid-column: 1 / -1;
  margin-top: 2px;
}

/* Compact icon button (edit / delete / save / cancel inside settings rows) */
.settings-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: currentColor;
  opacity: 0.7;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s, color 0.12s;
  flex: 0 0 auto;
}
.settings-icon-btn svg { width: 15px; height: 15px; }
.settings-icon-btn:hover {
  opacity: 1;
  background: rgb(0 0 0 / 8%);
}
.settings-icon-btn.is-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  opacity: 1;
}
.settings-icon-btn.is-accent {
  background: var(--text);
  color: var(--surface);
  opacity: 1;
}
.settings-icon-btn.is-accent:hover {
  background: var(--accent);
  color: var(--surface);
}

/* Visual color picker — chips that mirror the real block color */
.color-picker {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 2px 0;
}
.color-chip {
  width: 30px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--block-accent, var(--border));
  cursor: pointer;
  padding: 0;
  position: relative;
  font: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.color-chip:hover { transform: scale(1.06); border-width: 2px; }
.color-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-chip.is-selected {
  border-width: 2.5px;
  box-shadow: inset 0 0 0 2px var(--bg);
}
.color-chip.is-selected::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--block-accent);
  transform: translate(-50%, -50%);
}

/* Calendar list in settings */
#calendar-list-container { display: flex; flex-direction: column; gap: 6px; }

.cal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
}

.cal-color-dot {
  width: 12px; height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.cal-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.cal-email {
  font-size: 10.5px;
  color: var(--text-4);
  font-family: var(--mono);
}

/* ─── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
  z-index: 9000;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── BLOCK COLOR THEMES (applied via JS as class on .block) ── */
.b-rose, .b-fixe       { background: var(--rose-bg);    color: var(--rose-fg);    --block-accent: var(--rose-bd); }
.b-indigo, .b-profunda { background: var(--indigo-bg);  color: var(--indigo-fg);  --block-accent: var(--indigo-bd); }
.b-amber, .b-gestio    { background: var(--amber-bg);   color: var(--amber-fg);   --block-accent: var(--amber-bd); }
.b-emerald, .b-coord   { background: var(--emerald-bg); color: var(--emerald-fg); --block-accent: var(--emerald-bd); }
.b-sky, .b-buffer      { background: var(--sky-bg);     color: var(--sky-fg);     --block-accent: var(--sky-bd); }
.b-violet              { background: var(--violet-bg);  color: var(--violet-fg);  --block-accent: var(--violet-bd); }
.b-coral               { background: var(--coral-bg);   color: var(--coral-fg);   --block-accent: var(--coral-bd); }
.b-lime                { background: var(--lime-bg);    color: var(--lime-fg);    --block-accent: var(--lime-bd); }
.b-orange              { background: var(--orange-bg);  color: var(--orange-fg);  --block-accent: var(--orange-bd); }
.b-teal                { background: var(--teal-bg);    color: var(--teal-fg);    --block-accent: var(--teal-bd); }

/* ════════════════════════════════════════════════════════ */
/* Task detail · hero + meta rail (v3) */
/* ════════════════════════════════════════════════════════ */
.task-detail--v3 { display: flex; flex-direction: column; gap: 14px; }

/* Topbar (rendered into #sidebar-top) */
.td-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.td-back-btn {
  font-family: inherit;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-3);
  background: var(--surface-tint);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.td-back-btn:hover { background: var(--bg); color: var(--text-1); }
.td-trash-btn {
  font-size: 14px;
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-3);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.td-trash-btn:hover { color: var(--danger); background: rgb(255 90 90 / 8%); }

/* Hero: title + description as the main editable body */
.td-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.td-hero-titlerow {
  display: flex; align-items: center; gap: 12px;
}
.task-detail--v3 .td-title-input {
  flex: 1;
  font-family: inherit;
  font-size: 16px; font-weight: 700;
  color: var(--text);
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  outline: none;
  padding: 4px 0;
  line-height: 1.3;
  transition: border-color 0.12s;
  resize: none;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.task-detail--v3 .td-title-input:focus { border-bottom-color: var(--accent); }
.task-detail--v3 .td-title-input.is-done { text-decoration: line-through; color: var(--text-3); }
.task-detail--v3 .td-title-input::placeholder { color: var(--text-4); }

.task-detail--v3 textarea.td-desc {
  width: 100%;
  min-height: 180px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.task-detail--v3 textarea.td-desc:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.task-detail--v3 textarea.td-desc::placeholder { color: var(--text-4); }

/* Meta rail: secondary metadata grouped in one boxed area */
.td-meta-rail {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 14px;
}
.td-meta-row {
  display: grid;
  grid-template-columns: 22px 96px 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.td-meta-row:last-child { border-bottom: none; }
.td-meta-row--desc { align-items: start; }
.td-meta-icon { font-size: 13px; line-height: 1; text-align: center; opacity: 0.75; }
.td-tipus-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.td-meta-label {
  font-size: 10.5px; font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.td-meta-value { min-width: 0; font-size: 13px; color: var(--text); }

.td-select {
  width: 100%; font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); background: transparent; border: none; outline: none;
  cursor: pointer; padding: 2px 0;
}
.td-row-input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--text);
  border: none; outline: none; background: transparent; padding: 2px 0;
}
.td-row-input::placeholder { color: var(--text-4); }

/* ICE row + collapsible panel (nested inside meta rail) */
.td-ice { display: contents; }
.task-detail--v3 .td-ice > .td-meta-row { border-bottom: 1px solid var(--border); }
.task-detail--v3 .td-meta-row--ice + .td-ice-panel { display: none; }
.task-detail--v3 .td-ice.is-expanded > .td-meta-row--ice { border-bottom: none; }
.td-ice-rowval { display: flex; align-items: center; gap: 8px; }
.td-ice-pillwrap { display: inline-flex; align-items: center; gap: 5px; }
.td-tier-label { font-size: 11px; font-weight: 600; color: var(--text-3); }
.td-ice-empty { font-size: 12px; color: var(--text-4); }
.td-ice-toggle {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--accent); padding: 2px 4px;
}
.td-ice-toggle:hover { text-decoration: underline; }

.td-ice-panel {
  display: none; padding: 14px; margin: 2px 0 8px;
  background: var(--surface-tint); border-radius: 12px;
}
.td-ice.is-expanded .td-ice-panel { display: block; }

.td-ice-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.td-ice-panel-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent); text-transform: uppercase;
}
.td-ice-tier {
  font-size: 12px; font-weight: 700; color: var(--text-3);
}
.td-ice-tier.is-tier-baixa   { color: var(--text-3); }
.td-ice-tier.is-tier-mitjana { color: var(--accent); }
.td-ice-tier.is-tier-alta    { color: var(--coral-fg); }

/* Big score number + meta (tier desc + formula) side by side */
.td-ice-scorerow {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.td-ice-bignum {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 40px; font-weight: 800; line-height: 1; color: var(--accent);
}
.td-ice-scorerow-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: 11px;
}
.td-ice-tier-desc { color: var(--text-3); font-style: italic; }
.td-ice-formula {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 10.5px; color: var(--text-4);
}

.td-ice-bar {
  position: relative; height: 6px; border-radius: 999px; margin-top: 10px;
  background: linear-gradient(90deg, var(--text-4) 0%, var(--sky-bd) 50%, var(--coral-bd) 100%);
}
.td-ice-bar.is-empty { background: var(--border); }
.td-ice-bar-dot {
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
  transform: translate(-50%, -50%); box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.td-ice-bar.is-empty .td-ice-bar-dot { display: none; }
.td-ice-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--text-4); margin: 5px 0 14px;
}

/* Per-factor block: head + 3 buttons + dashed description */
.td-ice-factor { margin-top: 14px; }
.td-ice-factor-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
}
.td-ice-factor-label { font-size: 13px; font-weight: 700; color: var(--text-1); }
.td-ice-factor-hint  { font-size: 11px; color: var(--text-4); flex: 1; }
.td-ice-factor-val {
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 14px; font-weight: 800; color: var(--coral-fg);
}
.td-ice-factor-val.is-unset { color: var(--text-4); }

.td-ice-btns { display: flex; gap: 6px; }
.td-ice-btn {
  flex: 1; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 8px 0;
  font-family: var(--mono); font-feature-settings: 'tnum';
  font-size: 14px; font-weight: 700; color: var(--text-3);
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.td-ice-btn:hover { background: var(--bg); color: var(--text-2); }
.td-ice-btn.is-sel {
  background: var(--coral-bg);
  border-color: var(--coral-bd);
  color: var(--coral-fg);
}

.td-ice-factor-desc {
  margin-top: 8px;
  font-size: 10.5px; color: var(--text-3);
  border: 1px dashed var(--border); border-radius: 6px;
  padding: 4px 8px; display: inline-block;
}
.td-ice-factor-desc.is-unset { color: var(--text-4); }

.td-ice-hint {
  font-size: 10px; color: var(--text-4); text-align: center;
  margin-top: 16px; line-height: 1.5;
}

.td-created {
  margin: 14px 4px 2px;
  font-size: 11px;
  color: var(--text-4);
  font-family: var(--mono);
}

/* Scheduled-in row reuses .td-sched */
.td-row--sched .td-sched { display: flex; align-items: center; gap: 8px; width: 100%; }

/* Delete as a red text link */
.td-delete-wrap { text-align: center; padding: 14px 0 4px; }
.td-delete-link {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--danger); padding: 4px 8px;
}
.td-delete-link:hover { text-decoration: underline; }

/* Tier-colored ICE pill (panel + list cards) */
.task-ice.is-tier-baixa   { color: var(--text-3);  background: var(--surface-tint); }
.task-ice.is-tier-mitjana { color: var(--sky-fg);  background: var(--sky-bg); }
.task-ice.is-tier-alta    { color: var(--coral-fg); background: var(--coral-bg); }

/* ══════════════════════════════════════════════════════════
   TIME TRACKING — header pill, task-detail Temps, dashboard
   ══════════════════════════════════════════════════════════ */

/* ── Header running-timer pill ──────────────────────────── */
#timer-indicator { display: flex; align-items: center; }
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.timer-pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  animation: timerPulse 1.4s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.timer-pill-title {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.timer-pill-time { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.timer-pill-stop {
  border: none; background: var(--accent); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 9px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.timer-pill-stop:hover { filter: brightness(1.1); }

/* ── Task detail: Temps section ─────────────────────────── */
.td-temps-val { display: flex; align-items: center; gap: 10px; }
.td-temps-total {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--text-2);
}
.td-timer-btn {
  margin-left: auto;
  border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 4px 10px;
  font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.td-timer-btn:hover { filter: brightness(0.97); }
.td-timer-btn.is-stop {
  border-color: var(--danger); background: var(--danger-soft); color: var(--danger);
}
.td-est-val { display: flex; align-items: center; gap: 6px; }
.td-est-input { width: 70px; }
.td-est-unit { font-size: 11.5px; color: var(--text-3); }
.td-temps-foot { padding: 2px 0 0 30px; }
.td-temps-toggle {
  border: none; background: none; color: var(--accent);
  font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 0;
}
.td-temps-list { padding: 6px 0 4px 30px; display: flex; flex-direction: column; gap: 4px; }
.te-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
  background: var(--surface-tint); font-size: 11.5px;
}
.te-range { flex: 1; color: var(--text-2); }
.te-range em { color: var(--danger); font-style: normal; font-weight: 600; }
.te-dur { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; color: var(--text); }
.te-actions { display: flex; gap: 4px; }
.te-edit, .te-del {
  border: none; background: none; cursor: pointer; font-size: 11px;
  width: 22px; height: 22px; border-radius: 6px; color: var(--text-3);
}
.te-edit:hover { background: var(--accent-soft); }
.te-del:hover  { background: var(--danger-soft); }
.te-empty { font-size: 11.5px; color: var(--text-4); font-style: italic; padding: 4px 0; }
.te-add {
  align-self: flex-start; margin-top: 2px;
  border: 1px dashed var(--border); background: none; color: var(--text-3);
  border-radius: 8px; padding: 4px 10px; font-size: 11px; cursor: pointer;
}
.te-add:hover { color: var(--accent); border-color: var(--accent); }
.te-form {
  margin-top: 6px; padding: 10px; border-radius: 10px;
  background: var(--surface-tint); display: flex; flex-direction: column; gap: 8px;
}
.te-form-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-3); }
.te-form-field input { font-size: 12px; }
.te-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Dashboard modal ────────────────────────────────────── */
#dashboard-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 260;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
#dashboard-overlay.open { opacity: 1; pointer-events: all; }
#dashboard-modal {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 22px 24px 26px;
  width: 620px; max-width: 92vw; max-height: 84vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.dashboard-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.dashboard-head h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }

.dash-section { margin-bottom: 24px; }
.dash-section:last-child { margin-bottom: 0; }
.dash-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.dash-section-head h4 { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 0; }
.dash-section-total { font-size: 12px; color: var(--text-3); }
.dash-empty { font-size: 13px; color: var(--text-3); text-align: center; padding: 24px 0; line-height: 1.6; }

/* Per-day vertical bars */
.dash-bars { display: flex; gap: 8px; align-items: flex-end; height: 160px; }
.dash-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.dash-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.dash-bar-fill {
  width: 100%; min-height: 2px; border-radius: 6px 6px 2px 2px;
  background: var(--accent);
}
.dash-bar-val { font-size: 9.5px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; height: 12px; }
.dash-bar-label { font-size: 11px; color: var(--text-3); font-weight: 600; }

/* Per-type horizontal bars */
.dash-hrows { display: flex; flex-direction: column; gap: 8px; }
.dash-hrow { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; }
.dash-hrow-label { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-hrow-track { height: 16px; background: var(--surface-tint); border-radius: 6px; overflow: hidden; }
.dash-hrow-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.dash-hrow-val { font-size: 11.5px; font-family: 'JetBrains Mono', monospace; color: var(--text); }

/* Estimated vs real */
.dash-evr { display: flex; flex-direction: column; gap: 14px; }
.dash-evr-row { display: flex; flex-direction: column; gap: 5px; }
.dash-evr-title { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.dash-evr-badge { font-size: 10.5px; font-weight: 700; color: var(--emerald-fg); background: var(--emerald-bg); border-radius: 999px; padding: 1px 7px; }
.dash-evr-badge.is-over { color: var(--danger); background: var(--danger-soft); }
.dash-evr-bars { display: flex; flex-direction: column; gap: 4px; }
.dash-evr-line { display: grid; grid-template-columns: 34px 1fr 56px; align-items: center; gap: 8px; }
.dash-evr-tag { font-size: 10px; color: var(--text-3); text-transform: uppercase; }
.dash-evr-track { height: 12px; background: var(--surface-tint); border-radius: 5px; overflow: hidden; }
.dash-evr-fill { height: 100%; border-radius: 5px; min-width: 2px; }
.dash-evr-fill.is-real { background: var(--accent); }
.dash-evr-fill.is-est  { background: var(--text-4); }
.dash-evr-num { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text-2); text-align: right; }
