/* Calendario Familiar — aspecto cálido, redondeado y tranquilo. */
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --accent: #ff7a59;
  --accent-ink: #ffffff;
  --bg: #fbf7f4;
  --bg-2: #f4ede8;
  --surface: #ffffff;
  --surface-2: #fdfaf8;
  --text: #2a2522;
  --muted: #7d726b;
  --line: #efe6e0;
  --danger: #e5484d;
  --ok: #2bb673;
  --warn: #f5a524;
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(60, 35, 20, .05);
  --shadow: 0 1px 2px rgba(60, 35, 20, .04), 0 6px 24px rgba(60, 35, 20, .07);
  --shadow-lg: 0 24px 64px rgba(40, 20, 10, .22);
  --amarillo: #fff1a8; --rosa: #ffd6e4; --verde: #d3f5dc; --azul: #d6e6ff; --naranja: #ffe0c2; --lila: #e9dcff;
  --sticky-text: #2f2a1f;
  --font: "Figtree", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="azul"] { --accent: #4f7cff; }
[data-theme="verde"] { --accent: #22a06b; }
[data-theme="lila"] { --accent: #8b5cf6; }
[data-theme="rosa"] { --accent: #ec4899; }
[data-theme="turquesa"] { --accent: #0ea5b7; }

:root[data-appearance="dark"] {
  --bg: #17141a; --bg-2: #1f1b22; --surface: #231f27; --surface-2: #29242d; --text: #f1ece9; --muted: #a79d97;
  --line: #352f39; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-appearance="auto"] {
    --bg: #17141a; --bg-2: #1f1b22; --surface: #231f27; --surface-2: #29242d; --text: #f1ece9; --muted: #a79d97;
    --line: #352f39; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root { --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface)); --accent-line: color-mix(in srgb, var(--accent) 35%, transparent); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; margin-top: 1.4em; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small, small { font-size: .86rem; }
[hidden] { display: none !important; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.big-emoji { font-size: 1.4em; }

/* ---------------------------------------------------------------- Botones y formularios */
.btn {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .6em 1.15em; font: inherit; font-weight: 700; cursor: pointer; line-height: 1.2;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent-line); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.small { padding: .38em .8em; font-size: .86rem; }
.btn.icon { padding: .45em; width: 2.3em; height: 2.3em; border-radius: 50%; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--r-sm); padding: .62em .8em; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: 1.15em; height: 1.15em; accent-color: var(--accent); margin: 0; flex: none; }
input[type="color"] { padding: 3px; width: 46px; height: 42px; flex: none; border-radius: var(--r-sm); }
textarea { resize: vertical; }
label { display: block; font-weight: 700; font-size: .9rem; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { margin-top: .35em; font-weight: 500; }
label.check { display: flex; align-items: center; gap: .55em; font-weight: 600; cursor: pointer; }
.hint { font-weight: 500; color: var(--muted); font-size: .82rem; margin-top: .3em; }
.alert { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); padding: .7em 1em; border-radius: var(--r-sm); margin: .4em 0; font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: .4em; padding: .38em .8em; border-radius: 999px; font: inherit; font-weight: 700; font-size: .9rem;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--c, var(--accent)) 30%, transparent);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.chip input { accent-color: var(--c, var(--accent)); }
.chip.off { opacity: .45; }
.chip.dashed { border-style: dashed; background: transparent; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--muted); padding: .45em .95em; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.badge { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .35em; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; }
.pill { display: inline-block; padding: .15em .65em; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--bg-2); }
.pill.ok, .pill.active { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.pill.warn, .pill.pending { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); color: color-mix(in srgb, var(--warn) 50%, var(--text)); }
.pill.bad, .pill.rejected { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--c, var(--accent)); flex: none; font-size: .95rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.5rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 2px dashed var(--line); border-radius: var(--r-lg); }
.empty .big-emoji { display: block; font-size: 2rem; margin-bottom: 6px; }

/* ---------------------------------------------------------------- Páginas de acceso */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 10%, var(--bg)), var(--bg)); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); padding: 30px 26px; border-radius: var(--r-xl); box-shadow: var(--shadow); position: relative; }
.auth-card form { display: grid; gap: 14px; margin: 1.1em 0; }
.auth-card .btn.primary { padding: .85em; }
.auth-logo { width: 60px; height: 60px; display: block; margin-bottom: 14px; }
.lang-switch { position: absolute; top: 18px; right: 20px; display: flex; gap: 10px; font-size: .85rem; font-weight: 700; }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a[aria-current] { color: var(--accent); }
.shared .when { font-size: 1.1rem; font-weight: 700; }
.shared .notes { white-space: pre-wrap; background: var(--bg-2); padding: 12px; border-radius: var(--r-sm); }
ul.plain { padding-left: 1.1em; }

