/* ===== Tema oscuro 100% negro · púrpura y azul solo en UI ===== */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/cinzel.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter.woff2') format('woff2');
}

:root {
  --bg: #000000;
  --bg-2: #000000;
  --panel: rgba(9, 9, 11, 0.82);
  --panel-solid: #09090b;
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(168, 85, 247, 0.5);
  --text: #e8e8f2;
  --muted: #8f8fa8;
  --purple: #a855f7;
  --purple-deep: #7c3aed;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --pink: #ec4899;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --glow-purple: 0 0 24px rgba(168, 85, 247, 0.35);
  --glow-blue: 0 0 24px rgba(59, 130, 246, 0.3);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Cinzel', 'Segoe UI', serif;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; touch-action: manipulation; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

/* ===== Fondo: negro puro, sin destellos ===== */
.bg-effects {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #000000;
}

/* ===== Shell + menú lateral ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.96);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 60;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 4px 10px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.brand-glyph {
  color: var(--purple);
  text-shadow: 0 0 14px rgba(168, 85, 247, 0.9);
  animation: pulse-glyph 2.6s ease-in-out infinite;
}
@keyframes pulse-glyph {
  0%, 100% { text-shadow: 0 0 10px rgba(168, 85, 247, 0.7); transform: scale(1); }
  50% { text-shadow: 0 0 22px rgba(168, 85, 247, 1), 0 0 40px rgba(59, 130, 246, 0.6); transform: scale(1.12); }
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.2s;
}
.side-link:hover {
  color: var(--text);
  background: rgba(168, 85, 247, 0.1);
  transform: translateX(3px);
}
.side-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.26), rgba(59, 130, 246, 0.2));
  border-color: var(--border-hi);
  box-shadow: var(--glow-purple);
}
.side-icon { width: 20px; text-align: center; filter: saturate(0.85); }

.side-notify { width: 100%; }

.sidebar-backdrop {
  display: none;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-bar {
  display: none;
}

.bottom-nav {
  display: none;
}

/* ===== Contenedor ===== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 34px 22px 60px;
}
.container-wide { max-width: 1680px; }
@media (min-width: 901px) {
  .container-wide { width: 60%; }
}

.fade-in { animation: fadeInUp 0.25s ease backwards; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cabeceras de página ===== */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page-head.center { justify-content: center; text-align: center; }

.eyebrow {
  color: var(--purple);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.back-link { color: var(--purple); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.glow-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.8px;
  background: linear-gradient(100deg, #fff 20%, var(--purple) 55%, var(--blue) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}
.accent {
  -webkit-text-fill-color: var(--purple);
  color: var(--purple);
  text-shadow: 0 0 18px rgba(168, 85, 247, 0.8);
}
.sub { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }

/* ===== Dashboard hero ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(30px, 7vh, 70px) 10px 40px;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 12vw, 6.5rem);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  background: linear-gradient(115deg, #ffffff 15%, var(--purple) 52%, var(--blue) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 220% auto;
  animation: shimmer 5s linear infinite;
  text-shadow: 0 0 60px rgba(168, 85, 247, 0.25);
  filter: drop-shadow(0 0 26px rgba(124, 58, 237, 0.35));
}
.hero-phrase {
  margin-top: 26px;
  max-width: 760px;
  color: #f0f0fa;
  font-size: clamp(1.2rem, 3.2vw, 1.7rem);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.2px;
  text-shadow: 0 0 34px rgba(168, 85, 247, 0.3);
  animation: fadeInUp 0.35s 0.05s ease both;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: min(760px, 100%);
  margin-top: clamp(34px, 6vh, 56px);
}
.dash-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 24px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  animation: fadeInUp 0.55s ease both;
}
.dash-grid .dash-btn:nth-child(2) { animation-delay: 0.1s; }
.dash-grid .dash-btn:nth-child(3) { animation-delay: 0.2s; }
.dash-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(168, 85, 247, 0.14), rgba(59, 130, 246, 0.1));
  opacity: 0;
  transition: opacity 0.3s;
}
.dash-btn:hover {
  transform: translateY(-6px);
  border-color: var(--border-hi);
  box-shadow: var(--glow-purple), 0 14px 40px rgba(0, 0, 0, 0.45);
}
.dash-btn:hover::before { opacity: 1; }
.dash-icon {
  font-size: 2rem;
  position: relative;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.5));
  transition: transform 0.3s;
}
.dash-btn:hover .dash-icon { transform: scale(1.18) rotate(-6deg); }
.dash-label {
  position: relative;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.3px;
}
.dash-desc {
  position: relative;
  color: var(--muted);
  font-size: 0.8rem;
}

.dash-btn-diario {
  width: min(480px, 100%);
  margin-top: 18px;
  padding: 34px 20px;
  background: linear-gradient(140deg, rgba(124, 58, 237, 0.24), rgba(59, 130, 246, 0.18));
  border-color: var(--border-hi);
  box-shadow: 0 0 34px rgba(124, 58, 237, 0.22);
  animation-delay: 0.3s;
}
.dash-btn-diario .dash-icon { font-size: 2.7rem; }
.dash-btn-diario .dash-label { font-size: 1.5rem; }
.dash-btn-diario .dash-desc { font-size: 0.88rem; }
.dash-btn-diario:hover {
  box-shadow: var(--glow-purple), var(--glow-blue), 0 18px 50px rgba(0, 0, 0, 0.5);
}

/* ===== Selector de fecha (checklist) ===== */
.date-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.date-nav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.date-nav input[type="date"] {
  background: rgba(6, 6, 14, 0.9);
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 11px;
  color: var(--text);
  padding: 9px 13px;
  font-family: inherit;
  font-size: 0.95rem;
  color-scheme: dark;
}
.date-nav input[type="date"]:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--glow-purple);
}
.future-hint { margin-bottom: 16px; color: #93c5fd; }
.add-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

/* ===== Paneles ===== */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.panel:hover {
  border-color: var(--border-hi);
  box-shadow: 0 8px 40px rgba(124, 58, 237, 0.12);
}
.panel-narrow { max-width: 720px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 1.05rem; font-weight: 700; }

/* ===== Estadísticas ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  animation: fadeInUp 0.5s ease both;
}
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  opacity: 0.85;
}
.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hi);
  box-shadow: var(--glow-purple);
}
.card-purple::before { background: linear-gradient(90deg, var(--purple), var(--pink)); }
.card-blue::before { background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.card-pink::before { background: linear-gradient(90deg, var(--pink), var(--purple)); }
.card-cyan::before { background: linear-gradient(90deg, var(--cyan), var(--blue)); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-dim { font-size: 1.1rem; opacity: 0.5; }
.stat-label { color: var(--muted); font-size: 0.88rem; }
.stat-sub { color: var(--purple); font-size: 0.8rem; }
.stat-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.7);
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Dos columnas ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 820px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ===== Listas ===== */
.mini-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.mini-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: background 0.25s, transform 0.2s, border-color 0.25s;
  animation: fadeInUp 0.4s ease both;
}
.mini-item:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--border-hi);
  transform: translateX(4px);
}
.mini-grow { flex: 1; display: flex; flex-direction: column; }
.mini-title { font-weight: 600; font-size: 0.94rem; }
.mini-meta { color: var(--muted); font-size: 0.8rem; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--purple);
  box-shadow: 0 0 10px currentColor;
}
.dot-high { background: var(--red); }
.dot-blue { background: var(--blue); }
.dot-purple { background: var(--purple); }

