/* ==========================================================================
   Calculadora de ciclos de sueño y siestas reparadoras - Fijate Tools
   Estilos canónicos: Modelo test-burnout / Fijate UI 2026
   ========================================================================== */

:root {
  --bg-app: #0b0f17;
  --bg-card: #151c28;
  --bg-card-secondary: #1a2332;
  --bg-card-hover: #222d40;
  --border-color: #2b394f;
  --border-subtle: rgba(255, 255, 255, 0.08);

  --text-main: #f0f4f8;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-color: #ff8507;
  --accent-hover: #e07200;
  --accent-glow: rgba(255, 133, 7, 0.25);

  --color-sleep-5: #10b981;
  --color-sleep-6: #059669;
  --color-sleep-4: #06b6d4;
  --color-sleep-3: #f59e0b;
  --color-sleep-danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px -5px rgba(255, 133, 7, 0.35);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-app: #f4f6f9;
  --bg-card: #ffffff;
  --bg-card-secondary: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --border-color: #cbd5e1;
  --border-subtle: rgba(0, 0, 0, 0.06);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.07);
  --shadow-glow: 0 0 20px -5px rgba(255, 133, 7, 0.2);
}

/* Reset y base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  width: 100%;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1240px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr 300px;
  }
}

.tool-main-content {
  min-width: 0;
  width: 100%;
}

/* Migas de pan */
.tool-breadcrumbs {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.tool-breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: 0.5rem;
  color: var(--text-muted);
}

.tool-breadcrumbs-item a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.tool-breadcrumbs-item a:hover {
  color: var(--accent-color);
}

.tool-breadcrumbs-item:not(:last-child)::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--text-dim);
}

.tool-breadcrumbs-item[aria-current="page"] {
  color: var(--text-main);
  font-weight: 500;
}

/* Header badge */
.badge-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Tipografía general */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.font-mono {
  font-family: var(--font-mono);
}

.text-accent {
  color: var(--accent-color);
}

/* Tarjeta Principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .card-main {
    padding: 2.25rem;
  }
}

/* Navegación por pestañas */
.tabs-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  background: var(--bg-card-secondary);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  border: 1px solid var(--border-subtle);
}

@media (min-width: 900px) {
  .tabs-nav {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  min-height: 42px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn svg {
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .tab-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .tab-btn.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Barra de latencia */
.latency-control-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
  .latency-control-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.latency-info-group {
  min-width: 0;
}

.latency-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.latency-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.latency-val-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  background: rgba(255, 133, 7, 0.15);
  color: var(--accent-color);
  border: 1px solid rgba(255, 133, 7, 0.3);
}

.latency-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.latency-chips-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 32px;
}

.chip-btn:hover {
  color: var(--text-main);
  border-color: var(--accent-color);
}

.chip-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #0b0f17;
  font-weight: 700;
}

.btn-icon-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-subtle:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

/* Paneles de pestañas */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero de cada modo */
.mode-hero {
  background: linear-gradient(135deg, var(--bg-card-secondary), rgba(255, 133, 7, 0.05));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.time-clock-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.clock-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.clock-digits {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent-color);
  text-shadow: 0 0 20px rgba(255, 133, 7, 0.3);
  line-height: 1.1;
}

@media (min-width: 768px) {
  .clock-digits {
    font-size: 3.4rem;
  }
}

.clock-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

/* Selector despertador */
.wake-time-selector-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.selector-label {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.wake-input-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 600px) {
  .wake-input-row {
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
}

.styled-time-input, .styled-number-input {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  min-height: 48px;
  width: 100%;
  max-width: 220px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.styled-time-input:focus, .styled-number-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(255, 133, 7, 0.2);
}

.quick-wake-presets {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  width: 100%;
}

.presets-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.preset-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 36px;
}

.preset-pill:hover {
  border-color: var(--accent-color);
  color: var(--text-main);
}

.preset-pill.active {
  background: rgba(255, 133, 7, 0.15);
  border-color: var(--accent-color);
  color: var(--accent-color);
  font-weight: 700;
}

/* Resultados intro */
.results-intro {
  margin-bottom: 1.25rem;
}

.results-title {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.results-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Grid de tarjetas de ciclos */
.cycles-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 680px) {
  .cycles-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cycles-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cycle-card {
  position: relative;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cycle-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.cycle-card.is-recommended {
  border-color: var(--color-sleep-5);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card-secondary) 100%);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.cycle-card.is-optimal {
  border-color: var(--color-sleep-6);
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.08) 0%, var(--bg-card-secondary) 100%);
}

.cycle-card.is-acceptable {
  border-color: var(--color-sleep-4);
}

.cycle-card.is-short {
  border-color: var(--color-sleep-3);
}

.cycle-card.is-danger {
  opacity: 0.85;
}

.card-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cycle-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.badge-recommended {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-optimal {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.35);
}