/* Páginas sencillas (administración) */
body.page { background: var(--bg); }
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 24px; }
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 14px 20px; box-shadow: var(--shadow); min-width: 140px; }
.stat strong { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); font-weight: 600; }
.table-card { overflow-x: auto; padding: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
td.actions { display: flex; gap: 6px; }
td.actions form { margin: 0; }
.feedback.done { opacity: .55; }
.feedback footer { margin: 6px 0 10px; }

/* ---------------------------------------------------------------- Estructura de la app */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border-right: 1.5px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.brand img { width: 38px; height: 38px; }
.brand select { border: 0; background: transparent; font-weight: 800; font-size: 1.02rem; padding: 4px 2px; cursor: pointer; }
.nav-group { margin-top: 10px; }
.nav-group > span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 6px 12px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 14px; text-decoration: none; color: var(--text);
  font-weight: 650; transition: background .15s;
}
.nav a .ico { font-size: 1.15rem; width: 1.5em; text-align: center; }
.nav a:hover { background: var(--bg-2); }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 800; }
.nav a .badge { margin-left: auto; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1.5px solid var(--line); }
.sidebar .me form { margin: 0; }

.main { min-width: 0; }
.topbar { display: none; }
.view { max-width: 1180px; margin: 0 auto; padding: 26px 28px 110px; }
.view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h1 { margin: 0; }
.view-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.offline-banner { position: sticky; top: 0; z-index: 30; background: var(--warn); color: #3a2a00; text-align: center; padding: 6px; font-weight: 700; font-size: .9rem; }

.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card + .card { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: var(--r-sm); }
.list.divided > li { border-bottom: 1px solid var(--line); border-radius: 0; padding: 11px 4px; }
.list.divided > li:last-child { border-bottom: 0; }
.list li select { width: auto; }

/* Pestañas inferiores y botón + (solo móvil) */
.bottom-nav, .fab { display: none; }

/* ---------------------------------------------------------------- Hoy */
.hello { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.hello h1 { margin: 0; font-size: 1.9rem; }
.hello p { margin: 0; color: var(--muted); font-weight: 600; }
.today-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.today-grid > div { display: grid; gap: 18px; }
.weather { display: flex; align-items: center; gap: 14px; }
.weather .w-icon { font-size: 2.6rem; line-height: 1; }
.weather .w-temp { font-size: 1.6rem; font-weight: 800; }
.weather .w-tomorrow { margin-left: auto; text-align: right; }
.countdowns { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.countdown { flex: none; background: var(--accent-soft); border-radius: var(--r-md); padding: 10px 14px; min-width: 130px; }
.countdown strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.quick-add { display: flex; gap: 8px; align-items: center; background: var(--surface); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.quick-add input { border: 0; background: transparent; padding: .5em 0; box-shadow: none !important; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mini-list li { display: flex; gap: 10px; align-items: center; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.section-title h3 { margin: 0; }
.section-title > h3 + a, .section-title > h3 + button { margin-left: auto; }

/* Agenda */
.agenda { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.agenda-day { font-weight: 800; color: var(--muted); margin-top: .5em; font-size: .9rem; }
.agenda-item {
  display: flex; gap: 12px; align-items: center; background: var(--surface-2); padding: 10px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); cursor: pointer; position: relative; overflow: hidden;
}
.agenda-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.agenda-item .emoji { font-size: 1.35rem; width: 1.6em; text-align: center; flex: none; }
.agenda-item .time { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; font-size: .88rem; min-width: 84px; }
.agenda-item .who { color: var(--muted); font-size: .85rem; }

/* Post-its y notas */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.board > .empty { grid-column: 1 / -1; }
.sticky {
  position: relative; background: var(--amarillo); color: var(--sticky-text); padding: 16px 16px 12px;
  border-radius: 18px 18px 26px 18px; box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 10px 22px rgba(80, 60, 20, .09); min-height: 130px;
  display: flex; flex-direction: column; gap: 6px; transition: transform .15s;
}
.sticky.clickable { cursor: pointer; }
.sticky:nth-child(3n+1) { transform: rotate(-.7deg); }
.sticky:nth-child(3n+2) { transform: rotate(.6deg); }
.sticky:hover { transform: translateY(-2px); }
.sticky.rosa { background: var(--rosa); } .sticky.verde { background: var(--verde); } .sticky.azul { background: var(--azul); }
.sticky.naranja { background: var(--naranja); } .sticky.lila { background: var(--lila); } .sticky.amarillo { background: var(--amarillo); }
.sticky.seen { opacity: .6; }
.sticky h4 { margin: 0; font-size: 1.02rem; }
.sticky footer { margin-top: auto; font-size: .78rem; opacity: .7; font-weight: 600; }
.sticky .pin { position: absolute; top: -10px; right: 12px; font-size: 1.2rem; }
.postit-body { font-size: 1.08rem; margin: 0; white-space: pre-wrap; word-break: break-word; font-weight: 600; }
.sticky-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sticky-actions .btn { background: rgba(255, 255, 255, .65); color: var(--sticky-text); border-color: transparent; }
.rich p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.rich .todo { font-weight: 500; display: flex; gap: .45em; align-items: baseline; }
.rich .todo.done { text-decoration: line-through; opacity: .6; }

/* ---------------------------------------------------------------- Calendario */
.cal-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.cal-tools .quick-add { flex: 1 1 320px; margin: 0; }
#calendar { background: var(--surface); border-radius: var(--r-xl); padding: 14px; box-shadow: var(--shadow);
  --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--bg-2);
  --fc-list-event-hover-bg-color: var(--bg-2); --fc-today-bg-color: var(--accent-soft); --fc-event-border-color: transparent;
  --fc-button-bg-color: var(--surface); --fc-button-text-color: var(--text); --fc-button-border-color: var(--line);
  --fc-button-hover-bg-color: var(--bg-2); --fc-button-hover-border-color: var(--line);
  --fc-button-active-bg-color: var(--accent-soft); --fc-button-active-border-color: var(--accent-line); --fc-now-indicator-color: var(--accent); }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.fc .fc-toolbar-title { font-size: 1.25rem; font-weight: 800; }
.fc .fc-toolbar-title::first-letter { text-transform: uppercase; }
.fc .fc-button { font-weight: 700; border-radius: 999px !important; box-shadow: none !important; padding: .4em .9em; text-transform: none; }
.fc .fc-button-group { gap: 4px; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--text); }
.fc a { color: inherit; text-decoration: none; }
.fc .fc-col-header-cell-cushion { text-transform: capitalize; color: var(--muted); font-weight: 700; padding: 8px 4px; }
.fc .fc-daygrid-day-number { font-weight: 700; padding: 6px 8px; }
.fc .fc-scrollgrid { border-radius: var(--r-md); overflow: hidden; }
.fc-theme-standard .fc-scrollgrid { border: 1px solid var(--line); }
.fc .fc-daygrid-event { border-radius: 8px; padding: 1px 4px; font-weight: 600; }
.fc .fc-timegrid-event { border-radius: 10px; }
.fc-event { cursor: pointer; }
.fc .fc-multimonth { border: 0; }
.fc .fc-multimonth-title { font-size: 1rem; text-transform: capitalize; }
.fc .fc-list { border-radius: var(--r-md); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--bg-2); }

/* Diálogos */
dialog { border: 0; border-radius: var(--r-xl); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(30, 18, 12, .42); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
dialog { overflow-x: hidden; }
dialog > form, dialog > .dlg { padding: 22px 22px 18px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
dialog h2 { margin: 0; font-size: 1.25rem; }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
.dialog-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; bottom: -18px; background: var(--surface); padding: 10px 0 2px; }
.dlg-head { display: flex; align-items: center; gap: 10px; }
.dlg-head .btn.icon { margin-left: auto; }
.weekday-picker { display: flex; gap: 4px; flex-wrap: wrap; }
.weekday-picker label { position: relative; }
.weekday-picker input { position: absolute; opacity: 0; }
.weekday-picker span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-2); font-weight: 800; cursor: pointer; }
.weekday-picker input:checked + span { background: var(--accent); color: var(--accent-ink); }
.icon-button { display: inline-flex; align-items: center; gap: .55em; }
.icon-button .emoji { font-size: 1.5rem; }
.title-row .icon-button { width: 52px; height: 48px; padding: 0; border-radius: 16px; }
.title-row .icon-button .label { display: none; }
.comments { display: grid; gap: 8px; border-top: 1.5px solid var(--line); padding-top: 12px; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment .bubble { background: var(--bg-2); border-radius: 4px 16px 16px 16px; padding: 8px 12px; }
.comment .bubble small { display: block; color: var(--muted); font-weight: 700; }

/* Selector de iconos */
.icon-search { position: sticky; top: 0; background: var(--surface); padding-bottom: 6px; z-index: 1; }
.icon-cat h4 { margin: 12px 0 6px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.icon-tile { appearance: none; border: 2px solid transparent; background: var(--bg-2); border-radius: 14px; aspect-ratio: 1; font-size: 1.55rem; cursor: pointer; position: relative; }
.icon-tile:hover { border-color: var(--accent-line); }
.icon-tile.sel { border-color: var(--accent); background: var(--accent-soft); }
.icon-tile .star { position: absolute; top: -2px; right: 1px; font-size: .75rem; }
.fav-mode .icon-tile { border-style: dashed; border-color: var(--line); }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 80; background: var(--text); color: var(--bg);
  padding: .7em 1.2em; border-radius: 999px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); font-weight: 700; display: flex; gap: 12px; align-items: center; }
#toast button { background: transparent; border: 0; color: var(--accent); font: inherit; font-weight: 800; cursor: pointer; }

/* ---------------------------------------------------------------- Menú semanal */
.menu-layout { display: grid; grid-template-columns: 1fr 290px; gap: 18px; align-items: start; }
.menu-week { display: grid; grid-template-columns: 92px repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(3, auto); grid-auto-flow: column; gap: 8px; background: var(--surface); border-radius: var(--r-xl); padding: 14px; box-shadow: var(--shadow); }
.menu-week .hd { font-weight: 800; text-align: center; padding: 4px; text-transform: capitalize; font-size: .9rem; }
.menu-week .hd small { display: block; color: var(--muted); font-weight: 700; }
.menu-week .hd.today { color: var(--accent); }
.menu-week .slot-name { font-weight: 800; color: var(--muted); font-size: .85rem; align-self: center; }
.slot { min-height: 76px; border-radius: var(--r-md); border: 2px dashed var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: background .12s, border-color .12s; }
.slot:hover { border-color: var(--accent-line); }
.slot.filled { border-style: solid; background: var(--surface-2); }
.slot.over { border-color: var(--accent); background: var(--accent-soft); }
.slot .add { margin: auto; color: var(--muted); font-weight: 800; font-size: 1.2rem; opacity: .5; }
.dish { display: flex; align-items: flex-start; gap: 5px; font-weight: 700; font-size: .84rem; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; background: var(--surface); border-radius: 12px; padding: 6px 8px; box-shadow: var(--shadow-sm); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.dish .emoji { font-size: 1.1rem; }
.dish > span:last-child { min-width: 0; }
.slot { min-width: 0; }
.slot[data-slot="cole"] .dish { font-weight: 600; font-size: .8rem; }
.slot[data-slot="cole"] .dish .emoji { display: none; }
.recipes-panel { background: var(--surface); border-radius: var(--r-xl); padding: 14px; box-shadow: var(--shadow); position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 10px; }
.recipes-panel .recipe-list { overflow-y: auto; display: grid; gap: 6px; }
.recipe-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; font-weight: 700; }
.recipe-chip.selected { border-color: var(--accent); background: var(--accent-soft); }
.recipe-chip .emoji { font-size: 1.3rem; }
.recipe-chip .star { color: var(--warn); }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg); box-shadow: var(--shadow-lg); opacity: .95; }
.trash-zone { border: 2px dashed var(--line); border-radius: var(--r-md); padding: 10px; text-align: center; color: var(--muted); font-weight: 700; }
.trash-zone.over { border-color: var(--danger); color: var(--danger); }
.recipes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.recipe-card { cursor: pointer; display: grid; gap: 6px; }
.recipe-card .emoji { font-size: 2rem; }
.tag { display: inline-block; background: var(--bg-2); border-radius: 999px; padding: .1em .6em; font-size: .78rem; font-weight: 700; margin: 0 4px 4px 0; }

