/* =====================================================================
   BestBuds — sistema visual v2
   Neutros cálidos + acento verde. Inter (OFL) autoalojada, iconos Lucide.
   ===================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --surface-3: #eae7e1;
  --line: #e7e3dc;
  --line-strong: #d9d4cb;
  --ink: #1c1b19;
  --ink-2: #3b3833;
  --muted: #6f6a62;
  --faint: #76706a;        /* texto secundario pequeño: ≥ 4.5:1 */
  --faint-ic: #a19b92;     /* solo iconos decorativos */
  --green: #2e7d55;
  --green-600: #246646;
  --green-ink: #1e5a3e;
  --green-soft: #e7f3ec;
  --green-line: #bddfca;
  --amber: #a8620f;
  --amber-soft: #fcf1e2;
  --amber-line: #f0d6b0;
  --red: #b9412a;
  --red-soft: #fbeae5;
  --blue: #2f64a8;
  --blue-soft: #e8f0fa;
  --focus: rgba(46, 125, 85, .35);
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --sh-1: 0 1px 2px rgba(28, 27, 25, .05);
  --sh-2: 0 2px 6px rgba(28, 27, 25, .06), 0 16px 40px rgba(28, 27, 25, .10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --hour: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --side-bg: #f1efea; --side-ink: #3b3833; --side-ink-strong: #1c1b19; --side-muted: #6f6a62; --side-hover: #e7e4de; --side-active: #dedad2; --side-line: #e0dcd4;
  --panel-line: #e3dfd8;
  --group-bg: #faf9f6; --row-hover: #faf9f6;
  --si-backlog: #8f8a82; --si-todo: #8f8a82; --si-progress: #d39b1a; --si-done: #2e7d55; --si-resched: #d97a2b; --si-cancel: #a39d94; --si-check: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; overflow-x: hidden; }
a { color: var(--green-ink); text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.011em; font-weight: 650; }
h1 { font-size: 1.55rem; letter-spacing: -.022em; }
h2 { font-size: 1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.small-text { font-size: .875rem; margin: 0; }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 600; border-radius: var(--r); }
.skip:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 16px; height: 16px; flex: none; }
.boot { display: flex; gap: .6rem; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }
.logo-mark { width: 30px; height: 27px; background: url(/logo-sm.webp) center/contain no-repeat; display: inline-block; flex: none; }

/* ---------- estructura ---------- */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; background: var(--side-bg); }
.content { min-width: 0; }
@media (min-width: 861px) {
  .content { margin: 8px 8px 8px 0; height: calc(100vh - 16px); overflow-y: auto; background: var(--bg); border: 1px solid var(--panel-line); border-radius: 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
}
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); padding: 12px 10px 10px; display: flex; flex-direction: column; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 2px; }
.brand-row .compose { width: 32px; height: 32px; border-radius: 8px; background: var(--side-hover); color: var(--side-ink); border: 0; cursor: pointer; }
.brand-row .compose .ic { width: 17px; height: 17px; }
.brand-row .compose:hover { background: var(--side-active); }
.side .brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px; font-weight: 650; font-size: 1rem; letter-spacing: -.015em; color: var(--side-ink); text-decoration: none; border-radius: 8px; }
.side .brand .logo-mark { width: 28px; height: 26px; border-radius: 7px; background-color: #fff; background-size: 86%; }
.nav-group { margin-top: 18px; }
.nav-title { font-size: 12.5px; font-weight: 500; color: var(--side-muted); padding: 0 10px 4px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--side-ink); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .12s var(--ease), color .12s; }
.nav a .ic { width: 18px; height: 18px; color: var(--side-muted); transition: color .12s; stroke-width: 1.6; }
.nav a .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--side-hover); }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--side-ink-strong); }
.nav a[aria-current="page"] .ic { color: var(--side-ink-strong); }
.count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--side-active); color: var(--side-ink-strong); font-size: 12px; font-weight: 550; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.count.on { background: var(--green); color: #fff; }
h2 .count { margin-left: 8px; vertical-align: 1px; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px 8px; border-top: 1px solid var(--side-line); color: var(--side-ink); }
.me-txt { flex: 1; min-width: 0; }
.me-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; color: var(--side-muted); }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--side-muted); }
.icon-btn:hover { background: var(--side-hover); color: var(--side-ink-strong); }
main { padding: 28px clamp(16px, 3.2vw, 40px) 64px; max-width: 1240px; width: 100%; margin: 0 auto; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.page-head > .row { gap: 8px; }
.mobile-top { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-top { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; justify-content: space-between; height: 52px; padding: 0 16px; background: rgba(247, 246, 243, .92); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-top .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.015em; }
  .top-me { text-decoration: none; }
  .top-me .avatar { width: 30px; height: 30px; font-size: 12px; }
  main { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.35rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 40; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--faint); text-decoration: none; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--green); font-weight: 600; }
  .tabbar .dot { position: absolute; top: 0; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--green); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
}

