/* ==========================================================================
   Agenda — sistema visual
   Papel frío, tinta de pluma azul marino, subrayador amarillo para «hoy»,
   rojo de bolígrafo para «ahora». La bisagra antes → evento → después
   es el único elemento protagonista; el resto se mantiene sobrio.
   ========================================================================== */

@font-face { font-family: "Geist"; src: url(fonts/geist-latin-wght-normal.woff2) format("woff2-variations"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url(fonts/bricolage-grotesque-latin-standard-normal.woff2) format("woff2-variations"); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }

:root {
  --paper: #F2EDE6;
  --surface: #FBF8F3;
  --raised: #FFFDFA;
  --sunken: #ECE5DC;
  --ink: #2B1B1E;
  --ink-2: #5F4C4F;
  --ink-3: #9C8C88;
  --line: #E0D6CB;
  --line-soft: #EAE3D9;
  --hl: #7B1E2E;
  --hl-ink: #FBF3EE;
  --note: #E7D3AE;
  --red: #E0364B;
  --ok: #3F7D4E;
  --warn: #B0650A;
  --scrim: rgba(43, 27, 30, .24);
  --shadow-sm: 0 1px 2px rgba(43, 27, 30, .06);
  --shadow-md: 0 6px 18px -6px rgba(43, 27, 30, .18);
  --shadow-lg: 0 28px 70px -16px rgba(43, 27, 30, .32), 0 10px 24px -10px rgba(43, 27, 30, .14);
  --f-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Bricolage", "Geist", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sb-w: 268px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #120E0F; --surface: #1B1517; --raised: #241D20; --sunken: #0F0B0C;
  --ink: #F2EAE4; --ink-2: #BEB0AB; --ink-3: #867774; --line: #34292C; --line-soft: #2A2124;
  --hl: #C9505F; --hl-ink: #FFF5F2; --note: #5E4A2C; --red: #FF5C70; --ok: #7CC48C; --warn: #E8A24C;
  --scrim: rgba(3, 5, 15, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 20px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .04);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #120E0F; --surface: #1B1517; --raised: #241D20; --sunken: #0F0B0C;
  --ink: #F2EAE4; --ink-2: #BEB0AB; --ink-3: #867774; --line: #34292C; --line-soft: #2A2124;
  --hl: #C9505F; --hl-ink: #FFF5F2; --note: #5E4A2C; --red: #FF5C70; --ok: #7CC48C; --warn: #E8A24C;
    --scrim: rgba(3, 5, 15, .55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 20px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .04);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--f-ui); font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -.022em; line-height: 1.12; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 17px; letter-spacing: -.012em; }
p { margin: 0; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--sunken); padding: 1px 6px; border-radius: 5px; }
kbd { font: 500 11px/1 var(--f-ui); color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; min-width: 19px; text-align: center; display: inline-block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.i { flex: none; display: block; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.err-text { color: var(--red); }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--hl) 22%, transparent); color: var(--ink); }

/* ---------- Estructura de la app ---------- */
.has-shell { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 30; }
.sb-inner > * { flex-shrink: 0; }
.sb-inner { height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px 14px 16px; overflow-y: auto; scrollbar-width: none; }
.main { margin-left: var(--sb-w); padding: 28px 36px 60px; min-height: 100dvh; }
.has-shell .main {
  margin: 10px 10px 10px var(--sb-w); min-height: calc(100dvh - 20px);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 20px; box-shadow: var(--shadow-sm);
}
.main.wide { padding: 22px 26px 26px; }
.mbar, .tabbar, .scrim { display: none; }

/* Marca: dos puntos y la bisagra */
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px/1 var(--f-display); letter-spacing: -.03em; padding: 4px 6px; }
.brand-mark { display: inline-flex; align-items: center; gap: 3px; }
.brand-mark i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.brand-mark i:nth-child(1) { background: transparent; box-shadow: inset 0 0 0 1.8px var(--ink); }
.brand-mark i:nth-child(2) { width: 4px; height: 17px; border-radius: 3px; background: var(--hl); box-shadow: 0 0 0 1.5px var(--ink); margin: 0 1px; }

.sb-new, .sb-search { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px 0 12px; border-radius: 11px; border: 0; cursor: pointer; text-align: left; font-size: 14px; }
.sb-new { background: var(--hl); color: var(--hl-ink); font-weight: 550; margin-top: 4px; }
.sb-new kbd { margin-left: auto; background: transparent; color: color-mix(in srgb, var(--hl-ink) 70%, transparent); border-color: color-mix(in srgb, var(--hl-ink) 30%, transparent); }
.sb-new:hover { opacity: .92; }
.sb-search { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); margin-top: -6px; }
.sb-search:hover { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--ink-3); }
.sb-search kbd { margin-left: auto; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-nav a { display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 14.5px; }
.sb-nav a:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.sb-nav a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-soft); }
.count-badge { margin-left: auto; font: 600 11.5px/1 var(--f-ui); background: var(--hl); color: var(--hl-ink); padding: 3px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }

.today-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-soft); }
.today-card:hover { box-shadow: inset 0 0 0 1px var(--line); }
.today-card strong { display: block; font: 700 15px/1.2 var(--f-display); }
.today-card span { font-size: 12.5px; color: var(--ink-3); }
.ring { transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 3.6; }
.ring-bg { stroke: var(--sunken); }
.ring-fg { stroke: var(--hl); stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }

