:root {
  color-scheme: light;
  --bg: #ffffff;
  --side: #fafafa;
  --surface: #f4f4f6;
  --surface-2: #ebebef;
  --line: #e6e6ea;
  --line-strong: #d6d6dc;
  --text: #1d1d24;
  --muted: #74747f;
  --faint: #a3a3ad;
  --accent: #5b2be0;
  --accent-hover: #4c20c7;
  --accent-soft: #efe9fe;
  --today: #3b82f6;
  --now: #e5484d;
  --danger: #d93036;
  --success: #16a34a;
  --radius: 12px;
  --card-shadow: 0 1px 2px rgba(20, 20, 40, .05);
  --column: 295px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--accent); }

svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint-line { display: block; margin-top: 2px; }
.spacer { flex: 1; }
.error { color: var(--danger); min-height: 1.4em; }

/* ---------- Botones ---------- */

button, .button, summary.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  cursor: pointer;
  white-space: nowrap;
}
button:hover, summary.button:hover { background: var(--surface); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.quiet:hover { background: var(--surface); color: var(--text); }
.danger-text { color: var(--danger) !important; }
.icon-button {
  width: 32px;
  padding: 0;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover { color: var(--text); }
.icon-button.active { color: var(--text); }
.icon-button.tiny { width: 24px; height: 24px; border-radius: 6px; }
.small-button { height: 26px; padding: 0 9px; font-size: 13px; }
.pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--muted);
}
.pill.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface);
}
.segmented button {
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0 10px;
}
.segmented button.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.segmented.small button { height: 26px; width: 30px; padding: 0; justify-content: center; }

/* ---------- Menús desplegables ---------- */

