:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1b1d24;
  --muted: #6b7080;
  --border: #e1e4ec;
  --accent: #4f6bed;
  --accent-soft: #e4e9fd;
  --danger: #d9463b;
  --ok: #2e9e5b;
  --warn: #d98b1b;
  --c-clase: #4f6bed;
  --c-estudio: #8b5cf6;
  --c-entreno: #2e9e5b;
  --c-examen: #d9463b;
  --c-otro: #7a8090;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 24, 40, .08);
  --on-accent: #ffffff;
  --on-ok: #ffffff;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --font-num: var(--font-body);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --surface: #1b1e25; --surface-2: #252932; --text: #eceef3; --muted: #9aa0ae;
    --border: #2e333d; --accent: #7b92ff; --accent-soft: #263058; --shadow: none; --on-accent: #0f1420; color-scheme: dark;
    --c-clase: #7b92ff; --c-estudio: #a98bfa; --c-entreno: #4cc47e; --c-examen: #f06a5f; --c-otro: #9aa0ae;
  }
}
:root[data-theme="dark"] {
  --bg: #111318; --surface: #1b1e25; --surface-2: #252932; --text: #eceef3; --muted: #9aa0ae;
  --border: #2e333d; --accent: #7b92ff; --accent-soft: #263058; --shadow: none; --on-accent: #0f1420; color-scheme: dark;
  --c-clase: #7b92ff; --c-estudio: #a98bfa; --c-entreno: #4cc47e; --c-examen: #f06a5f; --c-otro: #9aa0ae;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font-body);
  display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: currentColor; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px;
  background: var(--bg);
}
.topbar h1 { font-size: 22px; margin: 0; font-weight: 700; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 50%; color: var(--muted); cursor: pointer; }
.icon-btn:active { background: var(--surface-2); }

main { flex: 1; overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 150px); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: 8px 0 10px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; cursor: pointer; min-width: 0;
}
.tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tabbar button.active { color: var(--accent); font-weight: 600; }

.card { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 2px 8px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--surface-2); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 6;
  width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 14px rgba(0,0,0,.2); font-size: 30px; line-height: 1; cursor: pointer;
}

.field { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
label.field > input, label.field > select, label.field > textarea { margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 15px; font-weight: 400;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }

/* Calendario */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { margin: 0; font-size: 17px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.cal-grid .dow { font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-day { aspect-ratio: 1 / 1.05; border: 0; background: none; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; font-size: 14px; position: relative; }
.cal-day.other { color: var(--muted); opacity: .45; }
.cal-day.today .n { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cal-day.sel .n { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-day .n { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cal-day.study { background: color-mix(in srgb, var(--warn) 13%, transparent); border-radius: 0; }
.cal-day.study.wk-start { border-radius: 10px 0 0 10px; } .cal-day.study.wk-end { border-radius: 0 10px 10px 0; }
.cal-day.other .dots { visibility: hidden; }
.dots { display: flex; gap: 2px; margin-top: 3px; height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }

.event { display: flex; gap: 12px; align-items: stretch; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; }
.event .bar { width: 4px; border-radius: 3px; }
.event .time { font-size: 13px; color: var(--muted); min-width: 50px; }
.event .t { font-weight: 600; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; color: #fff; }

.cat-clase { background: var(--c-clase); } .cat-estudio { background: var(--c-estudio); }
.cat-entreno { background: var(--c-entreno); } .cat-examen { background: var(--c-examen); } .cat-otro { background: var(--c-otro); }

/* Ideas */
.idea-input { display: flex; gap: 8px; align-items: flex-end; }
.idea-input textarea { min-height: 48px; }
.mic { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mic.rec { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,70,59,.5); } 100% { box-shadow: 0 0 0 14px rgba(217,70,59,0); } }
.idea { padding: 12px 14px; }
.idea .txt { white-space: pre-wrap; word-wrap: break-word; }
.idea.done .txt { text-decoration: line-through; color: var(--muted); }

/* Hábitos */
.habit-top { display: flex; align-items: center; gap: 12px; }
.check { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: none; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; color: transparent; }
.check.on { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.streak { font-weight: 700; font-size: 13px; color: var(--warn); white-space: nowrap; }
.mini-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; margin-top: 10px; }
.mini-days span { height: 8px; border-radius: 3px; background: var(--surface-2); }
.mini-days span.on { background: var(--ok); }
.mini-days span.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.banner { border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.banner.info { background: var(--accent-soft); }
.law { border-left: 3px solid var(--accent); padding-left: 10px; margin-top: 8px; }
.law b { font-size: 12.5px; color: var(--accent); display: block; }

/* Estudio */
.week-nav { display: flex; align-items: center; justify-content: space-between; }
.week-nav h2 { margin: 0; font-size: 16px; text-align: center; }
.day-card .dname { font-weight: 700; white-space: nowrap; }
.day-card .link { white-space: nowrap; }
.fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.fields label span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fields label { font-size: 11.5px; color: var(--muted); font-weight: 600; display: block; }
.fields input { padding: 8px; text-align: center; margin-top: 3px; }
.stress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.stress input[type=range] { flex: 1; accent-color: var(--accent); }
.stress input[type=range].unset { accent-color: var(--border); opacity: .7; }
.stress .val { font-weight: 700; min-width: 24px; text-align: right; }
.yn { display: flex; gap: 6px; }
.yn button { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-weight: 600; }
.yn button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.avg-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.avg-grid .v { font-size: 20px; font-weight: 700; }
.avg-grid .l { font-size: 11px; color: var(--muted); white-space: nowrap; }
.avg-grid .v small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 1px; }
.done-badge { font-size: 12px; color: var(--ok); font-weight: 700; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; cursor: pointer; font-size: 13px; }

/* Sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--surface);
  border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 20px);
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .grab { width: 44px; height: 5px; background: var(--border); border-radius: 3px; margin: 2px auto 12px; box-shadow: 0 0 0 10px transparent; }
.sheet h2 { margin: 0 0 14px; font-size: 19px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.hidden { display: none !important; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 84px);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; font-size: 14px; max-width: 90%;
}
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
details summary { cursor: pointer; font-weight: 600; }

/* =====================================================================
   Pantalla ancha (ordenador / tablet): barra lateral y columnas
   ===================================================================== */
.brand, .tabbar kbd { display: none; }
@media (min-width: 900px) {
  body { padding-left: 220px; }
  .topbar { padding: 22px 32px 8px; max-width: 1180px; }
  .topbar h1 { font-size: 26px; }
  main { padding: 8px 32px 48px; max-width: 1180px; width: 100%; }

  .tabbar {
    top: 0; bottom: 0; right: auto; width: 220px; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--border); padding: 22px 12px; gap: 4px;
  }
  .brand { display: block; font-size: 20px; font-weight: 800; padding: 0 12px 20px; letter-spacing: -.01em; }
  .tabbar button {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14.5px;
    padding: 10px 12px; border-radius: 10px; width: 100%;
  }
  .tabbar button:hover { background: var(--surface-2); }
  .tabbar button.active { background: var(--accent-soft); }
  .tabbar kbd {
    display: inline-block; margin-left: auto; font: 600 11px/1 ui-monospace, monospace; color: var(--muted);
    border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px;
  }

  .fab { bottom: 28px; right: 32px; }
  .toast { bottom: 28px; left: calc(50% + 110px); }

  /* Calendario: mes a la izquierda, agenda del día a la derecha */
  .cal-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .cal-right { position: sticky; top: 0; }
  .cal-right .section-title { margin-top: 4px; }
  .cal-day { aspect-ratio: 1 / .8; }
  .cal-day:hover { background: var(--surface-2); }
  .event:hover { border-color: var(--accent); }

  /* Hábitos e ideas en rejilla */
  .habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
  .habit-grid .card { margin-bottom: 0; }
  #view > .card:first-child:has(#idea-text) { max-width: 720px; }
  .idea { max-width: 720px; }

  /* Estudio: días en 2-3 columnas */
  .days-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  .days-grid .card { margin-bottom: 0; }

  /* Paneles como ventana centrada en vez de hoja inferior */
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 48px)); max-height: 86vh; border-radius: 18px; padding: 20px 24px 24px;
    animation: pop .16s ease-out;
  }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }
  .sheet .grab { display: none; }
  .btn:hover { filter: brightness(.96); }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* =====================================================================
   Asistente
   ===================================================================== */
.ai-log { display: flex; flex-direction: column; gap: 8px; padding-bottom: 84px; }
.ai-msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; position: relative; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; padding-right: 38px; }
.ai-replay { position: absolute; right: 6px; bottom: 6px; border: 0; background: none; cursor: pointer; font-size: 13px; opacity: .55; padding: 2px; }
.ai-replay:hover { opacity: 1; }
.ai-action { align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 5px 11px; border-radius: 999px; }
.ai-error { align-self: stretch; font-size: 13px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 9px 12px; border-radius: 12px; }
.ai-msg.typing { display: flex; gap: 4px; padding: 14px 16px; }
.ai-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.ai-msg.typing span:nth-child(2) { animation-delay: .2s; } .ai-msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ai-empty { text-align: center; color: var(--muted); padding: 24px 4px 0; }
.ai-empty p { margin: 18px 0 16px; font-size: 15px; }
.ai-orb { width: 96px; height: 96px; margin: 8px auto 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 35%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 70%, #000));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 40%, transparent); animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.ai-sugg { justify-content: center; }
.ai-sugg .chip { text-align: left; }

.ai-bar {
  position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 62px); z-index: 4;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--bg);
}
.ai-input { flex: 1; }
.ai-input input { width: 100%; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 15px; }
.ai-mic { width: 52px; height: 52px; }
.ai-mic:disabled, .ai-input input:disabled { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .ai-orb, .ai-msg.typing span { animation: none; } }
@media (min-width: 900px) {
  .ai { max-width: 760px; }
  .ai-bar { left: 220px; bottom: 0; padding: 14px 32px 20px; max-width: 824px; }
}