.mini { padding: 2px 4px; }
.mini-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; padding-left: 4px; }
.mini-head span { flex: 1; font: 650 14px var(--f-display); }
.mini-head em { font-style: normal; color: var(--ink-3); font-weight: 450; }
.mini-head a { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--ink-3); }
.mini-head a:hover { background: var(--sunken); color: var(--ink); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 1px; text-align: center; }
.mini-grid .wd { font-size: 10.5px; color: var(--ink-3); font-weight: 500; padding-bottom: 3px; }
.md { position: relative; height: 29px; display: grid; place-items: center; font-size: 12.5px; font-variant-numeric: tabular-nums; border-radius: 8px; color: var(--ink-2); }
.md:hover { background: var(--sunken); color: var(--ink); }
.md.out { color: color-mix(in srgb, var(--ink-3) 60%, transparent); }
.md.inweek { background: color-mix(in srgb, var(--ink) 5.5%, transparent); border-radius: 0; }
.md.inweek:nth-child(7n+1) { border-radius: 8px 0 0 8px; }
.md.inweek:nth-child(7n) { border-radius: 0 8px 8px 0; }
.md.busy::after { content: ""; position: absolute; bottom: 3px; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
.md.today { color: var(--hl-ink); font-weight: 700; }
.md.today::before { content: ""; position: absolute; inset: 4px 3px; background: var(--hl); border-radius: 7px 9px 6px 10px; transform: rotate(-4deg); z-index: -1; }
.mini-grid { isolation: isolate; }

.sb-cals { display: flex; flex-direction: column; gap: 1px; }
.sb-title { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 4px 10px; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.sb-title a { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; }
.sb-title a:hover { background: var(--sunken); color: var(--ink); }
.cal-toggle { display: flex; flex-direction: row; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.cal-toggle:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.cal-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cal-toggle .box { width: 15px; height: 15px; border-radius: 5px; border: 1.8px solid var(--c); flex: none; display: grid; place-items: center; transition: background .15s; }
.cal-toggle input:checked + .box { background: var(--c); }
.cal-toggle input:checked + .box::after { content: ""; width: 3.5px; height: 7px; border: solid #fff; border-width: 0 1.8px 1.8px 0; transform: translateY(-1px) rotate(45deg); }
.cal-toggle input:not(:checked) ~ .nm { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line); }
.cal-toggle input:focus-visible + .box { outline: 2px solid var(--ink); outline-offset: 2px; }
.cal-toggle .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: auto; flex: none; }

.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.sync-form { margin: 0; }
.sb-sync { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 10px; color: var(--ink-3); font-size: 12.5px; cursor: pointer; border-radius: 8px; }
.sb-sync:hover { color: var(--ink); background: var(--sunken); }
.sb-sync.spinning .i { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sb-user { display: flex; align-items: center; gap: 9px; padding: 6px 4px 0 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.sb-user form { margin: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--hl); color: var(--hl-ink); display: grid; place-items: center; font: 700 13px var(--f-display); flex: none; }
.sb-user .nm { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-switch { display: flex; background: var(--sunken); border-radius: 8px; padding: 2px; }
.theme-switch button { width: 24px; height: 22px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: 6px; cursor: pointer; }
.theme-switch button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 550 14px var(--f-ui); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--hl); color: var(--hl-ink); border-color: var(--hl); }
.btn.primary:hover { opacity: .9; }
.btn.subtle { background: var(--sunken); border-color: transparent; color: var(--ink-2); }
.btn.subtle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, var(--sunken)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.danger, .btn.ghost.danger { color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 9%, transparent); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.bordered { box-shadow: inset 0 0 0 1px var(--line); }
form.inline { display: inline; margin: 0; }

.seg { display: inline-flex; background: var(--sunken); padding: 3px; border-radius: 11px; gap: 2px; }
.seg a, .seg label { display: flex; align-items: center; gap: 6px; padding: 0 13px; height: 30px; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-3); cursor: pointer; }
.seg a:hover, .seg label:hover { color: var(--ink); }
.seg a.on, .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg label input { display: none; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
input, select, textarea {
  font: 15px var(--f-ui); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238A90AB' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--ink-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 9%, transparent); }
input[type=color] { width: 42px; height: 36px; padding: 3px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }
.switch { flex-direction: row; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; align-items: center; }
.row .t { width: 128px; flex: none; }
fieldset { border: 0; border-top: 1px solid var(--line-soft); padding: 18px 0 4px; margin: 0; min-width: 0; }
fieldset > * + * { margin-top: 14px; }
fieldset > legend + * { margin-top: 0; }
legend { font: 700 16px var(--f-display); padding: 0 10px 0 0; color: var(--ink); letter-spacing: -.01em; }
legend .muted { font: 400 13px var(--f-ui); letter-spacing: 0; }

.flash { padding: 11px 14px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: color-mix(in srgb, var(--ok) 60%, var(--ink)); border: 1px solid color-mix(in srgb, var(--ok) 22%, transparent); }
.flash.err { background: color-mix(in srgb, var(--red) 8%, var(--surface)); color: color-mix(in srgb, var(--red) 55%, var(--ink)); border-color: color-mix(in srgb, var(--red) 22%, transparent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-top: 22px; }
.card > h1, .card > h2 { margin-bottom: 18px; }
.card.narrow { max-width: 640px; margin: 8px auto 0; }
.empty { text-align: center; padding: 64px 16px; color: var(--ink-2); max-width: 440px; margin: 0 auto; }
.empty h2 { font-size: 22px; margin-bottom: 8px; color: var(--ink); }
.empty p { margin-bottom: 18px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 14px; margin-bottom: 16px; font-weight: 500; }
.back:hover { color: var(--ink); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.lead { margin: -10px 0 26px; max-width: 64ch; color: var(--ink-2); }

/* ---------- Check ---------- */
.check {
  width: 21px; height: 21px; border-radius: 50%; padding: 0; cursor: pointer; flex: none; margin-top: 1px;
  border: 1.7px solid color-mix(in srgb, var(--c, var(--ink)) 70%, var(--ink-3)); background: transparent;
  display: grid; place-items: center; transition: background .18s, border-color .18s, transform .12s;
}
.check svg { width: 70%; height: 70%; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset .28s var(--ease) .04s; }
.check:hover { background: color-mix(in srgb, var(--c, var(--ink)) 12%, transparent); }
.check:active { transform: scale(.88); }
.check[aria-pressed=true] { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); }
.check[aria-pressed=true] svg { stroke-dashoffset: 0; }
.check.pop { animation: pop .38s var(--ease); }
@keyframes pop { 0% { transform: scale(.8); } 55% { transform: scale(1.14); } 100% { transform: scale(1); } }
.check.sm { width: 19px; height: 19px; }
.check.lg { width: 32px; height: 32px; border-width: 2px; }

/* ---------- Bisagra (puntos antes | después) ---------- */
.hinge { display: inline-flex; align-items: center; gap: 5px; color: var(--c, var(--ink-2)); }
.hinge .side { display: inline-flex; gap: 3px; align-items: center; }
.hinge .side:empty { display: none; }
.hinge .side i { width: 6px; height: 6px; border-radius: 50%; box-shadow: inset 0 0 0 1.4px color-mix(in srgb, currentColor 75%, var(--ink-3)); }
.hinge .side i.on { background: currentColor; box-shadow: none; }
.hinge .side small { font-size: 10px; color: var(--ink-3); font-weight: 600; }
.hinge b { width: 2.5px; height: 12px; border-radius: 2px; background: var(--ink-2); }
.hinge.complete b { background: var(--ok); }
.hinge .nt { color: var(--ink-3); margin-left: 1px; }

/* ---------- Cabecera de la agenda ---------- */
.page-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-top .range { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.page-top h1 { font-size: 30px; }
.page-top h1 .yr { color: var(--ink-3); font-weight: 400; }
.nav-btns { display: flex; align-items: center; gap: 6px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.onboard { display: flex; gap: 28px; align-items: center; padding: 26px 28px; border-radius: 18px; background: var(--sunken); margin-bottom: 20px; }
.onboard h2 { font-size: 21px; margin-bottom: 6px; }
.onboard p { color: var(--ink-2); max-width: 56ch; margin-bottom: 16px; }
.onboard-art { display: flex; align-items: center; gap: 8px; flex: none; }
.onboard-art span { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px var(--ink); }
.onboard-art span:nth-child(2) { background: var(--ink); }
.onboard-art b { width: 8px; height: 52px; border-radius: 5px; background: var(--hl); box-shadow: 0 0 0 2.5px var(--ink); margin: 0 4px; }

/* ---------- Semana: rejilla horaria ---------- */
.week { --gut: 58px; display: flex; flex-direction: column; height: calc(100dvh - 128px); min-height: 460px; border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; background: var(--surface); }
.wk-head, .wk-allday, .wk-grid { display: grid; grid-template-columns: var(--gut) repeat(7, minmax(0, 1fr)); }
.wk-head { border-bottom: 1px solid var(--line-soft); }
.wk-day { display: flex; align-items: baseline; gap: 7px; padding: 12px 12px 10px; border-left: 1px solid var(--line-soft); }
.wk-day .wd { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.wk-day .num { position: relative; font: 650 22px/1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wk-day.past .num { color: var(--ink-3); }
.wk-day.today .num { color: var(--hl-ink); isolation: isolate; }
.wk-day.today .num::before { content: ""; position: absolute; inset: -3px -7px -4px -6px; background: var(--hl); border-radius: 8px 12px 7px 13px; transform: rotate(-3deg); z-index: -1; }
.wk-day.today .wd { color: var(--ink); font-weight: 600; }
.wk-day:hover .num { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.wk-day.today:hover .num { text-decoration: none; }

.wk-allday { border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--sunken) 55%, var(--surface)); }
.wk-allday .gutter { display: flex; align-items: flex-start; justify-content: flex-end; padding: 8px 8px 0 0; font-size: 11px; color: var(--ink-3); text-align: right; line-height: 1.2; }
.ad-col { border-left: 1px solid var(--line-soft); padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ad-ev { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 550; background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: color-mix(in srgb, var(--c) 45%, var(--ink)); min-width: 0; }
.ad-ev > span:not(.hinge):not(.ic) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ad-ev:hover { background: color-mix(in srgb, var(--c) 26%, var(--surface)); }
.ad-ev.done > span:not(.hinge) { text-decoration: line-through; opacity: .7; }
.ad-ev .hinge { flex: none; }

.wk-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; scroll-behavior: smooth; overscroll-behavior: contain; }
.wk-grid { position: relative; height: calc(var(--rows) * var(--hh)); }
.hours { position: relative; }
.hours span { position: absolute; right: 9px; transform: translateY(-50%); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.col {
  position: relative; border-left: 1px solid var(--line-soft);
  background-image:
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px),
    radial-gradient(circle, color-mix(in srgb, var(--ink-3) 45%, transparent) .75px, transparent 1.1px);
  background-size: 100% var(--hh), 7px var(--hh);
  background-position: 0 0, 0 calc(var(--hh) / 2 - 3.5px);
  background-repeat: repeat, repeat-x;
}
.col { background-repeat: repeat; }
.col.today { background-color: color-mix(in srgb, var(--note) var(--today-tint, 22%), transparent); }
:root[data-theme="dark"] { --today-tint: 14%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --today-tint: 14%; } }
.col.past .blk:not(:hover) { filter: saturate(.75); }
.col.creating { cursor: copy; }

.blk {
  position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  padding: 5px 7px 5px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.28;
  background: color-mix(in srgb, var(--c) 15%, var(--surface));
  color: color-mix(in srgb, var(--c) 40%, var(--ink));
  box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
  transition: box-shadow .15s, background .15s;
}
.blk:hover { z-index: 3; background: color-mix(in srgb, var(--c) 22%, var(--surface)); box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent), var(--shadow-md); }
.blk .b-title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; word-break: break-word; }
.blk .b-time { font-size: 11.5px; opacity: .78; font-variant-numeric: tabular-nums; }
.blk .ic { margin-right: 4px; }
.blk .hinge { margin-top: auto; padding-top: 3px; }
.blk.short { flex-direction: row; align-items: center; padding-top: 2px; padding-bottom: 2px; }
.blk.short .b-title { -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block; }
.blk.bold .b-title { font-weight: 750; }
.blk.done { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 9%, var(--surface)) 0 5px, var(--surface) 5px 10px); }
.blk.done .b-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--c) 55%, transparent); }
.blk.removed { box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px var(--line); background: var(--surface); opacity: .7; }
.blk.is-hidden, .ad-ev.is-hidden { opacity: .45; }
.blk.flash-in { animation: flashIn 1.4s var(--ease); }
@keyframes flashIn { 0%, 30% { box-shadow: inset 3px 0 0 var(--c), 0 0 0 3px var(--hl); } }

