:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --surface: rgba(15, 23, 42, .78);
  --surface-2: rgba(30, 41, 59, .82);
  --card: rgba(17, 24, 39, .86);
  --card-2: rgba(30, 41, 59, .92);
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --primary: #22d3ee;
  --primary-2: #8b5cf6;
  --accent: #14f195;
  --danger: #fb7185;
  --success: #22c55e;
  --warning: #facc15;
  --critical: #ff4d6d;
  --high: #fb923c;
  --medium: #fde047;
  --low: #22c55e;
  --border: rgba(148, 163, 184, .18);
  --shadow: 0 24px 80px rgba(0,0,0,.42);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(34,211,238,.22), transparent 28%),
    radial-gradient(circle at 90% 5%, rgba(139,92,246,.22), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(20,241,149,.10), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent);
}

a { color: inherit; text-decoration: none; }

.layout {
  max-width: 1280px;
  margin: auto;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  background: linear-gradient(135deg, rgba(15,23,42,.82), rgba(30,41,59,.58));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -.04em;
  background: linear-gradient(90deg, #fff, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  color: transparent;
}

h2 { margin: 20px 0 12px; font-size: 1.45rem; letter-spacing: -.02em; }
h3 { margin: 0 0 8px; }
p { color: var(--muted); line-height: 1.55; }

.app-navbar {
  padding: 10px;
  background: rgba(2, 6, 23, .42);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

.app-brand {
  color: var(--text);
  font-weight: 950;
  padding: 10px 12px;
}

.app-brand:hover { color: var(--primary); }

.app-toggler {
  border-color: var(--border);
  background: rgba(255,255,255,.08);
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a,
.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 14px;
  padding: 11px 15px;
  background: rgba(15,23,42,.68);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, filter .16s ease, background .16s ease;
}

.nav a:hover,
.btn:hover,
button:hover {
  transform: translateY(-1px);
  border-color: rgba(34,211,238,.55);
  filter: brightness(1.08);
  color: var(--text);
}

.nav a.active,
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #020617 !important;
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(34,211,238,.18);
}

.btn-danger { color: var(--danger); border-color: rgba(251,113,133,.55); }
.btn-success { color: var(--success); border-color: rgba(34,197,94,.55); }

.panel,
.card {
  background: linear-gradient(145deg, var(--surface), rgba(15,23,42,.56));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.grid { display: grid; gap: 14px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 12px;
  align-items: end;
}

input,
select,
textarea {
  background: rgba(2, 6, 23, .68) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 12px 13px !important;
  width: 100%;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(34,211,238,.10) !important;
}

textarea { min-height: 95px; resize: vertical; }

.task,
.note,
.project,
.routine,
.process-group {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(30,41,59,.88), rgba(15,23,42,.84)),
    radial-gradient(circle at top right, rgba(34,211,238,.12), transparent 34%);
  border-radius: var(--radius);
  padding: 17px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  margin-bottom: 13px;
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
}

.task.critica { border-left-color: var(--critical); }
.task.alta { border-left-color: var(--high); }
.task.media { border-left-color: var(--medium); }
.task.baja { border-left-color: var(--low); }

.process-group {
  border-left-color: var(--primary-2);
  background:
    linear-gradient(145deg, rgba(30,27,75,.72), rgba(15,23,42,.88)),
    radial-gradient(circle at top right, rgba(139,92,246,.20), transparent 38%);
}

.process-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.process-task {
  margin-left: 14px;
  border-left-style: double;
}

.badge,
.process-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #020617;
  font-weight: 950;
  font-size: .78rem;
  white-space: nowrap;
}

