:root {
  --bg: #ffffff; --side: #f6f6f8; --card: #ffffff; --hover: #efeff3; --text: #1c1c1e; --muted: #85858d;
  --line: #e6e6eb; --accent: #2f6fed; --on-accent: #ffffff; --late: #e5484d;
  --shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .04);
  --r: 12px; --side-w: 252px;
  --tile-dark-logo: transparent; --tile-light-logo: #2b2b31; /* baldosa tras logos transparentes que no contrastan */
  color-scheme: light dark;
}
/* Tema: Auto sigue al sistema; data-theme="light" | "dark" lo fuerza. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1e; --side: #141416; --card: #242428; --hover: #2d2d33; --text: #f2f2f5; --muted: #9a9aa3;
    --line: #313137; --tile-dark-logo: #ececf0; --tile-light-logo: transparent; --accent: #5b8cff; --on-accent: #0b0b0d; --late: #ff6b6e;
    --shadow: 0 0 0 1px var(--line);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1b1e; --side: #141416; --card: #242428; --hover: #2d2d33; --text: #f2f2f5; --muted: #9a9aa3;
  --line: #313137; --tile-dark-logo: #ececf0; --tile-light-logo: transparent; --accent: #5b8cff; --on-accent: #0b0b0d; --late: #ff6b6e;
  --shadow: 0 0 0 1px var(--line);
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.late { color: var(--late); }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; margin: 0; }
.primary { background: var(--accent); color: var(--on-accent); padding: 8px 16px; border-radius: 9px; font-weight: 600; }
.ghost { padding: 8px 14px; }
.ghost:hover, .icon:hover { background: var(--hover); }
.danger { color: var(--late); }
.icon { display: inline-grid; place-items: center; min-width: 32px; height: 32px; color: var(--muted); font-size: 16px; }
.mobile, #tabs, #scrim { display: none; }

/* ---------- barra lateral ---------- */
#side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; background: var(--bg); /* integrado: mismo fondo que la página */
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 1px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 2px 2px 18px 8px; }
.brand img { width: 26px; height: 26px; }
.brand > span { flex: 1; }
#side-toggle { display: grid; margin: -4px; padding: 4px; border: 0; border-radius: 8px; background: none; cursor: pointer; transition: background .15s, scale .15s; } /* el logo contrae/expande la barra */
#side-toggle:hover { background: var(--hover); }
#side-toggle:active { scale: .92; }
/* barra lateral contraída: solo iconos (solo escritorio; en el móvil es un cajón) */
body { transition: grid-template-columns .2s ease; }
@media (min-width: 761px) {
  .side-collapsed body { --side-w: 64px; }
  .side-collapsed #side { padding: 18px 10px; overflow-x: hidden; scrollbar-width: none; }
  .side-collapsed .brand { justify-content: center; padding: 2px 0 14px; }
  .side-collapsed :is(.brand > span, #side .navitem > span, .side-head > span, #plist .more) { display: none; }
  .side-collapsed #side .navitem { justify-content: center; padding: 9px 0; }
  .side-collapsed .side-head { justify-content: center; margin: 18px 0 4px; }
  .side-collapsed #plist .navitem { padding: 9px 0; }
  .side-collapsed #plist .dot { width: 12px; height: 12px; }
}
.navitem { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; text-align: left; border-radius: 8px; color: var(--text); font-size: 14.5px; }
.navitem svg { width: 18px; height: 18px; color: var(--muted); }
.navitem:hover { background: var(--hover); }
#side .navitem.on { background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--accent); font-weight: 600; }
#side .navitem.on svg { color: var(--accent); }
#side .navitem.on .count { color: var(--accent); }
.navitem > span:nth-of-type(1) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.side-head {
  display: flex; justify-content: space-between; align-items: center; margin: 22px 4px 4px 10px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.side-head .icon { min-width: 24px; height: 24px; font-size: 16px; }
#plist { list-style: none; margin: 0; padding: 0; }
.theme-btn { margin-top: auto; color: var(--muted); }
#plist { margin-bottom: 20px; }
#plist li { position: relative; }
#plist li.placeholder { border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 35%, transparent); }
#plist li.placeholder > * { visibility: hidden; }
#plist li.proj-ghost { position: fixed; z-index: 50; margin: 0; pointer-events: none; will-change: transform; }
#plist li.proj-ghost .navitem { height: 100%; background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 10px 24px rgb(0 0 0 / .2); scale: 1.04; transition: scale .15s, box-shadow .15s; }
#plist li.proj-ghost.landing { transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
#plist li.proj-ghost.landing .navitem { scale: 1; box-shadow: none; }
#plist .navitem { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } /* pulsación larga = arrastrar */
#plist .hidden-link { color: var(--muted); font-size: 13px; }
#plist .hidden-link svg { width: 16px; height: 16px; margin-inline: 3px; }
.hidden-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: var(--muted); background: var(--hover); white-space: nowrap; }
.hidden-tag svg { width: 13px; height: 13px; }
#plist .navitem { padding-right: 38px; }
#plist .more { position: absolute; right: 4px; top: 50%; translate: 0 -50%; min-width: 28px; height: 28px; opacity: 0; }
#plist .count { margin-right: -28px; transition: opacity .1s; }
#plist li:hover .more, #plist .more:focus-visible, #plist .more[aria-expanded=true] { opacity: 1; }
#plist li:hover .count, #plist li:has(.more[aria-expanded=true]) .count { opacity: 0; }
@media (hover: none) { #plist .more { opacity: 1; } #plist .count { margin-right: 0; } }
.more svg { width: 18px; height: 18px; }
#heading h1 .more { color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.chip .dot { width: 7px; height: 7px; }
/* logo de proyecto en lugar del punto de color (va después: gana a los tamaños de .dot) */
img.dot.logo { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; background: none; }
#plist img.dot.logo { width: 22px; height: 22px; margin: -2px 0; } /* más grande en la barra lateral (sin cambiar la altura de la fila) */
.chip img.dot.logo, .proj-switch.small img.dot.logo, .picker img.dot.logo { width: 15px; height: 15px; border-radius: 4px; }
.side-collapsed #plist img.dot.logo { width: 24px; height: 24px; border-radius: 6px; }
#plist .navitem > svg { margin-inline: 2px; } /* «Todos»: mismo hueco que un logo */
#plist i.dot { margin-inline: 6px; } /* mismo hueco que un logo (22px): los nombres quedan alineados */
.avatar.has-logo { background: none; }
img.logo[data-tone], .avatar img[data-tone] { padding: 1.5px; }
img.logo[data-tone=dark], .avatar img[data-tone=dark] { background: var(--tile-dark-logo); }
img.logo[data-tone=light], .avatar img[data-tone=light] { background: var(--tile-light-logo); }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: contain; }

/* ---------- cabecera + entrada rápida ---------- */
main { min-width: 0; padding: 22px clamp(16px, 4vw, 44px) 48px; }
#top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
#heading { flex: 1; min-width: 0; }
#heading h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
#heading h1 .dot { width: 14px; height: 14px; }
.proj-switch { display: inline-flex; align-items: center; gap: 10px; margin-left: -6px; padding: 0 6px; border-radius: 10px; font: inherit; color: inherit; letter-spacing: inherit; min-width: 0; }
.proj-switch > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-switch:hover, .proj-switch[aria-expanded=true] { background: var(--hover); }
.proj-switch svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.proj-switch.small { gap: 6px; padding: 2px 6px; font-size: 14px; font-weight: 400; color: var(--muted); }
.proj-switch.small .dot { width: 8px; height: 8px; }
.proj-switch.small svg { width: 14px; height: 14px; }
@media (min-width: 761px) { .proj-switch.all { display: none; } } /* en escritorio ya está la barra lateral */
.sub-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 26px; }
.sub-row .progress { margin: 0 0 0 4px; }
.sub-row .bar { max-width: 140px; }
.sub-row .more { min-width: 26px; height: 26px; }
.sub { color: var(--muted); margin-top: 4px; }
.sub::first-letter { text-transform: uppercase; }
#search {
  width: 230px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px 8px 34px; background: var(--side) no-repeat 11px center / 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385858d' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  outline: 0;
}
#search:focus { border-color: var(--accent); }
#quick {
  display: flex; align-items: center; gap: 8px; max-width: 780px; background: var(--card);
  box-shadow: var(--shadow); border-radius: var(--r); padding: 5px 5px 5px 14px;
}
#quick:focus-within { box-shadow: 0 0 0 2px var(--accent); }
#quick .plus { color: var(--accent); font-size: 22px; line-height: 1; font-weight: 300; }
#q { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 8px 0; font-size: 16px; }
#preview { display: block; min-height: 20px; margin: 6px 4px 18px; font-size: 13px; color: var(--muted); }

