:root {
  color-scheme: dark;
  /* Snazzy */
  --bg: #282a36;
  --surface: #2f313d;
  --surface-2: #3e404a;
  --ink: #eff0eb;
  --muted: #97979b;
  --line: #3e404a;
  --accent: #57c7ff;
  --accent-2: #ff6ac1;
  --danger: #ff5c57;
  --success: #5af78e;
  --warning: #f3f99d;

  --c-yellow: #f3f99d;
  --c-orange: #ff5c57;
  --c-red: #ff5c57;
  --c-pink: #ff6ac1;
  --c-purple: #ff6ac1;
  --c-blue: #57c7ff;
  --c-cyan: #9aedfe;
  --c-green: #5af78e;
  --c-gray: #97979b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
  cursor: pointer;
}

h1,
h2 {
  margin: 0;
}

/* Colores de la paleta */
.color-yellow { --card-color: var(--c-yellow); }
.color-orange { --card-color: var(--c-orange); }
.color-red { --card-color: var(--c-red); }
.color-pink { --card-color: var(--c-pink); }
.color-purple { --card-color: var(--c-purple); }
.color-blue { --card-color: var(--c-blue); }
.color-cyan { --card-color: var(--c-cyan); }
.color-green { --card-color: var(--c-green); }
.color-gray { --card-color: var(--c-gray); }

/* Cabecera */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.week-label {
  min-width: 170px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  line-height: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
}

.ghost-btn:hover,
.icon-btn:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
}

/* Tablero */
.app-main {
  padding: 16px 20px 48px;
}

.board-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 8px;
  min-width: 1050px;
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 2px solid transparent;
}

.day-head.is-today {
  border-bottom-color: var(--accent);
}

.day-name {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.day-head.is-today .day-name,
.day-head.is-today .day-date {
  color: var(--accent);
}

.day-date {
  font-size: 15px;
  font-weight: 700;
}

/* Carriles de proyectos */
.ranges-lane {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 30px;
  gap: 4px 8px;
}

.ranges-lane[hidden] {
  display: none;
}

.range-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-left: 4px solid var(--card-color);
  border-radius: 6px;
  background: var(--surface);
  background: color-mix(in srgb, var(--card-color) 18%, var(--surface));
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.range-bar.is-done {
  opacity: 0.55;
  text-decoration: line-through;
}

/* Columnas y tarjetas */
.day-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 300px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.empty {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  padding: 8px 0;
}

.card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--card-color);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
}