.now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--red); z-index: 4; pointer-events: none; }
.now i { position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--surface); }
.week-empty { text-align: center; color: var(--ink-3); margin-top: 14px; font-size: 14px; }
.ghost-blk { position: absolute; left: 2px; right: 2px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1.5px dashed var(--ink-3); pointer-events: none; z-index: 2; font-size: 12px; padding: 4px 8px; color: var(--ink-2); }

/* ---------- Lista ---------- */
.agenda-list { max-width: 860px; }
.al-day { display: grid; grid-template-columns: 104px 1fr; gap: 10px 24px; padding: 18px 0; border-top: 1px solid var(--line-soft); }
.al-day:first-child { border-top: 0; padding-top: 4px; }
.al-date { display: flex; flex-direction: column; align-items: flex-start; position: sticky; top: 12px; align-self: start; }
.al-date .num { position: relative; font: 700 44px/.95 var(--f-display); letter-spacing: -.045em; font-variant-numeric: tabular-nums; isolation: isolate; }
.al-date .wd { font-weight: 600; font-size: 14px; margin-top: 6px; }
.al-date .mo { font-size: 12.5px; color: var(--ink-3); }
.al-day.past .num { color: var(--ink-3); }
.al-day.today .num { color: var(--hl); }
.al-day.today .num::before { content: ""; position: absolute; inset: 14px -6px -2px -5px; background: color-mix(in srgb, var(--hl) 16%, transparent); border-radius: 4px 10px 5px 12px; transform: rotate(-2.5deg); z-index: -1; }
.al-items { display: flex; flex-direction: column; min-width: 0; }
.al-free { color: var(--ink-3); padding: 12px 0; }
.al-more { display: inline-block; margin: 20px 0 0 128px; color: var(--ink-2); font-weight: 550; font-size: 14px; border-bottom: 1.5px solid var(--line); padding-bottom: 2px; }
.al-more:hover { border-color: var(--ink); color: var(--ink); }

