:root {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --bg-elev-2: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.app-body, .app-body *, .app-body *::before, .app-body *::after,
.pricing-body, .pricing-body *, .pricing-body *::before, .pricing-body *::after,
.rhd-root, .rhd-root *, .rhd-root *::before, .rhd-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Páginas completas (app estática y página de precios): visten el body entero. */
.app-body, .pricing-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, #0f172a, #1e1b4b);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Contenedor de la app cuando va incrustada (p. ej. dentro de WordPress):
   se viste a sí mismo sin tocar el tema que la rodea. */
.rhd-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, #0f172a, #1e1b4b);
  color: var(--text);
  padding: 0.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Centrado robusto del contenido (independiente del tema anfitrión). */
.rhd-root .app-header,
.rhd-root main {
  width: 100%;
  max-width: 640px;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
}

.app-header {
  padding: 1.25rem 1rem 0;
  max-width: 640px;
  margin: 0 auto;
}

.app-header h1 { font-size: 1.5rem; margin-bottom: 1rem; }

.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-elev);
  padding: 0.25rem;
  border-radius: 999px;
}

.tab {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab.is-active { background: var(--primary); color: #fff; }

.rhd-root main { max-width: 640px; margin: 0 auto; padding: 1rem; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade 0.2s ease; }

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

/* ---------- Reloj ---------- */
.clock-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.clock-date { color: var(--text-dim); text-transform: capitalize; font-size: 0.95rem; }

.clock-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.clock-status.working { color: var(--success); }
.clock-status.break { color: var(--warning); }

.clock-timer {
  font-size: 3.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin: 0.25rem 0;
  letter-spacing: 0.02em;
}

.clock-target { color: var(--text-dim); font-size: 0.9rem; min-height: 1.2em; }
.clock-discard { margin-top: 0.75rem; min-height: 1em; }
.clock-discard:empty { margin: 0; }
.linklike {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 0.8rem; text-decoration: underline; padding: 0.25rem;
}
.linklike:hover { color: var(--danger); }

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
  color: #fff;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); color: #1f2937; }
.btn-danger { background: var(--danger); }
.btn-ghost { background: var(--bg-elev-2); color: var(--text); }
.btn-lg { padding: 1.1rem 2.5rem; font-size: 1.15rem; }

/* ---------- Detalle del día ---------- */
.day-detail { margin-top: 1.25rem; }
.day-detail:empty { display: none; }

.event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
}
.event-row .label { color: var(--text-dim); font-size: 0.9rem; }
.event-row .value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Resumen semanal ---------- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.summary-card {
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
}
.summary-card .num { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-card .lbl { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.25rem; }
.summary-card.positive .num { color: var(--success); }
.summary-card.negative .num { color: var(--warning); }

.history-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.history-toolbar h2 { font-size: 1.1rem; }
.history-toolbar .btn { padding: 0.5rem 1rem; font-size: 0.85rem; }

/* ---------- Historial ---------- */
.history-day { margin-bottom: 1.25rem; }
.history-day-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}
.history-day-header .total { color: var(--primary-hover); font-variant-numeric: tabular-nums; }

.session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elev);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.4rem;
}
.session-row .times { font-variant-numeric: tabular-nums; }
.session-row .dur { color: var(--text-dim); font-size: 0.85rem; }
.session-row { cursor: default; }
.row-actions { display: flex; gap: 0.25rem; }
.icon-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1.05rem; padding: 0.3rem; border-radius: 8px;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg-elev-2); }
.icon-btn.del:hover { color: var(--danger); }

.empty-state { text-align: center; color: var(--text-dim); padding: 3rem 1rem; line-height: 1.5; }

/* ---------- Navegación de semanas ---------- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.week-label { font-weight: 700; text-transform: capitalize; }
.btn-icon { padding: 0.4rem 0.9rem; font-size: 1.3rem; line-height: 1; }

.toolbar-actions { display: flex; gap: 0.5rem; }
.toolbar-actions .btn { padding: 0.5rem 0.9rem; font-size: 0.85rem; }

/* ---------- Gráfica semanal ---------- */
.chart-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 0.75rem;
  margin-bottom: 1.5rem;
}
.chart-title { font-size: 0.95rem; color: var(--text-dim); margin-bottom: 1rem; }
.chart-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 150px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: 70%;
  max-width: 32px;
  min-height: 2px;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.3s ease;
}
.chart-bar.met { background: var(--success); }
.chart-bar.today { outline: 2px solid var(--primary-hover); outline-offset: 1px; }
.chart-val { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.25rem; font-variant-numeric: tabular-nums; min-height: 0.9em; }
.chart-day { font-size: 0.75rem; color: var(--text-dim); font-weight: 600; }
.chart-day.today { color: var(--primary-hover); }
.chart-target-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px dashed rgba(245, 158, 11, 0.6);
  pointer-events: none;
}

/* ---------- Selects ---------- */
.field select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--bg-elev-2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 1.2rem; margin-bottom: 1.25rem; }
.field-row { display: flex; gap: 0.75rem; }
.field-row .field { flex: 1; }