.empty { color: var(--muted); font-style: italic; padding: 12px 0; }
.empty a { color: var(--purple); }

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--border-hi);
  background: rgba(168, 85, 247, 0.14);
  box-shadow: var(--glow-purple);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--purple-deep), var(--blue));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: var(--glow-purple), var(--glow-blue);
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 0.83rem; }
.btn-xs { padding: 3px 9px; font-size: 0.78rem; }
.btn-block { width: 100%; }

.notify-btn .notify-label { font-size: 0.82rem; }
.notify-btn.granted {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

/* ===== Formularios ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}
.form input,
.form select,
.form textarea,
.search-form input,
.form-inline input,
.form-inline select {
  background: rgba(10, 10, 20, 0.75);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 11px;
  color: var(--text);
  padding: 10px 13px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.form input:focus,
.form select:focus,
.form textarea:focus,
.form-inline input:focus,
.form-inline select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2), var(--glow-purple);
}
.form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.form-inline input[type="text"],
.form-inline input[type="search"],
.form-inline input[type="number"],
.form-inline select { flex: 1; min-width: 160px; }
.input-narrow { max-width: 90px !important; min-width: 70px !important; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 0.8rem; }

.color-picker { display: flex; gap: 8px; }
.color-swatch { cursor: pointer; }
.color-swatch input { display: none; }
.color-swatch span {
  display: block;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}
.color-swatch input:checked + span {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 14px var(--sw);
}
.color-swatch:hover span { transform: scale(1.1); }

/* ===== Checklist ===== */
.check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.3s;
  user-select: none;
}
.check-item:hover {
  border-color: var(--border-hi);
  background: rgba(168, 85, 247, 0.07);
}
.check-item.dragging {
  opacity: 0.4;
  border-color: var(--purple);
  border-style: dashed;
  box-shadow: var(--glow-purple);
  transition: none;
}
.drag-handle {
  cursor: grab;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 1rem;
  line-height: 1;
  font-family: inherit;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  user-select: none;
}
.drag-handle:hover {
  color: var(--purple);
  border-color: var(--border-hi);
  box-shadow: var(--glow-purple);
}
.drag-handle:active { cursor: grabbing; }
.check-item.done {
  opacity: 0.65;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.06);
}
.check-item.done .check-title {
  text-decoration: line-through;
  color: var(--muted);
}
.check-form { display: flex; }
.check-box {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid var(--purple);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.25s;
  padding: 0;
}
.check-box:hover {
  box-shadow: var(--glow-purple);
  transform: scale(1.08);
}
.check-svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 0.35s ease;
}
.check-item.done .check-box {
  background: linear-gradient(135deg, var(--green), var(--blue));
  border-color: transparent;
}
.check-item.done .check-svg { stroke-dashoffset: 0; }
.check-title { flex: 1; font-weight: 600; }
.check-meta { color: var(--muted); font-size: 0.78rem; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.check-edit { list-style: none; }

/* ===== Anillo de progreso ===== */
.progress-ring {
  position: relative;
  width: 88px; height: 88px;
  flex-shrink: 0;
}
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 7; }
.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke: var(--purple);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.8));
}
.progress-ring[data-progress] .ring-fill { stroke: var(--purple); }
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
}