details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
summary.icon-button { display: inline-flex; align-items: center; height: 32px; border-radius: 9px; cursor: pointer; }
summary.button.active { border-color: var(--accent); color: var(--accent); }
.menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 10px 30px rgba(20, 20, 40, .14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-items > button { border: 0; justify-content: flex-start; width: 100%; }
.menu-items .pad { padding: 6px 8px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: var(--surface); }
.check-row input { margin: 0; accent-color: var(--accent); }

/* ---------- Entrar ---------- */

#login { height: 100%; display: grid; place-items: center; background: var(--side); }
.login-card {
  width: min(360px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 10px 40px rgba(20, 20, 40, .08);
}
.login-card h1 { font-size: 26px; letter-spacing: -.02em; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.login-card input { height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; }
.login-card button { height: 40px; justify-content: center; }

/* ---------- Estructura ---------- */

#app {
  height: 100%;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
}
#app.no-sidebar { grid-template-columns: 0 minmax(0, 1fr) 300px; }
#app.no-panel { grid-template-columns: 260px minmax(0, 1fr) 0; }
#app.no-sidebar.no-panel { grid-template-columns: 0 minmax(0, 1fr) 0; }
/* Cada parte en su columna: si una se oculta, las otras no se corren a su hueco. */
#sidebar { grid-column: 1; }
#main { grid-column: 2; }
#panel { grid-column: 3; }

/* Plegar y desplegar las columnas de los lados: su ancho se anima y lo de
   dentro conserva el suyo, así que se desliza hacia fuera (la izquierda hacia
   la izquierda, la derecha hacia la derecha) en vez de estrujarse. Al
   terminar de plegarse se ocultan del todo. */
#app { transition: grid-template-columns .28s cubic-bezier(.3, .8, .25, 1); }
#sidebar, #panel { min-width: 0; overflow: hidden; transition: visibility 0s; }
#sidebar { align-items: flex-end; }
#sidebar > * { width: 259px; }
#panel > * { width: 299px; }
#app.no-sidebar #sidebar, #app.no-panel #panel { visibility: hidden; transition: visibility 0s .28s; }
@media (prefers-reduced-motion: reduce) {
  #app, #app.no-sidebar #sidebar, #app.no-panel #panel { transition: none; }
}

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#app[data-view="tasks"] #calendar { display: none; }
#app[data-view="calendar"] #board { display: none; }

#toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 54px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.toolbar-title { font-size: 16px; font-weight: 600; margin-left: 6px; text-transform: capitalize; }

/* ---------- Barra izquierda ---------- */

#sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--side);
}
.side-head { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 12px 0 16px; flex: none; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: -.03em; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 40px; }
.side-title { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px; }
.side-title h2 { font-size: 16px; }
.list { margin-top: 6px; }
.list-head { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.list-head .caret { width: 22px; height: 26px; }
.list-head .caret svg { transition: transform .15s; }
.list.collapsed .caret svg { transform: rotate(-90deg); }
.list-name {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  height: 30px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 15px;
}
.list-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.list-name:hover { background: transparent; text-decoration: underline; text-decoration-color: var(--line-strong); }
.emoji { font-size: 14px; }
.count { color: var(--muted); font-size: 12px; padding-right: 8px; }
.list-cards { min-height: 4px; padding-left: 20px; }
.list-head.drop-hover { background: var(--accent-soft); }

.empty-side { padding: 60px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--muted); margin-bottom: 6px; }
.due-group { margin: 10px 4px 0; }
.due-group h3 { font-size: 12.5px; color: var(--muted); padding: 4px 4px 6px; text-transform: capitalize; }
.due-group h3.late { color: var(--danger); }

/* ---------- Añadir tarea ---------- */

.add {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  cursor: text;
  flex: none;
}
.add:focus-within { border-color: var(--accent); color: var(--text); }
.add-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0; }
.add-input::placeholder { color: var(--muted); }
.add-button { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.add-button:hover { border-color: var(--line-strong); color: var(--text); }
.add-button:focus-visible { outline: 0; border-color: var(--accent); color: var(--text); }
.add.quiet-add { border-color: transparent; background: transparent; height: 32px; margin-left: 20px; padding: 0 8px; }
.add.quiet-add:focus-within { background: var(--bg); border-color: var(--line-strong); }

/* ---------- Tablero ---------- */

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 4px;
  scroll-behavior: auto;
}
.day {
  flex: none;
  width: var(--column);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 10px 0;
  min-height: 0;
}
.day-head { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; }
.day-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.day-head .weekday { text-transform: capitalize; }
.day-head .date { color: var(--faint); font-weight: 600; }
.day.today .day-head .date { color: var(--text); }
.badge { color: var(--today); font-size: 12.5px; font-weight: 600; }
.day-total { margin-left: auto; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.day.past .day-head h2 { color: var(--muted); }

.cards { display: flex; flex-direction: column; gap: 8px; }

/* Los bloques del día, cada uno con su color de fondo y su nombre. Debajo,
   sin marco, las tareas que no están en ninguno. */
.tier-must { --tier: #e5484d; --tier-bg: #fdf0f0; --tier-line: #f6d4d5; }
.tier-intend { --tier: #d97706; --tier-bg: #fdf6ea; --tier-line: #f3e0bd; }

/* Los días, las listas y el panel de Tareas se desplazan con la rueda o el
   trackpad, pero sin barra (ni el hueco que ocupaba). */
.tiers, .side-scroll, #panel-tasks { scrollbar-width: none; }
.tiers::-webkit-scrollbar, .side-scroll::-webkit-scrollbar, #panel-tasks::-webkit-scrollbar { display: none; }
.tiers { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 24px; margin: 0 -2px; }
.tier {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 6px 8px;
  border-radius: calc(var(--radius) + 2px);
  background: var(--tier-bg);
  border: 1px solid var(--tier-line);
}
.tier-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 0; font-size: 12px; font-weight: 700; color: var(--tier); letter-spacing: .02em; text-transform: uppercase; }
.tier-name { flex: none; }
.icon-button.tier-add { width: 18px; height: 18px; margin: -2px 0 -2px -4px; border-radius: 5px; color: var(--tier); opacity: .6; }
.icon-button.tier-add:hover, .icon-button.tier-add:focus-visible { opacity: 1; color: var(--tier); background: var(--bg); }
.tier-add svg { width: 12px; height: 12px; stroke-width: 3; }
.tier-time { margin-left: auto; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.tier .cards { min-height: 34px; gap: 6px; }
.tier.empty .cards { border: 1.5px dashed var(--tier-line); border-radius: 10px; }
.tier.empty .cards:has(.placeholder) { border-color: transparent; }
.tier .placeholder { max-height: 60px; }
.day.past .tier { opacity: .85; }
.cards.loose { flex: 1 0 auto; min-height: 80px; gap: 8px; padding-top: 2px; }

/* Elegir bloque: al escribir una tarea nueva y en la ficha. */
.block-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.tier-pill {
  height: 26px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--tier-line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.tier-pill:hover { color: var(--tier); }
.tier-pill.active { background: var(--tier); border-color: var(--tier); color: #fff; }
.list-cards { gap: 0; }

/* ---------- Tarjetas ---------- */

.card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.card:hover, .card[aria-expanded="true"] { border-color: var(--line-strong); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-title { overflow-wrap: anywhere; line-height: 1.35; }
.card.done .card-title { color: var(--faint); text-decoration: line-through; }
.card.done { background: var(--side); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.card-meta svg { width: 13px; height: 13px; }
.meta { display: inline-flex; align-items: center; gap: 3px; }
.meta.due.late { color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.empty { border: 1px solid var(--line-strong); }
.card-time {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.card-time.empty { color: var(--faint); }

.check {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  padding: 0;
  justify-content: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg);
  color: transparent;
}
.check svg { width: 12px; height: 12px; stroke-width: 3; }
.check:hover { border-color: var(--success); color: var(--line-strong); background: var(--bg); }
/* Hecha: verde, en las tareas y en las subtareas. */
.check[aria-checked="true"], .card.compact .check[aria-checked="true"] { background: var(--success); border-color: var(--success); color: #fff; }

.card.compact {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 8px;
  gap: 9px;
}
.card.compact:hover { background: var(--surface-2); }
.card.compact .card-body { gap: 2px; }
.card.compact .card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.compact .check { border-color: var(--label, var(--line-strong)); }

/* ---------- Arrastrar ---------- */

body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
body.is-resizing, body.is-resizing * { cursor: ns-resize !important; user-select: none; }
.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .95;
  box-shadow: 0 12px 28px rgba(20, 20, 40, .18);
  rotate: 1.5deg;
}
.card.drag-source { display: none; }
.block.drag-source { opacity: .35; }
.placeholder { border-radius: var(--radius); background: var(--accent-soft); border: 1.5px dashed #c9b8fb; flex: none; }
.list-cards .placeholder { height: 30px !important; border-radius: 8px; }

/* ---------- Rejilla de horas ---------- */

#calendar, #panel-grid { flex: 1; min-height: 0; overflow-y: auto; position: relative; }
/* Arriba, fijos al desplazar: los días y los eventos de todo el día. */
.grid-top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.grid.single .grid-top:not(:has(.grid-allday)) { display: none; }
.grid-head {
  display: grid;
  grid-template-columns: 52px repeat(var(--days), minmax(0, 1fr));
}
.grid.single .grid-head { display: none; }
.grid-allday { display: grid; grid-template-columns: 52px repeat(var(--days), minmax(0, 1fr)); padding: 4px 0; }
.grid:not(.single) .grid-allday { border-top: 1px solid var(--line); }
.allday-cell { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; min-width: 0; }
.allday-event {
  display: block;
  height: auto;
  padding: 2px 7px;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 24%, white);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.allday-event:hover { background: color-mix(in srgb, var(--c) 34%, white); }
.grid-head-day { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 10px 0; color: var(--muted); }
.grid-head-day .weekday { text-transform: capitalize; }
.grid-head-day .num { font-size: 17px; font-weight: 700; color: var(--text); }
.grid-head-day.today .num { background: var(--accent); color: #fff; border-radius: 7px; padding: 0 6px; }
.grid-body { position: relative; display: flex; }
.hours { width: 52px; flex: none; position: relative; }
.hour { display: block; height: var(--hour); position: relative; }
.hour { color: var(--faint); font-size: 11px; text-align: right; padding-right: 8px; transform: translateY(-7px); }
.grid-days { flex: 1; display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); }
.grid-day {
  position: relative;
  border-left: 1px solid var(--line);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% var(--hour);
}
.grid-day.today { background-color: #fcfbff; }
.now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 3; pointer-events: none; }
.now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

.block {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  padding: 4px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, white);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.block:hover { background: color-mix(in srgb, var(--c) 22%, white); }
.block.done .block-title { text-decoration: line-through; color: var(--muted); }
.block-title { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.block-time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.block.short { display: flex; gap: 6px; align-items: center; padding-top: 1px; padding-bottom: 1px; }
/* En los cortos, primero el título; la hora, si cabe. */
.block.short .block-title { white-space: nowrap; flex: 0 0 auto; max-width: 100%; }
.block.short .block-time { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.block.preview {
  --c: var(--accent);
  left: 2px;
  width: calc(100% - 4px);
  border: 1.5px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  pointer-events: none;
  z-index: 4;
}
.block.ghost { width: 200px; }
/* Los eventos de Google: rellenos del color de su calendario, sin la raya. */
.block.event {
  border-left: 0;
  border: 1px solid color-mix(in srgb, var(--c) 45%, white);
  background: color-mix(in srgb, var(--c) 26%, white);
}
.block.event:hover { background: color-mix(in srgb, var(--c) 36%, white); }
/* El iconito de Google Calendar, arriba a la derecha (en los cortos y los de
   todo el día, centrado). */
.allday-event { position: relative; padding-right: 19px; }
.block.event > p { margin-right: 13px; }
.block.event.short > .block-title { margin-right: 0; }
.gmark {
  position: absolute;
  top: 4px;
  right: 4px;
  display: block;
  width: 12px;
  height: 12px;
  overflow: hidden;
  border-radius: 2.5px;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08);
  pointer-events: none;
}
.gmark svg { display: block; width: 100%; height: 100%; stroke: none; }
.block.event.short .gmark, .allday-event .gmark { top: 50%; transform: translateY(-50%); }
/* En los muy estrechos (varios a la vez), el icono taparía el título. */
.block.event { container-type: inline-size; }
@container (max-width: 30px) {
  .gmark { display: none; }
  .block.event > p { margin-right: 0; }
}
.block.event.locked { cursor: default; }
.block.event .block-time { color: color-mix(in srgb, var(--c) 55%, var(--text)); }

/* ---------- Panel derecho ---------- */

#panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
#panel-head { display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); flex: none; }
#panel-head h2 { display: flex; align-items: center; gap: 6px; font-size: 16px; }
#panel-tasks { flex: 1; min-height: 0; overflow-y: auto; }
#panel-tasks .day { width: auto; height: 100%; padding-top: 12px; }
#panel-tasks .day-head { display: none; }

/* ---------- Ventanas ---------- */

.dialog {
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(20, 20, 40, .25);
  color: var(--text);
  width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 64px);
}
.dialog::backdrop { background: rgba(20, 20, 30, .28); }
.dialog.small { width: min(440px, calc(100% - 32px)); padding: 24px; }
.dialog.small h2 { font-size: 18px; margin-bottom: 8px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 4px 24px; }
.dialog-head h2 { font-size: 20px; }

.inline-input {
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}
.inline-input:hover { background: var(--surface); }
.inline-input:focus { outline: 0; border-color: var(--accent); background: var(--bg); }
.inline-input.invalid { border-color: var(--danger); }
.inline-input.number { width: 60px; border-color: var(--line); }
.inline-input.grow { flex: 1; }
select.inline-input { padding-right: 4px; cursor: pointer; }

/* Ficha de tarea */
.task-dialog { width: min(620px, calc(100% - 32px)); }
.task-scroll { max-height: calc(100vh - 64px); overflow-y: auto; padding: 22px 26px 28px; }
.task-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.task-header .check { width: 22px; height: 22px; margin-top: 6px; border-radius: 6px; }
.task-title {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  padding: 2px 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
  overflow: hidden;
  background: transparent;
}
.task-title::placeholder { color: var(--faint); }
.task-header.done .task-title { color: var(--muted); text-decoration: line-through; }
.fields { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.field { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: start; min-height: 36px; }
.field-label { display: flex; align-items: center; gap: 9px; color: var(--muted); height: 34px; }
.field-value { display: flex; align-items: center; min-height: 34px; flex-wrap: wrap; gap: 4px; }
.field-value .muted.small { padding: 0 8px; }
.with-clear, .date-and-time, .duration-field { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.date-and-time { gap: 10px; }
.time-input { gap: 2px; color: var(--muted); }
.time-input > svg { width: 15px; height: 15px; }
.duration-field { gap: 0; }
.duration-toggle { color: var(--muted); }

/* Botón que hace de desplegable (etiqueta): el punto de color va dentro,
   con su margen, para que el sombreado no lo toque. */
.select-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 400;
}
.select-button:hover { background: var(--surface); }
.select-button[aria-expanded="true"] { border-color: var(--accent); background: var(--bg); }
.select-button > svg { width: 14px; height: 14px; color: var(--muted); }
.select-lead { display: inline-flex; align-items: center; }
.select-text.muted { color: var(--muted); }

/* Menú flotante */
.popover {
  position: fixed;
  z-index: 100;
  max-height: min(360px, calc(100vh - 16px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 12px 32px rgba(20, 20, 40, .16);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 400;
  text-align: left;
  justify-content: flex-start;
  white-space: nowrap;
}
.popover-item:hover, .popover-item:focus-visible { background: var(--surface); outline: 0; }
.popover-item.selected { font-weight: 600; }
.popover-item.danger-text { color: var(--danger); }
.popover-lead { width: 18px; display: inline-flex; justify-content: center; align-items: center; flex: none; color: var(--muted); }
.popover-lead svg { width: 16px; height: 16px; }
.popover-lead .dot { width: 10px; height: 10px; }
.popover-label { flex: 1; }
.popover-check { display: inline-flex; color: var(--accent); }
.popover-check svg { width: 15px; height: 15px; stroke-width: 2.5; }
.popover-separator { height: 1px; background: var(--line); margin: 4px 6px; }

/* Repetición personalizada */
.repeat-popover { padding: 0; }
.repeat-panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.repeat-panel-body { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.repeat-row { display: flex; align-items: center; gap: 10px; }
.repeat-label { color: var(--muted); min-width: 44px; }
.repeat-interval {
  width: 64px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.repeat-interval:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select-button.boxed { height: 38px; border-color: var(--line-strong); justify-content: space-between; font-size: 15px; }
.select-button.grow { flex: 1; }
.inline-input.boxed { height: 34px; border-color: var(--line-strong); }
.weekday-circles { display: flex; justify-content: space-between; gap: 6px; }
.monthly-choice { display: flex; gap: 6px; flex-wrap: wrap; }
.monthly-choice .pill { height: 30px; padding: 0 12px; }
.weekday-circle {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  justify-content: center;
}
.weekday-circle:hover { background: var(--surface-2); }
.weekday-circle.on { background: var(--accent); color: #fff; }
.weekday-circle.on:hover { background: var(--accent-hover); }
.repeat-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.repeat-summary { color: var(--muted); font-size: 13px; }
.inline-input.duration { width: 76px; font-variant-numeric: tabular-nums; }
.location-field { display: flex; flex-wrap: nowrap; width: 100%; }
.location-input { flex: 1; min-width: 0; text-overflow: ellipsis; }
.location-input::placeholder { color: var(--muted); }
.repeat-field { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
.repeat-field > .muted.small { padding: 0 8px; }
.repeat-custom { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--side); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.weekdays .pill { width: 42px; justify-content: center; text-transform: capitalize; }
.task-section { padding-top: 16px; }
.task-section h3 { font-size: 14px; margin-bottom: 8px; }
.notes-edit {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
}
.notes-edit:focus { outline: 0; border-color: var(--accent); }
.notes-view { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; padding: 10px 12px; border-radius: 10px; cursor: text; }
.notes-view:hover { background: var(--surface); }
.subtasks { position: relative; display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
/* Que al bajarla a la vista quede algo de aire por debajo (y se vea «Añadir subtarea»). */
.subtask-title { scroll-margin: 12px 0 44px; }
/* Todo arriba, a la altura de la primera línea del texto (aunque ocupe varias). */
.subtasks li { display: flex; align-items: flex-start; gap: 8px; padding: 2px 4px 2px 0; border-radius: 8px; }
.subtasks li:hover, .subtasks li.dragging { background: var(--surface); }
.subtasks li.dragging { box-shadow: 0 4px 14px rgba(20, 20, 40, .12); }
.subtasks .check { margin-top: 6px; }
.subtasks .subtask-more { margin-top: 3px; }
.subtask-grip { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 30px; margin-right: -4px; color: var(--faint); cursor: grab; opacity: 0; flex: none; touch-action: none; user-select: none; -webkit-user-select: none; }
.subtasks li.dragging { position: relative; z-index: 2; background: var(--bg); }
.subtasks.sorting li:not(.dragging) { transition: transform .12s ease; }
.subtask-grip svg { width: 15px; height: 15px; }
.subtasks li:hover .subtask-grip, .subtasks li.dragging .subtask-grip { opacity: 1; }
.subtask-grip:hover { color: var(--muted); }
/* Crece hacia abajo si el texto no cabe en una línea. */
.subtask-title { flex: 1; min-width: 0; min-height: 30px; padding: 6px 0; border: 0; outline: 0; background: transparent; font: inherit; line-height: 18px; resize: none; field-sizing: content; overflow: hidden; }
.subtask-title::placeholder { color: var(--faint); }
/* La fila para escribir una nueva: igual que las demás, en gris. */
.subtasks li.draft { background: var(--surface); }
.subtasks li.draft .subtask-grip, .subtasks li.draft .subtask-more { opacity: .6; cursor: default; }
.subtask-add { display: flex; align-items: center; gap: 8px; height: 32px; margin-left: 12px; padding: 0 12px 0 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.subtask-add:hover { color: var(--text); }
.subtask-add svg { width: 15px; height: 15px; }
.subtask-title.done { color: var(--faint); text-decoration: line-through; }
.subtasks li .icon-button { opacity: 0; }
.subtasks li:hover .icon-button, .subtasks li:focus-within .icon-button, .subtasks li .icon-button[aria-expanded="true"] { opacity: 1; }

/* Las subtareas desplegadas dentro de una tarjeta del tablero (pulsando «0/3»). */
.card { flex-wrap: wrap; row-gap: 6px; }
/* Una línea fina separa la tarea de sus subtareas. */
.card-subtasks { flex: 0 0 calc(100% + 24px); margin: 2px -12px -6px; padding: 4px 6px 0; border-top: 1px solid var(--line); cursor: default; }
.card-subtasks .subtasks { margin-bottom: 0; }
.card-subtasks .subtask-title { font-size: 13px; line-height: 17px; min-height: 28px; padding: 5px 0; }
.card-subtasks .check { margin-top: 5px; }
.card-subtasks .subtask-grip { height: 27px; }
.card-subtasks .subtask-more { margin-top: 2px; }
.card-subtasks .subtask-add { height: 28px; font-size: 13px; }
.subtasks-toggle { padding: 1px 4px; margin: -1px -4px; border: 0; border-radius: 5px; background: none; color: inherit; font: inherit; cursor: pointer; }
.subtasks-toggle:hover, .subtasks-toggle[aria-expanded="true"] { background: var(--surface); color: var(--text); }

/* Ajustes */
.settings-dialog { width: min(560px, calc(100% - 32px)); padding-bottom: 12px; }
.settings-section { padding: 16px 24px; border-top: 1px solid var(--line); }
.settings-dialog .dialog-head + .settings-section { border-top: 0; }
.settings-section h3 { font-size: 15px; margin-bottom: 4px; }
.label-rows { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.label-rows li { display: flex; align-items: center; gap: 8px; }
.label-rows .inline-input { flex: 1; border-color: var(--line); }
.swatches { display: flex; gap: 3px; }
.swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.new-label { display: flex; gap: 8px; }
.new-label .inline-input { flex: 1; border-color: var(--line); }
.switch-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; cursor: pointer; }
.switch-row input { margin-top: 3px; accent-color: var(--accent); }

/* Editor de lista */
/* Como la de Ellie: estrecha, icono y nombre en una fila y debajo la etiqueta. */
.dialog.list-dialog { width: min(360px, calc(100% - 32px)); padding: 20px; }
.list-dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog.list-dialog h2 { font-size: 15px; font-weight: 600; margin: 0; }
.list-main-row { display: flex; gap: 8px; }
.emoji-button { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 18px; border-radius: 10px; flex: none; }
.emoji-button[aria-expanded="true"] { border-color: var(--accent); }
.list-name-input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.list-name-input::placeholder { color: var(--faint); }
.list-name-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.list-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); }
.label-button { height: 30px; padding: 0 8px; gap: 8px; margin-right: -8px; border-color: transparent; background: transparent; color: var(--text); }
.label-button.empty { color: var(--faint); }
.label-button:hover, .label-button[aria-expanded="true"] { background: var(--surface); }
.list-dialog .dialog-actions { margin-top: 6px; }
button.primary:disabled { opacity: .45; cursor: default; }
button.primary:disabled:hover { background: var(--accent); }

/* Selector de iconos */
.popover.emoji-popover { padding: 8px; gap: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; }
.emoji-choice { width: 32px; height: 32px; padding: 0; justify-content: center; border: 0; border-radius: 8px; background: transparent; font-size: 18px; transition: background-color .12s; }
.emoji-choice:hover, .emoji-choice:focus-visible { background: var(--surface); outline: 0; }
.emoji-choice.selected { background: var(--accent-soft); }
.emoji-other-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.emoji-other { width: 100%; }

/* Elegir etiqueta (buscar, crear, editar) */
.popover.label-popover { padding: 4px; }
.label-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; color: var(--muted); cursor: text; }
.label-search svg { width: 15px; height: 15px; }
.label-search-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.label-search-input::placeholder { color: var(--faint); }
.label-items { display: flex; flex-direction: column; gap: 1px; }
.label-empty { padding: 6px 10px; }
.label-popover .popover-item { transition: background-color .12s; }
.label-create-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 6px; color: var(--muted); font-weight: 600; }
.label-create-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 8px 8px; }
.label-create-body .swatches { flex-wrap: wrap; }

/* Aviso */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  transform: translate(-50%, 20px);
  opacity: 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: #1d1d24;
  color: #fff;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  #app, #app.no-sidebar, #app.no-panel { grid-template-columns: 0 minmax(0, 1fr) 0; }
  #sidebar, #panel { display: none; }
  .segmented button { padding: 0 8px; }
  .toolbar-title { display: none; }
  .field { grid-template-columns: 1fr; }
}

/* Aviso «¿Aplicar los cambios a las siguientes?», abajo a la derecha */
.series-prompt {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 16px 18px 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 12px 34px rgba(20, 20, 40, .18);
  animation: prompt-in .16s ease-out;
}
.series-prompt-text { display: flex; flex-direction: column; gap: 3px; }
.series-prompt-text strong { font-size: 14.5px; }
.series-prompt-text span { color: var(--muted); font-size: 13px; }
.series-prompt .primary { flex: none; }
.series-prompt-close {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 26px;
  height: 26px;
  padding: 0;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  box-shadow: 0 2px 6px rgba(20, 20, 40, .12);
}
.series-prompt-close svg { width: 13px; height: 13px; }
.series-prompt-close:hover { color: var(--text); }
@keyframes prompt-in { from { opacity: 0; transform: translateY(8px); } }

/* Al cerrar la ficha de una tarea nueva, la ficha se encoge hasta la tarjeta. */
.card.arriving, .block.arriving { visibility: hidden; }
.card-title.untitled { color: var(--muted); }
.fly-veil { position: fixed; inset: 0; z-index: 900; background: rgba(20, 20, 30, .28); pointer-events: none; }
.fly-ghost {
  position: fixed;
  z-index: 901;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(20, 20, 40, .25);
  pointer-events: none;
}
.fly-ghost > * { position: absolute; top: 0; left: 0; margin: 0; }
.card.landed { animation: landed 1.1s ease-out; }
@keyframes landed {
  0%, 30% { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
}

/* Google Calendar en Ajustes */
.settings-section h4 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: var(--muted); }
.google-connect { margin-top: 12px; gap: 8px; }
.google-connect svg { width: 16px; height: 16px; }
.google-account { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.settings-error { color: var(--danger); margin-top: 8px; }
.calendar-rows { display: flex; flex-direction: column; gap: 2px; }
.calendar-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.calendar-row input { accent-color: var(--accent); margin: 0; }
.calendar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.google-target { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.google-section .switch-row input:disabled + span { color: var(--faint); }

/* Ventana de un evento */
.dialog.event-dialog { width: min(400px, calc(100% - 32px)); padding: 20px; }
.event-dialog form { display: flex; flex-direction: column; gap: 12px; }
.event-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -6px -2px 0; }
.dialog.event-dialog h2 { font-size: 15px; font-weight: 600; margin: 0; }
.event-title-input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 16px; font-weight: 600; }
.event-title-input::placeholder { color: var(--faint); font-weight: 500; }
.event-title-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.event-when { display: flex; align-items: center; gap: 6px; }
.event-when input[type=date] { flex: 1; min-width: 0; }
.event-when input[type=time] { width: 92px; }
.event-when-text { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.event-when-text svg { width: 15px; height: 15px; flex: none; }
.event-calendar-row { display: flex; }
.event-calendar { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.event-calendar-row .select-button { margin-left: -8px; border-color: transparent; background: transparent; }
.event-calendar-row .select-button:hover, .event-calendar-row .select-button[aria-expanded="true"] { background: var(--surface); }
.event-link { color: var(--accent); font-size: 13px; text-decoration: none; align-self: center; }
.event-link:hover { text-decoration: underline; }
.event-dialog .dialog-actions { margin-top: 6px; align-items: center; }

/* Calendarios que se ven (desde el Timebox y la vista Calendario) */
.calendar-picker { padding: 8px; }
.calendar-picker .picker-head { font-weight: 600; padding: 2px 6px 0; }
.calendar-picker .picker-account { padding: 0 6px 4px; }
.calendar-picker .calendar-row { padding: 5px 6px; border-radius: 6px; }
.calendar-picker .calendar-row:hover { background: var(--surface); }
