/* ---------- Tokens (paleta cálida) ---------- */
:root {
  --bg: #f6efe4;
  --surface: #fffaf2;
  --surface-2: #fbf3e7;
  --ink: #3b2f28;
  --muted: #8b7a6b;
  --line: #eadcc8;
  --accent: #d0693f;
  --accent-ink: #ffffff;
  --navy: #5b4336;
  --today: #5b4336;
  --shadow: 0 1px 2px rgb(90 60 30 / .06), 0 6px 18px rgb(90 60 30 / .07);
  --radius: 16px;

  --c-recado: #5f9a7a;
  --c-recordatorio: #c9952f;
  --c-obligacion: #c25a3a;
  --c-reunion: #5a7fa8;
  --c-cumpleanos: #c9617c;
  --c-personal: #8a6aa8;
  --c-otro: #9a8a7c;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1814; --surface: #27201b; --surface-2: #2d2520; --ink: #f1e6d8; --muted: #b19e8b;
    --line: #3b3029; --navy: #e9d6c2; --today: #f1e6d8; --accent: #e07a4f;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
    --c-recado: #7fbf9c; --c-recordatorio: #e3b252; --c-obligacion: #e27b58; --c-reunion: #84a6cf;
    --c-cumpleanos: #e5859d; --c-personal: #b092cf; --c-otro: #b5a596;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1814; --surface: #27201b; --surface-2: #2d2520; --ink: #f1e6d8; --muted: #b19e8b;
  --line: #3b3029; --navy: #e9d6c2; --today: #f1e6d8; --accent: #e07a4f;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
  --c-recado: #7fbf9c; --c-recordatorio: #e3b252; --c-obligacion: #e27b58; --c-reunion: #84a6cf;
  --c-cumpleanos: #e5859d; --c-personal: #b092cf; --c-otro: #b5a596;
  color-scheme: dark;
}