.card-ev { position: relative; display: grid; grid-template-columns: 24px 1fr auto; gap: 14px; align-items: start; padding: 13px 12px 13px 10px; border-radius: 14px; margin: 0 -10px; transition: background .15s; }
.card-ev + .card-ev::before { content: ""; position: absolute; top: 0; left: 48px; right: 10px; height: 1px; background: var(--line-soft); }
.card-ev:hover { background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.card-ev:hover::before, .card-ev:hover + .card-ev::before { opacity: 0; }
.ce-time .now-tag { color: #fff; background: var(--red); font-weight: 650; padding: 0 6px; border-radius: 5px; margin-right: 6px; }
.card-ev .check { margin-top: 2px; }
.ce-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ce-time { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.ce-title { font: 600 16px/1.3 var(--f-ui); letter-spacing: -.01em; word-break: break-word; }
.ce-title .ic { margin-right: 7px; }
.card-ev.bold .ce-title { font-weight: 750; }
.ce-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--ink-3); }
.cal-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--c); margin-right: -4px; }
.loc { display: inline-flex; align-items: center; gap: 3px; }
.ce-next { display: flex; gap: 8px; align-items: baseline; margin-top: 5px; font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.ce-next em { font-style: normal; font-weight: 600; font-size: 12px; color: color-mix(in srgb, var(--c) 60%, var(--ink)); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 1px 7px; border-radius: 6px; flex: none; }
.card-ev .hinge { margin-top: 5px; }
.card-ev.done .ce-title { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }
.card-ev.removed { opacity: .65; }
.card-ev.is-hidden { opacity: .5; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; line-height: 1.55; background: color-mix(in srgb, var(--c, var(--ink)) 13%, transparent); color: color-mix(in srgb, var(--c, var(--ink)) 62%, var(--ink)); }
.badge.gone { background: var(--sunken); color: var(--ink-3); }
[data-cal].cal-off { display: none !important; }

/* ---------- Detalle: la bisagra ---------- */
.hinge-view { --c: var(--ink); }
.hv-head { padding: 4px 0 22px; }
.hv-when { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; flex-wrap: wrap; }
.hv-when .rel { font-weight: 650; color: color-mix(in srgb, var(--c) 70%, var(--ink)); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 9px; border-radius: 7px; }
.state-live .hv-when .rel { color: #fff; background: var(--red); }
.hv-title { font-size: 30px; line-height: 1.1; letter-spacing: -.028em; word-break: break-word; }
.hv-title .ic { margin-right: 10px; }
.hv-title.struck { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--c) 60%, transparent); color: var(--ink-2); }
.hv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; }
.chip-cal { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-weight: 500; }
.chip-cal i { width: 8px; height: 8px; border-radius: 3px; background: var(--cc); }
.hv-meta .loc, .edit-link { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); padding: 3px 8px; border-radius: 8px; }
.hv-meta .loc:hover, .edit-link:hover { background: var(--sunken); color: var(--ink); }
.meta-actions { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }

.hv-line { --rail: 16px; position: relative; padding-left: calc(var(--rail) * 2 + 8px); }
.hv-line::before { content: ""; position: absolute; left: calc(var(--rail) - 1px); top: 10px; bottom: 10px; width: 2px; border-radius: 2px;
  background: linear-gradient(to bottom, transparent, var(--line) 24px, var(--line) calc(100% - 24px), transparent); }