/* ---------- tarjetas ---------- */
.card {
  display: flex; gap: 10px; align-items: flex-start; background: var(--card); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px 12px; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; /* long-press para arrastrar */
}
.card:hover { box-shadow: var(--shadow), 0 3px 10px rgb(0 0 0 / .06); }
.card.placeholder { box-shadow: none; background: color-mix(in srgb, var(--accent) 6%, transparent); outline: 2px dashed color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -2px; }
.card.placeholder > * { visibility: hidden; }
.card.floating {
  position: fixed; z-index: 50; margin: 0; pointer-events: none; will-change: transform;
  rotate: 2.5deg; scale: 1.04; box-shadow: 0 0 0 1px var(--line), 0 16px 36px rgb(0 0 0 / .2);
  transition: rotate .15s, scale .15s, box-shadow .15s;
}
.card.floating.landing { rotate: 0deg; scale: 1; box-shadow: var(--shadow); transition: left .2s cubic-bezier(.2, .8, .2, 1), top .2s cubic-bezier(.2, .8, .2, 1), transform .2s cubic-bezier(.2, .8, .2, 1), rotate .2s, scale .2s, box-shadow .2s; }
body.grabbing, body.grabbing * { cursor: grabbing !important; user-select: none; }
.check {
  position: relative; display: grid; place-items: center; flex: none; width: 20px; height: 20px; margin-top: 1px;
  border-radius: 50%; border: 1.5px solid var(--muted);
}
.check::before { content: ''; position: absolute; inset: -10px; } /* área táctil de 40px */
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on::after { content: ''; width: 5px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.card .body { flex: 1; min-width: 0; }
.card .title { overflow-wrap: anywhere; }
.card.done .title { text-decoration: line-through; color: var(--muted); }
.card .notes { margin: 2px 0 0; color: var(--muted); font-size: 13px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.meta:empty { display: none; }
.card.today time { color: var(--accent); font-weight: 600; }
.card.late time { color: var(--late); font-weight: 600; }

.group { display: flex; flex-direction: column; gap: 8px; max-width: 780px; margin-bottom: 28px; }
.group h3, .col h3, #agenda h3 {
  display: flex; justify-content: space-between; margin: 0 2px 2px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.group.late h3 { color: var(--late); }

/* ---------- tablero ---------- */
#board { display: flex; gap: 22px; overflow-x: auto; align-items: flex-start; scroll-snap-type: x mandatory; padding: 8px 8px 16px; margin: -8px; }
#board.dragging { scroll-snap-type: none; }
#board, .toolbar { scrollbar-width: none; }
#board::-webkit-scrollbar, .toolbar::-webkit-scrollbar { display: none; }
#board .col.over { background: color-mix(in srgb, var(--accent) 7%, var(--side)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.col {
  position: relative; /* referencia de offsetTop al arrastrar */
  flex: 0 0 min(292px, 84vw); scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px;
  min-height: 140px; padding: 10px 8px 40px; border-radius: 14px; transition: background .15s, box-shadow .15s;
  background: var(--side); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent); /* columna marcada, sutil */
}

.progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.progress span { white-space: nowrap; }
.bar { flex: 1 1 auto; max-width: 240px; min-width: 60px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .3s; }

/* ---------- calendario ---------- */
.cal-head { display: flex; align-items: center; gap: 4px; max-width: 1200px; margin: 0 auto 10px; }
.cal-head h2 { margin: 0 auto 0 0; font-size: 18px; }
.cal-head h2::first-letter, #agenda h3::first-letter { text-transform: uppercase; }
.cal-head button { padding: 6px 12px; font-size: 15px; }
.cal-head button:hover { background: var(--hover); }
#grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; max-width: 1200px; margin: 0 auto;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
#grid i { font-style: normal; text-align: center; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--side); }
.day { min-height: 98px; padding: 5px; display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--bg); border-radius: 0; overflow: hidden; }
.day:hover { background: var(--hover); }
.day b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 13px; font-weight: 500; }
.day.out b { color: var(--muted); opacity: .6; }
.day.today b { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.ev {
  font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; /* hasta 2 líneas */
}
.ev.done { text-decoration: line-through; opacity: .55; }
.ev-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
/* eventos */
.band {
  height: 18px; margin: 0 -5px; padding: 0 6px; font-size: 11.5px; line-height: 18px; color: var(--text);
  background: color-mix(in srgb, var(--c) 24%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.band.start { margin-left: 0; border-radius: 5px 0 0 5px; }
.band.end { margin-right: 0; border-radius: 0 5px 5px 0; }
.band.start.end { border-radius: 5px; }
.event-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 9%, var(--card)); box-shadow: var(--shadow);
}
.event-row:hover { background: color-mix(in srgb, var(--c) 15%, var(--card)); }
.event-row > div { min-width: 0; }
.event-row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-row .meta { margin-top: 1px; }
.event-row .when {
  flex: none; margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--card); box-shadow: var(--shadow); white-space: nowrap;
}
.event-row .when.today { color: var(--on-accent); background: var(--accent); box-shadow: none; }
.event-row > div { flex: 1; }
/* eventos compactos: una línea */
.event-row { gap: 10px; padding: 6px 10px; }
.event-row > div { display: flex; align-items: baseline; gap: 8px; }
.event-row .meta { flex: none; margin-top: 0; font-size: 12.5px; white-space: nowrap; }
.event-row .when { padding: 2px 8px; font-size: 11.5px; }
.event-row .ev-icon { width: 24px; height: 24px; font-size: 13px; }
.ev-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; font-size: 16px; background: color-mix(in srgb, var(--c) 22%, transparent); }
#new-event { margin-right: 8px; padding: 6px 12px; font-size: 14px; }
main[data-view=cal] :is(#top, #quick, #preview) { max-width: 1200px; margin-left: auto; margin-right: auto; }
main:is([data-view=hoy], [data-view=search]) :is(#top, #quick, #preview, .group, .empty) { max-width: 780px; margin-inline: auto; }
main[data-view=projects] :is(#top, #quick, #preview, #projects-view) { max-width: 1000px; margin-inline: auto; }
/* tablero: la columna central mide lo que midan sus columnas (con más listas crece; si no cabe, scroll horizontal) */
@media (min-width: 761px) {
  main[data-view=board] { display: grid; grid-template-columns: minmax(0, max-content); justify-content: center; align-content: start; }
  main[data-view=board] #quick { max-width: none; }
}
#agenda h3:not(:first-child) { margin-top: 14px; }
#agenda { display: flex; flex-direction: column; gap: 8px; max-width: 1200px; margin: 24px auto 0; }

/* ---------- notas ---------- */
#notes-view { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; transition: grid-template-columns .2s; }
#notes-view:has(#nlist.compact) { grid-template-columns: 232px minmax(0, 1fr); } /* solo títulos → columna estrecha */
.note-list { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.new-note { text-align: left; padding: 10px 12px; color: var(--accent); font-weight: 600; }
.nlist-head { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.nlist-head .new-note { margin-right: auto; padding-inline: 8px; white-space: nowrap; }
.nlist-head .sort { min-width: 28px; height: 28px; }
.nlist-label { margin: 10px 12px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.nitem b svg { width: 13px; height: 13px; margin: 0 5px -1px 0; color: var(--accent); fill: currentColor; }
.pin svg { width: 17px; height: 17px; }
.pin[aria-pressed=true] { color: var(--accent); }
.pin[aria-pressed=true] svg { fill: currentColor; }
.nlist-head .sort svg { width: 16px; height: 16px; }
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--hover); }
.seg .icon { min-width: 28px; height: 26px; border-radius: 7px; }
.seg .icon svg { width: 15px; height: 15px; }
.seg .icon[aria-pressed=true] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
#nlist.compact .nitem :is(.snip, img, .chip) { display: none; }
#nlist.compact .nitem { padding: 8px 12px; }
.new-note:hover, .nitem:hover { background: var(--hover); }
.nitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; text-align: left; border-radius: 10px; }
.nitem.on { background: var(--hover); }
.nitem b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nitem .snip { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nitem .chip { font-size: 12px; }
.nitem > :not(img, .edited) { grid-column: 1; }
.nitem .edited { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; font-size: 12px; color: var(--muted); white-space: nowrap; }
.nitem img { grid-column: 2; grid-row: 2 / span 2; width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.notes-found .nitem { box-shadow: var(--shadow); background: var(--card); }
.note-editor { background: var(--card); box-shadow: var(--shadow); border-radius: 16px; padding: 18px clamp(16px, 4vw, 52px) 48px; min-height: 75vh; }
.ed-meta { display: flex; align-items: center; gap: 10px; min-height: 34px; margin-bottom: 8px; }
.picker.tag { margin: 0 0 0 -8px; padding: 4px 8px; gap: 6px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.picker.tag svg { width: 15px; height: 15px; color: var(--c, var(--muted)); }
.picker.tag::after { opacity: 0; transition: opacity .15s; }
.picker.tag:hover, .picker.tag[aria-expanded=true] { background: var(--hover); color: var(--text); }
.picker.tag:hover::after, .picker.tag[aria-expanded=true]::after, .picker.tag:focus-visible::after { opacity: .7; }
.status { font-size: 12.5px; color: var(--muted); }
.status { margin-right: auto; }
.trash:hover { color: var(--late); background: color-mix(in srgb, var(--late) 12%, transparent); }
.trash svg { width: 18px; height: 18px; }
#ntitle { width: 100%; padding: 0; border: 0; outline: 0; background: none; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
#ntitle::placeholder { color: var(--muted); opacity: .5; }
.toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px;
  margin: 12px 0 22px; padding: 8px 0; background: var(--card); border-bottom: 1px solid var(--line);
}
.toolbar button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 8px; color: var(--muted); }
.toolbar button:hover { background: var(--hover); color: var(--text); }
.toolbar button[aria-pressed=true] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.toolbar svg { width: 18px; height: 18px; }
.toolbar .size { display: inline-flex; gap: 2px; width: auto; padding: 0 6px 0 10px; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.toolbar .size svg { width: 14px; height: 14px; }
.toolbar .sep { width: 1px; height: 18px; margin: 0 6px; background: var(--line); }
#ned { min-height: 50vh; outline: 0; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
#ned p { margin: 0; } /* al pegar texto cada línea llega como <p>: sin margen, como líneas normales */
#ned ul, #ned ol { margin: .3em 0; padding-left: 1.4em; }
#ned li { margin: .1em 0; }
#ned ul.checklist { list-style: none; padding-left: 0; }
#ned ul.checklist ul.checklist { padding-left: 28px; } /* check anidado con Tab */
#ned ul.checklist > li { position: relative; padding-left: 28px; margin: .2em 0; }
#ned ul.checklist > li::before {
  content: ''; position: absolute; left: 0; top: .1em; width: 19px; height: 19px; box-sizing: border-box;
  border: 1.5px solid var(--muted); border-radius: 50%; cursor: pointer; transition: background-color .15s, border-color .15s;
}
#ned ul.checklist > li:hover::before { border-color: var(--accent); }
#ned ul.checklist > li[data-checked=true]::before {
  border-color: var(--accent); background: var(--accent) no-repeat center / 11px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2.5 6.2 2.3 2.3 4.7-5'/%3E%3C/svg%3E");
}
#ned ul.checklist > li[data-checked=true] { color: var(--muted); opacity: .7; transition: color .15s, opacity .15s; }
#ned:empty::before { content: 'Escribe aquí… puedes pegar imágenes'; color: var(--muted); }
#ned img { display: block; max-width: 100%; height: auto; margin: 8px 0; border-radius: 10px; }
#ned h1 { font-size: 26px; line-height: 1.2; margin: 16px 0 6px; letter-spacing: -.01em; }
#ned h2 { font-size: 21px; line-height: 1.25; margin: 14px 0 4px; }
#ned h3 { font-size: 17px; line-height: 1.3; margin: 12px 0 2px; font-weight: 650; }
#ned :is(h1, h2, h3):first-child { margin-top: 0; }
#ned hr { margin: 14px 0; border: 0; border-top: 1px solid var(--line); }
#ned span[style*=background] { border-radius: 3px; padding: 0 1px; }
/* buscar en la nota (CSS Custom Highlight API) */
::highlight(find) { background: rgba(250, 204, 21, .35); }
::highlight(find-now) { background: #f59e0b; color: #111; }
.find {
  position: fixed; z-index: 40; top: 16px; right: 24px; display: flex; align-items: center; gap: 4px;
  padding: 6px 6px 6px 10px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgb(0 0 0 / .15);
}
.find input { width: 200px; padding: 6px 4px; border: 0; background: none; outline: 0; font-size: 14px; }
#nfind-n { min-width: 34px; font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.find .icon { min-width: 28px; height: 28px; font-size: 16px; }
.swatch.hl { box-shadow: inset 0 0 0 1px var(--line); }
.swatch.tx { display: grid; place-items: center; background: var(--side); font-weight: 700; font-size: 15px; box-shadow: inset 0 0 0 1px var(--line); }
#ned blockquote { margin: 6px 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
#ned a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; cursor: pointer; overflow-wrap: anywhere; }
#ned a:hover { text-decoration-thickness: 2px; }
#nempty { align-self: center; }
/* pantalla completa de la nota */
body.focus { display: block; }
body.focus :is(#side, #scrim, #top, #quick, #preview, #tabs, .note-list) { display: none !important; }
body.focus main { padding: 0; }
body.focus #notes-view { display: block; }
body.focus .note-editor { min-height: 100dvh; border-radius: 0; box-shadow: none; padding: 24px clamp(20px, 6vw, 96px) 64px; }
#nfocus { margin-left: auto; } /* a la derecha de la barra, lejos de borrar */
body.focus #nfocus { color: var(--accent); }

/* ---------- proyectos ---------- */
#projects-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.proj {
  display: flex; flex-direction: column; gap: 16px; padding: 18px; border-radius: 16px; text-align: left;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .15s, translate .15s;
}
.proj:hover { box-shadow: var(--shadow), 0 8px 24px rgb(0 0 0 / .08); translate: 0 -1px; }
.proj header { display: flex; align-items: center; gap: 12px; }
.avatar {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); font-size: 17px; font-weight: 700;
}
.proj h3 { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-progress { display: flex; align-items: center; gap: 14px; }
.proj-progress > div:last-child { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.proj-empty { display: flex; align-items: center; height: 56px; margin: 0; font-size: 13.5px; color: var(--muted); }
.ring-wrap { position: relative; flex: none; width: 56px; height: 56px; }
.ring { width: 56px; height: 56px; }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--c); stroke-linecap: round; }
.ring-wrap b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 12px 0; border-block: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.stat b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat.late b { color: var(--late); }
.proj footer { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: auto; font-size: 13px; color: var(--muted); }
.proj footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj footer svg { width: 16px; height: 16px; }
.proj footer.late { color: var(--late); }
.proj.new {
  display: grid; place-items: center; min-height: 240px; background: none; box-shadow: none;
  border: 1.5px dashed var(--line); color: var(--muted); font-weight: 600;
}
.proj.new:hover { color: var(--accent); border-color: var(--accent); translate: none; box-shadow: none; }

/* ---------- ficha de tarea ---------- */
dialog:focus { outline: none; }
dialog {
  width: min(540px, calc(100vw - 32px)); padding: 22px; border: 0; border-radius: 16px;
  background: var(--card); color: var(--text); box-shadow: 0 24px 60px rgb(0 0 0 / .25);
}
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog input[name=title] {
  padding: 2px 0 8px; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: none; font-size: 20px; font-weight: 600;
  transition: border-color .15s;
}
dialog input[name=title]:focus { border-bottom-color: var(--accent); }
dialog input[name=title]::placeholder { color: var(--muted); opacity: .7; font-weight: 500; }
dialog textarea { min-height: 110px; padding: 12px; border: 0; border-radius: 10px; outline: 0; background: var(--side); resize: vertical; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fields input, .fields select { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--side); color: var(--text); font-size: 15px; }
/* campos de la ficha según tipo (data-kind) y clase de evento (data-cat) */
#edit form:not([data-kind=task]) .task-only,
#edit form:not([data-kind=event]) .event-only,
#edit form[data-kind=event] .no-event,
#edit form[data-kind=note] .no-note,
#edit form[data-kind=note] .time-field,
#edit form[data-kind=event]:not([data-cat=event]) .time-field,
#edit form:not([data-kind=event]) .range-field,
#edit form[data-cat=birthday] .range-field { display: none; }
.fields select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background: var(--side) no-repeat right 10px center / 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2385858d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
}

/* ---------- desplegable propio ---------- */
.picker { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; margin-left: -8px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.picker:hover, .picker[aria-expanded=true] { background: var(--hover); color: var(--text); }
.picker::after { content: ''; width: 5px; height: 5px; margin: -3px 2px 0 2px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: .7; }
.picker .dot { width: 8px; height: 8px; }
.picker.field { width: 100%; margin: 0; padding: 8px 10px; border: 1px solid var(--line); background: var(--side); color: var(--text); font-size: 15px; }
.picker.field::after { margin-left: auto; }
.pop {
  position: fixed; inset: auto; margin: 0; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 340px; overflow-y: auto;
  padding: 6px; border: 0; border-radius: 12px; background: var(--card); color: var(--text);
  box-shadow: 0 0 0 1px var(--line), 0 14px 36px rgb(0 0 0 / .18);
}
.pop-search { width: 100%; margin-bottom: 4px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: none; outline: 0; font-size: 14px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; text-align: left; font-size: 14px; border-radius: 8px; }
.pop-item:hover, .pop-item:focus-visible { background: var(--hover); outline: 0; }
.pop-item.on { font-weight: 600; }
.pop-item .tick { margin-left: auto; color: var(--accent); }
.pop-item.create { color: var(--accent); font-weight: 600; }
.pop-item svg { width: 16px; height: 16px; color: var(--muted); }
.pop-item.danger, .pop-item.danger svg { color: var(--late); }
.pop-title { padding: 6px 10px 8px; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-label { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.swatches { display: grid; grid-template-columns: repeat(5, 28px); gap: 8px; padding: 4px 10px 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); }
.swatch:hover { transform: scale(1.1); }
.swatch.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--c); }

/* ---------- login ---------- */
body.locked > :not(#login, dialog, #pop) { display: none !important; }
#login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--side); }
.login-card {
  display: flex; flex-direction: column; gap: 14px; width: min(360px, 100%); padding: 32px 28px; border-radius: 20px;
  background: var(--card); box-shadow: var(--shadow), 0 20px 50px rgb(0 0 0 / .08);
}
.login-logo { width: 60px; height: 60px; align-self: center; }
.login-card h1 { margin: 0; text-align: center; font-size: 24px; letter-spacing: -.02em; }
#login-sub { margin: -8px 0 6px; text-align: center; font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--side); color: var(--text); font-size: 16px; outline: 0; }
.login-card input:focus { border-color: var(--accent); }
.login-card .primary { margin-top: 4px; padding: 12px; font-size: 15px; }
.login-error { min-height: 1.2em; margin: 0; text-align: center; font-size: 13px; color: var(--late); }
.logout-btn { color: var(--muted); }

/* ---------- notas cifradas ---------- */
.nlocked { display: none; flex-direction: column; align-items: center; gap: 12px; padding: 60px 16px; text-align: center; color: var(--muted); }
.nlocked svg { width: 36px; height: 36px; }
.nlocked p { max-width: 320px; margin: 0; }
#neditor.sealed .nlocked { display: flex; }
#neditor.sealed :is(.toolbar, #ned) { display: none; }
.unlock-banner { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; text-align: left; color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.unlock-banner svg { width: 16px; height: 16px; color: var(--accent); }
.unlock-banner b { color: var(--accent); }
.nitem.sealed b { color: var(--muted); font-weight: 500; }
.nitem.sealed b svg { width: 13px; height: 13px; margin: 0 5px -1px 0; }

/* ---------- deshacer ---------- */
#offline { /* sin conexión / cambios pendientes */
  position: fixed; z-index: 55; right: 16px; bottom: 16px; padding: 6px 12px 6px 26px; border-radius: 99px; font-size: 12.5px; font-weight: 500;
  color: var(--muted); background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgb(0 0 0 / .12);
}
#offline::before { content: ''; position: absolute; left: 11px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #f59e0b; }
#toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; translate: -50% 0; display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .25); animation: toast-in .2s ease;
}
#toast button { padding: 6px 12px; border-radius: 8px; color: var(--accent); font-weight: 600; filter: brightness(1.3); }
#toast button:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
@keyframes toast-in { from { opacity: 0; translate: -50% 10px; } }

/* ---------- prioridad, subtareas, nota vinculada ---------- */
.prio { display: inline-flex; vertical-align: -2px; margin-right: 5px; }
.prio svg { width: 15px; height: 15px; stroke-width: 2.2; }
.prio.p1 { color: #f59e0b; }
.prio.p2 { color: var(--late); }
.prio svg path { fill: currentColor; fill-opacity: .25; }
.meta .subs, .note-link { display: inline-flex; align-items: center; gap: 4px; }
.meta .subs svg, .note-link svg { width: 13px; height: 13px; }
.meta .subs.all { color: var(--accent); }
.note-link { max-width: 160px; padding: 0 6px; margin-left: -6px; border-radius: 6px; color: var(--muted); font-size: 12.5px; }
.note-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-link:hover { background: var(--hover); color: var(--text); }
.subtasks { display: flex; flex-direction: column; gap: 2px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.check-row input:not([type]) { flex: 1; min-width: 0; padding: 5px 2px; border: 0; border-bottom: 1px solid transparent; background: none; outline: 0; font-size: 15px; }
.check-row input:not([type]):focus { border-bottom-color: var(--line); }
.check-row.on input:not([type]) { color: var(--muted); }
.check-row .icon { min-width: 26px; height: 26px; font-size: 12px; opacity: .5; }
.check-row:hover .icon { opacity: 1; }
#check-new { padding: 6px 2px; border: 0; background: none; outline: 0; font-size: 14.5px; color: var(--text); }
#check-new::placeholder { color: var(--accent); opacity: .9; }
#nlinks { display: contents; }
.backlink { display: inline-flex; align-items: center; gap: 4px; max-width: 180px; padding: 3px 8px; border-radius: 7px; font-size: 12.5px; color: var(--muted); background: var(--hover); }
.backlink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backlink svg { width: 13px; height: 13px; flex: none; }
.backlink.done span { text-decoration: line-through; }
.backlink:hover { color: var(--text); }

/* ---------- archivo ---------- */
.archived-btn { align-self: center; margin-top: 4px; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.archived-btn:hover { background: var(--hover); color: var(--text); }
.archive { width: min(560px, calc(100vw - 32px)); max-height: min(80dvh, 720px); }
.archive-head { display: flex; align-items: center; justify-content: space-between; }
.archive h3 { margin: 0; font-size: 18px; }
.archive-sub { margin: -8px 0 0; font-size: 13px; }
#archive-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------- compartir hacia Kairo ---------- */
.share { width: min(460px, calc(100vw - 32px)); }
.share h3 { margin: 0; font-size: 18px; }
.share input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--side); font-size: 16px; font-weight: 600; outline: 0; }
#share-preview { margin: 0; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }

/* ---------- ajustes de notificaciones ---------- */
.settings { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding-bottom: 0; background: var(--side); }
.settings form { gap: 0; }
.settings h3 { margin: 0 0 6px; font-size: 18px; }
.set-head { margin: 16px 14px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.set-group { border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; cursor: pointer; }
.set-group > * + .set-row { border-top: 1px solid var(--line); }
.set-row.plain { cursor: default; }
.set-row b { font-weight: 600; font-size: 14.5px; }
.set-row p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.35; }
.set-btns { display: flex; gap: 6px; flex: none; }
.set-btns button { padding: 7px 14px; }
#push-test:disabled { display: none; } /* solo con las notificaciones activas */
.set-inline { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); flex: none; }
.set-sub { display: flex; align-items: center; gap: 8px; margin-top: -4px; padding: 0 14px 12px; font-size: 14px; color: var(--muted); }
:is(.set-sub, .set-inline) :is(input, select) { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--side); color: var(--text); font-size: 14px; }
.set-sub input[type=number] { width: 64px; }
.set-inline input { width: 60px; }
.settings form.no-summary .summary-field, .settings form.no-reminders .reminders-field { display: none; }
.set-pass summary { list-style: none; }
.set-pass summary::-webkit-details-marker { display: none; }
.set-pass summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-right: 4px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; rotate: -45deg; transition: rotate .2s; }
.set-pass[open] summary::after { rotate: 45deg; }
.set-pass-body { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; }
.set-pass-body p { margin: 0; font-size: 12.5px; }
.set-pass-body p:empty { display: none; }
.set-pass-body input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--side); color: var(--text); font-size: 15px; outline: 0; }
.set-pass-body input:focus { border-color: var(--accent); }
.set-pass-body button { align-self: flex-start; margin-top: 2px; padding: 7px 14px; }
.settings menu { position: sticky; bottom: 0; z-index: 1; margin: 16px -22px 0; padding: 12px 22px max(16px, env(safe-area-inset-bottom)); background: var(--side); border-top: 1px solid var(--line); }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 42px; height: 25px; margin: 0; border-radius: 13px; background: var(--line); cursor: pointer; transition: background .2s; }
.switch::before { content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: translate .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::before { translate: 17px 0; }

/* ---------- diálogo propio ---------- */
.ask { width: min(400px, calc(100vw - 32px)); }
.ask h3 { margin: 0; font-size: 17px; }
.ask p { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.ask input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--side); outline: 0; font-size: 15px; }
.ask input:focus { border-color: var(--accent); }
.danger-bg { background: var(--late); }
menu { display: flex; gap: 8px; justify-content: flex-end; margin: 4px 0 0; padding: 0; }
menu .danger { margin-right: auto; }