/* ===== Calendario ===== */
.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
}
.cal-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.cal-dow {
  text-align: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 4px 0;
}
.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  min-height: 72px;
  padding: 7px 2px 6px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.cal-cell:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--border-hi);
}
.cal-cell:active { transform: scale(0.96); }
.cal-empty { opacity: 0.15; pointer-events: none; }
.cal-day-num {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}
.is-today {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.07);
}
.is-today .cal-day-num {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.7);
}
.cal-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ev-color, var(--purple));
  box-shadow: 0 0 6px var(--ev-color, var(--purple));
}

/* ===== Eventos del mes (desplegables) ===== */
.event-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.event-details {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}
.event-details[open] { border-color: var(--border-hi); }
.event-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.event-summary::-webkit-details-marker { display: none; }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.event-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-date { color: var(--muted); font-size: 0.78rem; }
.event-chevron { color: var(--muted); font-size: 0.8rem; transition: transform 0.2s; }
.event-details[open] .event-chevron { transform: rotate(180deg); }
.event-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 14px 14px;
  font-size: 0.86rem;
  color: var(--muted);
}
.event-body strong { color: var(--text); font-weight: 600; }
.event-notes { color: var(--text); }
.event-actions {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.event-actions form { margin: 0; }
.event-item.is-completed .event-title { color: var(--muted); text-decoration: line-through; }
.event-item.is-completed .dot { opacity: 0.45; }
.event-item.is-completed .event-details { background: rgba(255, 255, 255, 0.012); }
.cal-dot.is-completed { opacity: 0.3; }
.banner-empty {
  text-align: center;
  padding: 16px;
  margin-bottom: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(168, 85, 247, 0.05);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== Eventos del día (modal) ===== */
.day-empty { color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.day-events { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.day-event {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.day-event .dot { margin-top: 5px; }
.day-event-title { font-weight: 600; font-size: 0.95rem; }
.day-event-meta { color: var(--muted); font-size: 0.78rem; }
.day-event-notes { color: var(--muted); font-size: 0.86rem; margin-top: 4px; }
.day-event-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ===== Tareas por prioridad ===== */
.filters { margin-bottom: 18px; }
.task-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.task-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 13px;
  padding: 15px;
  transition: all 0.3s;
  animation: fadeInUp 0.4s ease both;
}
.task-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(124, 58, 237, 0.16);
}
.task-card.is-done { opacity: 0.55; }
.task-card.is-done .task-title { text-decoration: line-through; }
.task-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.task-title { font-size: 1.02rem; font-weight: 700; }
.task-desc { color: var(--muted); font-size: 0.88rem; margin-top: 5px; white-space: pre-wrap; }
.task-due { font-size: 0.78rem; color: var(--muted); }
.task-due.overdue { color: #fca5a5; font-weight: 700; }
.task-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-purple {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.4);
}
.p-high { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.p-medium { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.p-low { background: rgba(34, 197, 94, 0.16); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.s-pending { background: rgba(156, 163, 175, 0.16); color: #d1d5db; border: 1px solid rgba(156, 163, 175, 0.35); }
.s-progress { background: rgba(59, 130, 246, 0.16); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); }
.s-done { background: rgba(34, 197, 94, 0.16); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.text-high { color: #fca5a5; font-weight: 700; }

/* ===== Diario ===== */
.diary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.diary-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
  animation: fadeInUp 0.4s ease both;
}
.diary-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-4px);
  box-shadow: var(--glow-purple);
}
.diary-mood { font-size: 1.5rem; }
.diary-card-title { font-weight: 700; font-size: 0.92rem; }
.diary-card-date { color: var(--muted); font-size: 0.78rem; }

.entry-list { display: flex; flex-direction: column; gap: 12px; }
.entry-row {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 13px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
  animation: fadeInUp 0.4s ease both;
}
.entry-row:hover {
  border-color: var(--border-hi);
  background: rgba(168, 85, 247, 0.07);
  transform: translateX(5px);
}
.entry-mood { font-size: 1.6rem; }
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.entry-preview { color: var(--muted); font-size: 0.87rem; }
.entry-date { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.tag-row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 0.74rem;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 9px;
  border-radius: 999px;
}

.entry-full-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.entry-content {
  font-size: 1.03rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: #dcdcf0;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  animation: fadeInUp 0.5s ease both;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--glow-purple), 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-head h2 { font-size: 1.1rem; }

#day-modal .modal { display: flex; flex-direction: column; }
#day-modal-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: calc(90vh - 190px);
}
body.modal-open { overflow: hidden; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: linear-gradient(135deg, var(--purple-deep), var(--blue));
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--glow-purple);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 200;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 26px 20px 34px;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-105%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.7);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    z-index: 55;
  }
  .sidebar-backdrop[hidden] { display: none; }

  .app-main { margin-left: 0; }

  .mobile-bar { display: none; }

  .bottom-nav {
    display: flex;
    align-items: stretch;
    gap: 2px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    padding: 5px;
    background: rgba(9, 9, 13, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.65);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .bottom-nav::-webkit-scrollbar { display: none; }
  .bn-link {
    position: relative;
    flex: 1 0 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 2px;
    font-size: 0;
    color: var(--muted);
    text-decoration: none;
    border-radius: 15px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    scroll-snap-align: center;
    transition: color 0.2s, background 0.2s, transform 0.12s;
  }
  .bn-link span {
    font-size: 1.7rem;
    line-height: 1;
    transform: translateZ(0);
  }
  .bn-link.active {
    color: var(--purple);
    background: rgba(168, 85, 247, 0.13);
    box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.35);
  }
  .bn-link.active span {
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.9));
  }
  .bn-link:active {
    color: var(--blue);
    background: rgba(168, 85, 247, 0.2);
    transform: scale(0.94);
  }

  .container {
    padding: 22px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  }
  .footer {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .form-row { grid-template-columns: 1fr; }
  .cal-cell { min-height: 52px; padding: 5px 1px 4px; gap: 4px; border-radius: 10px; }
  .cal-dot { width: 5px; height: 5px; }
  .filters .form-inline { flex-direction: column; align-items: stretch; }
  .filters .form-inline select,
  .filters .form-inline .btn { width: 100%; }
  .entry-row { flex-direction: column; gap: 8px; }

  /* Dashboard tipo lanzador */
  .hero { padding: 10px 4px 26px; }
  .container-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .container-hero .hero {
    margin-top: auto;
    margin-bottom: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .container-hero + .footer { display: none; }
  .hero-name { font-size: clamp(2.9rem, 16vw, 4.2rem); letter-spacing: 0.5px; }
  .hero-phrase {
    margin-top: 14px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.55;
  }
  .dash-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; width: 100%; }
  .dash-btn { padding: 15px 6px; gap: 5px; border-radius: 16px; }
  .dash-icon { font-size: 1.8rem; }
  .dash-label { font-size: 0.82rem; letter-spacing: 0; }
  .dash-desc { display: none; }
  .dash-btn-diario {
    width: 100%;
    margin-top: 12px;
    padding: 16px;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
  .dash-btn-diario .dash-icon { font-size: 1.5rem; }
  .dash-btn-diario .dash-label { font-size: 1.02rem; }
  .dash-btn-diario .dash-desc { display: inline; font-size: 0.78rem; }
  .dash-btn:active { transform: scale(0.97); }

  /* Toques nativos */
  .panel { padding: 16px; border-radius: 18px; margin-bottom: 16px; }
  .check-item { padding: 10px 12px; min-height: 52px; gap: 10px; }
  .check-box { width: 28px; height: 28px; }
  .progress-ring { width: 64px; height: 64px; }
  .ring-label { font-size: 0.85rem; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .form input,
  .form select,
  .form textarea,
  .form-inline input,
  .form-inline select,
  .search-form input { font-size: 16px; min-height: 46px; }
  .add-form { gap: 8px; }
  .add-form input[type="text"] { flex: 1 1 100%; min-width: 0; }
  .add-form .btn { flex: 1; }

  /* Selector de fecha en una fila */
  .date-nav { flex-wrap: nowrap; gap: 8px; padding: 10px; }
  .date-nav-center { flex: 1; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; min-width: 0; }
  .date-nav input[type="date"] { flex: 1; min-width: 0; padding: 8px 10px; font-size: 16px; }
  .date-nav > .btn-ghost { font-size: 0; padding: 10px 13px; flex: 0 0 auto; }
  .date-nav > .btn-ghost::before { font-size: 1.15rem; line-height: 1; color: var(--text); }
  .date-nav > .btn-ghost:first-of-type::before { content: '‹'; }
  .date-nav > .btn-ghost:last-of-type::before { content: '›'; }
}

@media (max-width: 760px) {
  .page-head { align-items: flex-start; gap: 14px; }
}
