/* ============================================================
   Sabr — diseño oscuro, serio, estoico. Un solo acento: oro/ámbar.
   ============================================================ */
:root {
  --bg:        #0d0f12;
  --bg-soft:   #14171c;
  --card:      #181c22;
  --card-2:    #1f242b;
  --line:      #2a2f37;
  --text:      #e8e6e1;
  --text-dim:  #9aa0a8;
  --text-faint:#646a73;
  --gold:      #c8923a;
  --gold-soft: #e0b06a;
  --green:     #6fae6f;
  --red:       #cf6b5e;
  --radius:    16px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

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

/* ---------- Iconos de línea (SVG) ---------- */
.ic-svg {
  width: 1em; height: 1em; display: inline-block;
  vertical-align: -0.14em; flex: 0 0 auto;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.5;
  padding-bottom: calc(72px + var(--safe-b));
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 30px; color: var(--gold);
  font-family: "Times New Roman", serif;
  line-height: 1;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.motto { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.sev-badge {
  background: var(--card); color: var(--gold);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}

/* ---------- Layout ---------- */
.view { padding: 4px 16px 24px; max-width: 620px; margin: 0 auto; }
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-faint); margin: 22px 4px 10px;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}

/* ---------- Coach banner ---------- */
.coach {
  background: linear-gradient(135deg, #1d1812, #15130f);
  border: 1px solid #3a2f1c;
  border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.coach .who { font-size: 12px; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.coach p { font-size: 15.5px; color: var(--text); }
.coach.alert { border-color: var(--red); background: linear-gradient(135deg, #231413, #181010); }
.coach.alert .who { color: var(--red); }

/* ---------- Tareas ---------- */
.task {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.task.done { opacity: .55; }
.task .check {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--gold); flex: 0 0 auto;
  display: grid; place-items: center; cursor: pointer;
  color: var(--bg); font-size: 15px; font-weight: 700;
}
.task.done .check { background: var(--gold); }
.task .body { flex: 1; min-width: 0; }
.task .txt { font-size: 16px; }
.task.done .txt { text-decoration: line-through; }
.task .goal-tag { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.task .del { color: var(--text-faint); background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; }

.slot-empty {
  border: 1px dashed var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; color: var(--text-faint);
  font-size: 15px; text-align: center;
}

/* progreso del día */
.dayhead { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 4px 14px; }
.dayhead .date { font-size: 14px; color: var(--text-dim); }
.dayhead .count { font-size: 14px; color: var(--gold); font-weight: 600; }

/* ---------- Inputs / botones ---------- */
.field { display: flex; gap: 8px; margin-top: 10px; }
input[type=text], select, input[type=number] {
  flex: 1; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; font-family: inherit;
}
input::placeholder { color: var(--text-faint); }
.btn {
  background: var(--gold); color: #1a1206; border: none;
  border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn.full { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: .4; }

/* ---------- Metas ---------- */
.goal {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.goal .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
.goal .name { flex: 1; font-size: 16px; }
.goal.archived { opacity: .45; }

/* ---------- Hábitos ---------- */
.habit {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.habit .check {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  border: 2px solid var(--line); display: grid; place-items: center;
  cursor: pointer; font-size: 17px; color: var(--bg);
}
.habit .check.on { background: var(--green); border-color: var(--green); }
.habit .name { flex: 1; font-size: 16px; }
.habit .streak { font-size: 14px; color: var(--gold); font-weight: 700; white-space: nowrap; text-align: center; }
.habit .streak .flame { margin-right: 3px; }
.habit .streak small { color: var(--text-faint); font-weight: 400; }
.habit.warn { border-color: var(--red); }
.fail-flag { font-size: 12px; color: var(--red); margin-top: 2px; }

/* ---------- Respiración ---------- */
.breathe-wrap { text-align: center; padding: 24px 0 8px; }
.breathe-circle {
  width: 220px; height: 220px; margin: 24px auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2a2014, #15130f);
  border: 2px solid var(--gold);
  transform: scale(0.7);
  display: grid; place-items: center;
  box-shadow: 0 0 60px -10px rgba(200,146,58,.4);
}
.breathe-label { font-size: 26px; color: var(--gold); font-weight: 600; }
.breathe-counter { color: var(--text-dim); font-size: 14px; margin-top: 6px; }

/* ---------- Lecciones ---------- */
.lesson { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.lesson h3 { font-size: 16px; margin-bottom: 4px; }
.lesson .src { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.lesson p { font-size: 14.5px; color: var(--text-dim); }

/* ---------- Ajustes ---------- */
.row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .lbl { font-size: 15px; }
.row .sub { font-size: 12px; color: var(--text-faint); }
.seg { display: flex; gap: 6px; }
.seg button { background: var(--bg-soft); color: var(--text-dim); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.seg button.on { background: var(--gold); color: #1a1206; border-color: var(--gold); font-weight: 700; }
.switch { width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; border: none; }
.switch.on { background: var(--green); }
.switch::after { content:""; position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%; background:#fff; transition: left .2s; }
.switch.on::after { left: 23px; }

.hint { font-size: 12.5px; color: var(--text-faint); margin: 8px 4px; line-height: 1.6; }
.empty { text-align: center; color: var(--text-faint); padding: 30px 10px; font-size: 14px; }

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: rgba(13,15,18,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 10.5px; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 2px 8px;
}
.tab span { font-size: 19px; line-height: 1; }
.tab.active { color: var(--gold); }

/* ---------- onboarding ---------- */
.onb { max-width: 480px; margin: 8vh auto; padding: 0 20px; text-align: center; }
.onb .big { font-size: 40px; color: var(--gold); font-family:"Times New Roman",serif; }
.onb h2 { font-size: 24px; margin: 10px 0; }
.onb p { color: var(--text-dim); margin-bottom: 18px; }

@media (min-width: 560px) { .tab span { font-size: 20px; } }

/* ============================================================
   AHORA — tarjeta en vivo (lo que toca hacer en este momento)
   ============================================================ */
.now {
  border-radius: 20px; padding: 20px; margin-bottom: 16px;
  background: linear-gradient(150deg, #1b1f26, #121419);
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.now.phone-bad { border-color: var(--red); }
.now .now-kick { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-faint); }
.now .now-title { font-size: 26px; font-weight: 800; margin: 6px 0 2px; display: flex; align-items: center; gap: 10px; line-height: 1.15; }
.now .now-title .ic { font-size: 26px; }
.now .now-range { font-size: 14px; color: var(--text-dim); }
.now .now-remain { font-size: 14px; color: var(--gold); font-weight: 700; margin-top: 2px; }
.now .pbar { height: 8px; border-radius: 999px; background: var(--bg-soft); margin: 14px 0 6px; overflow: hidden; }
.now .pbar > i { display: block; height: 100%; border-radius: 999px; background: var(--gold); transition: width .6s; }
.now .now-actions { display: flex; gap: 8px; margin-top: 14px; }
.now .now-actions .btn { flex: 1; }

.phone-line {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 14px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.phone-line .pic { font-size: 22px; flex: 0 0 auto; color: var(--green); line-height: 0; }
.phone-line .ptxt { font-size: 13.5px; color: var(--text-dim); }
.now.phone-bad .phone-line { background: rgba(207,107,94,.08); border-color: #5a302b; }
.now.phone-bad .phone-line .pic { color: var(--red); }
.now.phone-bad .phone-line .ptxt { color: #e9c3bd; }
.now .now-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }

/* ============================================================
   LÍNEA DE TIEMPO del día
   ============================================================ */
.timeline { margin-top: 4px; }
.tl {
  display: flex; gap: 12px; padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  align-items: center;
}
.tl.past { opacity: .45; }
.tl.cur { border-color: var(--gold); background: linear-gradient(135deg,#1d1812,#16140f); }
.tl .tl-time { font-size: 12.5px; color: var(--text-dim); width: 58px; flex: 0 0 auto; line-height: 1.3; }
.tl .tl-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: 0 0 auto; }
.tl .tl-body { flex: 1; min-width: 0; }
.tl .tl-title { font-size: 15px; }
.tl .tl-type { font-size: 11.5px; color: var(--text-faint); }
.tl .tl-now { font-size: 10px; color: var(--gold); font-weight: 800; letter-spacing: 1px; }

/* ============================================================
   PLAN — editor de cronograma
   ============================================================ */
.weekchips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.weekchips button {
  flex: 0 0 auto; background: var(--bg-soft); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px;
  font-size: 13px; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.weekchips button.on { background: var(--gold); color: #1a1206; border-color: var(--gold); font-weight: 700; }
.weekchips button.istoday::after { content: " •"; color: var(--gold); }
.weekchips button.on.istoday::after { color: #1a1206; }

.block {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 9px;
}
.block .b-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: 0 0 auto; }
.block .b-body { flex: 1; min-width: 0; }
.block .b-time { font-size: 13px; color: var(--gold); font-weight: 600; }
.block .b-title { font-size: 15px; }
.block .b-type { font-size: 11.5px; color: var(--text-faint); }

.block-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.block-form .full2 { grid-column: 1 / -1; }
input[type=time] { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 15px; font-family: inherit; }

/* ============================================================
   MODAL (respiración)
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 24px; padding: 18px; width: 100%; max-width: 380px; }