/* ---------- móvil ---------- */
@media (max-width: 760px) {
  body { display: block; }
  .mobile { display: inline-grid; }
  #side-toggle { pointer-events: none; } /* en el móvil el menú ya es un cajón: el logo es solo logo */
  #side {
    position: fixed; z-index: 30; left: 0; top: 0; width: min(300px, 85vw); transform: translateX(-100%);
    transition: transform .2s ease; padding-top: max(18px, env(safe-area-inset-top));
  }
  body.menu #side { transform: none; }
  body.menu #scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgb(0 0 0 / .35); }
  main { padding: max(12px, env(safe-area-inset-top)) 16px calc(80px + env(safe-area-inset-bottom)); }
  #top { gap: 4px; margin-bottom: 14px; }
  #top.searching { align-items: center; }
  #menu { margin-left: -6px; color: var(--text); }
  #heading h1 { font-size: 24px; }
  #heading .progress, #heading .sub { font-size: 13px; }
  .sub-row .bar { display: none; } /* en el móvil solo el texto del progreso, para que quepa en una línea */
  #searchbox { display: none; }
  #top.searching #searchbox { display: block; flex: 1; }
  #top.searching #heading, #top.searching #menu, #top.searching #search-btn { display: none; }
  #search { width: 100%; font-size: 16px; }
  #tabs {
    display: flex; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    padding: 6px 4px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  #tabs .navitem { flex: 1; flex-direction: column; gap: 2px; padding: 4px 0; font-size: 10.5px; color: var(--muted); background: none; }
  #tabs .navitem.on { color: var(--accent); font-weight: 600; }
  #tabs .navitem.on svg { color: var(--accent); }
  #tabs .count { display: none; }
  #tabs svg { width: 22px; height: 22px; }
  #tabs .dot { width: 14px; height: 14px; margin: 4px; }
  #tabs img.dot.logo { width: 22px; height: 22px; margin: 0; }
  #tabs .navitem > span { max-width: 100%; padding-inline: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .day { min-height: 54px; flex-flow: row wrap; justify-content: center; align-content: flex-start; gap: 3px; }
  .day b { flex-basis: 100%; width: auto; height: 24px; }
  .day.today b { width: 24px; flex-basis: 24px; margin: 0 calc(50% - 12px); }
  .ev { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; font-size: 0; background: var(--c); }
  .cal-head h2 { font-size: 16px; white-space: nowrap; }
  #new-event { margin-right: 2px; padding: 6px 10px; white-space: nowrap; }
  .cal-head button { padding: 6px 8px; }
  .band, .band.start, .band.end { flex-basis: 100%; height: 4px; margin: 0; padding: 0; font-size: 0; border-radius: 2px; background: var(--c); }
  .ev-more { display: none; }

  #notes-view { display: block; }
  #nfocus { display: none; } /* en el móvil el editor ya ocupa toda la pantalla */
  .note-list { position: static; max-height: none; }
  body.note-open .note-list, body.note-open #top, body.note-open #quick, body.note-open #preview { display: none; } /* la barra de abajo se queda */
  body:not(.note-open) #nempty { display: none; }
  .note-editor { min-height: 0; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .back { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: -8px; color: var(--accent); }
  .back svg { width: 22px; height: 22px; stroke-width: 2.2; }
  #ntitle { font-size: 26px; }
  #ned { font-size: 16px; } /* en el móvil 16px: con menos, iOS hace zoom al empezar a escribir */
  .find { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; }
  .find input { flex: 1; width: auto; font-size: 16px; }
  .toolbar { top: env(safe-area-inset-top); overflow-x: auto; margin: 10px -16px 18px; padding: 6px 12px; background: var(--bg); }
  .toolbar > * { flex: none; }

  #offline { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100% - 24px); }
  dialog, dialog.ask, dialog.settings, dialog.archive, dialog.share { /* tarjeta flotante abajo, separada de los bordes */
    width: calc(100% - 20px); max-width: none; margin: auto auto max(10px, env(safe-area-inset-bottom)); border-radius: 20px;
    box-shadow: 0 10px 40px rgb(0 0 0 / .25);
  }
}