.card.is-done {
  opacity: 0.55;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.card-check {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.card.is-done .card-title {
  text-decoration: line-through;
}

.card-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Bandeja */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.45);
  transform: translateX(105%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-head h2 {
  font-size: 18px;
}

.drawer-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.backlog-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backlog-item {
  display: flex;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.backlog-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--card-color);
}

.backlog-body {
  min-width: 0;
}

.backlog-title {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.backlog-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.backlog-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Avisos */
.error-banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--surface));
  color: var(--danger);
  font-size: 13px;
}

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(360px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.login-card h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 6px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.login-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.login-card button {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.login-card button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* Controles de la semana */
.add-task {
  width: 100%;
  padding: 6px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.add-task:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card {
  cursor: pointer;
}

.card:hover {
  border-color: var(--muted);
}

.card-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.card-check:hover {
  background: rgba(255, 255, 255, 0.08);
}

.range-bar {
  cursor: pointer;
}

.range-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
}

.range-check:hover {
  background: rgba(255, 255, 255, 0.12);
}

.range-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modal de tarea */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 60;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
}

.modal[hidden] {
  display: none;
}

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

.modal-head h2 {
  font-size: 18px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.field textarea {
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--card-color);
}

.swatch[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.weekdays {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.weekdays legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.weekday-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.weekday-grid label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.subtasks {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.subtasks h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subtask-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.subtask-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.subtask-body {
  min-width: 0;
}

.subtask-title {
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.subtask-meta {
  color: var(--muted);
  font-size: 10.5px;
}

.subtask-empty {
  padding: 4px 2px;
  color: var(--muted);
  font-size: 12px;
}

.card-parent {
  margin-top: 3px;
  color: var(--c-orange);
  font-size: 10.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.range-parent {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 45%;
  overflow: hidden;
  color: var(--c-orange);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}

.modal-delete,
.modal-actions {
  display: flex;
  gap: 8px;
}

.danger-btn {
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--surface));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
}

.danger-btn:hover {
  background: color-mix(in srgb, var(--danger) 20%, var(--surface));
}

#save-task {
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

#save-task:disabled {
  opacity: 0.6;
  cursor: wait;
}

.intensity-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.intensity-dot.is-empty {
  background: var(--line);
}

.range-bar .intensity-dot {
  margin-top: 0;
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.category-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
}

.color-picker-host {
  display: flex;
  align-items: center;
}

.color-trigger {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.color-trigger:hover,
.color-trigger[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--accent);
}

.color-popover {
  position: fixed;
  z-index: 95;
  display: grid;
  gap: 8px;
  min-width: 150px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.color-popover[hidden] {
  display: none;
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(4, 20px);
  gap: 6px;
}

.color-dot {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--dot);
  cursor: pointer;
}

.color-dot.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface);
}

.color-hex {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 11px;
}

.color-hex.is-selected {
  border-color: var(--accent);
}

.category-row input,
.category-row select,
.category-add input,
.category-add select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.category-row .ghost-btn,
.category-row .danger-btn,
.category-add button {
  padding: 6px 9px;
  font-size: 12px;
}

.category-add {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 6px;
}

@media (max-width: 720px) {
  .app-header {
    padding: 10px 12px;
  }

  .app-main {
    padding: 12px;
  }

  .week-label {
    min-width: 0;
    font-size: 13px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .category-row {
    grid-template-columns: 1fr 1fr;
  }

  .category-add {
    grid-template-columns: 1fr;
  }
}

/* Tema oscuro estilo Tweek */
.app-header {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom-color: var(--line);
}

.brand h1 {
  font-size: 16px;
  font-weight: 600;
}

.week-label {
  font-size: 13px;
  font-weight: 500;
}

.ghost-btn,
.icon-btn {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.ghost-btn:hover,
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
  color: var(--ink);
}

.badge {
  background: var(--accent);
  color: var(--bg);
}

.toggle {
  color: var(--muted);
}

.app-main {
  padding: 8px 16px 40px;
}

.day-head {
  padding: 2px 6px;
  border-bottom-width: 1px;
}

.day-name {
  font-size: 10px;
  letter-spacing: 0.08em;
}

.day-date {
  font-size: 13px;
  font-weight: 600;
}

.day-column {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 4px;
  gap: 1px;
  min-height: 340px;
}

.card {
  background: transparent;
  border: 0;
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  padding: 5px 7px;
}

.card:hover {
  background: rgba(255, 255, 255, 0.045);
}

.card-title {
  font-size: 12.5px;
  font-weight: 500;
}

.card-meta {
  margin-top: 2px;
  font-size: 10.5px;
}

.card.is-done {
  opacity: 0.4;
}

.card-check {
  color: var(--muted);
}

.card-check:hover {
  background: rgba(255, 255, 255, 0.08);
}

.add-task {
  border-color: transparent;
  color: var(--muted);
  text-align: left;
  padding: 5px 7px;
}

.add-task:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
  color: var(--ink);
}

.ranges-lane {
  grid-auto-rows: 26px;
}

.range-bar {
  border-radius: 3px;
  background: var(--surface);
  background: color-mix(in srgb, var(--card-color) 26%, var(--surface));
}

.range-check:hover {
  background: rgba(255, 255, 255, 0.12);
}

.intensity-dot {
  width: 7px;
  height: 7px;
}

.drawer {
  background: var(--surface);
  border-left-color: var(--line);
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.45);
}

.backlog-item {
  background: var(--surface-2);
  border-color: var(--line);
}

.drawer-backdrop,
.modal-backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.modal.task-tinted {
  background: var(--surface);
  box-shadow:
    inset 0 3px 0 var(--task-color, var(--surface)),
    0 20px 60px rgba(0, 0, 0, 0.55);
}