/* ---------------------------------------------------------------- Listas */
.lists-layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.lists-nav { display: grid; gap: 6px; }
.lists-nav button { appearance: none; border: 1.5px solid transparent; background: var(--surface); border-radius: var(--r-md); padding: 11px 14px; font: inherit; font-weight: 700; text-align: left; display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: var(--shadow-sm); color: var(--text); }
.lists-nav button.on { border-color: var(--accent); background: var(--accent-soft); }
.lists-nav .emoji { font-size: 1.3rem; }
.lists-nav .count { margin-left: auto; color: var(--muted); font-size: .85rem; }
.add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.add-row .qty { max-width: 130px; }
.items { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.items li { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.items li label { display: flex; align-items: center; gap: .65em; font-weight: 600; font-size: 1.04rem; cursor: pointer; }
.items li input[type="checkbox"] { width: 22px; height: 22px; }
.items li.done .name { text-decoration: line-through; color: var(--muted); }
.items .qty { color: var(--muted); }

/* ---------------------------------------------------------------- Fotos y diario */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-grid > .empty { grid-column: 1 / -1; }
.photo { margin: 0; background: var(--surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-2); }
.photo figcaption { padding: 7px 11px; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-full { width: 100%; max-height: 68vh; object-fit: contain; border-radius: var(--r-md); background: var(--bg-2); }
.timeline { display: grid; gap: 14px; max-width: 720px; }
.entry { display: grid; gap: 8px; }
.entry img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--r-md); }
.entry .day { font-weight: 800; color: var(--accent); }
.memory { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }

/* Votaciones */
.poll-option { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); cursor: pointer; overflow: hidden; margin-bottom: 6px; background: var(--surface-2); }
.poll-option .bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; transition: width .3s; }
.poll-option > *:not(.bar) { position: relative; z-index: 1; }
.poll-option.mine { border-color: var(--accent); }
.poll-option .voters { margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 700; }