.cat-recado { --c: var(--c-recado); }
.cat-recordatorio { --c: var(--c-recordatorio); }
.cat-obligacion { --c: var(--c-obligacion); }
.cat-reunion { --c: var(--c-reunion); }
.cat-cumpleanos { --c: var(--c-cumpleanos); }
.cat-personal { --c: var(--c-personal); }
.cat-otro { --c: var(--c-otro); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; font-weight: 700; text-transform: capitalize; }
h2 { font-size: 19px; margin: 0; letter-spacing: -.01em; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.tabs { display: flex; gap: 4px; margin-left: 12px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.tabs .tab { border: 0; background: none; padding: 7px 16px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.tabs .tab.active { background: var(--navy); color: var(--bg); }
.top-actions { margin-left: auto; display: flex; gap: 4px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 10px; background: none; color: var(--ink);
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
#btn-notif.on { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 8px 14px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn.danger { color: var(--c-obligacion); }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* ---------- Layout ---------- */
main { padding: 20px; padding-bottom: 110px; max-width: 1500px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.nav-group { display: flex; align-items: center; gap: 8px; }
.nav-group h1 { min-width: 210px; text-align: center; }

input[type=date], input[type=time], input[type=search], select, input:not([type]), textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%;
}
.nav-group input { width: auto; }
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 99px; background: var(--line); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; }
.seg.full { display: flex; width: 100%; }
.seg.full .seg-btn { flex: 1; }
.seg-btn { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.seg-btn.active { background: var(--navy); color: var(--bg); }
#ev-level .seg-btn[data-level="hito"].active { background: var(--accent); }

/* ---------- Month ---------- */
.milestones { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: thin; }
.milestones:empty { display: none; }
.ms-card {
  flex: none; min-width: 180px; max-width: 240px; text-align: left;
  border: 0; border-radius: 12px; padding: 10px 12px; color: #fff;
  background: var(--c); box-shadow: var(--shadow);
}
.ms-card .d { font-size: 12px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.ms-card .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-card.done { opacity: .5; text-decoration: line-through; }
.ms-label { flex: none; align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-right: 4px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend .key { margin-left: auto; }
.legend b { color: var(--ink); }

.month-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.dow { background: var(--surface-2); padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cell {
  background: var(--surface); min-height: 128px; padding: 6px; display: flex; flex-direction: column; gap: 3px;
  cursor: pointer; position: relative; min-width: 0; text-align: left; border: 0; border-radius: 0;
}
.cell:hover { background: var(--surface-2); }
.cell.out { background: var(--surface-2); }
.cell.out .num { opacity: .4; }
.cell.weekend .num { color: var(--muted); }
.cell .num { font-weight: 700; font-size: 14px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 2px; }
.cell.today .num { background: var(--today); color: var(--bg); }
.cell.has-hito { box-shadow: inset 0 3px 0 var(--accent); }
.cell .note-flag { position: absolute; top: 9px; right: 8px; width: 14px; height: 14px; color: var(--muted); }

.chip {
  display: block; font-size: 12.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px;
  background: var(--c); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.done { opacity: .45; text-decoration: line-through; }
.line {
  display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; padding: 0 2px;
}
.line i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.line span { overflow: hidden; text-overflow: ellipsis; }
.line.done span { text-decoration: line-through; opacity: .6; }
.more { font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 2px; }
.dots { display: none; gap: 3px; flex-wrap: wrap; padding: 0 2px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* ---------- Week ---------- */
.week-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.pill b { color: var(--accent); }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.day-col {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 440px; box-shadow: var(--shadow); min-width: 0;
}
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.day-head { padding: 12px 12px 8px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.day-head .dname { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.day-head .dnum { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.day-head .dmon { font-size: 13px; color: var(--muted); }
.day-col.today .dnum { color: var(--accent); }
.day-head .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 4px; }

.task {
  display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start;
  padding: 8px 9px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--c);
  cursor: pointer;
}
.task.hito { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.task .tt { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.task .tm { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.task .tm .star { color: var(--accent); font-weight: 800; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }
.task.done { opacity: .7; }
.check {
  appearance: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--c); margin: 1px 0 0;
  display: grid; place-items: center; cursor: pointer; background: var(--surface);
}
.check:checked { background: var(--c); }
.check:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }

.quick-add { display: flex; gap: 4px; padding: 0 8px 8px; }
.quick-add input { font-size: 13.5px; padding: 7px 9px; background: var(--surface-2); }
.day-note-wrap { border-top: 1px dashed var(--line); padding: 8px; }
.day-note-wrap textarea { font-size: 13.5px; background: var(--surface-2); border-style: dashed; min-height: 76px; }

/* ---------- Notes ---------- */
.notes-layout { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
.notes-list { display: flex; flex-direction: column; gap: 8px; max-height: calc(100dvh - 200px); overflow-y: auto; padding: 2px; }
.note-item {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px; width: 100%;
}
.note-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.note-item .nt { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .np { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item .nd { font-size: 12px; color: var(--muted); }
.note-editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-height: 420px; display: flex; flex-direction: column; gap: 10px; }
.note-editor .title-in { font-size: 22px; font-weight: 700; border: 0; padding: 4px 0; background: transparent; }
.note-editor .title-in:focus { outline: none; }
.note-editor textarea.body-in { flex: 1; min-height: 340px; border: 0; padding: 4px 0; background: transparent; font-size: 16px; line-height: 1.6; resize: none; }
.note-editor textarea.body-in:focus { outline: none; }
.editor-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }
.editor-bar .spacer { flex: 1; }
.placeholder { display: grid; place-items: center; color: var(--muted); text-align: center; flex: 1; }

/* ---------- Mic ---------- */
.with-mic { position: relative; display: flex; gap: 6px; align-items: flex-start; }
.mic {
  flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--muted);
}
.mic:hover { color: var(--ink); }
.mic.rec { background: var(--c-obligacion); border-color: var(--c-obligacion); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-obligacion) 50%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.btn.rec { background: var(--c-obligacion); border-color: var(--c-obligacion); color: #fff; }
.rec-indicator {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 99px;
  background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: var(--shadow);
}
.rec-indicator .btn { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-obligacion); animation: pulse 1.2s infinite; }

/* ---------- FAB / bottom nav ---------- */
.fab {
  position: fixed; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 30;
  width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.5; }
.bottomnav { display: none; }

/* ---------- Dialogs ---------- */
dialog {
  border: 0; padding: 0; background: transparent; color: inherit; max-width: 560px; width: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgb(15 15 20 / .45); backdrop-filter: blur(2px); }
.sheet { background: var(--surface); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); max-height: calc(100dvh - 24px); overflow-y: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2::first-letter { text-transform: uppercase; }
.sheet-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field label, .field .label { font-size: 13px; font-weight: 700; color: var(--muted); }
.row { display: flex; gap: 12px; }
.cat-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-opt {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.cat-opt.active { background: var(--c); border-color: var(--c); color: #fff; }
.detected {
  font-size: 13px; background: color-mix(in srgb, var(--c-reunion) 10%, var(--surface)); border-radius: 10px; padding: 8px 10px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.day-items { display: flex; flex-direction: column; gap: 6px; }
.extract-list { display: flex; flex-direction: column; gap: 8px; }
.extract-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.extract-row input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; }
.extract-row .meta { font-size: 13px; color: var(--muted); }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 11px 14px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.menu-item.static { cursor: default; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(70px + env(safe-area-inset-top)); right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: tin .2s ease-out; }
.toast small { display: block; font-weight: 400; opacity: .8; }
@keyframes tin { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { padding-left: 16px; padding-right: 10px; }
  .tabs { display: none; }
  main { padding: 14px 16px 130px; }
  h1 { font-size: 21px; }
  .nav-group h1 { min-width: 150px; }
  .view-head { gap: 8px; }

  .cell { min-height: 74px; padding: 4px 3px; }
  .cell .num { width: 24px; height: 24px; font-size: 13px; }
  .chip { font-size: 10.5px; padding: 1px 4px; border-radius: 4px; }
  .line, .more { display: none; }
  .dots { display: flex; }
  .dow { padding: 6px 4px; font-size: 11px; text-align: center; }
  .cell .note-flag { top: 6px; right: 4px; width: 11px; height: 11px; }
  .legend .key { margin-left: 0; width: 100%; }
  .ms-label { display: none; }
  .chip { font-weight: 600; }

  .week-grid { grid-template-columns: 1fr; }
  .day-col { min-height: 0; }

  .notes-layout { grid-template-columns: 1fr; }
  .notes-layout.editing .notes-list { display: none; }
  .notes-layout:not(.editing) .note-editor { display: none; }
  .notes-list { max-height: none; }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav .tab { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px; }
  .bottomnav .tab.active { color: var(--accent); }
  .fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 16px; }
  .rec-indicator { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .row { flex-direction: column; gap: 14px; }
  dialog { width: 100%; max-width: none; margin: auto 0 0; max-height: 92dvh; }
  .sheet { border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 92dvh; }
}

.mobile-back { display: none; align-self: flex-start; }
@media (max-width: 760px) { .mobile-back { display: inline-flex; } }

/* ---------- Ajustes de calidez: etiquetas en tonos suaves ---------- */
.chip {
  background: color-mix(in srgb, var(--c) 26%, var(--surface));
  color: var(--ink); border-left: 3px solid var(--c); font-weight: 700;
}
.ms-card {
  background: color-mix(in srgb, var(--c) 20%, var(--surface)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); border-left: 5px solid var(--c);
}
.ms-card .d { color: color-mix(in srgb, var(--c) 70%, var(--ink)); opacity: 1; }
.cat-opt.active { background: color-mix(in srgb, var(--c) 22%, var(--surface)); border-color: var(--c); color: var(--ink); }
.task.hito { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.cell.today .num { color: var(--surface); }
.fab { border-radius: 50%; }
.month-grid, .day-col, .note-editor, .money-card { border-radius: 18px; }
.cell { background: var(--surface); }
.cell.out { background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }

/* ---------- Tira de la semana ---------- */
.week-strip {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.ws-day {
  border: 0; background: transparent; border-radius: 12px; padding: 6px 2px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
}
.ws-day:hover { background: var(--surface-2); }
.ws-day .ws-n { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ws-day .ws-d { font-size: 18px; font-weight: 800; line-height: 1.1; }
.ws-day .ws-dots { display: flex; gap: 3px; height: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ws-day .ws-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.ws-day .ws-dots .star { font-size: 10px; color: var(--accent); line-height: 1; }
.ws-day.today { background: var(--navy); }
.ws-day.today .ws-n, .ws-day.today .ws-d { color: var(--bg); }
.ws-day.all-done .ws-d { text-decoration: line-through; text-decoration-color: var(--accent); }
.day-col { scroll-margin-top: 80px; }
.day-col.flash { animation: flash 1s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--accent); } }

/* ---------- Gastos ---------- */
.money-add { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.money-add input { font-size: 16px; padding: 11px 14px; border-radius: 14px; }
.mic.big { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); border-color: var(--accent); color: #fff; }
.mic.big svg { width: 22px; height: 22px; }
.money-preview {
  background: var(--surface); border: 1px dashed var(--accent); border-radius: 16px; padding: 12px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.mp-row { display: grid; grid-template-columns: 90px 1fr auto auto; gap: 8px; align-items: center; }
.mp-row input, .mp-row select { padding: 6px 8px; }
.mp-actions { display: flex; gap: 8px; justify-content: flex-end; }

.money-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; align-items: start; }
.money-card { background: var(--surface); border: 1px solid var(--line); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.money-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.money-total .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.money-total .delta { font-size: 13px; color: var(--muted); }
.budget { margin: 12px 0 4px; }
.budget-bar { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.budget-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.budget-bar.over span { background: var(--c-obligacion); }
.budget .small { margin-top: 4px; display: block; }

.breakdown { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.bk-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; cursor: default; }
.bk-row .bk-l { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.bk-row .bk-v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bk-row .bk-v small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.bk-bar { grid-column: 1 / -1; height: 8px; border-radius: 0 4px 4px 0; background: var(--surface-2); position: relative; }
.bk-bar span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 4px; }
.bk-row:hover .bk-bar span { filter: brightness(1.08); }

.mx-day { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; display: flex; justify-content: space-between; }
.mx-day:first-child { margin-top: 0; }
.mx-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.mx-row:last-child { border-bottom: 0; }
.mx-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 17px; }
.mx-desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-row select { width: auto; font-size: 12px; padding: 2px 4px; border: 0; background: transparent; color: var(--muted); }
.mx-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.mx-del { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 8px; }
.mx-del:hover { background: var(--surface-2); color: var(--c-obligacion); }

@media (max-width: 760px) {
  .week-strip { position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 10; gap: 2px; padding: 4px; }
  .ws-day .ws-d { font-size: 16px; }
  .money-layout { grid-template-columns: 1fr; }
  .money-total .big { font-size: 34px; }
  .money-add input { font-size: 15px; }
  .mp-row { grid-template-columns: 76px 1fr auto; }
  .mp-row .mp-desc { grid-column: 1 / -1; order: -1; }
}

/* ---------- Mes: desplegables de resumen y notas ---------- */
.month-panels { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; margin-bottom: 12px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 14px; user-select: none;
}
.panel summary::-webkit-details-marker { display: none; }
.panel-ico { font-size: 18px; }
.panel-title { font-weight: 800; }
.panel-hint { color: var(--muted); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.panel .chev { transition: transform .2s; color: var(--muted); }
.panel[open] .chev { transform: rotate(180deg); }
.panel-body { padding: 0 14px 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.panel-body textarea { min-height: 120px; background: var(--surface-2); }
.panel-actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }

.sum-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.sum-progress .budget-bar { flex: 1; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.sum-block { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.sum-block h3 { margin: 0 0 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; }
.sum-item {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none;
  padding: 4px 0; font-size: 14px; border-radius: 6px;
}
.sum-item:hover .si-t { text-decoration: underline; text-decoration-color: var(--line); }
.sum-item .si-d { flex: none; width: 52px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sum-item .si-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sum-item .si-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); align-self: center; }
.sum-item.done .si-t { text-decoration: line-through; color: var(--muted); }
.sum-item.late .si-d { color: var(--c-obligacion); }
.sum-money { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sum-empty { color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .month-panels { grid-template-columns: 1fr; }
}

/* ---------- Sincronización ---------- */
.sync-btn { position: relative; }
.sync-dot { position: absolute; right: 6px; bottom: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); border: 2px solid var(--bg); }
.sync-btn[data-state="ok"] .sync-dot { background: var(--c-recado); }
.sync-btn[data-state="pending"] .sync-dot, .sync-btn[data-state="offline"] .sync-dot { background: var(--c-recordatorio); }
.sync-btn[data-state="error"] .sync-dot { background: var(--c-obligacion); }
.sync-btn[data-state="syncing"] svg { animation: syncpulse 1s ease-in-out infinite; }
@keyframes syncpulse { 50% { opacity: .35; } }
.sync-box { gap: 6px; }
.sync-row { display: flex; gap: 8px; align-items: center; }
.sync-row input { flex: 1; }

/* ---------- Bienvenida ---------- */
#dlg-welcome { max-width: 420px; }
.welcome { text-align: center; align-items: stretch; padding: 26px 22px 20px; }
.welcome h2 { font-size: 22px; }
.welcome p { margin: 0; }
.welcome-ico { font-size: 40px; line-height: 1; }
.welcome input { text-align: center; font-size: 16px; padding: 12px; }
.welcome .btn { justify-content: center; padding: 11px; }
.welcome-error { color: var(--c-obligacion); font-weight: 700; font-size: 14px; }
@media (max-width: 760px) { #dlg-welcome { margin: auto; width: calc(100% - 24px); } .welcome { border-radius: 18px; } }