/* =====================================================================
   Alarmas
   ===================================================================== */
.top-actions { display: flex; align-items: center; gap: 2px; }
.alarm-btn { display: flex; align-items: center; gap: 4px; border-radius: 999px; padding: 7px 9px; }
.alarm-btn #alarm-badge { font: 600 12.5px/1 ui-monospace, "SF Mono", monospace; color: var(--text); font-variant-numeric: tabular-nums; }
.alarm-btn #alarm-badge:empty { display: none; }
.alarm-btn.on { color: var(--accent); background: var(--accent-soft); }
.desk-only { display: none !important; }
@media (min-width: 900px) { .desk-only { display: flex !important; } .alarm-btn { display: none; } }

.alarm-hero { text-align: center; padding: 22px 14px; background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.alarm-hero-time { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.alarm-card { display: flex; flex-direction: column; gap: 8px; }
.alarm-card.off .alarm-time, .alarm-card.off .alarm-tasks { opacity: .45; }
.alarm-main { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; flex: 1; min-width: 0; }
.alarm-time { font-size: 38px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.alarm-tasks { display: flex; flex-wrap: wrap; gap: 6px; }
.task-pill { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.alarm-time-input { font-size: 44px !important; font-weight: 750; text-align: center; padding: 10px !important; font-variant-numeric: tabular-nums; }

/* Interruptor */
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.task-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.task-row { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 12px; padding: 10px; }
.task-row .grow { display: flex; flex-direction: column; }
.task-row input, .task-row select { margin-top: 6px; background: var(--surface); width: 100%; }
.task-ico { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; line-height: 1.3; }
.task-name { font-weight: 600; font-size: 14px; }
.task-btns { display: flex; gap: 2px; }
.task-btns .ib { width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.task-btns .ib:disabled { opacity: .3; cursor: default; }
.task-btns .ib:not(:disabled):hover { background: var(--surface); color: var(--text); }
.task-option { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 12px; cursor: pointer; color: var(--text); }
.task-option:hover { border-color: var(--accent); }

/* Pantalla de alarma sonando */
.alarm-ring {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 40px) 24px calc(env(safe-area-inset-bottom) + 36px);
  background: radial-gradient(120% 80% at 50% 35%, #2c3a8f 0%, #141a3a 55%, #0b0e1f 100%); color: #fff;
}
.ring-label { font-size: 20px; font-weight: 700; opacity: .9; text-align: center; }
.ring-center { position: relative; display: flex; flex-direction: column; align-items: center; }
.ring-clock { font-size: clamp(72px, 24vw, 128px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.ring-date { font-size: 17px; opacity: .75; position: relative; z-index: 1; }
.ring-pulse { position: absolute; top: 50%; left: 50%; width: 260px; height: 260px; margin: -150px 0 0 -130px; border-radius: 50%; background: radial-gradient(circle, rgba(123,146,255,.45), rgba(123,146,255,0) 70%); animation: ringpulse 1.6s ease-out infinite; }
@keyframes ringpulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.ring-actions { display: flex; flex-direction: column; gap: 12px; width: min(100%, 360px); }
.ring-btn { border: 0; border-radius: 999px; padding: 18px; font-size: 18px; font-weight: 700; cursor: pointer; }
.ring-btn.snooze { background: rgba(255,255,255,.14); color: #fff; }
.ring-btn.stop { background: #fff; color: #141a3a; }

/* Resumen al apagar */
.alarm-brief { position: fixed; inset: 0; z-index: 49; overflow-y: auto; background: var(--bg); padding: calc(env(safe-area-inset-top) + 28px) 16px calc(env(safe-area-inset-bottom) + 24px); }
.brief-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.brief-hello { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.brief-date { color: var(--muted); margin-top: -8px; }
.brief-cards { display: flex; flex-direction: column; gap: 10px; }
.brief-card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; animation: up .3s ease-out both; }
.brief-ico { font-size: 26px; line-height: 1; }
.brief-title { font-weight: 700; margin-bottom: 4px; }
.brief-body { color: var(--text); font-size: 14.5px; }
.brief-row { display: grid; grid-template-columns: 8px 46px 1fr; align-items: baseline; gap: 8px; padding: 2px 0; }
.brief-row .dot { align-self: center; }
.brief-time { font-variant-numeric: tabular-nums; }
.brief-big { font-size: 28px; font-weight: 800; margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .ring-pulse, .brief-card { animation: none; } }
.topbar h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   Piezas visuales nuevas
   ===================================================================== */
/* Iconos por tipo */
.cat-badge { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); align-self: center; }
.event .cat-badge { margin-right: -2px; }
.legend-item .cat-ico { flex-shrink: 0; }

/* Pantallas vacías */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 16px 26px; color: var(--muted); }
.empty-state .illu { width: 150px; height: auto; margin-bottom: 6px; }
.empty-state b { color: var(--text); font-size: 16px; }
.empty-state span { max-width: 34ch; font-size: 14px; }

/* Hoy */
.today-head { margin: 2px 2px 12px; }
.today-date { color: var(--muted); font-size: 13px; font-weight: 600; }
.today-hello { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hero { position: relative; overflow: hidden; border: 0; color: var(--text); background: linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--surface)), var(--surface) 75%); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, var(--border)); }
.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, transparent); }
.hero-lbl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--c); }
.hero-big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 2px; position: relative; z-index: 1; }
.hero-sub { font-size: 13px; color: var(--muted); position: relative; z-index: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.tile { display: flex; align-items: center; gap: 10px; margin: 0; text-align: left; cursor: pointer; color: var(--text); font: inherit; min-width: 0; }
.tile.col { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
.tile:first-child { flex-direction: column; align-items: flex-start; gap: 4px; }
.tile:first-child .ring { width: 50px; height: 50px; }
.tile .ring { width: 58px; height: 58px; flex-shrink: 0; }
.tile-lbl { font-size: 12px; font-weight: 700; color: var(--muted); }
.tile-big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--muted); }
.tile.study { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warn) 55%, transparent); }
.timeline { padding: 6px; }
.tl-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none; border-radius: 10px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tl-item:hover { background: var(--surface-2); }
.tl-item.past { opacity: .45; }
.tl-item.now { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tl-time { width: 44px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tl-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-now { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
.idea-quick { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; }
.idea-quick input { border: 0; background: none; padding: 8px 0; }
.idea-quick input:focus { outline: none; }
.idea-quick .mic { width: 40px; height: 40px; }

/* Mapas de calor */
.heat { --cell: 14px; display: grid; grid-template-rows: repeat(7, var(--cell)); grid-auto-flow: column; gap: 3px; margin-top: 10px; justify-content: start; max-width: 100%; overflow-x: auto; }
.heat-strip { display: grid; grid-template-columns: repeat(21, 1fr); gap: 3px; margin-top: 10px; }
.heat-strip .hm { aspect-ratio: auto; height: 10px; }
.hm { display: block; border-radius: 3px; background: var(--surface-2); min-width: 0; }
.hm.l1 { background: color-mix(in srgb, var(--ok) 35%, var(--surface-2)); }
.hm.l2 { background: color-mix(in srgb, var(--ok) 65%, var(--surface-2)); }
.hm.l3 { background: var(--ok); }
.hm.ln { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.hm.lf { background: transparent; }
.hm.now { outline: 2px solid var(--accent); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.heat-legend .hm { width: 11px; height: 11px; }

.const-card { margin-bottom: 12px; }

/* Medalla y confeti */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.medal { text-align: center; padding: 8px 4px; }
.medal-ico { font-size: 72px; line-height: 1; margin: 6px 0 10px; animation: medal .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes medal { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }

/* Calendario: selector y semana */
.cal-switch { margin-bottom: 10px; max-width: 260px; }
.wk-nav { margin: 2px 0 8px; }
.wk { padding: 8px 6px; }
.wk-grid { display: grid; grid-template-columns: 30px repeat(7, minmax(0, 1fr)); gap: 0 3px; }
.wk-head { position: sticky; top: 0; z-index: 2; padding-bottom: 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.wk-day { border: 0; background: none; color: var(--muted); font: inherit; display: flex; flex-direction: column; align-items: center; padding: 3px 0; border-radius: 8px; cursor: pointer; }
.wk-day b { color: var(--text); font-size: 15px; }
.wk-day.today b { color: var(--on-accent); background: var(--accent); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; }
.wk-day.study { background: color-mix(in srgb, var(--warn) 13%, transparent); }
.wk-h0 { font-size: 10px; color: var(--muted); padding-top: 6px; }
.wk-allday { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; min-width: 0; }
.wk-chip { border: 0; border-radius: 6px; padding: 2px 4px; font: 600 10.5px/1.2 inherit; color: var(--text); background: color-mix(in srgb, var(--c) 22%, var(--surface)); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.wk-scroll { max-height: 62vh; overflow-y: auto; }
.wk-body { position: relative; padding-top: 6px; }
.wk-hours { position: relative; }
.wk-h { position: absolute; left: 0; right: 4px; font-size: 10px; color: var(--muted); text-align: right; transform: translateY(-6px); font-variant-numeric: tabular-nums; }
.wk-col { position: relative; background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--h)); border-radius: 4px; cursor: copy; }
.wk-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.wk-ev { position: absolute; left: 1px; right: 1px; border: 0; border-left: 3px solid var(--c); border-radius: 6px; padding: 3px 3px 3px 4px; font: 600 10.5px/1.15 inherit; text-align: left; color: var(--text); background: color-mix(in srgb, var(--c) 20%, var(--surface)); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.wk-ev .cat-ico { color: var(--c); flex-shrink: 0; }
.wk-ev span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; }
.wk-now { position: absolute; left: -2px; right: 0; height: 2px; background: var(--danger); z-index: 1; }
.wk-now::before { content: ""; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* Gráficas */
.charts { display: flex; flex-direction: column; gap: 6px; }
.charts .seg button { font-size: 12.5px; padding: 7px 2px; }
.chart { margin: 6px 0 0; }
.chart figcaption { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 10px; }
.ch-val { fill: var(--text); font-size: 10.5px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.ch-bar rect { fill: var(--accent); }
.ch-bar rect.hit { fill: transparent; }
.ch-bar:hover rect:not(.hit), .ch-bar.hl rect:not(.hit) { fill: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.ch-bar:hover .ch-val, .ch-bar.hl .ch-val, .ch-bar:focus-within .ch-val { opacity: 1; }
.ch-bar .ch-val { opacity: .9; }
.ch-na { fill: var(--muted); font-size: 12px; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.dot-mark { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.ch-pt:hover .dot-mark { r: 6; }
.chart .ch-val:last-of-type { opacity: 1; }
.ch-table summary { cursor: pointer; color: var(--muted); }
.ch-table table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.ch-table th, .ch-table td { border-bottom: 1px solid var(--border); padding: 4px 2px; text-align: center; }

/* Jarvis: orbe con estados */
.ai-orb { position: relative; }
.ai-orb .orb-ring { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); opacity: 0; }
.ai-orb .orb-wave { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3px; opacity: 0; }
.ai-orb .orb-wave i { width: 4px; height: 10px; border-radius: 3px; background: #fff; animation: wave 0.9s ease-in-out infinite; }
.ai-orb .orb-wave i:nth-child(2n) { animation-delay: .15s; } .ai-orb .orb-wave i:nth-child(3n) { animation-delay: .3s; } .ai-orb .orb-wave i:nth-child(4n) { animation-delay: .45s; }
@keyframes wave { 50% { height: 34px; } }
.ai-orb.listening { animation: none; transform: scale(1.08); }
.ai-orb.listening .orb-wave, .ai-orb.speaking .orb-wave { opacity: 1; }
.ai-orb.listening .orb-ring { opacity: 1; animation: ripple 1.4s ease-out infinite; } .ai-orb.listening .orb-ring.r2 { animation-delay: .7s; }
@keyframes ripple { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
.ai-orb.thinking .orb-ring { opacity: 1; border-color: transparent; border-top-color: var(--accent); border-right-color: color-mix(in srgb, var(--accent) 40%, transparent); animation: spin .9s linear infinite; }
.ai-orb.thinking .orb-ring.r2 { inset: -20px; animation-duration: 1.6s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-orb-lbl { font-weight: 700; color: var(--accent); margin-top: 10px; }
.ai-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 2px 4px 10px; }
.orb-sm { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); position: relative; }
.ai-status.listening .orb-sm { animation: breathe .8s ease-in-out infinite; }
.ai-status.thinking .orb-sm::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent); animation: spin .8s linear infinite; }
.ai-status.speaking .orb-sm { animation: breathe .5s ease-in-out infinite; }
.ai-status .link { margin-left: auto; }
.mini-orb { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 35%, #fff), var(--accent) 65%); position: relative; }
.mini-orb.thinking::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* Alarmas: instrucciones */
.jarvis-box { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.jarvis-box textarea { background: var(--surface); }
.jarvis-box .mic { width: 44px; height: 44px; }
.chips.sugg { margin-top: 6px; }
.chips.sugg .chip { text-align: left; font-size: 12.5px; }
.alarm-prompt { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.4; }
.jv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 4px; }
.brief-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.brief-actions:empty { display: none; }
.jarvis-card .brief-ico { display: grid; place-items: center; }

@media (prefers-reduced-motion: reduce) {
  .ai-orb, .ai-orb *, .orb-sm, .orb-sm::after, .mini-orb::after, .medal-ico { animation: none !important; }
}
@media (min-width: 900px) {
  .tiles { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .tile:first-child { flex-direction: row; align-items: center; }
  .heat { --cell: 16px; }
  #view > .today-head, #view > .hero { max-width: none; }
  .wk-scroll { max-height: calc(100vh - 260px); }
  .charts { max-width: 720px; }
}

@media (max-width: 520px) { .wk-ev .cat-ico { display: none; } .wk-ev { font-size: 9.5px; padding: 2px 2px 2px 3px; } }
.sheet .heat { --cell: 11px; gap: 2px; }
@media (max-width: 520px) { .wk-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: clip; -webkit-line-clamp: unset; word-break: normal; } }
.brief-card .brief-ico { align-self: flex-start; }
.brief-row .dot { align-self: start; margin-top: 7px; }
.wk-ev { flex-direction: row; align-items: flex-start; gap: 3px; }
.wk-ev .cat-ico { margin-top: 1px; }
.wk-ev span { flex: 1; min-width: 0; }
@media (min-width: 900px) {
  .charts { max-width: 900px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
  .charts > .seg, .charts > .ch-table, .charts > div.small { grid-column: 1 / -1; }
  .charts > .seg { max-width: 520px; }
}


/* =====================================================================
   ESTILOS ELEGIBLES (⚙️ → Estilo). Van al final para ganar a claro/oscuro.
   ===================================================================== */
.topbar h1, .today-hello, .hero-big, .sheet h2, .brief-hello, .empty-state b, .alarm-hero-time, .alarm-time, .ring-clock { font-family: var(--font-display); }
.tile-big, .avg-grid .v, .alarm-time, .alarm-hero-time, .streak, .ring-clock, .tl-time, .time { font-family: var(--font-num); }

/* ---------- A · Noche de estudio ---------- */
:root[data-style="noche"][data-style] {
  --bg: #0f1420; --surface: #1a2236; --surface-2: #232d47; --text: #eef1fb; --muted: #8d97b8; --border: #2b3552;
  --accent: #ff6b5b; --accent-soft: #3a2430; --on-accent: #1a0e0b; --ok: #c8ff5e; --on-ok: #1a2a05; --warn: #ffc857; --danger: #ff4d6d;
  --c-clase: #6fb7ff; --c-estudio: #b490ff; --c-entreno: #c8ff5e; --c-examen: #ff6b5b; --c-otro: #8d97b8;
  --shadow: none; --radius: 16px; color-scheme: dark;
  --font-display: 'Fraunces', Georgia, serif; --font-body: 'Manrope', system-ui, sans-serif; --font-num: 'Manrope', system-ui, sans-serif;
}
:root[data-style="noche"] .topbar h1, :root[data-style="noche"] .today-hello { font-weight: 700; letter-spacing: -.01em; }
:root[data-style="noche"] .hero { background: linear-gradient(135deg, color-mix(in srgb, var(--c) 26%, #1a2236), #1a2236 70%); }
:root[data-style="noche"] .tabbar button.active { color: var(--accent); }
:root[data-style="noche"] .ai-orb { background: radial-gradient(circle at 35% 30%, #ffb3a8, #ff6b5b 45%, #7a2235 85%); box-shadow: 0 0 0 10px rgba(255,107,91,.12), 0 0 0 22px rgba(255,107,91,.06), 0 20px 60px rgba(255,107,91,.35); }

/* ---------- B · Aurora ---------- */
:root[data-style="aurora"][data-style] {
  --bg: #120e2b; --surface: rgba(255,255,255,.11); --surface-2: rgba(255,255,255,.09); --text: #ffffff; --muted: rgba(255,255,255,.72); --border: rgba(255,255,255,.2);
  --accent: #7cf7d4; --accent-soft: rgba(124,247,212,.18); --on-accent: #0d1b2a; --ok: #7cf7d4; --on-ok: #0d1b2a; --warn: #ffd27a; --danger: #ff6b9a;
  --c-clase: #8ab4ff; --c-estudio: #c3a6ff; --c-entreno: #7cf7d4; --c-examen: #ff6b9a; --c-otro: #ffd27a;
  --shadow: none; --radius: 20px; color-scheme: dark;
  --font-display: 'Sora', system-ui, sans-serif; --font-body: 'DM Sans', system-ui, sans-serif; --font-num: 'Sora', system-ui, sans-serif;
}
:root[data-style="aurora"] body {
  background: radial-gradient(120% 60% at 0% 0%, #5b3df5 0%, transparent 60%), radial-gradient(90% 60% at 100% 30%, #0096b8 0%, transparent 55%), radial-gradient(100% 70% at 50% 100%, #d63a78 0%, transparent 60%), #120e2b;
  background-attachment: fixed;
}
:root[data-style="aurora"] .topbar { background: transparent; }
:root[data-style="aurora"] .card, :root[data-style="aurora"] .event, :root[data-style="aurora"] .brief-card { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
:root[data-style="aurora"] .topbar h1, :root[data-style="aurora"] .today-hello, :root[data-style="aurora"] .hero-big { font-weight: 800; letter-spacing: -.03em; }
:root[data-style="aurora"] .tabbar { left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 10px); border-radius: 22px; border: 1px solid var(--border); background: rgba(30,22,70,.55); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); padding-bottom: 0; }
:root[data-style="aurora"] .fab { bottom: calc(env(safe-area-inset-bottom) + 90px); }
:root[data-style="aurora"] .sheet { background: #1d1745; }
:root[data-style="aurora"] .alarm-brief, :root[data-style="aurora"] .backdrop { background-color: rgba(18,14,43,.92); }
:root[data-style="aurora"] input[type=text], :root[data-style="aurora"] input[type=number], :root[data-style="aurora"] input[type=date], :root[data-style="aurora"] input[type=time], :root[data-style="aurora"] input[type=url], :root[data-style="aurora"] input[type=password], :root[data-style="aurora"] select, :root[data-style="aurora"] textarea { background: rgba(255,255,255,.08); }
:root[data-style="aurora"] select option { background: #1d1745; color: #fff; }
:root[data-style="aurora"] .toast { background: rgba(255,255,255,.92); color: #120e2b; }
:root[data-style="aurora"] .ai-orb { background: radial-gradient(circle, #7cf7d4, #00b4d8 55%, #2a1f6e 100%); box-shadow: 0 0 40px #00b4d8, 0 0 0 12px rgba(124,247,212,.1); }
@media (min-width: 900px) {
  :root[data-style="aurora"] .tabbar { left: 12px; right: auto; top: 12px; bottom: 12px; width: 200px; border-radius: 22px; }
  :root[data-style="aurora"] .fab { bottom: 28px; }
}

/* ---------- C · Vestuario ---------- */
:root[data-style="vestuario"][data-style] {
  --bg: #f3f1ec; --surface: #ffffff; --surface-2: #ebe8e1; --text: #15161a; --muted: #55575f; --border: #15161a;
  --accent: #ff5a36; --accent-soft: #ffe1d8; --on-accent: #ffffff; --ok: #1db87a; --on-ok: #ffffff; --warn: #c98a00; --danger: #d92d2d;
  --c-clase: #2f6bff; --c-estudio: #8b5cf6; --c-entreno: #1db87a; --c-examen: #ff5a36; --c-otro: #15161a;
  --shadow: none; --radius: 14px; color-scheme: light;
  --font-display: 'Archivo', system-ui, sans-serif; --font-body: 'Archivo', system-ui, sans-serif; --font-num: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
}
:root[data-style="vestuario"] .card, :root[data-style="vestuario"] .event, :root[data-style="vestuario"] .brief-card { border-width: 2px; }
:root[data-style="vestuario"] .topbar h1 { font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
:root[data-style="vestuario"] .today-hello { font-weight: 900; text-transform: uppercase; }
:root[data-style="vestuario"] .tile-big, :root[data-style="vestuario"] .alarm-hero-time, :root[data-style="vestuario"] .alarm-time, :root[data-style="vestuario"] .avg-grid .v { font-weight: 800; font-size: 1.25em; letter-spacing: 0; }
:root[data-style="vestuario"] .tile-big { font-size: 34px; line-height: 1; }
:root[data-style="vestuario"] .tile:nth-child(1) { background: #ffd23f; border-color: #15161a; }
:root[data-style="vestuario"] .tile:nth-child(2) { background: #15161a; color: #f3f1ec; }
:root[data-style="vestuario"] .tile:nth-child(2) .tile-lbl, :root[data-style="vestuario"] .tile:nth-child(2) .tile-sub { color: rgba(243,241,236,.75); }
:root[data-style="vestuario"] .tile:nth-child(3) { background: #1db87a; color: #fff; }
:root[data-style="vestuario"] .tile:nth-child(3) .tile-lbl, :root[data-style="vestuario"] .tile:nth-child(3) .tile-sub { color: rgba(255,255,255,.85); }
:root[data-style="vestuario"] .tile:nth-child(1) .tile-lbl, :root[data-style="vestuario"] .tile:nth-child(1) .tile-sub { color: rgba(21,22,26,.75); }
:root[data-style="vestuario"] .tile:nth-child(1) .ring circle:first-child { stroke: rgba(21,22,26,.15); }
:root[data-style="vestuario"] .hero { background: #ff5a36; color: #fff; box-shadow: none; border: 2px solid #15161a; }
:root[data-style="vestuario"] .hero .hero-lbl, :root[data-style="vestuario"] .hero .hero-sub { color: rgba(255,255,255,.9); }
:root[data-style="vestuario"] .hero-big { font-weight: 900; text-transform: uppercase; }
:root[data-style="vestuario"] .tabbar { border-top: 2px solid #15161a; }
:root[data-style="vestuario"] .tabbar button span { font-weight: 800; text-transform: uppercase; font-size: 10px; letter-spacing: .02em; }
:root[data-style="vestuario"] .btn.primary, :root[data-style="vestuario"] .fab { box-shadow: 3px 3px 0 #15161a; border: 2px solid #15161a; }
:root[data-style="vestuario"] .section-title { color: var(--text); font-weight: 900; }
:root[data-style="vestuario"] .ai-orb { background: #15161a; box-shadow: 0 0 0 10px #ffd23f; }
@media (min-width: 900px) { :root[data-style="vestuario"] .tabbar { border-top: 0; border-right: 2px solid #15161a; } }

/* Selector de estilo en Ajustes */
.style-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.style-opt { border: 2px solid var(--border); border-radius: 14px; padding: 6px; background: var(--surface); cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.style-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.style-opt .sw { height: 54px; border-radius: 10px; display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
.style-opt .sw i { width: 14px; height: 14px; border-radius: 4px; display: block; }
.style-opt b { display: block; font-size: 13px; margin: 6px 2px 0; }
.style-opt span { display: block; font-size: 11.5px; color: var(--muted); margin: 0 2px 2px; }
/* Vestuario: líneas finas en gris (el negro solo para los bordes de tarjeta) */
:root[data-style="vestuario"] .hm.ln { box-shadow: inset 0 0 0 1px #cfcabf; }
:root[data-style="vestuario"] .wk-col { background-image: repeating-linear-gradient(to bottom, #dcd8ce 0 1px, transparent 1px var(--h)); }
:root[data-style="vestuario"] .ch-grid { stroke: #dcd8ce; }
:root[data-style="vestuario"] .event .grow .small, :root[data-style="vestuario"] .tl-item { border-color: #dcd8ce; }
:root[data-style="aurora"] .wk-head { background: rgba(29,23,69,.85); }
:root[data-style="noche"] .wk-head { background: var(--surface); }

/* Jarvis con el móvil bloqueado: solo se ve Jarvis */
body.locked-ai .tabbar, body.locked-ai .top-actions { display: none !important; }
body.locked-ai #view { padding-bottom: 16px; }
.lock-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; margin-bottom: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 700; }
.lock-bar span { flex: 1; min-width: 0; white-space: nowrap; }
.lock-bar small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.lock-bar .btn { padding: 7px 12px; font-size: 13px; }
.field input[type=range] { display: block; width: 100%; margin-top: 6px; }

/* KIO: bienvenida y código de vinculación */
.welcome-logo { font-family: var(--font-display); font-weight: 800; font-size: 44px; letter-spacing: 6px; text-align: center; color: var(--accent); margin: 8px 0 4px; }
.pair-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 30px; font-weight: 800; letter-spacing: 4px; margin: 10px 0 6px; color: var(--text); user-select: all; }

/* KIO: modo conversación */
.kio-voice { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; color: #fff;
  background: radial-gradient(120% 80% at 50% 35%, color-mix(in srgb, var(--accent) 35%, #0b0e18) 0%, #0b0e18 60%, #05070c 100%);
  padding: calc(env(safe-area-inset-top) + 14px) 20px calc(env(safe-area-inset-bottom) + 22px); animation: kvIn .22s ease-out; }
.kio-voice.closing { animation: kvOut .2s ease-in forwards; }
@keyframes kvIn { from { opacity: 0; } } @keyframes kvOut { to { opacity: 0; } }
.kv-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; letter-spacing: 3px; opacity: .85; }
.kv-brand { font-family: var(--font-display); font-size: 18px; }
.kv-lock { font-size: 12px; letter-spacing: 0; font-weight: 600; opacity: .8; }
.kv-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.kv-orb { width: 168px; height: 168px; border: 0; cursor: pointer; margin: 0 0 18px; transform: scale(calc(1 + var(--lvl, 0) * .18)); transition: transform .08s linear; }
.kv-orb .orb-wave i { width: 6px; height: 16px; }
.kv-state { font-weight: 700; font-size: 15px; opacity: .8; min-height: 20px; }
.kv-you { font-size: 15px; opacity: .65; max-width: 520px; min-height: 20px; }
.kv-kio { font-size: 21px; line-height: 1.4; font-weight: 600; max-width: 560px; max-height: 32vh; overflow-y: auto; }
.kv-bar { display: flex; justify-content: center; gap: 28px; }
.kv-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.kv-btn svg { width: 26px; height: 26px; fill: currentColor; }
.kv-btn.kv-end { background: #e5484d; }
.ai-convo svg { width: 22px; height: 22px; }
.kv-orb.hearing { transform: scale(1.14); box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 70%, transparent); }

/* =====================================================================
   KIO — logo y pantalla de carga (brand.js)
   ===================================================================== */
.kio-mark { display: block; flex: none; overflow: visible; }
.kio-lockup { display: inline-flex; align-items: center; gap: 10px; }
.kio-word { font-family: var(--font-display); font-weight: 800; letter-spacing: .14em; font-size: 1.05em; }
.brand[data-kio-logo] { padding: 0 12px 22px; }
.brand .kio-word { font-size: 21px; }
.welcome-logo[data-kio-logo] { display: flex; justify-content: center; color: var(--text); font-size: 34px; letter-spacing: 0; }
.welcome-logo .kio-lockup { gap: 14px; }
.welcome-tag { text-align: center; font-size: 13px; color: var(--muted); letter-spacing: .04em; margin: -2px 0 10px; }
.welcome-tag b { color: var(--accent); }
.kv-brand { display: inline-flex; align-items: center; gap: 8px; }

.ks { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--ks-bg); color: var(--ks-text); overflow: hidden; transition: opacity .38s ease, transform .38s ease; }
.ks.ks-out { opacity: 0; transform: scale(1.035); pointer-events: none; }
.ks-center { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: -6vh; }
.ks-mark { filter: drop-shadow(0 18px 40px rgba(0,0,0,.28)); }
.ks-vestuario .ks-mark { filter: none; }
.ks-word { font-family: 'Sora', 'Archivo', system-ui, sans-serif; font-weight: 800; font-size: 40px; letter-spacing: .28em; margin-right: -.28em; line-height: 1; }
.ks-fixed-font .ks-word { font-family: var(--font-display); }
.ks-noche .ks-word { font-family: 'Fraunces', Georgia, serif; letter-spacing: .2em; margin-right: -.2em; }
.ks-vestuario .ks-word { font-family: 'Archivo', system-ui, sans-serif; font-weight: 900; letter-spacing: .12em; margin-right: -.12em; }
.ks-word span { display: inline-block; }
.ks-tag { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--ks-sub); font-weight: 600; }
.ks-tag b { color: var(--ks-hi); font-weight: 800; }
.ks-foot { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 46px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ks-hello { font-size: 15px; color: var(--ks-sub); font-weight: 500; }
.ks-bar { width: 132px; height: 4px; border-radius: 4px; background: var(--ks-bar); overflow: hidden; }
.ks-bar i { display: block; width: 40%; height: 100%; border-radius: 4px; background: var(--ks-dot); animation: ksBar 1.15s cubic-bezier(.6,0,.4,1) infinite; }
@keyframes ksBar { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* Animación del logo: aparece la pieza, se dibuja la K y cae el orbe */
.km-anim .km-tile { transform-origin: 50px 50px; animation: kmTile .55s cubic-bezier(.34,1.56,.64,1) both; }
.km-anim .km-stem, .km-anim .km-arm1, .km-anim .km-arm2 { stroke-dasharray: 1; stroke-dashoffset: 1; animation: kmDraw .32s cubic-bezier(.5,0,.2,1) forwards; }
.km-anim .km-stem { animation-delay: .28s; }
.km-anim .km-arm1 { animation-delay: .5s; }
.km-anim .km-arm2 { animation-delay: .6s; }
.km-anim .km-dot { transform-origin: 69px 50px; animation: kmDrop .62s cubic-bezier(.3,1.6,.5,1) .82s both, kmPulse 1.8s ease-in-out 1.6s infinite; }
@keyframes kmTile { from { transform: scale(.55) rotate(-8deg); opacity: 0; } }
@keyframes kmDraw { to { stroke-dashoffset: 0; } }
@keyframes kmDrop { from { transform: translateY(-46px) scale(.3); opacity: 0; } }
@keyframes kmPulse { 50% { transform: scale(1.14); } }
.ks-word span { animation: ksUp .5s cubic-bezier(.2,.9,.3,1.2) both; }
.ks-word span:nth-child(1) { animation-delay: 1.0s; } .ks-word span:nth-child(2) { animation-delay: 1.07s; } .ks-word span:nth-child(3) { animation-delay: 1.14s; }
.ks-tag { animation: ksFade .5s ease 1.28s both; }
.ks-foot { animation: ksFade .5s ease .5s both; }
@keyframes ksUp { from { transform: translateY(14px); opacity: 0; } }
@keyframes ksFade { from { opacity: 0; transform: translateY(6px); } }
.ks-still *, .ks-still .km-anim * { animation: none !important; stroke-dashoffset: 0 !important; }

/* KIO — categorías personalizables */
.cat-chip { display: inline-flex; align-items: center; gap: 5px; }
.cat-chip .cat-ico { color: var(--c); }
.cat-chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.cat-chip.on .cat-ico { color: #fff; }
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.cat-row-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cat-row-go { width: 18px; height: 18px; color: var(--muted); flex: none; }
.sw-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sw-pick { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; color: #fff; font-weight: 800; font-size: 12px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.sw-pick.on { border-color: var(--text); }
.ico-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.ico-pick { height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.ico-pick .cat-ico { width: 20px; height: 20px; }
.ico-pick.on { border: 2px solid currentColor; background: color-mix(in srgb, currentColor 14%, var(--surface)); }
svg.cat-ico { fill: none; }

/* =====================================================================
   ESCRITORIO · diseño de ordenador (ventana ancha)
   ===================================================================== */
.side-foot, .t-next { display: none; }
/* Hoy en el móvil: una sola columna en el orden de siempre */
.hoy-dash { display: flex; flex-direction: column; }
.hoy-dash .t-main, .hoy-dash .t-side { display: contents; }
.t-head { order: 0; } .t-hero { order: 1; } .t-tiles { order: 2; } .t-agenda, .t-tasks { order: 3; } .t-idea { order: 4; } .t-const { order: 5; }
.t-tiles { margin-bottom: 12px; }

@media (min-width: 900px) {
  :root { --side: 248px; }
  body { padding-left: var(--side); }
  .topbar, main#view { max-width: 1240px; width: 100%; margin-inline: auto; }
  .topbar { padding: 26px 36px 10px; }
  main#view { padding: 6px 36px 56px; }
  .topbar h1 { font-size: 28px; letter-spacing: -.02em; }
  #btn-settings { display: none; }

  /* ---- Barra lateral ---- */
  .tabbar { width: var(--side); padding: 20px 14px 16px; gap: 2px; background: var(--surface); }
  .brand { padding: 4px 10px 22px; }
  .tabbar button[data-tab] { position: relative; padding: 10px 12px; font-size: 14.5px; font-weight: 500; transition: background .15s, color .15s; }
  .tabbar button[data-tab] svg { width: 20px; height: 20px; }
  .tabbar button[data-tab].active { color: var(--accent); font-weight: 650; }
  .tabbar button[data-tab].active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
  .tabbar kbd { opacity: 0; transition: opacity .15s; }
  .tabbar:hover kbd, .tabbar button.active kbd { opacity: 1; }

  .side-foot { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 16px; }
  .side-clock { padding: 0 12px 8px; display: flex; flex-direction: column; line-height: 1.15; }
  .side-clock b { font: 800 30px/1 var(--font-num, var(--font-display)); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .side-clock span { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
  .side-foot .side-kio {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
    padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface));
    color: var(--text); transition: transform .15s, box-shadow .15s;
  }
  .side-foot .side-kio:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 22%, transparent); }
  .side-orb { width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 35%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 70%, #000));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); animation: breathe 3.5s ease-in-out infinite; }
  .side-kio-txt { display: flex; flex-direction: column; min-width: 0; }
  .side-kio-txt b { font-size: 14px; }
  .side-kio-txt small { font-size: 12px; color: var(--muted); }
  .side-foot button span, .side-foot button small, .side-foot button b { white-space: normal !important; overflow: visible !important; text-transform: none !important; letter-spacing: normal !important; padding: 0 !important; }
  :root[data-style="vestuario"] .side-foot .side-kio b { text-transform: uppercase !important; font-weight: 900; }
  :root[data-style="vestuario"] .side-foot .side-kio small { color: rgba(21,22,26,.7); }
  .side-foot .side-set { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
  .side-foot .side-set:hover { background: var(--surface-2); color: var(--text); }
  .side-foot .side-set svg { width: 20px; height: 20px; }

  .fab { right: max(36px, calc((100vw - var(--side) - 1240px) / 2 + 36px)); bottom: 32px; width: 58px; height: 58px; }
  .toast { left: calc(50% + var(--side) / 2); }

  /* ---- Tarjetas: un poco de vida al pasar el ratón ---- */
  .card { transition: border-color .15s, box-shadow .15s, transform .15s; }
  button.card:hover, .tile[data-go]:hover, #hoy-weather[style*="pointer"]:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
  .tl-item, .nd-ev, .event, .chip, .link { cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ---- Hoy: panel con dos columnas ---- */
  .hoy-dash { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 380px); gap: 0 28px; align-items: start; }
  .hoy-dash .t-main, .hoy-dash .t-side { display: flex; flex-direction: column; min-width: 0; }
  .t-head { grid-column: 1 / -1; margin-bottom: 14px; }
  .today-hello { font-size: 30px; }
  .t-hero .hero { padding: 22px 24px; min-height: 132px; display: flex; flex-direction: column; justify-content: center; }
  .t-hero .hero-big { font-size: 36px; }
  .t-hero .hero::after { width: 170px; height: 170px; right: -40px; top: -50px; opacity: .8; }
  .hoy-dash .tiles { grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 6px; }
  .hoy-dash .t-main > *, .hoy-dash .t-side > * { order: 0; }
  .hoy-dash .tile:first-child { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hoy-dash .tile:first-child .ring { width: 46px; height: 46px; }
  .hoy-dash .tile { margin: 0; min-height: 96px; }
  .t-side .section-title:first-child { margin-top: 14px; }
  .t-const .heat { --cell: 17px; gap: 4px; }
  .t-next { display: block; }
  .next-days { padding: 6px 14px; }
  .nd-day { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
  .nd-day:first-child { border-top: 0; }
  .nd-date { width: 42px; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
  .nd-date b { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
  .nd-date span { font: 800 22px/1.1 var(--font-num, var(--font-display)); }
  .nd-evs { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .nd-ev { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; border-radius: 8px; padding: 6px 8px; background: color-mix(in srgb, var(--c) 9%, transparent); color: var(--text); }
  .nd-ev:hover { background: color-mix(in srgb, var(--c) 18%, transparent); }
  .nd-ev .cat-ico { color: var(--c); flex: none; }
  .nd-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
  .nd-h { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

  /* ---- Ideas: escribir a la izquierda, tablero a la derecha ---- */
  .ideas-wrap { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
  .ideas-compose { position: sticky; top: 0; }
  .ideas-compose textarea { min-height: 120px; }
  .ideas-list { columns: 2 300px; column-gap: 14px; }
  .ideas-list .section-title { break-after: avoid; column-span: none; margin-top: 0; padding-top: 4px; }
  .ideas-list .idea { break-inside: avoid; max-width: none; }

  /* ---- Hábitos ---- */
  .const-card .heat { --cell: 18px; gap: 4px; }

  /* ---- Alarmas en rejilla ---- */
  .alarm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
  .alarm-grid .card { margin: 0; }
  .alarm-hero { padding: 30px 14px; }
  #al-test { display: block; width: auto; min-width: 280px; margin: 4px auto 0 !important; padding-inline: 24px; }

  /* ---- Kio: conversación centrada ---- */
  .ai { max-width: 780px; margin-inline: auto; }
  .ai-bar { left: var(--side); right: 0; max-width: none; padding: 14px max(36px, calc((100vw - var(--side) - 780px) / 2)) 22px; }
  .ai-sugg .chip:hover { border-color: var(--accent); color: var(--accent); }

  /* ---- Estilos que cambian la barra lateral ---- */
  :root[data-style="aurora"] .tabbar { left: 12px; top: 12px; bottom: 12px; width: calc(var(--side) - 24px); }
  :root[data-style="aurora"] .tabbar button[data-tab].active::before { left: -10px; }
  :root[data-style="vestuario"] .side-foot .side-kio { border: 2px solid #15161a; background: #ffd23f; box-shadow: 3px 3px 0 #15161a; }
  :root[data-style="vestuario"] .side-clock b { font-size: 36px; }
  :root[data-style="vestuario"] .tabbar button[data-tab] span { text-transform: uppercase; font-weight: 800; font-size: 13px; }
  :root[data-style="vestuario"] .t-hero .hero-big { font-size: 40px; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .hoy-dash { grid-template-columns: minmax(0, 1fr) 300px; gap: 0 20px; }
  .ideas-wrap { grid-template-columns: 300px minmax(0, 1fr); }
  .ideas-list { columns: 1; }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) { .side-orb { animation: none; } .card { transition: none; } }

/* ---- Ventana de Windows sin barra de título: se arrastra desde arriba ---- */
.desktop .topbar, .desktop .tabbar .brand { -webkit-app-region: drag; }
.desktop .topbar button, .desktop .topbar input, .desktop .tabbar .brand a { -webkit-app-region: no-drag; }
.desktop .topbar { padding-right: 150px; }   /* sitio para — ▢ ✕ */
.desktop body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 12px; -webkit-app-region: drag; z-index: 1; }

/* ---- Barras de desplazamiento finas (Windows) ---- */
.desktop ::-webkit-scrollbar { width: 12px; height: 12px; }
.desktop ::-webkit-scrollbar-track { background: transparent; }
.desktop ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
.desktop ::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 32%, transparent); }
.desktop ::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Conversación con Kio a pantalla completa en Windows: deja sitio a — ▢ ✕ y se puede arrastrar */
.desktop .kio-voice { padding-top: 16px; }
.desktop .kv-top { -webkit-app-region: drag; padding-right: 140px; min-height: 30px; }
.desktop .kv-top * { -webkit-app-region: no-drag; }

/* =====================================================================
   Notas de exámenes
   ===================================================================== */
.cal-top { gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.cal-top .cal-switch { margin-bottom: 0; flex: 1; }
.grades-btn { padding: 9px 14px; white-space: nowrap; }
.grade-pill { align-self: center; flex: none; font: 800 14px/1 var(--font-num); padding: 7px 10px; border-radius: 999px; color: var(--g); background: color-mix(in srgb, var(--g) 14%, transparent); font-variant-numeric: tabular-nums; }
.grade-add { align-self: center; flex: none; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); background: none; color: var(--accent); font-weight: 700; font-size: 12.5px; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.grade-hero { display: flex; align-items: center; gap: 18px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 80%); border: 1px solid var(--border); }
.grade-avg { font: 800 44px/1 var(--font-num); letter-spacing: -.02em; }
.grade-stats { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.grade-stats b { color: var(--text); }
.grade-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); margin-bottom: 6px; cursor: pointer; }
.grade-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.grade-date { width: 34px; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.05; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.grade-date b { font: 800 18px/1.1 var(--font-num); color: var(--text); }
.grade-name { flex: 1; min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grade-sub { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px 18px; gap: 10px; align-items: center; padding: 5px 2px; font-size: 14px; }
.grade-sub > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grade-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.grade-bar i { display: block; height: 100%; border-radius: 99px; }
.grade-sub b { font-family: var(--font-num); text-align: right; }
.grade-nudge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: -2px; }
.grade-nudge-ico { font-size: 22px; }
.grade-nudge .small-btn { padding: 8px 12px; font-size: 13px; }
.grade-nudge .icon-btn { padding: 6px; font-size: 14px; }

/* ---------- Apartados de la barra (elegibles) ---------- */
.tabbar button.tab-hidden { display: none !important; }
.tab-pick { display: grid; gap: 8px; }
.tab-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.tab-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.tab-opt.fixed { opacity: .85; cursor: default; }
.tab-opt-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.tab-opt.on .tab-opt-ico { background: var(--accent); color: var(--on-accent); }
.tab-opt-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tab-opt-txt b { font-size: 15px; }
.tab-opt-txt span { font-size: 12.5px; color: var(--muted); }
.tab-opt-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.tab-opt-check svg { width: 16px; height: 16px; opacity: 0; fill: var(--on-accent); }
.tab-opt.on .tab-opt-check { background: var(--accent); border-color: var(--accent); }
.tab-opt.on .tab-opt-check svg { opacity: 1; }
@media (min-width: 900px) { .tab-pick { grid-template-columns: 1fr 1fr; } }

/* =====================================================================
   Tareas
   ===================================================================== */
.tasks-wrap { max-width: 760px; }
.task-add { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 14px; margin-bottom: 4px; }
.task-add input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; font-size: 15px; outline: none; }
.task-add .mic { width: 40px; height: 40px; }
.task-go { width: 40px; height: 40px; padding: 0; border-radius: 12px; font-size: 22px; line-height: 1; flex: none; }
.task-hint { min-height: 1.4em; padding: 2px 4px 6px; }
.task-list { padding: 4px 6px; }
.task { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task-check { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: none; border: 0; cursor: pointer; padding: 0; }
.task-check svg { width: 22px; height: 22px; padding: 2px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent); fill: transparent; transition: background .15s, border-color .15s, fill .15s; }
.task-check:hover svg { border-color: var(--ok); }
.task.done .task-check svg { background: var(--ok); border-color: var(--ok); fill: var(--on-ok); }
.task-body { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); padding: 10px 2px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.task-text { font-size: 15px; overflow-wrap: anywhere; }
.task.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; gap: 6px; font-size: 12.5px; flex-wrap: wrap; }
.task-due { font-weight: 700; color: var(--muted); }
.task-due.today { color: var(--accent); }
.task-due.late { color: var(--danger); }
.task-star { width: 36px; height: 36px; flex: none; background: none; border: 0; font-size: 19px; color: var(--muted); cursor: pointer; opacity: .55; }
.task.star .task-star { color: var(--warn); opacity: 1; }
.task.just-done { animation: taskDone .38s ease forwards; }
@keyframes taskDone { 60% { opacity: .6; } to { opacity: 0; transform: translateX(16px); } }
.task-late-title { color: var(--danger); }
.small-empty { padding: 24px 8px; }
.t-tasks .section-title { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .task.just-done { animation: none; } }

/* ---------- Leyenda del mes: tocar para quitar/poner los puntos ---------- */
button.legend-item { background: none; border: 0; padding: 2px 4px; border-radius: 6px; cursor: pointer; font: inherit; }
button.legend-item:hover { background: var(--surface-2); }
button.legend-item.off { opacity: .4; text-decoration: line-through; }
.sw-custom { position: relative; display: grid; place-items: center; font-weight: 800; color: var(--muted); background: var(--surface-2); overflow: hidden; cursor: pointer; }
.sw-custom.on { color: #fff; }
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

/* ---------- Rutinas ---------- */
.routine-btn { padding: 9px 12px; white-space: nowrap; }
.routine-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.routine-list { display: flex; flex-direction: column; gap: 6px; }
.routine-row { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--border); border-radius: 14px; padding: 2px 4px 2px 2px; }
.routine-row.on { border-color: var(--accent); background: var(--accent-soft); }
.routine-pick { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 10px 12px; color: var(--text); cursor: pointer; min-width: 0; }
.routine-pick .grow { display: flex; flex-direction: column; min-width: 0; }
.routine-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: none; }
.routine-row.on .routine-dot { border: 6px solid var(--accent); }
.rt-evs { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow: auto; }
.rt-ev { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.rt-ev input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.rt-ev .grow { display: flex; flex-direction: column; min-width: 0; }
.rt-ev:has(input:not(:checked)) { opacity: .55; }
.routine-today { font-size: inherit; font-weight: 700; padding: 0; }

/* =====================================================================
   Iconos de arriba: Kio y sincronización · barra lateral del ordenador
   ===================================================================== */
.kio-btn.on, .side-ico.on { color: var(--accent); background: var(--accent-soft); }
.sync-btn { position: relative; }
.sync-btn svg { width: 21px; height: 21px; }
.sync-dot { position: absolute; right: 6px; bottom: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.sync-btn[data-ph="pending"] .sync-dot { background: var(--warn); }
.sync-btn[data-ph="syncing"] .sync-dot { background: var(--accent); animation: syncPulse 1s ease-in-out infinite; }
.sync-btn[data-ph="error"] .sync-dot { background: var(--danger); }
.sync-btn[data-ph="error"] { color: var(--danger); }
@keyframes syncPulse { 50% { transform: scale(.55); opacity: .5; } }
.side-icons { display: flex; gap: 4px; padding: 2px 4px; }
.side-ico { flex: 1; display: grid; place-items: center; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; position: relative; }
.side-ico:hover { background: var(--surface-2); color: var(--text); }
.side-ico svg { width: 20px; height: 20px; }
.side-ico .sync-dot { right: 30%; bottom: 7px; }
@media (min-width: 900px) { .top-actions .kio-btn, .top-actions .sync-btn { display: none; } }

/* Vincular dispositivos */
.sync-status { display: flex; gap: 12px; align-items: center; }
.sync-ico { font-size: 26px; line-height: 1; }
.sync-status.ph-error b { color: var(--danger); }
.dev-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dev-row:last-child { border-bottom: 0; }
.dev-ico { font-size: 22px; }
.dev-me { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.link-steps { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.link-steps > div { display: flex; gap: 10px; align-items: flex-start; }
.link-steps span { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* Pantalla de actualización obligatoria */
#kio-update { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: grid; place-items: center; padding: 24px; overflow: auto; }
html.updating body > *:not(#kio-update) { visibility: hidden; }
.upd-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.upd-box h2 { margin: 6px 0 0; }
.upd-logo { display: flex; justify-content: center; }
.upd-ver { font-weight: 700; color: var(--accent); }
.upd-notes { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: left; white-space: pre-wrap; font-size: 14px; }
.upd-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.upd-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* =====================================================================
   Finanzas
   ===================================================================== */
.fin-wrap { padding-bottom: 80px; }
.fin-hero { text-align: center; }
.fin-total { font: 800 38px/1.1 var(--font-num); letter-spacing: -.02em; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.fin-month { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; text-transform: capitalize; }
.fin-io { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.fin-io > div { background: var(--surface-2); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; }
.fin-io b { font-size: 17px; font-variant-numeric: tabular-nums; }
.fin-in { color: var(--ok); }
.fin-out { color: var(--danger); }
.fin-actions { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.fin-actions:has(#fin-photo) { grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .fin-actions:has(#fin-photo) { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
.fin-jars { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 6px; }
.fin-jar { text-align: left; border: 1px solid var(--border); border-left: 5px solid var(--jc); background: var(--surface); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.fin-jar.on { outline: 2px solid var(--jc); }
.fin-jar-ico { font-size: 22px; }
.fin-jar-name { font-weight: 700; display: flex; flex-direction: column; }
.fin-jar-name small { font-weight: 500; color: var(--muted); font-size: 12px; }
.fin-jar-bal { font-size: 18px; font-variant-numeric: tabular-nums; }
.fin-jar-bal.neg { color: var(--danger); }
.fin-goal { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.fin-goal i { display: block; height: 100%; background: var(--jc, var(--ok)); border-radius: 99px; }
.fin-goal.big { height: 10px; margin: 8px 0 6px; }
.fin-goal.big i { background: var(--ok); }
.fin-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.fin-goal-card { text-align: left; cursor: pointer; width: 100%; margin: 0; }
.fin-grid2 { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 900px) { .fin-grid2 { grid-template-columns: 1fr 1fr; } }
.fin-inv-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.fin-inv-row > div { display: flex; flex-direction: column; }
.fin-chart { width: 100%; height: auto; }
.fin-area { fill: color-mix(in srgb, var(--ok) 18%, transparent); }
.fin-line { fill: none; stroke: var(--ok); stroke-width: 2.5; }
.fin-line2 { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.fin-lbl { font: 700 11px var(--font-body); fill: var(--text); }
.fin-ax { font: 10px var(--font-body); fill: var(--muted); }
.fin-cats { display: flex; flex-direction: column; gap: 8px; }
.fin-cat { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.fin-cat-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.fin-cat-bar i { display: block; height: 100%; background: var(--danger); border-radius: 99px; opacity: .8; }
.fin-compare h3 { margin: 0; }
.fin-key { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin: 0 3px 0 8px; vertical-align: -1px; }
.fin-key.in { background: var(--ok); } .fin-key.out { background: var(--danger); }
.fin-bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 12px 0 8px; }
.fin-bar-col { border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border-radius: 10px; font-size: 11px; color: var(--muted); }
.fin-bar-col.on { background: var(--surface-2); color: var(--text); }
.fin-bar-col b { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-bar-pair { height: 80px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.fin-bar-pair i { width: 30%; max-width: 14px; min-height: 2px; border-radius: 4px 4px 0 0; }
.fin-bar-pair i.in { background: var(--ok); } .fin-bar-pair i.out { background: var(--danger); opacity: .85; }
.fin-list { padding: 4px 10px; }
.fin-mv { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.fin-mv:last-child { border-bottom: 0; }
.fin-mv b { display: block; }
.fin-mv small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-mv-ico { font-size: 20px; width: 28px; text-align: center; }
.fin-amount { display: flex; align-items: center; gap: 6px; }
.fin-amount input { font-size: 22px; font-weight: 700; }
.fin-amount span { font-weight: 700; color: var(--muted); }
.fin-split { display: flex; flex-direction: column; gap: 6px; }
.fin-split-row { display: flex; justify-content: space-between; border-left: 4px solid var(--jc); padding: 6px 10px; background: var(--surface-2); border-radius: 8px; }
.fin-jar-edit { display: grid; grid-template-columns: 40px 1fr 70px 90px 34px; gap: 6px; align-items: center; border-left: 4px solid var(--jc); padding-left: 6px; }
.fin-ico-btn { font-size: 22px; border: 0; background: var(--surface-2); border-radius: 10px; height: 40px; cursor: pointer; }
.fin-pct { display: flex; align-items: center; gap: 2px; }
.fin-goal-in input { font-size: 14px; }
.fin-note, .train-note { text-align: center; margin: 16px 0 6px; }
@media (max-width: 420px) { .fin-jar-edit { grid-template-columns: 36px 1fr 62px; } .fin-goal-in, .fin-jar-edit .icon-btn { grid-column: span 1; } .fin-cat { grid-template-columns: 96px 1fr auto; } }

/* =====================================================================
   Entreno
   ===================================================================== */
.train-wrap { padding-bottom: 90px; }
.train-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; text-align: center; }
.train-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; }
.train-stats b { font: 800 26px/1.1 var(--font-num); }
.train-stats span { font-size: 12px; color: var(--muted); }
.train-go { font-size: 16px; padding: 14px; margin-bottom: 6px; }
.train-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .train-list { grid-template-columns: 1fr 1fr; } }
.train-card { display: flex; gap: 12px; align-items: center; margin: 0; }
.train-card-ico { font-size: 30px; width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.train-card-act { display: flex; flex-direction: column; gap: 6px; }
.train-card-act .btn { padding: 8px 12px; }
.train-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.train-chips span { font-size: 11.5px; background: var(--surface-2); border-radius: 99px; padding: 2px 8px; color: var(--muted); }
.train-quick-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.train-quick-btns .btn { padding: 10px 4px; line-height: 1.2; }
.train-quick-btns small { font-weight: 500; color: var(--muted); font-size: 11px; }
@media (max-width: 520px) { .train-quick-btns { grid-template-columns: 1fr 1fr; } }
.train-muscles { margin-bottom: 10px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ex-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 8px 8px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; position: relative; box-shadow: var(--shadow); }
.ex-card b { font-size: 13.5px; line-height: 1.2; }
.ex-card span { font-size: 11px; color: var(--muted); }
.ex-card .lvl { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 8px; letter-spacing: 1px; color: var(--accent); }
.ex-anim { display: block; width: auto; height: auto; max-width: 100%; }
.ex-anim .mf, .ex-anim .mb { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.ex-anim .mb { stroke: var(--muted); opacity: .75; }
.ex-anim .mh { fill: var(--accent); }
.ex-anim .mg { stroke: var(--border); stroke-width: 2.5; stroke-linecap: round; }
.ex-anim .mp { stroke: var(--muted); stroke-width: 3.5; fill: none; stroke-linecap: round; }
.ex-hero { display: flex; justify-content: center; background: var(--surface-2); border-radius: 16px; padding: 10px; }
.ex-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.ex-errors { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.ex-var { margin: 0; display: flex; flex-direction: column; gap: 3px; }
.train-hist { display: flex; flex-direction: column; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.we-item { border: 1px solid var(--border); border-radius: 12px; padding: 8px; display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; }
.we-ex { display: flex; align-items: center; gap: 8px; min-width: 0; }
.we-ex b { font-size: 14px; }
.we-ctl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.we-move { grid-row: 1; grid-column: 2; display: flex; }
.we-move .icon-btn { padding: 6px 8px; }
.we-num { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.we-num input { width: 64px; padding: 6px; text-align: center; }
.seg-sm button { padding: 5px 10px; font-size: 12.5px; }
.train-done { text-align: center; padding: 10px 0; }
.train-done-ico { font-size: 56px; }

/* Reproductor del entreno (pantalla completa) */
#train-run { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 18px calc(env(safe-area-inset-bottom) + 18px); gap: 6px; overflow: auto; }
#train-run.ph-work { --ph: var(--ok); }
#train-run.ph-rest { --ph: var(--accent); }
#train-run.ph-prep { --ph: var(--warn); }
#train-run.paused .tr-clock { opacity: .45; }
html.training .fab { display: none; }
.tr-top { width: 100%; max-width: 560px; display: flex; align-items: center; gap: 8px; }
.tr-title { flex: 1; text-align: center; font-weight: 700; }
.tr-round { min-width: 72px; text-align: right; font-weight: 700; color: var(--ph); font-size: 14px; }
.tr-prog { width: 100%; max-width: 560px; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.tr-prog i { display: block; height: 100%; background: var(--ph); transition: width .4s; }
.tr-phase { margin-top: 10px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ph); }
.tr-name { margin: 0; text-align: center; font-size: 28px; line-height: 1.15; }
.tr-mid { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 26px; width: 100%; }
.tr-anim { background: var(--surface); border-radius: 22px; padding: 10px; border: 1px solid var(--border); }
.tr-anim.dim { opacity: .55; }
.tr-clockbox { position: relative; width: 210px; height: 210px; display: grid; place-items: center; }
.tr-ringsvg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tr-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.tr-ring { fill: none; stroke: var(--ph); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.tr-clock { font: 800 60px/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tr-clock.small { font-size: 22px; color: var(--muted); margin-top: 6px; }
.tr-reps { display: flex; flex-direction: column; align-items: center; }
.tr-reps b { font: 800 84px/1 var(--font-num); color: var(--ph); }
.tr-reps span { font-weight: 700; color: var(--muted); }
.tr-clockbox:has(.tr-reps) { display: flex; flex-direction: column; justify-content: center; }
.tr-next { color: var(--muted); text-align: center; }
.tr-ctl { display: flex; gap: 10px; width: 100%; max-width: 420px; margin-top: 6px; }
.tr-ctl .btn { flex: 1; padding: 14px 6px; font-size: 18px; }
.tr-ctl .tr-big { flex: 2.2; background: var(--ph); color: #fff; }
.tr-opts { display: flex; gap: 18px; }
.tabbar .side-icons .side-ico { flex: 1 1 0; width: auto; min-width: 0; padding: 0; justify-content: center; gap: 0; height: 40px; }

/* Finanzas · compras pendientes */
.shop { display: flex; flex-direction: column; gap: 10px; }
.shop-sum { display: flex; gap: 8px; flex-wrap: wrap; }
.shop-sum > div { flex: 1 1 90px; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; }
.shop-sum b { font-size: 18px; font-variant-numeric: tabular-nums; }
.shop-sum small { font-size: 12px; color: var(--muted); font-weight: 500; }
.shop-groups { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.shop-groups .chip { white-space: nowrap; flex: none; }
.shop-groups .chip small { opacity: .75; font-weight: 700; margin-left: 2px; }
.shop-gh { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 2px 2px; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.shop-group .shop-item:last-child { border-bottom: 0; }
.shop-chk { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-weight: 800; color: var(--on-ok); padding: 0; }
.shop-chk:hover { border-color: var(--ok); }
.shop-item.done .shop-chk { background: var(--ok); border-color: var(--ok); }
.shop-item.done .shop-main b { text-decoration: line-through; color: var(--muted); }
.shop-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; }
.shop-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-late { color: var(--danger); font-weight: 600; }
.shop-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shop-price small { color: var(--muted); font-weight: 500; }
.shop-link { text-decoration: none; color: var(--accent); font-weight: 700; padding: 4px; }
.shop-empty { padding: 4px 2px; }
.shop-sum > div span, .shop-sum b { white-space: nowrap; }
.shop-sum b { font-size: 17px; }
.acc-av { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }

/* Notas · rúbricas por asignatura */
.grade-scope { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grade-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.grade-subj { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.grade-subj:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.grade-subj-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.grade-subj-top b:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-final { font: 800 20px var(--font-num); }
.grade-trims { display: flex; gap: 6px; }
.grade-trims span { flex: 1; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 3px 6px; text-align: center; border-bottom: 3px solid var(--g); }
.grade-trims span.off { border-bottom-color: transparent; }
.grade-trims b { color: var(--text); font-variant-numeric: tabular-nums; }
.grade-rb { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.grade-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.grade-parts span { background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.grade-notes { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.grade-trim { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.grade-trim.now { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.grade-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; gap: 8px; align-items: center; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; color: var(--text); }
.grade-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-item b { text-align: right; font-variant-numeric: tabular-nums; }
.grade-need { background: color-mix(in srgb, var(--warn) 15%, transparent); border-radius: 8px; padding: 6px 8px; }
.grade-final-card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.grade-meta { border-top: 1px solid var(--border); padding-top: 10px; }
.grade-scope .seg button { white-space: nowrap; }

/* Fotos → calendario / finanzas */
.photo-link { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); color: var(--text); border-radius: 14px; padding: 10px 14px; font-size: 22px; cursor: pointer; }
.photo-link span { display: flex; flex-direction: column; font-size: 14px; }
.photo-link small { color: var(--muted); font-size: 12.5px; }
.photo-src .btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; font-weight: 600; }
.photo-src .btn span { font-size: 30px; }
.photo-busy { position: relative; border-radius: 14px; overflow: hidden; max-height: 46vh; display: flex; justify-content: center; background: var(--surface-2); }
.photo-busy img { max-width: 100%; max-height: 46vh; object-fit: contain; display: block; }
.photo-scan { position: absolute; left: 0; right: 0; height: 30%; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 35%, transparent), transparent); animation: photoScan 1.6s ease-in-out infinite alternate; }
@keyframes photoScan { from { top: -30%; } to { top: 100%; } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; border: 1px solid var(--border); }
.photo-total { font: 800 30px var(--font-num); }
.photo-lines { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.photo-lines .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cp-list { display: flex; flex-direction: column; gap: 8px; }
.cp-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 10px; transition: opacity .15s; }
.cp-item.off { opacity: .5; }
.cp-chk { width: 20px; height: 20px; margin-top: 8px; accent-color: var(--accent); flex: none; }
.cp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cp-body input, .cp-body select { font: inherit; font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.cp-title { font-weight: 600 !important; width: 100%; }
.cp-when { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cp-week { font-size: 13px; background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; }
.cp-start, .cp-end { width: 92px; }
.cp-when > input, .cp-when > select { width: auto !important; flex: 1 1 96px; margin: 0; }
.cp-when > .cp-date { flex-basis: 130px; }
.cp-when > select { flex-basis: 110px; }
.cp-when > span.muted { display: none; }

/* Revisa tu técnica (cámara) */
.coach-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; color: var(--text); font: inherit; border: 1px solid var(--border); }
.coach-card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.coach-card small { color: var(--muted); font-size: 13px; }
.coach-card-ico { font-size: 26px; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.coach-pick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; }
.coach-ex { flex: none; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.2; text-align: center; cursor: pointer; scroll-snap-align: center; }
.coach-ex.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.coach-setup { margin: 0; }
.coach { position: fixed; inset: 0; z-index: 9000; background: #000; color: #fff; overflow: hidden; }
.coach video, .coach canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.coach.mirror video, .coach.mirror canvas { transform: scaleX(-1); }
.coach-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: linear-gradient(rgba(0,0,0,.6), transparent); font-size: 17px; }
.coach-x { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 20px; cursor: pointer; }
.coach-count { position: absolute; top: calc(env(safe-area-inset-top) + 66px); left: 16px; display: flex; flex-direction: column; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.coach-count b { font: 800 72px/1 var(--font-num); }
.coach-count span { font-size: 14px; opacity: .85; }
.coach-cue { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 86px); padding: 12px 16px; border-radius: 16px; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); font-size: 17px; font-weight: 600; text-align: center; }
.coach-cue.ok { background: rgba(22,150,90,.85); }
.coach-cue.warn { background: rgba(214,120,10,.9); }
.coach-cue.bad { background: rgba(200,50,50,.9); }
.coach-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 14px 16px calc(env(safe-area-inset-bottom) + 18px); }
.coach-bottom .btn { min-width: 160px; background: rgba(255,255,255,.92); color: #111; }
.coach-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coach-sum > div { background: var(--surface-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.coach-sum b { font: 800 30px var(--font-num); }
.coach-sum span { font-size: 13px; color: var(--muted); }

/* Semana: categorías visibles · compartir */
.wk-legend { margin-top: 10px; padding: 10px 12px; }
.cal-share { margin-left: auto; font-weight: 600; }
.share-list { display: flex; flex-direction: column; gap: 6px; }
.share-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 8px 8px 12px; }
.share-row .grow { display: flex; flex-direction: column; min-width: 0; }
.share-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .btn { padding: 6px 12px; min-height: 0; }
.share-count { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.share-srcs { display: flex; flex-direction: column; gap: 8px; }

/* Notas · libreta por apartados */
.gb-fill { display: flex; align-items: center; gap: 10px; }
.gb-fill .btn { flex: none; }
.gb-auto { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; }
.gb-trim { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.gb-trim.now { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.gb-th { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 16px; }
.gb-g { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--border); }
.gb-gh { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.gb-gh > span:first-child { flex: 1; min-width: 0; }
.gb-gh .gb-gv { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.gb-w { font-weight: 500; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.gb-slot { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.gb-sl { flex: 1; min-width: 0; font-size: 14px; }
.gb-vals { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px; max-width: 62%; }
.gb-vals input { width: 64px; font: inherit; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 6px 4px; }
.gb-vals input.cal { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--accent-soft); }
.gb-vals input.gb-add { width: 72px; background: transparent; border-style: dashed; }
.gb-calico { font-size: 12px; }
.gb-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 999px; padding: 3px 4px 3px 10px; }
.gb-chip.cal { background: var(--accent-soft); }
.gb-chip button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; }
.gb-rec .gb-sl { color: var(--muted); }
.gb-st { display: flex; flex-direction: column; gap: 4px; }
.gb-st:empty { display: none; }
.gb-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.gb-blocks span { background: var(--surface-2); border-radius: 8px; padding: 3px 8px; font-size: 12.5px; }
.gb-notes summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.gb-notes[open] { display: flex; flex-direction: column; gap: 6px; }
.gb-addlist { display: flex; flex-direction: column; gap: 6px; }
.gb-addbtn { text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; cursor: pointer; }
.gb-addbtn:hover { border-color: var(--accent); }

/* ---------- Edición pública sin IA: se esconde todo lo de Kio (ver kioIA en app.js) ---------- */
html.sin-ia .solo-ia { display: none !important; }

/* ---------- Entrada obligatoria con cuenta (versión pública, account.js → showAccountGate) ---------- */
#kio-gate { position: fixed; inset: 0; z-index: 9998; background: var(--bg); display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 18px 24px; overflow: auto; }
html.gated body > *:not(#kio-gate):not(#toast):not(#kio-update):not(.web-aviso) { visibility: hidden; }
.gate-box { text-align: left; }
.gate-box .upd-logo, .gate-box h2, .gate-box > .small { text-align: center; }
.gate-box .actions { margin-top: 4px; }

/* Web (kio.deepzone.es): avisos de «versión nueva» e «Instala KIO» (app/web.js) */
.web-aviso { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 9999; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 14px; background: var(--surface-2); color: inherit; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); font-size: 14px; }
.web-aviso > span { flex: 1 1 200px; }
.web-aviso a, .solo-en-app a { color: var(--accent); font-weight: 600; }
@media (min-width: 821px) { .web-aviso { left: auto; max-width: 420px; } }
