/* El lenguaje visual de Foco iOS: tipografía del sistema, fondo claro con un
   tinte de agua, superficies blancas redondeadas, botones píldora y la foca. */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: #1c2633;
  background: #f4f7fb;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --bg: #f4f7fb;
  --surface: #fff;
  --title: #16294a;
  --accent: #2b61a8;
  --accent-dark: #204e8c;
  --fill: #e6eefa;
  --rule: #dfe6f0;
  --muted: #627086;
  --danger: #a8392f;
  --shadow: 0 10px 34px rgba(22, 41, 74, 0.07);
  --shadow-float: 0 8px 28px rgba(22, 41, 74, 0.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 100% 0, #e4effb 0, transparent 70%),
    radial-gradient(800px 600px at 0 100%, #e8f1fc 0, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #7eabd9;
  outline-offset: 3px;
}
button {
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 10px 16px;
  border-radius: 999px;
  min-height: 44px;
  font-weight: 500;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:hover { background: #e3ebf7; }
button.primary { color: #fff; background: var(--accent); padding: 12px 26px; box-shadow: 0 6px 18px rgba(43, 97, 168, 0.22); }
button.primary:hover { background: var(--accent-dark); }
button.quiet { background: var(--surface); box-shadow: inset 0 0 0 1.5px #d3ddec; padding: 12px 22px; }
button.quiet:hover { background: #f1f5fb; }
button.danger { color: var(--danger); }
.small { font-size: 0.875rem; }
.muted, small { color: var(--muted); }
small { font-size: 0.875rem; line-height: 1.5; }
h1, h2, h3, h4 { color: var(--title); font-weight: 600; margin-top: 0; }
h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); line-height: 1.12; letter-spacing: -0.022em; margin-bottom: 14px; }
h2 { font-size: 1.45rem; letter-spacing: -0.015em; }
h3 { font-size: 1.1rem; }
p { line-height: 1.55; margin: 0 0 18px; }
label { display: grid; gap: 9px; color: var(--title); line-height: 1.4; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--title);
  border-radius: 16px;
  padding: 13px 16px;
  min-width: 0;
  font-size: 1rem;
}
input::placeholder, textarea::placeholder { color: #a3aebf; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); padding: 0; }
input[type="color"] { height: 48px; padding: 5px; }
textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; }
.fields { display: grid; gap: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; min-height: 36px; background: var(--surface); color: var(--accent); border-radius: 999px; font-size: 0.875rem; box-shadow: var(--shadow); }
.ochre { color: #92501e; background: #f6e9d8; box-shadow: none; }
.dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.icon { width: 21px; height: 21px; flex-shrink: 0; }

/* La foca y el agua (foca.mjs) */
foco-foca { display: inline-block; width: 96px; aspect-ratio: 1; flex-shrink: 0; vertical-align: middle; }
foco-foca > canvas { display: block; width: 100%; height: 100%; }
foco-agua { display: block; position: relative; overflow: hidden; }
foco-agua > canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
foco-agua > :not(canvas) { position: relative; }
.bubble {
  position: relative;
  display: inline-block;
  margin: 0;
  padding: 14px 24px;
  background: var(--surface);
  color: var(--title);
  border: 1.5px solid #cfe0f6;
  border-radius: 26px;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
  box-shadow: var(--shadow);
}
.bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: var(--surface);
  border-left: 1.5px solid #cfe0f6;
  border-top: 1.5px solid #cfe0f6;
  transform: rotate(45deg);
}

/* Estructura */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  margin: 16px 0 16px 16px;
  padding: 22px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.brand { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; display: flex; align-items: center; gap: 6px; color: var(--title); padding: 0 8px; text-decoration: none; }
.brand foco-foca { width: 46px; }
.sidebar nav { display: grid; gap: 4px; }
.navitem { display: flex; align-items: center; text-align: left; gap: 12px; padding: 8px 12px 8px 8px; width: 100%; color: #1c2633; font-size: 1rem; line-height: 1.2; }
.navitem .icon { width: 34px; height: 34px; padding: 8px; border-radius: 50%; color: #fff; background: radial-gradient(circle at 35% 25%, #5b8ccb, #2b61a8 55%, #1d4682); }
.navitem.active { color: var(--accent); background: #e8ecf2; font-weight: 600; }
.side-bottom { margin-top: auto; display: grid; gap: 2px; }
.side-bottom .navitem { color: var(--muted); font-size: 0.94rem; padding: 6px 12px 6px 8px; }
.side-bottom .navitem .icon { width: 30px; height: 30px; padding: 6px; color: var(--accent); background: var(--fill); }
.side-bottom .navitem.active { color: var(--accent); }
.side-foot { padding: 12px 12px 4px; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }
.workspace { min-width: 0; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 44px; }
.topbar > span { font-weight: 600; font-size: 1.06rem; color: var(--title); }
.topbar .date { font-size: 0.9rem; color: var(--muted); }
.topbar button:not(.pill) { background: var(--surface); box-shadow: var(--shadow); min-height: 36px; padding: 6px 16px; font-size: 0.875rem; }
.content { padding: 26px 44px 60px; max-width: 1240px; margin: auto; }

/* Companion */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 36px; }
.chat-main { min-height: calc(100vh - 170px); display: flex; flex-direction: column; min-width: 0; }
.welcome { margin: auto; padding: 20px 0 30px; text-align: center; display: flex; flex-direction: column; align-items: center; width: 100%; }
.welcome foco-foca { width: 150px; margin-bottom: 8px; }
.welcome h1 { max-width: 560px; }
.welcome p { color: var(--muted); max-width: 460px; font-size: 1.05rem; }
.suggestions { display: grid; gap: 10px; margin-top: 18px; width: min(100%, 480px); }
.suggestions button { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 14px 20px; gap: 18px; background: var(--surface); box-shadow: var(--shadow); border-radius: 22px; }
.suggestions button:hover { background: #f1f5fb; }
.chat-aside { display: grid; gap: 14px; align-content: start; }
.chat-aside section { background: var(--surface); border-radius: 26px; padding: 22px; box-shadow: var(--shadow); }
.chat-aside h3 { margin-bottom: 10px; }
.chat-aside p { margin-bottom: 12px; }
.chat-aside button { margin-left: -8px; }
.chat-aside button.quiet { margin-left: 0; }
.mini-time { font-size: 2.8rem; font-weight: 600; color: var(--title); letter-spacing: -0.04em; margin-bottom: 8px; }
.mini-time small { font-size: 1rem; font-weight: 400; letter-spacing: 0; }
.composer { background: var(--surface); border: 1px solid var(--rule); border-radius: 28px; padding: 16px 18px 12px; margin-top: 22px; box-shadow: var(--shadow); }
.composer textarea { background: none; border: 0; border-radius: 8px; padding: 2px 4px; min-height: 54px; max-height: 240px; outline-offset: 6px; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.composer-foot [data-action="voice"] { width: 44px; padding: 0; display: grid; place-items: center; background: var(--fill); }
.composer-note { text-align: center; font-size: 0.8125rem; color: var(--muted); margin-top: 12px; }
.messages { display: flex; flex-direction: column; gap: 6px; }
.message { max-width: 720px; line-height: 1.6; padding: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.04rem; }
.message.user { align-self: flex-end; background: var(--surface); border: 1px solid var(--rule); padding: 13px 18px; border-radius: 22px; max-width: 85%; margin: 14px 0; }
.message.actionResult { font-size: 0.9rem; color: var(--accent); background: var(--fill); padding: 10px 16px; border-radius: 16px; align-self: flex-start; }
.proposal { border: 1px solid var(--rule); border-radius: 26px; padding: 22px; margin: 12px 0; background: var(--surface); box-shadow: var(--shadow); }
.proposal h3 { margin: 0 0 12px; font-weight: 500; font-size: 1.2rem; }
.proposal ul { padding-left: 20px; line-height: 1.6; }

/* Secciones y listas */
.section-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.intro { max-width: 630px; color: var(--muted); font-size: 1.05rem; }
.section { margin-top: 36px; }
.list { margin-top: 14px; display: grid; gap: 10px; }
.list-item { padding: 18px 22px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.list-item h3 { margin: 0 0 6px; }
.list-item p { margin: 0; }
.empty { padding: 26px 0; color: var(--muted); max-width: 550px; line-height: 1.6; }
.notice { border-radius: 22px; background: var(--fill); padding: 16px 20px; color: #3a4d6b; line-height: 1.55; margin: 18px 0; }
.notice.warn { background: #f6eddc; color: #825324; }
.notice.error { background: #fbeceb; color: var(--danger); }
.duration { font-size: 4.6rem; font-weight: 600; color: var(--title); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 24px 0; }
.duration small { font-size: 1.1rem; font-weight: 400; letter-spacing: 0; margin-left: 12px; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice button { background: var(--surface); box-shadow: inset 0 0 0 1.5px #d3ddec; }
.choice button.selected { background: var(--accent); color: #fff; box-shadow: none; }
.focus-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }
.focus-pane, .focus-pane + div { background: var(--surface); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); }
.symbol { width: 52px; height: 52px; display: grid; place-items: center; color: var(--accent); background: var(--fill); border-radius: 16px; flex-shrink: 0; }
.collection-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 22px 0; padding: 5px; background: rgba(255, 255, 255, 0.82); border-radius: 999px; box-shadow: var(--shadow); }
.collection-tabs button { min-height: 38px; padding: 6px 16px; color: #1c2633; }
.collection-tabs button[aria-selected="true"] { background: #e8ecf2; color: var(--accent); font-weight: 600; }
.day { display: flex; align-items: center; gap: 7px; background: var(--fill); padding: 8px 12px; border-radius: 999px; }
.day input { margin: 0; }
.session-banner { padding: 24px 28px; color: #fff; background: linear-gradient(180deg, #2b61a8, #1c4079); border-radius: 28px; margin: 0 0 28px; box-shadow: var(--shadow-float); }
.session-banner small, .session-banner p { color: rgba(255, 255, 255, 0.85); }
.session-banner .timer { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.03em; color: #fff; font-variant-numeric: tabular-nums; }
.session-banner button.quiet { box-shadow: none; }
.cap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cap { padding: 24px; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); }
.cap h3 { font-size: 1.2rem; margin: 14px 0 8px; }
.cap p { color: var(--muted); }
.metric { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.035em; color: var(--title); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0; }
.stat { background: var(--surface); border-radius: 24px; padding: 20px 22px; box-shadow: var(--shadow); }
.progress { height: 8px; background: var(--fill); border-radius: 20px; overflow: hidden; margin-top: 12px; }
.progress progress { width: 100%; height: 8px; accent-color: var(--accent); }
dialog { border: 0; border-radius: 30px; padding: 30px; width: min(610px, calc(100vw - 32px)); max-height: 90vh; background: var(--bg); color: #1c2633; box-shadow: 0 24px 80px rgba(22, 41, 74, 0.22); }
dialog::backdrop { background: rgba(22, 41, 74, 0.3); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; }
.dialog-head button { margin-top: -6px; margin-right: -8px; background: var(--surface); box-shadow: var(--shadow); }
.dialog-error { color: var(--danger); line-height: 1.5; margin-top: 14px; }
.review { padding: 16px 18px; background: var(--surface); border-radius: 20px; margin: 12px 0; line-height: 1.6; box-shadow: var(--shadow); }
.review dl { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin: 0; }
.review dt { color: var(--muted); }
.review dd { margin: 0; overflow-wrap: anywhere; }
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--title); color: #fff; padding: 14px 24px; border-radius: 999px; max-width: min(550px, 90vw); z-index: 100; box-shadow: var(--shadow-float); display: none; line-height: 1.4; }
#toast.show { display: block; }
.loading { margin: 70px; }
.skip { position: fixed; top: -100px; left: 20px; z-index: 999; background: #fff; padding: 15px; border-radius: 16px; }
.skip:focus { top: 10px; }

/* Mar y Lago: la foca flota sobre el agua de la app */
.sea { border-radius: 32px; min-height: 380px; display: grid; justify-items: center; align-content: start; padding-top: 34px; margin-top: 30px; background: linear-gradient(180deg, #eaf2fc, #dbe9fa); box-shadow: var(--shadow); }
.sea foco-foca { width: 150px; }
.lake-note { text-align: center; max-width: 560px; margin: 25px auto; }
.lake-note > foco-foca { width: 130px; margin: 14px; }
.calendar-item { align-items: start; }
.badge-label { font-size: 0.85rem; color: var(--muted); }
.hidden { display: none !important; }

/* Pausa de un sitio protegido */
.blocked { max-width: 560px; margin: 6vh auto; padding: 28px; text-align: center; }
.blocked foco-foca { width: 150px; }
.blocked h1 { margin-top: 8px; }
.blocked .actions { justify-content: center; }
.blocked .duration { font-size: 4rem; }
.blocked form, .blocked .notice { text-align: left; }
.word { font-size: 1.2rem; line-height: 1.7; padding: 18px; background: var(--fill); border-radius: 20px; user-select: none; }
.challenge-form { margin-top: 22px; }

/* Calendario */
.calendar-toolbar { margin: 28px 0 18px; }
.calendar-toolbar h2 { margin: 0; text-transform: capitalize; }
.calendar-scroll { overflow-x: auto; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); min-width: 750px; }
.weekday { padding: 14px 10px; font-size: 0.8125rem; font-weight: 600; text-align: center; color: var(--muted); }
.calendar-day { min-height: 125px; padding: 10px 8px; border-right: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-grid.week .calendar-day { min-height: 330px; }
.day-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; margin-bottom: 8px; color: var(--title); }
.day-number.today { background: var(--accent); color: #fff; }
.adjacent .day-number { color: var(--muted); }
.calendar-entry { display: grid; gap: 4px; width: 100%; min-height: 0; text-align: left; padding: 9px 10px; margin-bottom: 7px; background: #e4edf8; color: #214e8a; border-radius: 12px; font-size: 0.875rem; font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
.calendar-entry small { font-size: 0.8125rem; color: inherit; }
.calendar-entry.assessments { background: #f5e7d8; color: #865021; }
.calendar-entry.classes { background: #e2eeea; color: #2e6858; }
.calendar-entry.availability { background: #edf0f4; color: #586578; }
.calendar-empty { font-size: 0.875rem; color: var(--muted); }

@media (max-width: 1150px) {
  .shell { grid-template-columns: 224px 1fr; }
  .content { padding: 22px 28px 50px; }
  .topbar { padding: 0 28px; }
  .chat-layout { gap: 20px; grid-template-columns: minmax(0, 1fr) 230px; }
}
@media (max-width: 900px) {
  .chat-layout { display: block; }
  .chat-aside { display: none; }
  .focus-grid, .cap-grid { grid-template-columns: 1fr; }
}
/* En el teléfono, la barra flotante de la app */
@media (max-width: 640px) {
  .shell { display: block; }
  .sidebar { display: contents; }
  .sidebar .brand { padding: 16px 20px 0; font-size: 22px; }
  .brand foco-foca { width: 38px; }
  .sidebar nav {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
    border-radius: 999px;
    box-shadow: var(--shadow-float);
    max-width: calc(100vw - 20px);
  }
  .sidebar nav .navitem { flex-direction: column; gap: 3px; width: auto; min-width: 72px; padding: 6px 9px; font-size: 0.7rem; font-weight: 600; text-align: center; white-space: nowrap; }
  .sidebar nav .navitem .icon { width: 30px; height: 30px; padding: 7px; }
  .side-bottom { display: flex; overflow-x: auto; gap: 6px; margin: 0; padding: 10px 20px 0; scrollbar-width: none; }
  .side-bottom .row { display: contents; }
  .side-bottom .navitem { width: auto; min-width: max-content; min-height: 36px; padding: 4px 14px 4px 4px; font-size: 0.85rem; background: var(--surface); box-shadow: var(--shadow); }
  .side-bottom .navitem .icon { width: 28px; height: 28px; }
  .side-foot { display: none; }
  .topbar { padding: 0 20px; height: 60px; }
  .topbar .date { display: none; }
  .content { padding: 14px 20px 130px; }
  .chat-main { min-height: 62vh; }
  .welcome foco-foca { width: 120px; }
  .two { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .stats { grid-template-columns: 1fr; }
  .list-item { gap: 12px; flex-wrap: wrap; padding: 16px 18px; }
  .list-item .actions { margin: 0; }
  .focus-pane, .focus-pane + div { padding: 22px; }
  .duration { font-size: 4rem; }
  .session-banner { padding: 22px; }
  .blocked { margin-top: 2vh; }
  dialog { padding: 22px; border-radius: 26px; }
  #toast { bottom: 96px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background 0.15s, color 0.15s; }
  .breathing { animation: breathe 8s ease-in-out infinite; }
  @keyframes breathe { 50% { transform: scale(1.12); } }
}