.process-badge { background: linear-gradient(135deg, #c084fc, #22d3ee); }
.critica-badge { background: var(--critical); }
.alta-badge { background: var(--high); }
.media-badge { background: var(--medium); }
.baja-badge { background: var(--low); }

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .9rem;
  margin-top: 9px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.completed { opacity: .56; }
.completed h3, .completed strong { text-decoration: line-through; }

.field { display: grid; gap: 6px; }

.field label {
  color: var(--soft);
  font-size: .88rem;
  font-weight: 850;
}

.field small { color: var(--muted); font-size: .78rem; }

.inline-form { display: inline; }

.quick-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.quick-form .field { min-width: 150px; }

.auth-box {
  max-width: 440px;
  margin: 8vh auto;
}

.agenda-day { display: grid; gap: 10px; }

.agenda-slot {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: stretch;
}

.agenda-time {
  color: var(--primary);
  font-weight: 900;
  padding-top: 12px;
}

.agenda-block {
  background: rgba(2,6,23,.56);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 24px;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,.7);
  color: var(--text);
  font-weight: 800;
}

.pagination .current {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #020617;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 25px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(2,6,23,.28);
}

details { margin: 14px 0; }
summary { cursor: pointer; font-weight: 850; color: var(--primary); }

.process-summary { display: grid; gap: 10px; }
.process-next-title { color: var(--primary); font-weight: 950; }

@media (max-width: 991px) {
  .navbar-collapse { margin-top: 12px; }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .nav a {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar .btn { width: 100%; }
}

@media (max-width: 768px) {
  html { font-size: 15px; }

  .layout {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .panel,
  .card,
  .task,
  .note,
  .project,
  .routine,
  .process-group {
    padding: 15px;
    border-radius: 18px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.25rem; }

  .form-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .actions,
  .quick-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions .btn,
  .actions button,
  .quick-form .btn,
  .quick-form button {
    width: 100%;
  }

  .quick-form .field { min-width: 100%; }

  .agenda-slot {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .agenda-time {
    padding-top: 0;
    color: var(--accent);
  }

  .process-group-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .process-task { margin-left: 0; }

  .meta {
    gap: 6px;
    font-size: .83rem;
  }

  .badge,
  .process-badge {
    max-width: 100%;
    white-space: normal;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 420px) {
  .layout {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .topbar { padding: 15px; }

  .panel,
  .task,
  .note,
  .project,
  .routine,
  .process-group {
    padding: 13px;
  }

  .pagination a,
  .pagination span {
    padding: 7px 10px;
  }
}


/* Calendario mensual */
.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-month-title {
  font-weight: 950;
  color: var(--text);
  margin: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.calendar-weekday {
  color: var(--primary);
  font-weight: 950;
  text-align: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2,6,23,.36);
}

.calendar-day {
  min-height: 128px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  background: rgba(2,6,23,.38);
  display: grid;
  align-content: start;
  gap: 6px;
}

.calendar-day.today {
  border-color: rgba(34,211,238,.75);
  box-shadow: 0 0 0 3px rgba(34,211,238,.12);
}

.calendar-day.other-month {
  opacity: .36;
}

.calendar-day-number {
  font-weight: 950;
  color: var(--soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-items {
  display: grid;
  gap: 5px;
}

.calendar-item {
  display: block;
  border-radius: 10px;
  padding: 5px 7px;
  font-size: .78rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.12);
  color: #020617;
}

.calendar-item.task-item {
  background: linear-gradient(135deg, #22d3ee, #38bdf8);
}

.calendar-item.process-item {
  background: linear-gradient(135deg, #c084fc, #22d3ee);
}

.calendar-item.routine-item {
  background: linear-gradient(135deg, #22c55e, #14f195);
}

.calendar-item.completed-item {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
  opacity: .8;
}

.collapse-card {
  margin-top: 12px;
}

@media (max-width: 991px) {
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(92px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .calendar-weekday,
  .calendar-day {
    min-width: 92px;
  }

  .calendar-day {
    min-height: 112px;
    padding: 8px;
  }
}

@media (max-width: 576px) {
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(82px, 1fr));
  }

  .calendar-weekday,
  .calendar-day {
    min-width: 82px;
  }

  .calendar-day {
    min-height: 100px;
  }

  .calendar-item {
    font-size: .72rem;
    padding: 4px 6px;
  }
}


.list-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8, #14f195);
  color: #020617;
  font-weight: 950;
  font-size: .78rem;
}
.resource-secret { letter-spacing: .16em; font-weight: 950; color: var(--soft); }
.day-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.summary-box { border: 1px solid var(--border); border-radius: 16px; background: rgba(2, 6, 23, .38); padding: 14px; }
.summary-number { font-size: 2rem; font-weight: 950; color: var(--primary); }


.app-dropdown {
  display: inline-flex;
}

.app-dropdown-menu {
  background: rgba(15,23,42,.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow);
z-index: 99999 !important;

}

.app-dropdown-menu .dropdown-item {
  color: var(--text);
  border-radius: 12px;
  font-weight: 850;
  padding: 10px 12px;
}

.app-dropdown-menu .dropdown-item:hover,
.app-dropdown-menu .dropdown-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #020617 !important;
}

@media (max-width: 991px) {
  .app-dropdown {
    display: block;
    width: 100%;
  }

  .app-dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 8px;
  }
}


/* Corrección v17: dropdown siempre visible por encima de paneles */
.topbar,
.app-navbar,
.navbar,
.navbar-collapse,
.app-dropdown {
  position: relative;
  z-index: 5000;
}

.app-navbar {
  overflow: visible !important;
}

.navbar-collapse {
  overflow: visible !important;
}

.app-dropdown-menu,
.dropdown-menu {
  z-index: 99999 !important;
}

.app-dropdown .dropdown-toggle {
  width: auto;
}

/* En móvil el submenú se integra dentro del menú hamburguesa */
@media (max-width: 991px) {
  .navbar-collapse.show {
    display: block !important;
    position: relative;
    z-index: 99999;
  }

  .app-dropdown {
    width: 100%;
    display: block;
  }

  .app-dropdown .dropdown-toggle {
    width: 100%;
    justify-content: flex-start;
  }

  .app-dropdown-menu {
    position: static !important;
    transform: none !important;
    display: none;
    width: 100%;
    margin: 8px 0 0 0 !important;
    padding: 8px;
    box-shadow: none;
  }

  .app-dropdown-menu.show {
    display: block !important;
  }

  .app-dropdown-menu .dropdown-item {
    width: 100%;
    margin-bottom: 6px;
  }

  .navbar-nav .dropdown-menu {
    position: static !important;
  }
}


/* Corrección v18: menú Gestión visible en móvil */
.app-dropdown > .dropdown-toggle,
.app-dropdown > button.dropdown-toggle {
  border: 1px solid var(--border);
  background: rgba(15,23,42,.68);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 850;
}

.app-dropdown > .dropdown-toggle.active,
.app-dropdown > button.dropdown-toggle.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #020617 !important;
}

@media (max-width: 991px) {
  .app-dropdown-menu {
    position: static !important;
    transform: none !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 100% !important;
    margin-top: 8px !important;
    background: rgba(2, 6, 23, .72) !important;
    border: 1px solid var(--border) !important;
  }

  .app-dropdown-menu.show {
    display: grid !important;
    gap: 8px;
  }

  .navbar-nav .dropdown-menu {
    float: none !important;
  }

  .app-dropdown > button.dropdown-toggle {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}


/* Corrección v19: en móvil Gestión muestra siempre sus opciones */
@media (max-width: 991px) {
  .navbar-collapse.show {
    background: rgba(2, 6, 23, .96);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    margin-top: 12px;
    z-index: 999999 !important;
  }

  .navbar-collapse.show .app-dropdown-menu,
  .app-dropdown-menu {
    display: grid !important;
    position: static !important;
    transform: none !important;
    inset: auto !important;
    float: none !important;
    width: 100% !important;
    min-width: 100% !important;
    margin: 8px 0 0 0 !important;
    padding: 8px !important;
    gap: 8px;
    background: rgba(15, 23, 42, .92) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    box-shadow: none !important;
  }

  .app-dropdown-menu .dropdown-item {
    display: flex !important;
    width: 100% !important;
    color: var(--text) !important;
    background: rgba(15,23,42,.68) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    padding: 11px 15px !important;
  }

  .app-dropdown-menu .dropdown-item.active,
  .app-dropdown-menu .dropdown-item:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-2)) !important;
    color: #020617 !important;
  }

  .app-dropdown > button.dropdown-toggle::after,
  .app-dropdown > .dropdown-toggle::after {
    display: none;
  }

  .app-dropdown > button.dropdown-toggle {
    pointer-events: none;
    opacity: .86;
  }
}


/* v20: badges de origen y controles */
.origin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #020617;
  font-weight: 950;
  font-size: .78rem;
}

.origin-list { background: linear-gradient(135deg, #38bdf8, #14f195); }
.origin-project { background: linear-gradient(135deg, #facc15, #fb923c); }
.origin-process { background: linear-gradient(135deg, #c084fc, #22d3ee); }
.origin-routine { background: linear-gradient(135deg, #22c55e, #84cc16); }
.origin-individual { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }

.sort-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.collapsed-config {
  margin-bottom: 16px;
}

.section-empty-soft {
  opacity: .65;
}

@media (max-width: 768px) {
  .sort-panel {
    display: grid;
    grid-template-columns: 1fr;
  }
}


.calendar-day-number a {
  color: var(--primary);
  font-weight: 950;
  text-decoration: none;
}

.calendar-day-number a:hover {
  color: var(--accent);
}


/* v26: calendario compacto de seguimiento de rutinas */
.routine-calendar-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.routine-calendar-board-many {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.routine-month {
  background: rgba(2, 6, 23, .38);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.routine-month h4 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: .98rem;
}

.routine-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.routine-weekday {
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
  font-weight: 900;
}

.routine-day {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15,23,42,.72);
  color: var(--soft);
  display: grid;
  place-items: center;
  font-size: .75rem;
  position: relative;
  padding: 2px;
}

.routine-day small {
  font-size: .55rem;
  line-height: 1;
  color: #020617;
  font-weight: 950;
}

.routine-day-muted {
  opacity: .28;
}

.routine-day-done {
  background: linear-gradient(135deg, #22c55e, #14f195);
  color: #020617;
  border-color: transparent;
  font-weight: 950;
}

.routine-day-today {
  outline: 2px solid var(--primary);
}

@media (max-width: 576px) {
  .routine-calendar-board,
  .routine-calendar-board-many {
    grid-template-columns: 1fr;
  }

  .routine-day {
    min-height: 28px;
  }
}


.field small {
  color: var(--muted);
  font-size: .78rem;
}
.task-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.task-table th, .task-table td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}
.task-table th {
  background: var(--dark-bg);
  color: var(--primary);
}
.task-table tr:hover {
  background: rgba(34,197,94,.1);
}
.task-table a {
  color: var(--primary);
  text-decoration: none;
}

/* Configuración de usuario y temas */
body.theme-light {
  --bg: #f4f7fb;
  --bg-2: #e8eef7;
  --surface: rgba(255, 255, 255, .92);
  --surface-2: rgba(241, 245, 249, .96);
  --card: rgba(255, 255, 255, .94);
  --card-2: rgba(248, 250, 252, .98);
  --text: #0f172a;
  --muted: #475569;
  --soft: #334155;
  --primary: #2563eb;
  --primary-2: #7c3aed;
  --accent: #059669;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --border: rgba(15, 23, 42, .14);
  --shadow: 0 18px 55px rgba(15, 23, 42, .12);
}

body.theme-forest {
  --bg: #03140f;
  --bg-2: #092016;
  --surface: rgba(6, 35, 25, .82);
  --surface-2: rgba(12, 56, 40, .86);
  --card: rgba(8, 47, 35, .88);
  --card-2: rgba(16, 68, 49, .92);
  --text: #ecfdf5;
  --muted: #a7f3d0;
  --soft: #d1fae5;
  --primary: #34d399;
  --primary-2: #10b981;
  --accent: #bef264;
  --danger: #fb7185;
  --success: #22c55e;
  --warning: #fde047;
  --border: rgba(167, 243, 208, .20);
  --shadow: 0 24px 80px rgba(0,0,0,.40);
}

body.theme-sunset {
  --bg: #170b13;
  --bg-2: #2a1018;
  --surface: rgba(47, 18, 32, .82);
  --surface-2: rgba(75, 28, 38, .86);
  --card: rgba(61, 22, 36, .88);
  --card-2: rgba(90, 35, 46, .92);
  --text: #fff7ed;
  --muted: #fed7aa;
  --soft: #ffedd5;
  --primary: #fb923c;
  --primary-2: #f43f5e;
  --accent: #facc15;
  --danger: #fb7185;
  --success: #4ade80;
  --warning: #fde047;
  --border: rgba(254, 215, 170, .22);
  --shadow: 0 24px 80px rgba(0,0,0,.42);
}

body.theme-light h1 {
  background: linear-gradient(90deg, #0f172a, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  color: transparent;
}

body.theme-light::before {
  background-image:
    linear-gradient(rgba(15,23,42,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.045) 1px, transparent 1px);
}

body.theme-light .topbar,
body.theme-light .app-navbar,
body.theme-light .panel,
body.theme-light .card {
  background: linear-gradient(145deg, var(--surface), rgba(241,245,249,.76));
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-card {
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.setting-switch,
.theme-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  padding: 14px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  cursor: pointer;
}

.setting-switch input,
.theme-option input {
  margin-top: 4px;
  accent-color: var(--primary);
}

.setting-switch strong,
.theme-option strong {
  display: block;
  color: var(--text);
}

.setting-switch small,
.theme-option small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.theme-options {
  display: grid;
  gap: 10px;
}

.theme-swatch {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}

.theme-preview-neon .theme-swatch {
  background: linear-gradient(135deg, #070b16, #22d3ee, #8b5cf6);
}

.theme-preview-light .theme-swatch {
  background: linear-gradient(135deg, #ffffff, #dbeafe, #2563eb);
}

.theme-preview-forest .theme-swatch {
  background: linear-gradient(135deg, #03140f, #34d399, #bef264);
}

.theme-preview-sunset .theme-swatch {
  background: linear-gradient(135deg, #170b13, #fb923c, #f43f5e);
}

.theme-option:has(input:checked),
.setting-switch:has(input:checked) {
  border-color: color-mix(in srgb, var(--primary) 60%, transparent);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.app-alert {
  border-radius: 16px;
  border: 1px solid var(--border);
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Temas adicionales */
body.theme-mono {
  --bg: #f7f7f7;
  --bg-2: #eeeeee;
  --surface: rgba(255, 255, 255, .96);
  --surface-2: rgba(245, 245, 245, .98);
  --card: rgba(255, 255, 255, .98);
  --card-2: rgba(242, 242, 242, .98);
  --text: #111111;
  --muted: #555555;
  --soft: #2f2f2f;
  --primary: #111111;
  --primary-2: #3b82f6;
  --accent: #3b82f6;
  --danger: #b91c1c;
  --success: #166534;
  --warning: #92400e;
  --border: rgba(17, 17, 17, .18);
  --shadow: 0 16px 45px rgba(0, 0, 0, .10);
}

body.theme-midnight {
  --bg: #020617;
  --bg-2: #0f172a;
  --surface: rgba(15, 23, 42, .88);
  --surface-2: rgba(30, 41, 59, .90);
  --card: rgba(15, 23, 42, .94);
  --card-2: rgba(30, 41, 59, .96);
  --text: #e0f2fe;
  --muted: #93c5fd;
  --soft: #bfdbfe;
  --primary: #38bdf8;
  --primary-2: #6366f1;
  --accent: #22d3ee;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #facc15;
  --border: rgba(147, 197, 253, .20);
  --shadow: 0 24px 80px rgba(0, 0, 0, .48);
}

body.theme-ocean {
  --bg: #042f2e;
  --bg-2: #083344;
  --surface: rgba(15, 118, 110, .28);
  --surface-2: rgba(8, 145, 178, .30);
  --card: rgba(6, 78, 59, .74);
  --card-2: rgba(14, 116, 144, .66);
  --text: #ecfeff;
  --muted: #a5f3fc;
  --soft: #cffafe;
  --primary: #06b6d4;
  --primary-2: #2dd4bf;
  --accent: #67e8f9;
  --danger: #fb7185;
  --success: #22c55e;
  --warning: #fef08a;
  --border: rgba(165, 243, 252, .22);
  --shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

body.theme-grape {
  --bg: #14051f;
  --bg-2: #2e1065;
  --surface: rgba(46, 16, 101, .72);
  --surface-2: rgba(88, 28, 135, .74);
  --card: rgba(59, 7, 100, .84);
  --card-2: rgba(76, 29, 149, .86);
  --text: #faf5ff;
  --muted: #d8b4fe;
  --soft: #f3e8ff;
  --primary: #c084fc;
  --primary-2: #f0abfc;
  --accent: #a78bfa;
  --danger: #fb7185;
  --success: #4ade80;
  --warning: #fde047;
  --border: rgba(216, 180, 254, .24);
  --shadow: 0 24px 80px rgba(0, 0, 0, .43);
}

body.theme-coffee {
  --bg: #1c120b;
  --bg-2: #2b1b12;
  --surface: rgba(68, 43, 28, .82);
  --surface-2: rgba(87, 56, 36, .84);
  --card: rgba(69, 45, 32, .88);
  --card-2: rgba(98, 64, 42, .90);
  --text: #fff7ed;
  --muted: #fed7aa;
  --soft: #ffedd5;
  --primary: #d97706;
  --primary-2: #f59e0b;
  --accent: #facc15;
  --danger: #fb7185;
  --success: #84cc16;
  --warning: #fde047;
  --border: rgba(254, 215, 170, .22);
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
}

body.theme-mono h1 {
  background: linear-gradient(90deg, #111111, #111111, #3b82f6);
  -webkit-background-clip: text;
  color: transparent;
}

body.theme-mono::before {
  background-image:
    linear-gradient(rgba(17,17,17,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17,17,17,.035) 1px, transparent 1px);
}

body.theme-mono .topbar,
body.theme-mono .app-navbar,
body.theme-mono .panel,
body.theme-mono .card {
  background: linear-gradient(145deg, var(--surface), rgba(245,245,245,.86));
}

.theme-preview-mono .theme-swatch {
  background: linear-gradient(135deg, #ffffff, #111111, #3b82f6);
}

.theme-preview-midnight .theme-swatch {
  background: linear-gradient(135deg, #020617, #38bdf8, #6366f1);
}

.theme-preview-ocean .theme-swatch {
  background: linear-gradient(135deg, #042f2e, #06b6d4, #2dd4bf);
}

.theme-preview-grape .theme-swatch {
  background: linear-gradient(135deg, #14051f, #c084fc, #f0abfc);
}

.theme-preview-coffee .theme-swatch {
  background: linear-gradient(135deg, #1c120b, #d97706, #facc15);
}

/* Ajuste de alineación para checks/radios en configuración */
.setting-switch,
.theme-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
}

.theme-option {
  grid-template-columns: auto 42px minmax(0, 1fr);
}

.setting-switch input,
.theme-option input {
  margin: 2px 0 0 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* Selector de temas con scroll */
.theme-selector-box {
  display: grid;
  gap: 8px;
}

.theme-options-scroll {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.035);
}

.theme-options-scroll .theme-option:first-child {
  margin-top: 0;
}

.theme-scroll-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .04em;
}

.theme-scroll-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 10 temas nuevos */
body.theme-slate {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --surface: rgba(30, 41, 59, .88);
  --surface-2: rgba(51, 65, 85, .90);
  --card: rgba(15, 23, 42, .92);
  --card-2: rgba(30, 41, 59, .94);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --soft: #e2e8f0;
  --primary: #94a3b8;
  --primary-2: #38bdf8;
  --accent: #60a5fa;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #facc15;
  --border: rgba(203, 213, 225, .20);
  --shadow: 0 24px 80px rgba(0,0,0,.42);
}

body.theme-rose {
  --bg: #fff1f2;
  --bg-2: #ffe4e6;
  --surface: rgba(255, 255, 255, .94);
  --surface-2: rgba(255, 241, 242, .98);
  --card: rgba(255, 255, 255, .96);
  --card-2: rgba(255, 228, 230, .78);
  --text: #3f121b;
  --muted: #881337;
  --soft: #4c0519;
  --primary: #e11d48;
  --primary-2: #fb7185;
  --accent: #f97316;
  --danger: #be123c;
  --success: #15803d;
  --warning: #b45309;
  --border: rgba(136, 19, 55, .16);
  --shadow: 0 18px 55px rgba(136, 19, 55, .12);
}

body.theme-mint {
  --bg: #f0fdfa;
  --bg-2: #ccfbf1;
  --surface: rgba(255, 255, 255, .94);
  --surface-2: rgba(240, 253, 250, .96);
  --card: rgba(255, 255, 255, .96);
  --card-2: rgba(204, 251, 241, .68);
  --text: #042f2e;
  --muted: #0f766e;
  --soft: #134e4a;
  --primary: #0d9488;
  --primary-2: #14b8a6;
  --accent: #22c55e;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --border: rgba(15, 118, 110, .18);
  --shadow: 0 18px 55px rgba(15, 118, 110, .13);
}

body.theme-cyber {
  --bg: #08000f;
  --bg-2: #1a0428;
  --surface: rgba(26, 4, 40, .86);
  --surface-2: rgba(49, 8, 74, .88);
  --card: rgba(18, 3, 34, .92);
  --card-2: rgba(52, 8, 80, .90);
  --text: #fff7ff;
  --muted: #f0abfc;
  --soft: #fde047;
  --primary: #f0f000;
  --primary-2: #ec4899;
  --accent: #22d3ee;
  --danger: #ff3864;
  --success: #39ff14;
  --warning: #fde047;
  --border: rgba(240, 171, 252, .26);
  --shadow: 0 24px 90px rgba(236, 72, 153, .22);
}

body.theme-nord {
  --bg: #2e3440;
  --bg-2: #3b4252;
  --surface: rgba(59, 66, 82, .88);
  --surface-2: rgba(67, 76, 94, .90);
  --card: rgba(46, 52, 64, .92);
  --card-2: rgba(76, 86, 106, .92);
  --text: #eceff4;
  --muted: #d8dee9;
  --soft: #e5e9f0;
  --primary: #88c0d0;
  --primary-2: #81a1c1;
  --accent: #a3be8c;
  --danger: #bf616a;
  --success: #a3be8c;
  --warning: #ebcb8b;
  --border: rgba(216, 222, 233, .20);
  --shadow: 0 24px 80px rgba(0,0,0,.38);
}

body.theme-solar {
  --bg: #fffbeb;
  --bg-2: #fef3c7;
  --surface: rgba(255, 255, 255, .94);
  --surface-2: rgba(255, 251, 235, .96);
  --card: rgba(255, 255, 255, .96);
  --card-2: rgba(254, 243, 199, .76);
  --text: #422006;
  --muted: #92400e;
  --soft: #78350f;
  --primary: #d97706;
  --primary-2: #f59e0b;
  --accent: #eab308;
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #ca8a04;
  --border: rgba(146, 64, 14, .16);
  --shadow: 0 18px 55px rgba(146, 64, 14, .12);
}

body.theme-ruby {
  --bg: #1f0509;
  --bg-2: #450a0a;
  --surface: rgba(69, 10, 10, .82);
  --surface-2: rgba(127, 29, 29, .82);
  --card: rgba(69, 10, 10, .90);
  --card-2: rgba(153, 27, 27, .78);
  --text: #fff1f2;
  --muted: #fecdd3;
  --soft: #ffe4e6;
  --primary: #f43f5e;
  --primary-2: #fb7185;
  --accent: #f97316;
  --danger: #f87171;
  --success: #86efac;
  --warning: #fde047;
  --border: rgba(254, 205, 211, .22);
  --shadow: 0 24px 80px rgba(0,0,0,.44);
}

body.theme-matrix {
  --bg: #000000;
  --bg-2: #031a07;
  --surface: rgba(1, 20, 6, .88);
  --surface-2: rgba(3, 36, 12, .90);
  --card: rgba(0, 0, 0, .92);
  --card-2: rgba(2, 28, 10, .94);
  --text: #dcfce7;
  --muted: #86efac;
  --soft: #bbf7d0;
  --primary: #22c55e;
  --primary-2: #16a34a;
  --accent: #4ade80;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #a3e635;
  --border: rgba(34, 197, 94, .24);
  --shadow: 0 24px 80px rgba(0,0,0,.58);
}

body.theme-lavender {
  --bg: #f5f3ff;
  --bg-2: #ede9fe;
  --surface: rgba(255, 255, 255, .94);
  --surface-2: rgba(245, 243, 255, .96);
  --card: rgba(255, 255, 255, .96);
  --card-2: rgba(237, 233, 254, .72);
  --text: #2e1065;
  --muted: #6d28d9;
  --soft: #4c1d95;
  --primary: #7c3aed;
  --primary-2: #a78bfa;
  --accent: #ec4899;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #ca8a04;
  --border: rgba(109, 40, 217, .16);
  --shadow: 0 18px 55px rgba(109, 40, 217, .12);
}

body.theme-sand {
  --bg: #faf7f0;
  --bg-2: #eee4d3;
  --surface: rgba(255, 252, 247, .94);
  --surface-2: rgba(250, 247, 240, .98);
  --card: rgba(255, 252, 247, .96);
  --card-2: rgba(238, 228, 211, .76);
  --text: #29200f;
  --muted: #6b5a3c;
  --soft: #3f321f;
  --primary: #a16207;
  --primary-2: #c2410c;
  --accent: #0f766e;
  --danger: #b91c1c;
  --success: #15803d;
  --warning: #b45309;
  --border: rgba(107, 90, 60, .18);
  --shadow: 0 18px 55px rgba(107, 90, 60, .12);
}

body.theme-rose h1,
body.theme-mint h1,
body.theme-solar h1,
body.theme-lavender h1,
body.theme-sand h1 {
  background: linear-gradient(90deg, var(--text), var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  color: transparent;
}

body.theme-rose::before,
body.theme-mint::before,
body.theme-solar::before,
body.theme-lavender::before,
body.theme-sand::before {
  background-image:
    linear-gradient(rgba(15,23,42,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.035) 1px, transparent 1px);
}

body.theme-rose .topbar,
body.theme-rose .app-navbar,
body.theme-rose .panel,
body.theme-rose .card,
body.theme-mint .topbar,
body.theme-mint .app-navbar,
body.theme-mint .panel,
body.theme-mint .card,
body.theme-solar .topbar,
body.theme-solar .app-navbar,
body.theme-solar .panel,
body.theme-solar .card,
body.theme-lavender .topbar,
body.theme-lavender .app-navbar,
body.theme-lavender .panel,
body.theme-lavender .card,
body.theme-sand .topbar,
body.theme-sand .app-navbar,
body.theme-sand .panel,
body.theme-sand .card {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.theme-preview-slate .theme-swatch { background: linear-gradient(135deg, #0f172a, #94a3b8, #38bdf8); }
.theme-preview-rose .theme-swatch { background: linear-gradient(135deg, #fff1f2, #e11d48, #fb7185); }
.theme-preview-mint .theme-swatch { background: linear-gradient(135deg, #f0fdfa, #0d9488, #22c55e); }
.theme-preview-cyber .theme-swatch { background: linear-gradient(135deg, #08000f, #f0f000, #ec4899); }
.theme-preview-nord .theme-swatch { background: linear-gradient(135deg, #2e3440, #88c0d0, #a3be8c); }
.theme-preview-solar .theme-swatch { background: linear-gradient(135deg, #fffbeb, #d97706, #eab308); }
.theme-preview-ruby .theme-swatch { background: linear-gradient(135deg, #1f0509, #f43f5e, #f97316); }
.theme-preview-matrix .theme-swatch { background: linear-gradient(135deg, #000000, #22c55e, #86efac); }
.theme-preview-lavender .theme-swatch { background: linear-gradient(135deg, #f5f3ff, #7c3aed, #ec4899); }
.theme-preview-sand .theme-swatch { background: linear-gradient(135deg, #faf7f0, #a16207, #0f766e); }


/* Temas Agenda Clásica */
body.theme-agenda-classic {
  --bg: #f7f2e8;
  --bg-2: #ebe1cf;
  --surface: rgba(255, 252, 246, .96);
  --surface-2: rgba(250, 246, 238, .98);
  --card: rgba(255, 253, 248, .98);
  --card-2: rgba(241, 234, 220, .86);
  --text: #24211b;
  --muted: #6d675b;
  --soft: #3a352d;
  --primary: #1f4e79;
  --primary-2: #2f6f9f;
  --accent: #8a6f3f;
  --danger: #9f2f2f;
  --success: #2f6b45;
  --warning: #9a6b18;
  --border: rgba(50, 45, 36, .18);
  --shadow: 0 14px 34px rgba(57, 45, 29, .12);
  font-family: Georgia, "Times New Roman", serif;
}

body.theme-agenda-dark {
  --bg: #1c1a17;
  --bg-2: #2a241d;
  --surface: rgba(43, 38, 31, .94);
  --surface-2: rgba(55, 48, 39, .96);
  --card: rgba(37, 33, 28, .96);
  --card-2: rgba(64, 55, 43, .90);
  --text: #f4ead8;
  --muted: #cbbda5;
  --soft: #f7efe2;
  --primary: #d3a94d;
  --primary-2: #e2c372;
  --accent: #8fb0a9;
  --danger: #e07a68;
  --success: #9ac18a;
  --warning: #e2b85c;
  --border: rgba(244, 234, 216, .18);
  --shadow: 0 22px 70px rgba(0,0,0,.42);
  font-family: Georgia, "Times New Roman", serif;
}

body.theme-agenda-classic::before,
body.theme-agenda-dark::before {
  background-image:
    linear-gradient(rgba(31, 78, 121, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 78, 121, .035) 1px, transparent 1px);
  background-size: 100% 34px, 34px 100%;
}

body.theme-agenda-dark::before {
  background-image:
    linear-gradient(rgba(244, 234, 216, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 234, 216, .035) 1px, transparent 1px);
}

body.theme-agenda-classic h1,
body.theme-agenda-dark h1 {
  background: none;
  -webkit-background-clip: initial;
  color: var(--text);
  letter-spacing: .01em;
}

body.theme-agenda-classic .topbar,
body.theme-agenda-classic .app-navbar,
body.theme-agenda-classic .panel,
body.theme-agenda-classic .card,
body.theme-agenda-dark .topbar,
body.theme-agenda-dark .app-navbar,
body.theme-agenda-dark .panel,
body.theme-agenda-dark .card {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

body.theme-agenda-classic .panel,
body.theme-agenda-classic .card,
body.theme-agenda-dark .panel,
body.theme-agenda-dark .card {
  border-radius: 14px;
}

body.theme-agenda-classic table,
body.theme-agenda-dark table {
  border-collapse: separate;
  border-spacing: 0;
}

body.theme-agenda-classic th,
body.theme-agenda-dark th {
  font-weight: 700;
  background: var(--card-2);
}

.theme-preview-agenda_classic .theme-swatch { background: linear-gradient(135deg, #f7f2e8, #fffdf8, #1f4e79); }
.theme-preview-agenda_dark .theme-swatch { background: linear-gradient(135deg, #1c1a17, #3b3024, #d3a94d); }


/* Finanzas y tareas recurrentes */
.app-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.app-table th,
.app-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.app-table th {
  color: var(--soft);
  background: rgba(148, 163, 184, .10);
  font-weight: 700;
}

.table-responsive {
  overflow-x: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 14px 36px rgba(0,0,0,.16);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 1.35rem;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list > div,
.recurrence-box {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(148, 163, 184, .08);
}

.recurrence-options {
  margin-top: 12px;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.weekday-picker input,
.setting-switch input,
.theme-option input {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}

/* Finanzas: recurrentes sencillos */
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.check-option {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, .08);
  color: var(--soft);
  font-weight: 800;
  line-height: 1.1;
}

.check-option input[type="checkbox"],
.check-option input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 16px;
}

.check-option span {
  display: inline-block;
  white-space: nowrap;
}

.active-check {
  max-width: max-content;
}

.finance-recurring-panel .recurrence-options {
  display: grid;
  gap: 12px;
}

/* Finanzas: categorías con color */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .22rem .55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cat-color, #64748b) 45%, transparent);
  background: color-mix(in srgb, var(--cat-color, #64748b) 14%, transparent);
  white-space: nowrap;
}
.category-pill > span,
.category-dot {
  width: .75rem;
  height: .75rem;
  border-radius: 999px;
  background: var(--cat-color, #64748b);
  display: inline-block;
  flex: 0 0 auto;
}
.finance-category-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}
.category-form,
.category-manager-row,
.category-delete-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.category-manager-list {
  display: grid;
  gap: .55rem;
}
.category-manager-row {
  padding: .55rem;
  border: 1px solid var(--border-color, rgba(148,163,184,.25));
  border-radius: .8rem;
  background: rgba(148, 163, 184, .07);
}
.category-manager-row input[name="category_name"] {
  flex: 1 1 170px;
  min-width: 140px;
}
.category-manager-row input[type="color"],
.category-form input[type="color"] {
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 2px;
}
.category-delete-row {
  justify-content: flex-end;
  margin: -.35rem 0 .35rem;
}
@media (max-width: 640px) {
  .finance-category-columns { grid-template-columns: 1fr; }
  .category-form, .category-manager-row { align-items: stretch; }
  .category-manager-row input[name="category_name"] { min-width: 100%; }
}