.field input,
.field textarea,
.field select {
  background-color: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.category-row input,
.category-row select,
.category-add input,
.category-add select {
  background-color: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.login-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.login-card input {
  background-color: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.field input,
.field textarea,
.field select,
.category-row input,
.category-row select,
.category-add input,
.category-add select,
.login-card input {
  border-radius: 10px;
}

.field select,
.category-row select,
.category-add select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239a9aa1' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* Arrastre */
.card.is-draggable {
  cursor: grab;
  user-select: none;
}

.card.is-dragging {
  opacity: 0.25;
}

.drag-ghost {
  position: fixed;
  z-index: 100;
  margin: 0;
  pointer-events: none;
  opacity: 0.95;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  will-change: transform;
}

.range-bar:not(.is-dragging) {
  transition: transform 0.12s ease;
}

.pending-empty {
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
}

.day-column.drop-target {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: -2px;
}

.panel-col.drop-target {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: -2px;
  border-radius: 8px;
}

.panel-tab.drop-target,
#inbox-btn.drop-target {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
}

.range-bar {
  cursor: grab;
}

.range-bar.is-dragging {
  opacity: 0.7;
  cursor: grabbing;
}

body.dragging-card {
  user-select: none;
  cursor: grabbing;
}

.login-card button,
#save-task {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.error-banner {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--surface));
  color: var(--danger);
}

.danger-btn {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
  color: var(--danger);
}

.danger-btn:hover {
  background: color-mix(in srgb, var(--danger) 20%, var(--surface));
}

.swatch {
  border-color: transparent;
}

/* Panel de proyectos, pendientes e inbox */
.workspace {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.board {
  flex: 1 1 auto;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 0;
}

.side-panel {
  flex: 0 0 600px;
  width: 600px;
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  padding: 0 2px;
}

.panel-tabs {
  display: none;
}

.panel-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.panel-col {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  padding: 2px 4px 5px;
  border-bottom: 1px solid var(--line);
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.panel-toggle {
  padding: 2px 7px;
  font-size: 10.5px;
}

.panel-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-head h2 {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-head .icon-btn {
  width: 24px;
  height: 24px;
  font-size: 16px;
}

.panel-hint {
  margin: 4px 4px 6px;
  color: var(--muted);
  font-size: 10.5px;
}

.pending-list,
.project-list,
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-empty {
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
}

.pending-item {
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  padding: 5px 7px;
  cursor: pointer;
}

.pending-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.pending-item-top {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.pending-title {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.pending-title:hover {
  text-decoration: underline;
}

.pending-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.pending-project {
  margin-top: 2px;
  color: var(--c-orange);
  font-size: 10.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pending-actions {
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.pending-action {
  padding: 1px 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.pending-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

/* Proyectos */
.project-card {
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  padding: 6px 7px;
  cursor: pointer;
}

.project-card:hover {
  background: rgba(255, 255, 255, 0.045);
}

.project-card.is-done {
  opacity: 0.45;
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.project-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.project-check:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.project-title {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.project-title:hover {
  text-decoration: underline;
}

.project-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

/* Inbox */
.inbox-quick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 8px;
}

.inbox-quick input,
.inbox-quick select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.inbox-quick-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-quick-row .ghost-btn {
  width: 100%;
  padding: 6px 8px;
  font-size: 11px;
}

.inbox-item {
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  padding: 5px 7px;
}

.inbox-item[draggable="true"] {
  cursor: grab;
}

.inbox-item.is-dragging {
  opacity: 0.35;
}

.inbox-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.inbox-item-top {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.inbox-title {
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.inbox-title:hover {
  text-decoration: underline;
}

.inbox-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.inbox-actions {
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.inbox-action {
  padding: 1px 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.inbox-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

/* Barra de proyecto: contenedor, no arrastrable */
.range-bar.is-project {
  border-left-style: double;
  border-left-width: 5px;
  cursor: pointer;
  background: color-mix(in srgb, var(--card-color) 16%, var(--surface));
}

.project-tasks {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.project-tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.project-tasks-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-task-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-left: 3px solid var(--card-color);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.project-task-row.is-done {
  opacity: 0.55;
}

.project-task-row.is-done .project-task-title {
  text-decoration: line-through;
}

.project-task-body {
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.project-task-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.project-task-check:hover {
  background: rgba(255, 255, 255, 0.08);
}

.project-task-check .icon svg {
  width: 16px;
  height: 16px;
}

.project-task-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.project-task-title {
  font-size: 12.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.project-task-meta {
  color: var(--muted);
  font-size: 10.5px;
}

.project-task-empty {
  padding: 4px 2px;
  color: var(--muted);
  font-size: 12px;
}

#project-save {
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

#project-save:disabled {
  opacity: 0.6;
  cursor: wait;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  vertical-align: middle;
}

.icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.card-check .icon,
.range-check .icon,
.project-check .icon,
.project-task-check .icon,
.pending-action .icon,
.inbox-action .icon {
  margin-right: 0;
}

.card-check .icon svg,
.range-check .icon svg,
.project-check .icon svg,
.project-task-check .icon svg {
  width: 16px;
  height: 16px;
}

.pending-action .icon svg,
.inbox-action .icon svg {
  width: 14px;
  height: 14px;
}

/* Fallada: se conserva visible en su día */
.card.is-failed {
  opacity: 0.8;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.card.is-failed .card-title {
  color: color-mix(in srgb, var(--danger) 55%, var(--ink));
}

.card.is-failed .card-check,
.range-bar.is-failed .range-check {
  color: var(--danger);
}

#mark-failed {
  color: var(--danger);
}

.range-bar.is-failed {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.range-bar.is-failed .range-label {
  color: color-mix(in srgb, var(--danger) 55%, var(--ink));
}

.card-requested,
.pending-requested {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

/* Cajón con pestañas en pantallas angostas */
@media (max-width: 1599px) {
  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(560px, 100%);
    max-height: none;
    padding: 16px;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.45);
    transform: translateX(100%);
    transition: transform 0.18s ease;
  }

  .side-panel.is-open {
    transform: translateX(0);
  }

  .panel-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }

  .panel-tab {
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }

  .panel-tab.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink);
  }

  .panel-close {
    display: inline-flex;
    margin-left: auto;
  }

  .panel-columns {
    display: block;
  }

  .panel-col {
    display: none;
  }

  .side-panel[data-tab="projects"] [data-pane="projects"],
  .side-panel[data-tab="pending"] [data-pane="pending"],
  .side-panel[data-tab="inbox"] [data-pane="inbox"] {
    display: block;
  }
}

@media (min-width: 1600px) {
  #backlog-btn,
  #inbox-btn {
    display: none;
  }

  .panel-close {
    display: none;
  }
}

/* Confirmación propia (estilo Tweek) */
#confirm-backdrop {
  z-index: 70;
}

#confirm-modal {
  z-index: 80;
  width: min(420px, calc(100vw - 32px));
}

.confirm-message {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.confirm-foot {
  justify-content: flex-end;
  gap: 8px;
}

#confirm-ok {
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

#confirm-ok.is-danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
}

.modal-foot button {
  font-size: 13px;
}

[data-sort-id].is-sorting {
  opacity: 0.4;
}

/* Borrado de una serie */
#delete-backdrop {
  z-index: 70;
}

#delete-modal {
  z-index: 80;
  width: min(460px, calc(100vw - 32px));
}

.delete-options {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.delete-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.delete-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.delete-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.delete-option input {
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.delete-option strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.delete-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

#delete-ok {
  padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--surface));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-weight: 600;
}

#delete-ok:hover {
  background: color-mix(in srgb, var(--danger) 20%, var(--surface));
}

#delete-ok.is-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

#delete-ok.is-accent:hover {
  background: color-mix(in srgb, var(--accent) 85%, var(--bg));
}

/* Movimiento suave */
.icon-btn,
.ghost-btn,
.danger-btn,
#save-task,
#project-save,
#confirm-ok,
#delete-ok,
.add-task,
.inbox-action,
.pending-action,
.card-check,
.range-check,
.project-check,
.panel-tab,
.swatch {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    box-shadow 0.15s ease;
}

.field input,
.field textarea,
.field select,
.login-card input,
.category-row input,
.category-row select,
.category-add input,
.category-add select,
.inbox-quick input,
.inbox-quick select {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.card,
.day-column,
.backlog-item,
.pending-item,
.project-card,
.inbox-item {
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease,
    outline-color 0.15s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal:not([hidden]) {
  animation: modal-in 0.16s ease-out;
}

@keyframes banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.error-banner:not([hidden]) {
  animation: banner-in 0.18s ease-out;
}

@keyframes week-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.board.week-switch {
  animation: week-in 0.2s ease-out;
}

/* Notas rápidas */
.app-main {
  padding-bottom: 248px;
}

.scratchpad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
}

.scratchpad-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--line);
}

.scratchpad-head h2 {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scratchpad-status {
  min-height: 1em;
  color: var(--muted);
  font-size: 11px;
}

.scratchpad-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.scratchpad-actions .ghost-btn {
  padding: 4px 9px;
  font-size: 11px;
}

.scratchpad-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 180px;
  padding: 8px 16px 12px;
}

.scratchpad.is-collapsed .scratchpad-body {
  display: none;
}

.scratchpad.is-collapsed .scratchpad-head {
  border-bottom: 0;
}

.scratchpad-toolbar {
  display: flex;
  gap: 4px;
}

.scratchpad-toolbar button {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.scratchpad-toolbar button:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.scratchpad textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: 13px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  resize: none;
}

.scratchpad textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.scratchpad-preview {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.5;
}

.scratchpad-preview:empty::before {
  content: "Nada que mostrar.";
  color: var(--muted);
}

.scratchpad-preview h1,
.scratchpad-preview h2,
.scratchpad-preview h3 {
  margin: 0.6em 0 0.3em;
  line-height: 1.25;
}

.scratchpad-preview h1 { font-size: 17px; }
.scratchpad-preview h2 { font-size: 15px; }
.scratchpad-preview h3 { font-size: 14px; }

.scratchpad-preview p {
  margin: 0.4em 0;
}

.scratchpad-preview ul,
.scratchpad-preview ol {
  margin: 0.4em 0;
  padding-left: 22px;
}

.scratchpad-preview blockquote {
  margin: 0.4em 0;
  padding: 2px 10px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.scratchpad-preview code {
  padding: 1px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
}


  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