/* ---------- proyectos compartidos ---------- */
/* persona: inicial en un círculo de su color (asignada, miembros, «Solo mías») */
.who { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--c); color: #fff; font-size: 10.5px; font-weight: 650; line-height: 1; }
.people { display: inline-flex; flex: none; }
.people .who { width: 22px; height: 22px; font-size: 11.5px; box-shadow: 0 0 0 2px var(--card, var(--bg)); }
.people .who + .who { margin-left: -6px; }
.shared-ic { display: inline-flex; flex: none; color: var(--muted); }
.shared-ic svg { width: 14px; height: 14px; }
.side-collapsed .shared-ic { display: none; }
.mine-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 3px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }
.mine-toggle:hover { background: var(--hover); }
.mine-toggle[aria-pressed=true] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--accent); }
#members-list { display: flex; flex-direction: column; gap: 2px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.member-row:hover { background: var(--hover); }
.ask .member-row input { width: 17px; height: 17px; padding: 0; accent-color: var(--accent); }
.member-row .who { width: 24px; height: 24px; font-size: 12px; }

/* ---------- tablero como lista (por fecha) ---------- */
.board-mode { margin-left: auto; }
#board.as-list { display: block; overflow: visible; scroll-snap-type: none; max-width: 780px; margin: 0 auto; padding: 4px 0 0; }
#board.as-list .group { margin-bottom: 26px; }
#board.as-list .group.doing h3 { color: var(--accent); }
#board.as-list .group.doing .card { box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }
.doing-tag { color: var(--accent); font-weight: 600; }
.done-group summary { cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.done-group summary::-webkit-details-marker { display: none; }
.done-group summary::before { content: '›'; display: inline-block; width: 14px; transition: transform .15s; }
.done-group[open] summary::before { transform: rotate(90deg); }