/* Personas */
.person-card { display: grid; gap: 10px; }
.person-card .top { display: flex; align-items: center; gap: 12px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .92rem; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; white-space: pre-wrap; }
.wish { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wish.reserved .name { text-decoration: line-through; color: var(--muted); }

/* Huecos libres */
.free-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.free-day { background: var(--surface); border-radius: var(--r-lg); padding: 12px; box-shadow: var(--shadow); }
.free-day h4 { margin: 0 0 8px; text-transform: capitalize; }
.free-slot { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-radius: 12px; padding: 6px 10px; margin-bottom: 6px; font-weight: 700; font-size: .9rem; }

/* Ajustes */
.theme-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-picker button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.theme-picker button.on { box-shadow: 0 0 0 3px var(--text); }
.copy { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- Móvil */
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 10px; padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  }
  .topbar img { width: 34px; height: 34px; }
  .topbar select { border: 0; background: transparent; font-weight: 800; font-size: 1.05rem; padding: 4px 0; flex: 1; }
  .view { padding: 8px 14px 130px; }
  .view-head h1 { font-size: 1.45rem; }
  .bottom-nav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 25;
    background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 6px; justify-content: space-around;
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: var(--muted);
    font-size: .68rem; font-weight: 800; padding: 6px 2px; border-radius: 20px; position: relative; }
  .bottom-nav a .ico { font-size: 1.35rem; line-height: 1.1; }
  .bottom-nav a.active { background: var(--accent-soft); color: var(--text); }
  .bottom-nav .badge { position: absolute; top: 2px; right: 18%; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 80px); z-index: 26;
    width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.9rem; font-weight: 400;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent); cursor: pointer; }
  .more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .more-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; background: var(--surface-2); border-radius: var(--r-md);
    text-decoration: none; color: var(--text); font-weight: 700; font-size: .85rem; text-align: center; border: 1.5px solid var(--line); }
  .more-grid a .ico { font-size: 1.6rem; }
  .today-grid, .menu-layout, .lists-layout { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
  .menu-week { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; padding: 10px; }
  .menu-week .slot[data-slot="cole"] { grid-column: 1 / -1; min-height: 44px; }
  .hide-mobile { display: none !important; }
  .settings { grid-template-columns: 1fr; }
  .k-grid { grid-template-columns: 1fr; }
  .menu-week .corner, .menu-week .slot-name { display: none; }
  .menu-week .daycell { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .menu-week .daycell .hd { grid-column: 1 / -1; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .slot { min-height: 58px; }
  .slot::before { content: attr(data-label); font-size: .7rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }
  .recipes-panel { order: -1; position: sticky; top: calc(max(10px, env(safe-area-inset-top)) + 50px); z-index: 6; max-height: none; padding: 10px; gap: 8px; border-radius: var(--r-lg); }
  .recipes-panel .hint, .recipes-panel .trash-zone, .recipes-panel input[type="search"] { display: none; }
  .recipes-panel .recipe-list { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .recipe-chip { flex: none; }
  .lists-nav { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .lists-nav button { flex: none; }
  .add-row .qty { max-width: 92px; }
  .free-week { grid-template-columns: 1fr; }
  .fc .fc-toolbar-title { font-size: 1.05rem; }
  #calendar { padding: 8px; border-radius: var(--r-lg); }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  #toast { bottom: 150px; }
}
@media (min-width: 861px) {
  .menu-week .daycell { display: contents; }
  .more-only { display: none; }
}

/* ---------------------------------------------------------------- Piezas de la interfaz v1 */
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack-sm { display: grid; gap: 8px; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > input { min-width: 0; }
.pre { white-space: pre-wrap; }
.eyebrow { display: block; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.section-gap { margin-top: 28px; }
.search { margin-bottom: 14px; }
.title-row .icon-button { flex: none; }
.title-row input { font-size: 1.1rem; font-weight: 700; }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
label.inline input, label.inline select { width: auto; }
.file-btn input { display: none; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); box-shadow: none; }
.topbar .btn.icon, .top-postits { position: relative; text-decoration: none; }
.topbar .badge { position: absolute; top: -2px; right: -2px; }
#toast.error { background: var(--danger); color: #fff; }
#toast.error button { color: #fff; }
body.dragging { user-select: none; cursor: grabbing; }
.avatar.sm { width: 26px; height: 26px; font-size: .78rem; }
.chip-select { width: auto; border-radius: 999px; padding: .38em 2em .38em .9em; font-weight: 700; font-size: .9rem; }
.cal-filters { margin-bottom: 12px; align-items: center; }
.repeat-box { background: var(--bg-2); border-radius: var(--r-md); padding: 12px; }
.repeat-box .hint { margin: 0 0 6px; }

/* Selector de color de notas y post-its */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch::after { content: ""; display: block; width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.08); cursor: pointer; }
.swatch.amarillo::after { background: var(--amarillo); } .swatch.rosa::after { background: var(--rosa); } .swatch.verde::after { background: var(--verde); }
.swatch.azul::after { background: var(--azul); } .swatch.naranja::after { background: var(--naranja); } .swatch.lila::after { background: var(--lila); }
.swatch:has(input:checked)::after { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.swatch:has(input:focus-visible)::after { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Eventos rápidos */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.template { appearance: none; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: var(--r-md); padding: 12px; font: inherit; font-weight: 700;
  color: var(--text); cursor: pointer; display: grid; gap: 2px; justify-items: start; text-align: left; }
.template:hover { border-color: var(--accent); background: var(--accent-soft); }
.template .emoji { font-size: 1.5rem; }
.template small { color: var(--muted); }

/* Hoy */
.small-board { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.small-board .sticky { min-height: 96px; }
.slot-label { min-width: 72px; }
.agenda-none { padding: 2px 4px 6px; }
.mini-list .emoji { width: 1.5em; text-align: center; }
.mini-list a { color: inherit; text-decoration: none; font-weight: 650; }
.countdown { border: 1.5px solid color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); }
.weather.muted { text-decoration: none; color: var(--muted); font-weight: 600; }

/* Semana (menú, huecos) */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav h1 { margin: 0; }
.week-nav .btn.icon { font-size: 1.5rem; line-height: 1; }

/* Listas */
.lists-title { margin-bottom: 14px; }
.lists-nav .new-list { border-style: dashed; border-color: var(--line); background: transparent; box-shadow: none; color: var(--muted); }
.usual { margin-top: 18px; }
.usual h3 { margin-top: 0; }
.items li .who { margin-left: auto; }
.checklist li.done strong { text-decoration: line-through; color: var(--muted); }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

/* Votaciones */
button.poll-option { width: 100%; font: inherit; color: var(--text); text-align: left; font-weight: 650; }
button.poll-option:disabled { cursor: default; }
.poll.closed h3::after { content: " 🔒"; }
.photos-title { margin-top: 30px; }

/* Medicación */
.next-dose { font-weight: 800; font-size: 1.05rem; }
.next-dose.late { color: var(--danger); }
.med.inactive { opacity: .6; }
.med { display: grid; gap: 10px; }
.med h3 { margin: 0; }
details summary { cursor: pointer; font-weight: 700; color: var(--muted); }

/* Huecos libres */
.free-options { margin-bottom: 16px; }
.free-slot { appearance: none; border: 0; display: block; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.free-slot:hover { outline: 2px solid var(--ok); }
.free-day.past { opacity: .5; }

/* Ajustes e historial */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.settings-card h2 { font-size: 1.15rem; }
.settings-card .list li input[type="color"] { width: 40px; height: 36px; }
.copy input { flex: 1; }
.history li.undone { opacity: .55; }
.seg { margin-bottom: 14px; }

/* ---------------------------------------------------------------- Pantalla de cocina */
body.kitchen { font-size: 19px; }
.kitchen-wrap { max-width: 1400px; margin: 0 auto; padding: 22px 26px 40px; }
.k-head { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; }
.k-clock { font-size: 4.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.k-date { font-size: 1.4rem; color: var(--muted); font-weight: 700; }
.k-weather { display: flex; align-items: center; gap: 12px; font-size: 1.7rem; font-weight: 800; margin-left: auto; }
.k-w-icon { font-size: 3rem; }
.k-rain { font-size: 1.1rem; color: var(--muted); }
.k-exit { opacity: .5; }
.k-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.k-side { display: grid; gap: 20px; }
.k-card { background: var(--surface); border-radius: var(--r-xl); padding: 20px 22px; box-shadow: var(--shadow); }
.k-card h2 { font-size: 1.3rem; }
.k-agenda .agenda-item { font-size: 1.1rem; padding: 14px 16px; }
.k-agenda .agenda-item .time { min-width: 110px; }
.k-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.k-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kitchen .board { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

@media (max-width: 860px) {
  .settings, .k-grid, .cards.two { grid-template-columns: 1fr; }
  .kitchen-wrap { padding: 14px; }
  .k-head { flex-wrap: wrap; }
  .k-clock { font-size: 3rem; }
  .week-nav h1 { font-size: 1.2rem; }
  .template-grid { grid-template-columns: 1fr 1fr; }
}
.settings-card .row > select { width: auto; flex: 1 1 140px; }
.settings-card label > input[type="color"] { display: block; }
.menu-layout > *, .lists-layout > *, .today-grid > *, .today-grid > div > * { min-width: 0; }
.view { overflow-x: clip; }