.breaks-section { margin-bottom: 1.25rem; }
.breaks-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.breaks-header > span { font-size: 0.9rem; color: var(--text-dim); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.break-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.break-row input { flex: 1; padding: 0.6rem; border-radius: 8px; border: 1px solid var(--bg-elev-2); background: var(--bg); color: var(--text); }
.break-row span { color: var(--text-dim); }

.modal-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }
.modal-actions { display: flex; align-items: center; gap: 0.5rem; }
.modal-actions .spacer { flex: 1; }
.modal-actions .btn { padding: 0.6rem 1.1rem; font-size: 0.9rem; }

/* ---------- Distintivo de jornada manual/editada ---------- */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}
.tag-ok { background: rgba(16, 185, 129, 0.2); color: var(--success); }

/* ---------- Cumplimiento legal ---------- */
.legal-card {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--bg-elev-2);
}
.legal-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.legal-card .hint { margin-bottom: 1rem; }
.report-row { display: flex; gap: 0.75rem; align-items: flex-end; margin: 0.5rem 0 1rem; }
.report-row .field { flex: 1; margin-bottom: 0; }
.report-row .btn { white-space: nowrap; }

.audit { margin-top: 1rem; }
.audit summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--text-dim); padding: 0.4rem 0; }
.audit-log { max-height: 220px; overflow-y: auto; margin-top: 0.5rem; }
.audit-row {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--bg-elev-2);
  font-size: 0.8rem;
}
.audit-when { color: var(--text-dim); font-size: 0.72rem; }
.audit-what { color: var(--text); }

@media (max-width: 420px) {
  .report-row { flex-direction: column; align-items: stretch; }
}

/* ---------- Ajustes ---------- */
.settings-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.field { display: block; margin-bottom: 1.25rem; }
.field span { display: block; font-size: 0.9rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--bg-elev-2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.hint { color: var(--text-dim); font-size: 0.85rem; line-height: 1.4; }
.field-check { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; }
.field-check input { width: auto; }
.field-check span { margin: 0; }
.dur .geo { text-decoration: none; }

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.settings-actions .btn { padding: 0.6rem 1rem; font-size: 0.85rem; }

.pro-teaser {
  margin-top: 1rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79,70,229,0.25), rgba(99,102,241,0.1));
  border: 1px solid rgba(99,102,241,0.4);
}
.pro-teaser h3 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.badge {
  font-size: 0.65rem;
  background: var(--warning);
  color: #1f2937;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}
.pro-teaser ul { list-style: none; margin-bottom: 1rem; }
.pro-teaser li { padding: 0.35rem 0; font-size: 0.9rem; color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 50;
  font-size: 0.9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =========================================================================
 * Página de precios (precios.html)
 * ========================================================================= */
.pricing-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1000px; margin: 0 auto; padding: 1rem;
}
.pricing-header .brand { font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.pricing-header .btn { padding: 0.5rem 1rem; font-size: 0.85rem; text-decoration: none; }

.pricing-main { max-width: 1000px; margin: 0 auto; padding: 1rem; }

.pricing-hero { text-align: center; padding: 2rem 1rem 2.5rem; }
.pricing-hero h1 { font-size: 2rem; line-height: 1.2; }
.pricing-hero h1 span { color: var(--primary-hover); }
.pricing-hero p { color: var(--text-dim); max-width: 620px; margin: 0.75rem auto 0; line-height: 1.5; }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.plan {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--bg-elev-2);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}
.plan-featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.ribbon {
  position: absolute; top: -0.7rem; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0.25rem 0.75rem; border-radius: 999px;
}
.plan h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.plan .price { margin-bottom: 1.25rem; }
.plan .amount { font-size: 2rem; font-weight: 800; }
.plan .per { color: var(--text-dim); font-size: 0.85rem; margin-left: 0.25rem; }
.plan ul { list-style: none; margin-bottom: 1.5rem; }
.plan li { padding: 0.4rem 0; font-size: 0.92rem; line-height: 1.4; }
.btn-block { display: block; width: 100%; text-align: center; text-decoration: none; box-sizing: border-box; }

.compare { margin: 3rem 0; }
.compare h2, .faq h2 { text-align: center; margin-bottom: 1.25rem; }
.compare table { width: 100%; border-collapse: collapse; background: var(--bg-elev); border-radius: var(--radius); overflow: hidden; }
.compare th, .compare td { padding: 0.75rem 1rem; text-align: center; border-bottom: 1px solid var(--bg-elev-2); }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare thead th { background: var(--bg-elev-2); font-size: 0.85rem; }

.faq { margin: 3rem 0; max-width: 720px; margin-left: auto; margin-right: auto; }
.faq details { background: var(--bg-elev); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 0.6rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--text-dim); margin-top: 0.6rem; line-height: 1.5; }

.pricing-footer { text-align: center; color: var(--text-dim); padding: 2rem 1rem; font-size: 0.85rem; }
.pricing-footer a { color: var(--primary-hover); }

@media (max-width: 760px) {
  .plans { grid-template-columns: 1fr; }
  .pricing-hero h1 { font-size: 1.6rem; }
}