.phase { position: relative; padding: 4px 0 16px; }
.phase::before { content: ""; position: absolute; left: calc(var(--rail) * -1 - 8px - 5px); top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink-3); }
.phase.focus::before { box-shadow: inset 0 0 0 2px var(--c); }
.phase header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.phase h2 { font-size: 19px; }
.phase header p { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.phase:not(.focus) h2 { color: var(--ink-2); }
.meter { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.meter .count { font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meter .bar { width: 56px; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; transition: width .4s var(--ease); }
.meter.full .count { color: var(--ok); }
.meter.full .bar i { background: var(--ok); }

.hv-node { position: relative; display: flex; align-items: center; gap: 14px; margin: 6px 0 20px calc((var(--rail) * 2 + 8px) * -1); padding: 12px 16px 12px 0; }
.hv-node::before { content: ""; position: absolute; inset: 0 0 0 var(--rail); border-radius: 16px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 28%, transparent); z-index: 0; }
.hv-node > * { position: relative; z-index: 1; }
.hv-node .check { --cz: 0; margin: 0 0 0 calc(var(--rail) - 16px); box-shadow: 0 0 0 5px var(--surface); background: var(--surface); }
.hv-node .check[aria-pressed=true] { background: var(--c); }
.node-body { display: flex; flex-direction: column; margin-left: 10px; }
.node-time { font: 650 17px/1.2 var(--f-display); letter-spacing: -.01em; color: color-mix(in srgb, var(--c) 45%, var(--ink)); font-variant-numeric: tabular-nums; }
.node-label { font-size: 12.5px; color: var(--ink-2); }
.live-dot { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent); animation: live 1.8s ease-out infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.items { list-style: none; padding: 0; margin: 0; }
.item { position: relative; display: grid; grid-template-columns: 22px 1fr 24px; gap: 10px; align-items: start; padding: 7px 6px 7px 4px; margin: 0 -6px 0 -4px; border-radius: 10px; transition: background .12s, opacity .25s, transform .25s; }
.item:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.item .txt { font-size: 15px; line-height: 1.45; word-break: break-word; cursor: text; border-radius: 6px; padding: 0 4px; margin: 0 -4px; outline: 0; }
.item .txt[contenteditable=true] { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink-2); }
.item.done .txt { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }
.item.note { background: color-mix(in srgb, var(--note) 34%, transparent); margin-top: 3px; margin-bottom: 3px; }
.item.note:hover { background: color-mix(in srgb, var(--note) 50%, transparent); }
.item.note .txt { color: var(--ink-2); font-size: 14.5px; }
.note-mark { color: color-mix(in srgb, var(--note) 35%, var(--ink-2)); display: grid; place-items: center; height: 21px; }
.item .del { opacity: 0; border: 0; background: none; color: var(--ink-3); cursor: pointer; width: 24px; height: 22px; display: grid; place-items: center; border-radius: 6px; transition: opacity .12s; }
.item:hover .del, .item .del:focus-visible { opacity: 1; }
.item .del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.item.leaving { opacity: 0; transform: translateX(10px); }
.item.entering { animation: enter .3s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(-4px); } }
@media (hover: none) { .item .del { opacity: .55; } }

.add-item { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 3px 4px; border-radius: 10px; }
.add-item .add-ic { color: var(--ink-3); width: 22px; display: grid; place-items: center; flex: none; }
.add-item input[name=body], .add-item textarea { border: 0; padding: 7px 2px; background: transparent; border-radius: 0; box-shadow: none; font-size: 15px; }
.add-item textarea { resize: none; overflow: hidden; min-height: 36px; line-height: 1.45; display: block; }
.add-item { align-items: flex-start; }
.add-item .add-ic { margin-top: 8px; }
.add-item .kind-toggle { margin-top: 4px; }
.add-item:focus-within { background: var(--sunken); }
.add-item:focus-within .add-ic { color: var(--ink); }
.kind-toggle { display: inline-flex; border-radius: 8px; padding: 2px; flex: none; opacity: 0; transition: opacity .15s; }
.add-item:focus-within .kind-toggle, .add-item:hover .kind-toggle { opacity: 1; }
.kind-toggle button { border: 0; background: transparent; font: 550 12px var(--f-ui); color: var(--ink-3); padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.kind-toggle button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
@media (hover: none) { .kind-toggle { opacity: 1; } }

.hv-desc { margin-top: 10px; padding: 14px 0 0; border-top: 1px solid var(--line-soft); }
.hv-desc summary { cursor: pointer; font-size: 13px; color: var(--ink-3); font-weight: 550; list-style: none; display: flex; align-items: center; gap: 6px; }
.hv-desc summary::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(-45deg); transition: transform .2s; }
.hv-desc[open] summary::before { transform: rotate(45deg); }
.hv-desc summary::-webkit-details-marker { display: none; }
.hv-desc div { margin-top: 10px; color: var(--ink-2); font-size: 14px; line-height: 1.6; word-break: break-word; max-width: 68ch; }
.hv-desc a { text-decoration: underline; text-underline-offset: 2px; }

.page-event { max-width: 680px; }