.badge-acceptable {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-short {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-emergency {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.cycle-count-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cycle-main-time {
  margin-bottom: 0.5rem;
}

.cycle-time-val {
  font-family: var(--font-mono);
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text-main);
}

.is-recommended .cycle-time-val {
  color: #10b981;
}

.is-optimal .cycle-time-val {
  color: #34d399;
}

.cycle-sleep-hours {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.cycle-desc-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 1.1rem;
  line-height: 1.45;
}

.btn-copy-alarm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-alarm:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #0b0f17;
}

/* Modo Siestas */
.naps-selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .naps-selector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.nap-card {
  background: var(--bg-card-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
}

.nap-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
}

.nap-card.active {
  border-color: var(--accent-color);
  background: linear-gradient(180deg, rgba(255, 133, 7, 0.08) 0%, var(--bg-card-secondary) 100%);
  box-shadow: 0 4px 20px rgba(255, 133, 7, 0.15);
}

.nap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.nap-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.badge-cyan { background: rgba(6, 182, 212, 0.2); color: #22d3ee; }
.badge-emerald { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.nap-duration {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.nap-name {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.nap-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.75rem;
  flex-grow: 1;
}

.nap-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.6rem;
}

/* Temporizador */
.nap-timer-panel {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

@media (min-width: 860px) {
  .nap-timer-panel {
    grid-template-columns: 340px 1fr;
    align-items: center;
  }
}

.timer-display-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.timer-circle-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 1.25rem;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: var(--bg-card);
}

.timer-progress {
  fill: none;
  stroke: var(--accent-color);
  stroke-linecap: round;
  stroke-dasharray: 552.92;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s ease;
}

.timer-center-info {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-countdown {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.timer-protocol-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.timer-controls-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.timer-actions-row {
  display: flex;
  gap: 0.6rem;
  width: 100%;
}

.btn-timer-main {
  flex: 1;
}

.timer-extra-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: left;
}

/* Toggle switch */
.toggle-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.toggle-control input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-control input:checked + .toggle-slider {
  background-color: var(--accent-color);
}

.toggle-control input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.btn-text-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.btn-text-action:hover {
  color: var(--accent-color);
}

/* Tarjeta de instrucciones de siesta */
.nap-instructions-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.inst-title {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  color: var(--accent-color);
}

.inst-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.inst-steps-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.inst-steps-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

/* Hipnograma y Canvas */
.hypnogram-section-card, .circadian-clock-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.hypno-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
  .hypno-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.hypno-title {
  font-size: 1.15rem;
}

.hypno-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hypno-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-awake { background: #94a3b8; }
.dot-rem { background: #818cf8; }
.dot-n12 { background: #06b6d4; }
.dot-n3 { background: #10b981; }

.canvas-responsive-container {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 1rem;
}

#hypnogram-canvas {
  width: 100%;
  height: auto;
  min-width: 600px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  display: block;
}

.stage-info-interactive-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
}

.stage-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.status-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.badge-info {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stage-duration-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.stage-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Reloj circadiano */
.circadian-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}

@media (min-width: 860px) {
  .circadian-grid {
    grid-template-columns: 340px 1fr;
  }
}

.canvas-clock-container {
  display: flex;
  justify-content: center;
}

#circadian-canvas {
  width: 320px;
  height: 320px;
  max-width: 100%;
}

.circadian-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-event-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border-left: 3px solid var(--border-color);
  font-size: 0.82rem;
}

.timeline-event-item.highlight-nap {
  border-left-color: var(--accent-color);
  background: rgba(255, 133, 7, 0.07);
}

.event-time {
  font-weight: 700;
  color: var(--accent-color);
  min-width: 90px;
  flex-shrink: 0;
}

.event-body strong {
  color: var(--text-main);
  display: block;
}

.event-body p {
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Botones principales y secundarios */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.35rem;
  background: var(--accent-color);
  color: #0b0f17;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

@media (min-width: 600px) {
  .btn-primary {
    width: auto;
  }
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 15px rgba(255, 133, 7, 0.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.65rem 1.25rem;
  background: var(--bg-card-secondary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 32px;
}

.btn-subtle:hover {
  color: var(--text-main);
  border-color: var(--accent-color);
}

/* Acciones footer de la card */
.app-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 600px) {
  .app-footer-actions button {
    width: 100%;
  }
}

/* Modales */
.app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.app-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 500px;
  padding: 1.75rem;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-modal-box.modal-lg {
  max-width: 680px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.app-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-modal-title {
  font-size: 1.25rem;
}

.app-modal-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.wakeup-tips-box {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.wakeup-tips-box ul {
  list-style: disc inside;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.neuro-info-block {
  margin-top: 1rem;
}

.neuro-info-block h4 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.app-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@media (max-width: 500px) {
  .app-modal-footer {
    flex-direction: column;
  }
  .app-modal-footer button {
    width: 100%;
  }
}

/* Toast */
.app-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--accent-color);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 10000;
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-toast svg {
  color: var(--accent-color);
}

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

/* Controles select responsivos */
select, .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/* Inputs táctiles mínimos */
input[type="time"], input[type="number"], button {
  min-height: 40px;
}