/* ---------- superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-1); min-width: 0; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-pad { padding: 14px 18px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 28px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-top: 0; }
.grid + .card, .card + .grid, .grid + .grid, .callout + .card, .card + .callout { margin-top: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- botones ---------- */
.btn { font: inherit; font-size: 13.5px; font-weight: 550; height: 34px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; box-shadow: var(--sh-1); transition: background .12s var(--ease), border-color .12s, color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 1px 2px rgba(30, 90, 62, .25); }
.btn.primary:hover { background: var(--green-600); border-color: var(--green-600); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.warm { background: var(--amber-soft); border-color: var(--amber-line); color: #7a4509; }
.btn.warm:hover { background: #f9e7cd; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: #efc7bd; }
.btn.small { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }
.btn.small .ic { width: 14px; height: 14px; }
.btn.big { height: 40px; padding: 0 16px; font-size: 14.5px; }
.btn.icon-only { width: 30px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.seg .btn { box-shadow: none; border-color: transparent; background: transparent; color: var(--muted); height: 26px; }
.seg .btn.primary { background: var(--surface); color: var(--ink); border-color: transparent; box-shadow: var(--sh-1); }

/* ---------- chips, pills, contadores ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip .ic { width: 13px; height: 13px; color: var(--muted); }
.chip.green { background: var(--green-soft); color: var(--green-ink); }
.chip.green .ic { color: var(--green); }
.chip.warn { background: var(--amber-soft); color: #7a4509; }
.chip.warn .ic { color: var(--amber); }
.chip.muted { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.green { color: var(--green-ink); } .pill.green::before { background: var(--green); }
.pill.blue { color: var(--blue); } .pill.blue::before { background: var(--blue); }
.pill.amber { color: var(--amber); } .pill.amber::before { background: #d48a2c; }
.pill.clay { color: var(--red); } .pill.clay::before { background: var(--red); }
.pill.tb { color: var(--green-ink); background: var(--green-soft); padding: 1px 7px; border-radius: 6px; }
.pill.tb::before { display: none; }
.tagname { font-size: 12.5px; color: var(--muted); }
.new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- formularios ---------- */
form .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
label { font-weight: 550; font-size: 13px; color: var(--ink-2); }
input, select, textarea { font: inherit; font-size: 14.5px; padding: 0 11px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 88px; padding: 9px 11px; height: auto; resize: vertical; line-height: 1.45; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6a62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
input:hover, select:hover, textarea:hover { border-color: #c9c3b8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--focus); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--green); flex: none; box-shadow: none; }
input[type=file] { height: auto; }
input[readonly] { background: var(--surface-2); }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 450; font-size: 14px; color: var(--ink); line-height: 1.4; }
.check input { margin-top: 1px; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 10px; }
.field-error { color: var(--red); font-size: 12.5px; }
[aria-invalid=true] { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(185, 65, 42, .15) !important; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 0 4px; }
fieldset > .hint { margin-bottom: 10px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.days label { display: inline-flex; align-items: center; gap: 6px; height: 32px; border: 1px solid var(--line-strong); padding: 0 10px; border-radius: 8px; font-weight: 500; cursor: pointer; background: var(--surface); }
.days label:has(input:checked) { border-color: var(--green-line); background: var(--green-soft); color: var(--green-ink); }

/* ---------- listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item { padding: 11px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.item:first-child { border-top: 0; }
.item .title { font-weight: 550; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item .title a { color: var(--ink); text-decoration: none; }
.item .title a:hover { text-decoration: underline; }
.item .meta, .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* fila de pendiente */
.task-row { padding: 12px 10px; margin: 0 -10px; border-radius: 9px; border-top: 0; align-items: flex-start; transition: background .12s; }
.task-row + .task-row { box-shadow: inset 0 1px 0 var(--line); border-radius: 0; }
.task-row:hover { background: var(--row-hover); }
.st-ic { width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; flex: none; }
.st-ic .si { width: 16px; height: 16px; }
/* iconos de estado */
.si { width: 16px; height: 16px; flex: none; display: block; }
.si-backlog { color: var(--si-backlog); }
.si-todo { color: var(--si-todo); }
.si-progress { color: var(--si-progress); }
.si-done { color: var(--si-done); }
.si-resched { color: var(--si-resched); }
.si-cancel { color: var(--si-cancel); }
/* grupos (estilo Linear) */
.tabs-bar { border-bottom: 1px solid var(--line); }
.group-head { display: flex; align-items: center; gap: 9px; padding: 8px 18px; background: var(--group-bg); border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 550; color: var(--ink); position: sticky; top: 0; z-index: 2; }
.group-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.group .list { padding: 0; }
.group .task-row { margin: 0; padding: 11px 18px; border-radius: 0; }
.group .task-row + .task-row { box-shadow: inset 0 1px 0 var(--line); }
.group + .group .group-head { border-top: 1px solid var(--line); }
.task-row.is-done .title a, .task-row.is-done .title { color: var(--muted); }
.task-row .note { margin: 6px 0 0; }
.mini-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; margin-top: 3px; }
.mini-progress .bar { width: 72px; height: 5px; border-radius: 3px; background: var(--surface-3); display: flex; overflow: hidden; }
.mini-progress .done { background: var(--green); }
.mini-progress .sched { background: #a9d3b8; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
@media (max-width: 640px) {
  .task-row { flex-wrap: wrap; }
  .task-row > .grow { flex-basis: calc(100% - 32px); }
  .task-row .mini-progress { margin-left: 32px; }
  .task-row .row-actions { margin-left: auto; }
}

/* línea de tiempo (sesiones) */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 75px; top: 22px; bottom: 22px; width: 2px; background: var(--line); border-radius: 1px; }
.tl-item { position: relative; display: grid; grid-template-columns: 48px 32px minmax(0, 1fr) auto auto; column-gap: 12px; align-items: center; padding: 9px 0; }
.tl-time { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.tl-node { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--surface); }
.tl-node .si { width: 17px; height: 17px; }
.tl-main { min-width: 0; }
.tl-title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.tl-title:hover { text-decoration: underline; }
.st-completed .tl-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.tl-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 1px; font-variant-numeric: tabular-nums; }
.sep { color: var(--line-strong); }
.dur { font-size: 12px; font-weight: 550; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 2px 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-actions { display: flex; gap: 6px; }
.tl-item.private .tl-title { color: var(--muted); font-weight: 500; }
@media (max-width: 640px) {
  .timeline::before { left: 65px; }
  .tl-item { grid-template-columns: 40px 28px minmax(0, 1fr) auto; column-gap: 10px; }
  .tl-node { width: 28px; height: 28px; }
  .tl-actions { grid-column: 3 / -1; margin-top: 8px; }
}

/* ---------- pestañas (control segmentado) ---------- */
.tabs { display: inline-flex; gap: 6px; padding: 0; background: none; margin-bottom: 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-size: 13px; font-weight: 500; height: 28px; padding: 0 11px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s; }
.tabs button:hover { color: var(--ink); background: var(--surface-2); }
.tabs button[aria-selected=true] { background: var(--surface-3); color: var(--ink); border-color: var(--surface-3); }
.card-pad .tabs { margin-bottom: 0; }

/* ---------- estados ---------- */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--faint-ic); display: grid; place-items: center; margin: 0 auto 10px; }
.empty-ic .ic { width: 20px; height: 20px; }
.empty h3 { color: var(--ink); font-size: .95rem; margin-bottom: 4px; }
.empty p { font-size: .875rem; max-width: 36ch; margin: 0 auto 12px; }
.loading { color: var(--muted); padding: 16px 0; display: flex; align-items: center; gap: 10px; }
.loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { border-radius: var(--r); padding: 9px 12px; margin-bottom: 14px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border: 1px solid transparent; }
.banner.info { background: var(--blue-soft); color: #23466f; border-color: #d3e1f3; }
.banner.warn { background: var(--amber-soft); color: #6d3e08; border-color: var(--amber-line); }
.banner.error { background: var(--red-soft); color: #7a2817; border-color: #f0cdc4; }
.banner.ok { background: var(--green-soft); color: var(--green-ink); border-color: var(--green-line); }
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); border: 1px solid var(--amber-line); margin-bottom: 16px; }
.callout > .ic { color: var(--amber); width: 18px; height: 18px; }
.callout strong { font-weight: 600; font-size: 14px; }

/* ---------- inicio ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.dash-aside > * + *, .dash-main > * + * { margin-top: 16px; }
.dash-aside .tb-grid { grid-template-columns: 1fr; margin: 0; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } }
.day-progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: -2px 0 10px; }
.day-progress > div { height: 100%; background: var(--green); border-radius: 2px; transition: width .4s var(--ease); }
.bud-card { border-left: 3px solid #d9a45a; padding-left: 18px; }
.bud-card .quote { font-size: 1.12rem; line-height: 1.5; font-weight: 500; letter-spacing: -.01em; color: var(--ink); margin: 10px 0 12px; white-space: pre-wrap; }
.bud-card h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cheer { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--green-ink); background: var(--green-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.cheer .ic { color: var(--green); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { font-size: 1.3rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); line-height: 1.35; }
.resolved { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.resolved ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; font-size: 12px; }
.checklist .done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.checklist .done .lbl { color: var(--faint); text-decoration: line-through; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; font-weight: 650; font-size: 13px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(30, 90, 62, .08); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; display: flex; }
.progress .done { background: var(--green); }
.progress .sched { background: #a9d3b8; }

/* avisos */
.n-list { list-style: none; margin: 0; padding: 0; }
.n-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.n-item:first-child { border-top: 0; padding-top: 2px; }
.n-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.n-ic .ic { width: 15px; height: 15px; }
.n-item.unread .n-ic { background: var(--green-soft); color: var(--green); }
.n-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.n-title a { color: var(--ink); text-decoration: none; }
.n-title a:hover { text-decoration: underline; }
.n-body { font-size: 13px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.n-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.n-time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* bandeja de propuestas */
.inbox { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.inbox-row + .inbox-row { border-top: 1px solid var(--line); }
.inbox-link { display: flex; gap: 12px; align-items: center; padding: 13px 18px; color: inherit; text-decoration: none; transition: background .12s; }
.inbox-link:hover { background: var(--row-hover); }
.inbox-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.inbox-who { font-weight: 550; color: var(--ink-2); }
.inbox-time { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.inbox-title { font-weight: 600; font-size: 14.5px; margin: 1px 0 0; }
.inbox-row.unread .inbox-title { color: var(--ink); }
.inbox-row .meta { margin-top: 6px; }
.inbox-link > .pill { flex: none; min-width: 96px; justify-content: flex-end; }

/* hilos, historial y utilidades */
.thread { border-left: 2px solid var(--line); padding-left: 12px; margin: 10px 0; }
.thread .msg { margin-bottom: 8px; font-size: 14px; }
.thread .who { font-size: 12px; color: var(--muted); }
.history li { font-size: 13px; color: var(--ink-2); padding: 5px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .88em; word-break: break-all; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 10px; padding-left: 4px; }
.steps li::marker { color: var(--faint); font-weight: 600; }
.draggable { cursor: grab; }

/* ---------- calendario ---------- */
.cal-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cal-toolbar .range { font-weight: 650; font-size: 14.5px; margin-left: 6px; letter-spacing: -.01em; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend span:last-child::before { display: none; }
.legend .l-av::before { background: #eef7f1; box-shadow: inset 0 0 0 1px var(--green-line); }
.legend .l-busy::before { background: repeating-linear-gradient(135deg, #ebe7e0 0 3px, #f6f4f0 3px 6px); box-shadow: inset 0 0 0 1px var(--line); }
.legend .l-prot::before { background: repeating-linear-gradient(135deg, #f5e3c8 0 3px, #fcf4e8 3px 6px); }
.legend .l-sess::before { background: #e3f1e8; box-shadow: inset 3px 0 0 var(--green); }
.legend .l-tb::before { background: var(--green-soft); box-shadow: inset 0 -3px 0 #8ccaa3; }
.week { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.week .dh { padding: 8px 4px 9px; text-align: center; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week .dh .wd { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.week .dh b { font-size: 1.05rem; font-weight: 650; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.week .dh.today .wd { color: var(--green); }
.week .dh.today b { background: var(--green); color: #fff; }
.week .dh.tbd { box-shadow: inset 0 -3px 0 #8ccaa3; }
.tb-day { display: block; font-size: 10.5px; font-weight: 650; color: var(--green-ink); background: var(--green-soft); border-radius: 5px; padding: 0 5px; white-space: nowrap; }
.week-body { grid-column: 1 / -1; display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); max-height: 68vh; overflow-y: auto; position: relative; scrollbar-width: thin; }
.hours div { height: var(--hour); font-size: 11px; color: var(--faint); text-align: right; padding-right: 8px; transform: translateY(-.55em); font-variant-numeric: tabular-nums; }
.col { position: relative; border-left: 1px solid var(--line); height: calc(var(--hour) * 24); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), #f1eee9 calc(var(--hour) - 1px), #f1eee9 var(--hour)); }
.slot-btn { position: absolute; left: 0; right: 0; height: calc(var(--hour) / 2); background: transparent; border: 0; padding: 0; cursor: pointer; z-index: 1; border-radius: 4px; }
.slot-btn:hover, .slot-btn:focus-visible { background: rgba(46, 125, 85, .07); }
.slot-btn.drop { background: rgba(46, 125, 85, .18); }
.blk { position: absolute; left: 0; right: 0; font-size: 10.5px; padding: 3px 5px; overflow: hidden; color: var(--faint); pointer-events: none; z-index: 0; }
.blk.available { background: #f0f8f3; }
.blk.commitment, .blk.busy, .blk.blocked { background: repeating-linear-gradient(135deg, #f1eee8 0 5px, #f8f6f2 5px 10px); }
.blk.protected { background: repeating-linear-gradient(135deg, #f7e8d2 0 5px, #fcf5ec 5px 10px); color: #a77a3f; }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; background: #e3f1e8; color: var(--green-ink); box-shadow: inset 3px 0 0 var(--green); font-size: 11.5px; padding: 4px 6px 4px 9px; overflow: hidden; z-index: 2; border: 0; text-align: left; cursor: pointer; font-family: inherit; line-height: 1.3; transition: filter .12s, box-shadow .12s; }
.ev:hover { filter: brightness(.97); }
.ev .t { font-weight: 650; display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.started { background: #e1ecf8; box-shadow: inset 3px 0 0 var(--blue); color: #23466f; }
.ev.completed { background: var(--surface-2); box-shadow: inset 3px 0 0 #a9d3b8; color: var(--muted); }
.ev.completed .t { color: var(--muted); text-decoration: line-through; }
.ev.needs_reschedule { background: var(--amber-soft); box-shadow: inset 3px 0 0 #d48a2c; color: #6d3e08; }
.ev.private { background: repeating-linear-gradient(135deg, #e9e5de 0 5px, #f1eee9 5px 10px); box-shadow: none; cursor: default; color: var(--muted); }
.ev.private .t { color: var(--muted); font-weight: 550; }
.ev.override { outline: 1.5px dashed #d48a2c; outline-offset: -1.5px; }
.now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--red); z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.agenda .day { margin-bottom: 18px; }
.agenda .day h3 { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 0 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.agenda .day h3 .pill { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
.agenda .a-item { display: flex; gap: 12px; padding: 9px 0; align-items: flex-start; border-bottom: 1px dashed var(--line); }
.agenda .a-item:last-child { border-bottom: 0; }
.agenda .a-time { width: 6.8rem; flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda .a-item a { color: var(--ink); font-weight: 600; text-decoration: none; }
.agenda .a-kind { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- diálogos y avisos flotantes ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: min(560px, calc(100vw - 24px)); width: 100%; box-shadow: var(--sh-2); color: var(--ink); background: var(--surface); }
dialog[open] { animation: dlg-in .16s var(--ease); }
dialog::backdrop { background: rgba(28, 27, 25, .32); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.dlg-head { padding: 16px 18px 6px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dlg-head h2 { font-size: 1.05rem; margin: 0; }
.dlg-body { padding: 6px 20px 20px; max-height: min(78vh, 760px); overflow: auto; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 700; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
#toasts .toast:nth-last-child(n+4) { display: none; }
.toast { background: #1f1e1b; color: #f7f6f3; padding: 10px 14px; border-radius: 10px; box-shadow: var(--sh-2); font-size: 13.5px; animation: toast-in .2s var(--ease); }
.toast.error { background: #6e2414; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 860px) { #toasts { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* ---------- acceso ---------- */
.auth { max-width: 420px; margin: 8vh auto 4rem; padding: 0 16px; }
.auth .brand { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; margin-bottom: 18px; color: var(--ink); }
.auth .brand .logo-mark { width: 104px; height: 92px; }
.auth .card { padding: 26px 24px; box-shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 12px 32px rgba(28, 27, 25, .06); }
.auth h1 { font-size: 1.3rem; }
.auth .btn.big { width: 100%; margin-top: 4px; }

/* ---------- T-break ---------- */
.tb-grid { margin-top: 16px; }
.tb-card { display: flex; gap: 14px; align-items: center; }
.tb-card.on { border-color: var(--green-line); background: #f7fbf8; }
.tb-fig { width: 116px; height: auto; flex: none; }
.tb-body { flex: 1; min-width: 0; }
.tb-body h2 { margin-bottom: 2px; }
.tb-body p { margin-bottom: 8px; }
.tb-count { font-size: 1.6rem; font-weight: 700; letter-spacing: -.025em; color: var(--green-ink); line-height: 1.1; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.tb-count span { font-size: .9rem; font-weight: 550; color: var(--muted); letter-spacing: 0; }
.tb-body .progress { margin-bottom: 6px; height: 5px; }
.tb-btn .ic { color: var(--green); }
@media (max-width: 520px) { .tb-fig { width: 92px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
/* ---------- pantalla de entrada (logo animado) ---------- */
.splash { position: fixed; inset: 0; z-index: 500; background: var(--bg); display: grid; place-items: center; cursor: pointer;
  animation: sp-out .45s ease 3s forwards; }
.splash.gone { display: none; }
.splash-inner { display: flex; flex-direction: column; align-items: center; padding: 1rem; }
.splash-pop { width: min(72vw, 380px); animation: sp-pop .6s cubic-bezier(.2, .9, .3, 1.15) both; }
.splash-art { position: relative; width: 100%; aspect-ratio: 806 / 714; transform-origin: 50% 90%; animation: sp-hug .7s ease-in-out .55s both; }
.splash-art img, .splash-art svg { position: absolute; display: block; }
.sp-base { inset: 0; width: 100%; height: 100%; }
.sp-bud { left: 17.37%; top: 30.67%; width: 23.45%; transform-origin: 50% 100%; animation: sp-puff .5s ease-in-out 1.3s 2 both; }
.sp-head { left: 19.851%; top: 5.042%; width: 20.968%; transform-origin: 50% 50%; animation: sp-sniff 1.3s ease-in-out 1.15s both; }
.sp-wisps { inset: 0; width: 100%; height: 100%; overflow: visible; }
.sp-wisps path { fill: none; stroke: #5f9b3c; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 120; stroke-dashoffset: 120; opacity: 0; animation: sp-wisp 1.15s ease-out 1.2s forwards; }
.sp-wisps .w2 { animation-delay: 1.35s; }
.sp-wisps .w3 { stroke-width: 4; animation-delay: 1.5s; }
.splash-name { margin-top: 1rem; font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; color: #12357f; animation: sp-fade .5s ease 1.9s both; }
.splash-tag { color: var(--muted); animation: sp-fade .5s ease 2.15s both; }
@keyframes sp-pop { from { opacity: 0; transform: scale(.86) translateY(14px); } to { opacity: 1; transform: none; } }
/* el abrazo: se aprietan un poco */
@keyframes sp-hug { 0%, 100% { transform: none; } 45% { transform: scaleX(.965) scaleY(1.012); } }
/* olerla: la cabeza se acerca al cogollo dos veces y regresa a su lugar exacto */
@keyframes sp-sniff {
  0%, 100% { transform: none; }
  25% { transform: translateY(2.4%) rotate(-4deg) scale(1.05); }
  42% { transform: translateY(1.2%) rotate(-2deg) scale(1.03); }
  60%, 78% { transform: translateY(2.4%) rotate(-4deg) scale(1.05); }
}
@keyframes sp-puff { 0%, 100% { transform: none; } 50% { transform: scale(1.06); } }
@keyframes sp-wisp { 0% { stroke-dashoffset: 120; opacity: 0; } 20% { opacity: .75; } 70% { stroke-dashoffset: 0; opacity: .75; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sp-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sp-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .splash { animation: sp-out .3s ease 1.2s forwards; }
  .splash *, .splash-art img, .sp-wisps path { animation: none !important; }
  .sp-wisps { display: none; }
}

/* =====================================================================
   Tema oscuro (por defecto) — inspirado en Linear
   ===================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --surface: #161619;
  --surface-2: #1e1f23;
  --surface-3: #2a2b30;
  --line: #24252a;
  --line-strong: #32343a;
  --ink: #ededef;
  --ink-2: #c8c9ce;
  --muted: #8b8f98;
  --faint: #8b8f98;
  --faint-ic: #5f636b;
  --green: #2f8f61;
  --green-600: #35a06d;
  --green-ink: #74d3a2;
  --green-soft: rgba(76, 183, 130, .13);
  --green-line: rgba(76, 183, 130, .32);
  --amber: #f0a356;
  --amber-soft: rgba(240, 163, 86, .12);
  --amber-line: rgba(240, 163, 86, .3);
  --red: #f07a6a;
  --red-soft: rgba(240, 106, 90, .12);
  --blue: #8aa9f4;
  --blue-soft: rgba(110, 145, 240, .14);
  --focus: rgba(76, 183, 130, .35);
  --sh-1: none;
  --sh-2: 0 0 0 1px #2a2b30, 0 16px 48px rgba(0, 0, 0, .55);
  --side-bg: #0b0b0d; --side-ink: #d4d5da; --side-ink-strong: #f4f4f6; --side-muted: #7d818a; --side-hover: #18191c; --side-active: #222327; --side-line: #1d1e22;
  --panel-line: #222328;
  --group-bg: #1a1b1f; --row-hover: #1b1c20;
  --si-backlog: #6f737c; --si-todo: #9a9ea6; --si-progress: #f2c94c; --si-done: #4cb782; --si-resched: #f2994a; --si-cancel: #5f636b; --si-check: #161619;
}
:root[data-theme="dark"] body { background: var(--side-bg); }
:where(:root[data-theme="dark"]) a { color: var(--green-ink); }
:root[data-theme="dark"] .card { box-shadow: none; }
:root[data-theme="dark"] .btn { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
:root[data-theme="dark"] .btn:hover { background: var(--surface-3); }
:root[data-theme="dark"] .btn.primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .btn.primary:hover { background: var(--green-600); border-color: var(--green-600); }
:root[data-theme="dark"] .btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
:root[data-theme="dark"] .btn.ghost:hover { background: var(--surface-2); }
:root[data-theme="dark"] .btn.warm { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
:root[data-theme="dark"] .btn.danger { color: var(--red); }
:root[data-theme="dark"] .btn.danger:hover { background: var(--red-soft); border-color: rgba(240, 106, 90, .3); }
:root[data-theme="dark"] .seg { background: var(--surface-2); }
:root[data-theme="dark"] .seg .btn { background: transparent; }
:root[data-theme="dark"] .seg .btn.primary { background: var(--surface-3); color: var(--ink); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background-color: #121215; border-color: var(--line-strong); color: var(--ink); }
:root[data-theme="dark"] input:hover, :root[data-theme="dark"] select:hover, :root[data-theme="dark"] textarea:hover { border-color: #3e4047; }
:root[data-theme="dark"] input[readonly] { background-color: var(--surface-2); }
:root[data-theme="dark"] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .days label { background: transparent; }
:root[data-theme="dark"] .chip.warn { color: var(--amber); }
:root[data-theme="dark"] .banner.info { color: #b9cdf7; border-color: rgba(110, 145, 240, .25); }
:root[data-theme="dark"] .banner.warn { color: #f5c595; }
:root[data-theme="dark"] .banner.error { color: #f6b3a8; border-color: rgba(240, 106, 90, .3); }
:root[data-theme="dark"] .banner.ok { color: var(--green-ink); }
:root[data-theme="dark"] .callout strong { color: var(--ink); }
:root[data-theme="dark"] .bud-card { border-left-color: #c58a3c; }
:root[data-theme="dark"] .avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .mini-progress .sched, :root[data-theme="dark"] .progress .sched { background: rgba(76, 183, 130, .35); }
:root[data-theme="dark"] .tb-card.on { background: #141a17; border-color: rgba(76, 183, 130, .28); }
:root[data-theme="dark"] .tb-fig { filter: drop-shadow(0 0 0 transparent); }
:root[data-theme="dark"] dialog { background: #18181b; }
:root[data-theme="dark"] dialog::backdrop { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .toast { background: #2a2b30; color: #f4f4f6; box-shadow: 0 0 0 1px #34363c, 0 12px 32px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .auth .card { box-shadow: none; }
:root[data-theme="dark"] .auth .brand { color: var(--ink); }
:root[data-theme="dark"] .auth .brand .logo-mark { background-color: transparent; }
/* calendario oscuro */
:root[data-theme="dark"] .week { background: var(--surface); }
:root[data-theme="dark"] .week .dh { background: var(--surface); }
:root[data-theme="dark"] .col { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), #1f2024 calc(var(--hour) - 1px), #1f2024 var(--hour)); }
:root[data-theme="dark"] .blk.available { background: rgba(76, 183, 130, .07); }
:root[data-theme="dark"] .blk.commitment, :root[data-theme="dark"] .blk.busy, :root[data-theme="dark"] .blk.blocked { background: repeating-linear-gradient(135deg, #1c1d21 0 5px, #18191c 5px 10px); color: var(--muted); }
:root[data-theme="dark"] .blk.protected { background: repeating-linear-gradient(135deg, rgba(240, 163, 86, .12) 0 5px, rgba(240, 163, 86, .05) 5px 10px); color: var(--amber); }
:root[data-theme="dark"] .ev { background: rgba(76, 183, 130, .16); color: #a7e3c4; box-shadow: inset 3px 0 0 #4cb782; }
:root[data-theme="dark"] .ev .t { color: #eafaf1; }
:root[data-theme="dark"] .ev.started { background: rgba(242, 201, 76, .14); color: #f2dc96; box-shadow: inset 3px 0 0 #f2c94c; }
:root[data-theme="dark"] .ev.completed { background: #1c1d21; color: var(--muted); box-shadow: inset 3px 0 0 #2e6b4c; }
:root[data-theme="dark"] .ev.completed .t { color: var(--muted); }
:root[data-theme="dark"] .ev.needs_reschedule { background: rgba(242, 153, 74, .14); color: #f5c08f; box-shadow: inset 3px 0 0 #f2994a; }
:root[data-theme="dark"] .ev.private { background: repeating-linear-gradient(135deg, #222328 0 5px, #1c1d21 5px 10px); color: var(--muted); }
:root[data-theme="dark"] .slot-btn:hover, :root[data-theme="dark"] .slot-btn:focus-visible { background: rgba(255, 255, 255, .04); }
:root[data-theme="dark"] .legend .l-av::before { background: rgba(76, 183, 130, .12); }
:root[data-theme="dark"] .legend .l-busy::before { background: repeating-linear-gradient(135deg, #2a2b30 0 3px, #1c1d21 3px 6px); }
:root[data-theme="dark"] .legend .l-prot::before { background: repeating-linear-gradient(135deg, rgba(240, 163, 86, .35) 0 3px, rgba(240, 163, 86, .12) 3px 6px); }
:root[data-theme="dark"] .legend .l-sess::before { background: rgba(76, 183, 130, .2); box-shadow: inset 3px 0 0 #4cb782; }
:root[data-theme="dark"] .week .dh.today b { background: var(--green); }
/* móvil oscuro */
@media (max-width: 860px) {
  :root[data-theme="dark"] body { background: var(--bg); }
  :root[data-theme="dark"] .shell { background: var(--bg); }
  :root[data-theme="dark"] .mobile-top { background: rgba(11, 11, 13, .9); border-bottom-color: var(--line); }
  :root[data-theme="dark"] .mobile-top .brand { color: var(--ink); }
  :root[data-theme="dark"] .tabbar { background: rgba(11, 11, 13, .94); border-top-color: var(--line); }
  :root[data-theme="dark"] .tabbar a { color: var(--muted); }
  :root[data-theme="dark"] .tabbar a[aria-current="page"] { color: var(--ink); }
}
@media (max-width: 860px) { .shell { background: var(--bg); } }
/* pantalla de entrada en oscuro */
:root[data-theme="dark"] .splash { background: #0b0b0d; }
:root[data-theme="dark"] .splash-name { color: #f4f4f6; }