/* ---------- Panel lateral ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .3s; backdrop-filter: blur(1.5px); }
.drawer-panel {
  position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(540px, calc(100vw - 20px));
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); border: 1px solid var(--line-soft);
  transform: translateX(calc(100% + 24px)); transition: transform .38s var(--ease); display: flex; flex-direction: column; overflow: hidden;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; z-index: 2; }
.drawer-body { flex: 1; overflow-y: auto; padding: 30px 30px 40px; overscroll-behavior: contain; }
.drawer-body.loading { opacity: .5; transition: opacity .2s .1s; }
.drawer-body .hv-title { padding-right: 70px; }
.drawer-grip { display: none; }

/* ---------- Paleta ---------- */
.palette { position: fixed; inset: 0; z-index: 70; display: none; }
.palette.open { display: block; }
.palette-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.palette-box { position: relative; margin: 12vh auto 0; width: min(640px, calc(100vw - 24px)); background: var(--raised); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; animation: rise .22s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px; border-bottom: 1px solid var(--line-soft); color: var(--ink-3); }
.palette-input input { border: 0; background: none; padding: 0; font-size: 17px; height: 100%; box-shadow: none; border-radius: 0; }
.palette-input input:focus { box-shadow: none; }
.palette-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 6px; }
.pl-group { font-size: 12px; color: var(--ink-3); font-weight: 550; padding: 10px 12px 4px; }
.pl-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; cursor: pointer; min-height: 46px; }
.pl-item.active { background: var(--sunken); }
.pl-item .pl-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); flex: none; font-size: 15px; }
.pl-item.active .pl-ic { background: var(--surface); }
.pl-item .pl-ic.ev { background: color-mix(in srgb, var(--c) 18%, transparent); color: color-mix(in srgb, var(--c) 50%, var(--ink)); }
.pl-item .pl-ic.create { background: var(--hl); color: var(--hl-ink); }
.pl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-main strong { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-main span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item kbd { visibility: hidden; }
.pl-item.active kbd { visibility: visible; }
.pl-empty { padding: 22px 16px; color: var(--ink-3); text-align: center; font-size: 14px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.palette-foot kbd { margin-right: 3px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); padding: 10px 12px 10px 16px; border-radius: 13px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toastIn .3s var(--ease); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); color: #fff; }
.toast button { border: 0; background: color-mix(in srgb, var(--paper) 14%, transparent); color: color-mix(in srgb, var(--hl) 35%, #fff); font-weight: 650; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- Tareas ---------- */
.tgroup { margin-bottom: 36px; max-width: 800px; }
.tgroup > header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.tgroup > header h2 { font-size: 21px; }
.tgroup > header .n { font: 650 13px var(--f-ui); background: var(--sunken); color: var(--ink-2); padding: 1px 8px; border-radius: 999px; }
.tgroup.warn > header .n { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.tcard { --c: var(--ink); padding: 14px 0 10px; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 4px 1fr; gap: 0 16px; }
.tcard::before { content: ""; grid-row: 1 / span 2; background: var(--c); border-radius: 3px; opacity: .85; }
.tcard-head { display: flex; flex-direction: column; margin-bottom: 4px; }
.tcard-head .when { font-size: 12.5px; color: var(--ink-3); }
.tcard-head .ttl { font-weight: 650; font-size: 15.5px; }
.tcard-head:hover .ttl { text-decoration: underline; text-underline-offset: 3px; }
.tcard .items { margin-left: -4px; }

/* ---------- Listas (calendarios, reglas) ---------- */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.list:empty { display: none; }
.row-card { display: flex; align-items: center; gap: 14px; background: var(--surface); padding: 14px 16px; flex-wrap: wrap; }
.row-card + .row-card { border-top: 1px solid var(--line-soft); }
.row-card.off { opacity: .55; }
.row-card .name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-card .btns { display: flex; gap: 2px; flex-wrap: wrap; }
.row-card .btns form { margin: 0; }
.swatch { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: 16px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); }
.tag { font-size: 11.5px; font-weight: 550; color: var(--ink-3); background: var(--sunken); padding: 1px 7px; border-radius: 6px; }
.swatches { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; flex-direction: row; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 10%, transparent); transition: transform .12s; }
.sw:hover { transform: scale(1.1); }
.sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.card + .list, .list + .card { margin-top: 18px; }

.sentence { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 15px; color: var(--ink-2); }
.sentence select, .sentence input { width: auto; }
.sentence .w-value { min-width: 170px; flex: 1; }
.preview-box { background: var(--sunken); border-radius: 16px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.preview-box .sample { background: var(--surface); }
.preview-box .card-ev { margin: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--line-soft); max-width: 460px; }
.match-state { color: var(--ink-3); }
.match-state.yes { color: var(--ok); font-weight: 550; }

/* ---------- Acceso ---------- */
.bare .main { margin: 0; padding: 0; }
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { position: relative; background: #5C1726; color: #FBF3EE; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art .brand { color: #FBF3EE; padding: 0; }
.auth-art .brand-mark i { background: #FBF3EE; }
.auth-art .brand-mark i:nth-child(1) { background: transparent; box-shadow: inset 0 0 0 1.8px #FBF3EE; }
.auth-art .brand-mark i:nth-child(2) { box-shadow: 0 0 0 1.5px #FBF3EE; }
.auth-art h1 { font-size: clamp(34px, 3.9vw, 58px); line-height: 1.02; letter-spacing: -.04em; font-weight: 700; }
.auth-art h1 span { display: block; }
.auth-art p { color: #DDBFC1; max-width: 38ch; margin-top: 18px; font-size: 16px; }
.auth-hinge { display: flex; align-items: center; gap: 12px; margin: 40px 0; }
.auth-hinge span { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 3px #FBF3EE; opacity: .9; }
.auth-hinge span.on { background: #FBF3EE; }
.auth-hinge b { width: 12px; height: 76px; border-radius: 7px; background: #E6C58B; margin: 0 6px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 360px; }
.auth-card h2 { font-size: 28px; margin-bottom: 6px; }
.auth-card > p { color: var(--ink-3); margin-bottom: 28px; }
.auth-card .btn { height: 44px; width: 100%; font-size: 15px; }
.auth-card input { height: 44px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  :root { --sb-w: 244px; }
  .main.wide { padding: 18px 18px 22px; }
}
@media (max-width: 900px) {
  :root { --sb-w: 0px; }
  body.has-shell { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { width: 300px; transform: translateX(-104%); transition: transform .32s var(--ease), box-shadow .32s; background: var(--paper); z-index: 50; }
  .sidebar.open { box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 45; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar.open + .scrim { opacity: 1; pointer-events: auto; }
  .has-shell .main { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: auto; padding: 16px 16px 30px; }
  .main.wide { padding: 12px 12px 20px; }
  .mbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; padding: 8px 8px; padding-top: max(8px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line-soft); }
  .mbar .brand { font-size: 18px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line-soft); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 550; color: var(--ink-3); padding: 4px 0; }
  .tabbar a.on { color: var(--ink); }
  .tab-new { justify-self: center; width: 50px; height: 50px; border-radius: 17px; border: 0; background: var(--hl); color: var(--hl-ink); display: grid; place-items: center; box-shadow: var(--shadow-md); cursor: pointer; transform: translateY(-8px); }

  .page-top { display: grid; grid-template-columns: auto 1fr; gap: 10px 10px; margin-bottom: 12px; align-items: center; }
  .page-top .range, .top-actions { display: contents; }
  .page-top h1 { grid-column: 1 / -1; font-size: 24px; }
  .top-actions .seg { justify-self: end; }
  .top-actions > .btn.subtle { grid-column: 1 / -1; justify-self: start; order: 5; }
  .top-actions .btn.primary { display: none; }
  h1 { font-size: 26px; }

  /* La semana se convierte en un día con tira de días arriba */
  .week { height: calc(100dvh - 206px - env(safe-area-inset-bottom)); border-radius: 14px; --gut: 46px; }
  .wk-head { grid-template-columns: repeat(7, 1fr); padding: 6px; gap: 2px; }
  .wk-head .gutter { display: none; }
  .wk-day { flex-direction: column; align-items: center; gap: 3px; border: 0; border-radius: 12px; padding: 7px 0 8px; }
  .wk-day.sel { background: var(--sunken); }
  .wk-day .num { font-size: 19px; }
  .wk-day:hover .num { text-decoration: none; }
  .wk-allday, .wk-grid { grid-template-columns: var(--gut) 1fr; }
  .ad-col:not(.sel), .col:not(.sel) { display: none; }
  .ad-col, .col { border-left: 0; }
  .blk { font-size: 13.5px; }

  .al-day { grid-template-columns: 58px 1fr; gap: 6px 12px; }
  .al-date .num { font-size: 32px; }
  .al-date .wd { font-size: 12.5px; }
  .al-more { margin-left: 70px; }
  .card-ev { grid-template-columns: 22px 1fr; gap: 12px; }
  .card-ev .hinge { grid-column: 2; margin-top: -4px; }

  .onboard { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }

  /* Panel como hoja inferior */
  .drawer-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 90dvh; border-radius: 24px 24px 0 0; transform: translateY(104%); border-bottom: 0; }
  .drawer-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
  .drawer-body { padding: 18px 18px calc(30px + env(safe-area-inset-bottom)); }
  .drawer-tools { top: 14px; }
  .hv-title { font-size: 25px; }
  .palette-box { margin-top: 10px; }
  .palette-foot { display: none; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 24px 30px; min-height: auto; }
  .auth-art h1 { font-size: 36px; }
  .auth-hinge { margin: 22px 0 18px; transform: scale(.7); transform-origin: left center; }
  .row .t { width: calc(50% - 6px); }
  .row { flex-wrap: wrap; }
  .row-card .btns { width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.stack > .seg { align-self: flex-start; }
fieldset > .fs-hint { margin-top: -6px; }

/* ==========================================================================
   Temas
   ========================================================================== */
.topic-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 8px; font-weight: 600; color: color-mix(in srgb, var(--tc) 70%, var(--ink)); background: color-mix(in srgb, var(--tc) 12%, transparent); }
.topic-chip:hover { background: color-mix(in srgb, var(--tc) 20%, transparent); }

.sb-topics { display: flex; flex-direction: column; gap: 1px; }
.sb-topic { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 9px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.sb-topic:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); }
.sb-topic.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-soft); }
.sb-topic .ti { width: 15px; height: 15px; border-radius: 4px; background: var(--c); flex: none; display: grid; place-items: center; font-size: 10px; line-height: 1; }
.sb-topic .ti:not(:empty) { background: transparent; font-size: 14px; }
.sb-topic .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tab-menu { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 550 10.5px var(--f-ui); color: var(--ink-3); padding: 4px 0; background: none; border: 0; cursor: pointer; }

.tc-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font: 700 18px var(--f-display); color: #fff; background: var(--c); flex: none; }
.tc-icon.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 22px; }
.topic-card { --c: var(--hl); display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s, transform .15s; min-height: 180px; }
.topic-card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tc-name { font: 700 18px/1.2 var(--f-display); letter-spacing: -.015em; margin-top: 4px; }
.tc-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.tc-stats b { color: var(--ink); font-weight: 650; }
.tc-stats .open b { color: var(--warn); }
.tc-next { margin-top: auto; font-size: 12.5px; color: var(--ink-3); }

.topic-form .sentence { font-size: 15px; }
.topic-preview { font-size: 13.5px; color: var(--ink-3); min-height: 20px; }
.topic-preview.yes { color: var(--ok); }
.topic-preview ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.topic-preview li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topic-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.topic-head h1 { font-size: 32px; line-height: 1.08; }
.topic-stats { display: flex; gap: 14px; margin-top: 6px; color: var(--ink-2); font-size: 14px; flex-wrap: wrap; }
.topic-stats b { color: var(--ink); }
.topic-actions { display: flex; gap: 4px; }

.next-session { --c: var(--hl); display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; align-items: baseline; padding: 14px 18px; border-radius: 16px; margin-bottom: 22px; background: color-mix(in srgb, var(--c) 9%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); max-width: 860px; }
.next-session:hover { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.ns-label { grid-row: span 2; font-size: 12px; font-weight: 650; color: var(--hl-ink); background: var(--c); padding: 3px 9px; border-radius: 7px; align-self: center; }
.ns-when { font: 650 16px var(--f-display); }
.ns-title { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topic-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; max-width: 860px; }
.topic-search { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 11px; background: var(--sunken); color: var(--ink-3); }
.topic-search input { border: 0; background: transparent; padding: 9px 0; box-shadow: none; }
.topic-search input:focus { box-shadow: none; }
.topic-search:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 18%, transparent); }

.notebook { max-width: 860px; }
.tn-session { display: grid; grid-template-columns: 110px 1fr; gap: 6px 24px; padding: 20px 0; border-top: 1px solid var(--line-soft); }
.tn-session.is-next .tn-date .n { color: var(--hl-ink); background: var(--c); }
.tn-date { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; position: sticky; top: 12px; align-self: start; }
.tn-date .n { font-size: 12px; font-weight: 650; color: color-mix(in srgb, var(--c) 70%, var(--ink)); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 8px; border-radius: 6px; }
.tn-date .d { font: 700 24px/1.1 var(--f-display); letter-spacing: -.02em; margin-top: 6px; }
.tn-date .y { font-size: 12.5px; color: var(--ink-3); }
.tn-body.phase { padding: 0; min-width: 0; }
.tn-body.phase::before { display: none; }
.tn-title { display: flex; flex-direction: column; font-weight: 650; font-size: 15.5px; margin-bottom: 6px; }
.tn-title span { font-size: 12.5px; font-weight: 450; color: var(--ink-3); }
.tn-title:hover { color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.tn-phase { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 0 2px; }
.notebook .item.note { background: transparent; }
.notebook .item.note:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.notebook .item.note .txt { color: var(--ink); font-size: 15px; line-height: 1.6; }
.notebook .note-mark { color: color-mix(in srgb, var(--c) 60%, var(--ink-3)); }
.notebook .add-item { opacity: .75; }
.notebook .add-item:focus-within, .notebook .tn-session:hover .add-item { opacity: 1; }
.item.dim { opacity: .35; }
.tn-none { color: var(--ink-3); padding: 24px 0; }

@media (max-width: 900px) {
  .topic-head h1 { font-size: 26px; }
  .topic-actions { width: 100%; }
  .tn-session { grid-template-columns: 1fr; gap: 8px; }
  .tn-date { position: static; flex-direction: row; align-items: baseline; gap: 10px; }
  .tn-date .d { font-size: 18px; margin-top: 0; }
  .topic-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .topic-card { min-height: 150px; padding: 14px; }
}

/* Impresión / PDF del cuaderno */
@media print {
  .sidebar, .mbar, .tabbar, .scrim, .drawer, .palette, .toasts, .back, .topic-actions, .topic-tools, .add-item, .item .del, .next-session { display: none !important; }
  body, .has-shell .main { background: #fff !important; color: #000; margin: 0 !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 0 !important; }
  .tn-session { break-inside: avoid; }
  .tn-session.is-empty { display: none !important; }
  .tn-date { position: static; }
  .item .check { border-color: #666; }
}

/* Enlaces en tareas y notas */
.item .txt a.lnk { color: color-mix(in srgb, var(--c, var(--hl)) 75%, var(--ink)); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); cursor: pointer; overflow-wrap: anywhere; }
.item .txt a.lnk:hover { text-decoration-color: currentColor; }
.item .txt a.lnk::after { content: "↗"; font-size: .78em; margin-left: 2px; opacity: .6; }
.item.done .txt a.lnk { color: var(--ink-3); }
.item .txt[contenteditable=true] { white-space: pre-wrap; }
@media print { .item .txt a.lnk::after { content: " (" attr(href) ")"; font-size: .8em; opacity: .7; } }

/* ==========================================================================
   Archivos
   ========================================================================== */
.item .body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.item .txt:empty { display: none; }
.item .txt[data-placeholder]:empty { display: block; }
.item .txt[data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--ink-3); font-size: 13px; opacity: 0; transition: opacity .15s; }
.item:hover .txt[data-placeholder]:empty::before, .item .txt[data-placeholder]:focus::before { opacity: 1; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.att-img { display: block; max-width: min(100%, 420px); max-height: 320px; border-radius: 10px; overflow: hidden; background: var(--sunken); box-shadow: 0 0 0 1px var(--line); cursor: zoom-in; }
.att-img img { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: contain; }
.att-img:hover { box-shadow: 0 0 0 1px var(--ink-3), var(--shadow-md); }
.att-doc { font-size: 13px; text-decoration: underline; }

.att-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-3); cursor: pointer; flex: none; margin-top: 3px; flex-direction: row; }
.att-btn:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.upbar { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; max-width: 240px; }
.upbar i { display: block; height: 100%; width: 4%; background: var(--c, var(--hl)); transition: width .2s; }
.item.uploading .txt { color: var(--ink-3); font-size: 13.5px; }

/* Zonas para soltar */
body.dragging .tn-body, body.dragging .hv-line .phase, body.dragging .docs { outline: 2px dashed color-mix(in srgb, var(--ink-3) 45%, transparent); outline-offset: 4px; border-radius: 12px; }
.drop-on { outline: 2px dashed var(--c, var(--hl)) !important; background: color-mix(in srgb, var(--c, var(--hl)) 6%, transparent); }

/* Documentos del tema */
.docs { position: relative; max-width: 860px; margin: 0 0 26px; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.docs header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.docs h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.docs h2 .n { font: 650 12px var(--f-ui); background: var(--sunken); color: var(--ink-2); padding: 1px 8px; border-radius: 999px; }
.docs label.btn { flex-direction: row; cursor: pointer; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line-soft); padding: 4px 0; }
.doc:first-child { border-top: 0; }
.doc.uploading { flex-wrap: wrap; }
.doc.uploading .upbar { flex-basis: 100%; margin: 2px 0 6px 52px; }
.doc-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px 6px; border-radius: 10px; }
.doc-main:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.doc-ic { grid-row: span 2; width: 40px; height: 46px; border-radius: 6px 12px 6px 6px; display: grid; place-items: end center; padding-bottom: 7px; font: 700 9.5px/1 var(--f-ui); letter-spacing: .02em; color: #fff; background: #8A6E62; }
.doc-ic.k-pdf { background: #B3261E; } .doc-ic.k-doc { background: #2B579A; } .doc-ic.k-xls { background: #217346; }
.doc-ic.k-ppt { background: #C43E1C; } .doc-ic.k-zip { background: #6B5B45; } .doc-ic.k-img { background: #2F6F73; }
.doc-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 12.5px; color: var(--ink-3); }
.doc .icon-btn { color: var(--ink-3); }
.doc .del-file { opacity: 0; }
.doc:hover .del-file, .doc .del-file:focus-visible { opacity: 1; }
.doc .del-file:hover { color: var(--red); }
@media (hover: none) { .doc .del-file { opacity: .6; } }
.docs-empty { color: var(--ink-3); font-size: 14px; padding: 6px 0 4px; max-width: 60ch; }
.drop-hint { display: none; }
.docs.drop-on .drop-hint { display: grid; place-items: center; position: absolute; inset: 0; border-radius: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); font-weight: 650; color: color-mix(in srgb, var(--c) 70%, var(--ink)); }

/* Visor */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(15, 8, 10, .86); display: grid; place-items: center; padding: 24px; opacity: 0; transition: opacity .18s; cursor: zoom-out; }
.lightbox.open { opacity: 1; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 90px); border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lb-close { position: absolute; top: 14px; right: 14px; color: #fff; background: rgba(255,255,255,.12); }
.lb-close:hover { background: rgba(255,255,255,.22); color: #fff; }
.lb-open { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: .8; text-decoration: underline; }

@media print {
  .docs header label, .doc .icon-btn { display: none !important; }
  .att-img { max-height: 380px; box-shadow: none; }
}
