:root {
  --bg: #f5f4f8;
  --surface: #ffffff;
  --surface-soft: #faf9fc;
  --text: #1d1b20;
  --muted: #706b76;
  --line: #ddd9e2;
  --accent: #7257c7;
  --accent-soft: #eee9fb;
  --danger: #b53b35;
  --danger-soft: #fbe8e6;
  --success: #2f7c5c;
  --business: #7658c8;
  --personal: #2f876d;
  --work: #347ab9;
  --study: #bd722f;
  --shadow: 0 5px 20px rgb(37 31 49 / 0.07);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); }
body { min-width: 320px; margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #7f66d1; outline-offset: 3px; }
a { color: var(--accent); }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(1.8rem, 4vw, 2.35rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 14px; font-size: 1.1rem; line-height: 1.2; }
h3 { margin-bottom: 6px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 10px; left: 10px; padding: 10px 14px; color: #fff; background: #2b2533; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 20px; background: rgb(250 249 252 / .95); border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px rgb(37 31 49 / .04); backdrop-filter: blur(14px); }
.brand { flex: 0 0 auto; color: var(--text); font-size: 1.1rem; font-weight: 850; letter-spacing: -.03em; text-decoration: none; }
.main-nav { display: flex; gap: 4px; }
.nav-button { min-height: 40px; padding: 0 13px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px; font-weight: 700; }
.nav-button:hover, .nav-button.active { color: var(--text); background: var(--surface); border-color: var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; }
.search-box { position: relative; display: block; width: min(310px, 25vw); min-width: 150px; }
.search-box input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.search-results { position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; left: 0; display: grid; gap: 2px; max-height: 330px; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.search-result { display: grid; gap: 2px; width: 100%; padding: 9px; color: var(--text); text-align: left; background: transparent; border: 0; border-radius: 7px; }
.search-result:hover { background: var(--accent-soft); }
.search-result small, .search-empty { color: var(--muted); font-size: .78rem; }
.search-empty { margin: 6px; }
.connection-dot { display: inline-block; width: 10px; height: 10px; margin-left: 7px; color: var(--success); background: currentColor; border: 1px solid currentColor; border-radius: 50%; vertical-align: 1px; }
.connection-dot.offline { color: var(--danger); }
.feedback-visible { position: fixed; z-index: 90; right: 18px; bottom: 18px; width: min(420px, calc(100vw - 36px)); min-height: 42px; margin: 0; padding: 11px 14px; color: #fff; background: #2b2533; border-radius: 10px; box-shadow: var(--shadow); clip: auto; white-space: normal; }

main { max-width: 1540px; margin: 0 auto; padding: 0 20px 60px; }
.view { display: block; padding-top: 20px; }
.view.active { display: block; }
.page-heading { display: flex; align-items: end; gap: 16px; margin: 4px 0 16px; }
.page-heading > div { min-width: 0; }
.page-heading .button { margin-left: auto; }
.subtitle { margin: 0; color: var(--muted); font-size: .94rem; }
.eyebrow { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted-label { color: var(--muted); font-size: .76rem; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 28px; padding: 4px 9px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.empty { margin: 8px 0 0; color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 13px; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-weight: 750; }
.button:hover { background: var(--surface-soft); }
.button.primary { color: #fff; background: #2b2533; border-color: #2b2533; }
.button.primary:hover { background: #19151e; }
.button.secondary { color: var(--accent); background: var(--accent-soft); border-color: #d6cef3; }
.button.quiet { color: var(--muted); }
.button.danger-action { color: var(--danger); }
.button:disabled { cursor: wait; opacity: .55; }

.area-marker, .node-mark, .hot-marker { display: inline-block; flex: 0 0 auto; width: 12px; height: 12px; background: var(--accent); border-radius: 50%; }

.day-heading { display: flex; align-items: center; gap: 18px; min-width: 0; }
.day-switcher { display: flex; align-items: center; gap: 5px; }
.day-switcher .button { min-height: 36px; padding: 6px 10px; font-size: .8rem; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 12px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.metric-card { display: grid; gap: 2px; min-height: 62px; padding: 9px 12px; background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.metric-card:last-child { border-right: 0; }
.metric-card span { color: var(--muted); font-size: .7rem; font-weight: 650; }
.metric-card strong { font-size: 1.3rem; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); font-size: .68rem; }
.metric-card.attention strong { color: var(--danger); }
.metric-card.success strong { color: var(--success); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); gap: 12px; align-items: stretch; }
.queue-panel { min-width: 0; padding: 16px; }
.home-secondary { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 12px; margin-top: 12px; }
.home-secondary > .panel { min-width: 0; padding: 15px; }
.calendar-panel { min-width: 0; padding: 16px; }
.calendar-filter { display: grid; gap: 4px; margin-top: 9px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.calendar-filter select { min-height: 36px; padding: 6px 8px; font-size: .78rem; }
.calendar-feedback { min-height: 19px; margin: 8px 0 0; color: var(--muted); font-size: .73rem; }
.calendar-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 7px; }
.calendar-summary > div { min-width: 0; padding: 7px; background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 8px; }
.calendar-summary small { display: block; overflow: hidden; color: var(--muted); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-summary strong { display: block; overflow: hidden; margin-top: 2px; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-agenda { min-width: 0; margin-top: 9px; }
.calendar-all-day { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; align-items: start; padding: 6px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; font-size: .67rem; }
.calendar-all-day > strong { color: var(--muted); font-size: .64rem; }
.calendar-all-day > div { display: flex; flex-wrap: wrap; gap: 4px; }
.calendar-all-day-event { padding: 3px 5px; color: var(--text); background: var(--accent-soft); border-radius: 5px; font-size: .67rem; }
.calendar-all-day-event.cancelled { color: var(--muted); text-decoration: line-through; opacity: .65; }
.calendar-timeline { position: relative; height: 650px; margin-top: 7px; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(11.111% - 1px), #eeeaf1 calc(11.111% - 1px), #eeeaf1 11.111%); }
.calendar-hours { position: absolute; inset: 0 auto 0 0; width: 43px; pointer-events: none; }
.calendar-hours span { position: absolute; left: 0; color: var(--muted); font-size: .61rem; transform: translateY(-5px); }
.calendar-canvas { position: absolute; inset: 0 0 0 46px; border-left: 1px solid #eeeaf1; }
.calendar-free { position: absolute; right: 3px; left: 3px; z-index: 1; overflow: hidden; padding: 3px 5px; color: #85818c; background: rgb(250 249 252 / .82); border: 1px dashed #d5d0dc; border-radius: 6px; font-size: .61rem; line-height: 1.2; }
.calendar-event { position: absolute; top: 0; right: 4px; left: 4px; z-index: 3; min-width: 0; overflow: hidden; padding: 5px 6px; color: #16324d; background: #e6f0fb; border-left: 3px solid var(--work); border-radius: 6px; font-size: .66rem; line-height: 1.2; cursor: default; }
.calendar-event[data-overlap-depth="1"] { left: 14px; z-index: 4; }
.calendar-event[data-overlap-depth="2"] { left: 24px; z-index: 5; }
.calendar-event.is-overlapping { box-shadow: -3px 0 0 rgb(255 255 255 / .85), 0 4px 12px rgb(20 20 35 / .14); }
.calendar-event:hover, .calendar-event:focus-visible { z-index: 100; }
.calendar-event strong, .calendar-event span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event strong { font-size: .69rem; }
.calendar-event span { margin-top: 2px; color: var(--muted); font-size: .61rem; }
.calendar-tone-1 { color: #20563f; background: #e8f6ee; border-left-color: var(--personal); }
.calendar-tone-2 { color: #67400e; background: #fff3df; border-left-color: var(--study); }
.calendar-tone-3 { color: #553186; background: #f0eafb; border-left-color: var(--accent); }
.calendar-event.cancelled { color: var(--muted); background: #f0eef2; border-left-color: #aaa2ae; text-decoration: line-through; opacity: .62; }
.calendar-now { position: absolute; right: 0; left: 0; z-index: 5; height: 2px; background: var(--danger); }
.calendar-now::before { position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; content: ""; }
.calendar-loading { padding: 14px 0; }
.calendar-retry { margin-top: 8px; min-height: 36px; font-size: .75rem; }

.task-list { display: grid; gap: 7px; margin-top: 10px; }
.task-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 8px; border-bottom: 1px solid #eeeaf1; position: relative; }
.task-card:last-child { border-bottom: 0; }
.task-card::before { position: absolute; top: 8px; bottom: 8px; left: 0; width: 4px; background: var(--accent); border-radius: 0 5px 5px 0; content: ""; }
.task-card[data-area="empresas"]::before, [data-area="empresas"] .node-mark, [data-area="empresas"] .area-marker, [data-area="empresas"] .hot-marker { background: var(--business); }
.task-card[data-area="personal"]::before, [data-area="personal"] .node-mark, [data-area="personal"] .area-marker, [data-area="personal"] .hot-marker { background: var(--personal); }
.task-card[data-area="once"]::before, [data-area="once"] .node-mark, [data-area="once"] .area-marker, [data-area="once"] .hot-marker { background: var(--work); }
.task-card[data-area="educacion"]::before, [data-area="educacion"] .node-mark, [data-area="educacion"] .area-marker, [data-area="educacion"] .hot-marker { background: var(--study); }
.task-card.overdue { background: #fff8f7; }
.task-card.completed { opacity: .62; }
.task-card.completed .task-copy strong { text-decoration: line-through; }
.task-check { display: grid; width: 23px; height: 23px; place-items: center; padding: 0; color: #fff; background: #fff; border: 2px solid #aaa2ae; border-radius: 7px; font-size: .85rem; font-weight: 900; }
.task-card.completed .task-check { background: var(--success); border-color: var(--success); }
.task-copy { display: grid; gap: 4px; min-width: 0; }
.task-copy strong { overflow-wrap: anywhere; font-size: .9rem; line-height: 1.25; }
.task-copy span { overflow: hidden; color: var(--muted); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.task-copy .recurrence-badge { color: var(--muted); font-size: .72rem; line-height: 1.3; overflow-wrap: anywhere; }
.task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.task-action { min-height: 33px; padding: 5px 8px; font-size: .75rem; }
.task-schedule { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: end; gap: 5px; padding: 4px 0 0; }
.quick-button { min-height: 32px; padding: 4px 8px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; font-size: .75rem; font-weight: 700; }
.quick-button:hover { color: var(--accent); background: var(--accent-soft); }
.date-quick { display: grid; gap: 3px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.date-quick input { min-height: 32px; width: 140px; padding: 4px 6px; font-size: .75rem; }
.flow-list, .insight-list { display: grid; gap: 0; margin-top: 8px; }
.flow-row { display: grid; grid-template-columns: minmax(74px, 1fr) repeat(3, minmax(66px, auto)) minmax(125px, 1.2fr); gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eeeaf1; }
.flow-row:last-child { border-bottom: 0; }
.flow-row strong, .flow-row span, .flow-row b { font-size: .73rem; }
.flow-row span { color: var(--muted); }
.flow-row b { text-align: right; }
.flow-row b.attention { color: var(--danger); }
.flow-row b.warning { color: var(--study); }
.flow-row b.success { color: var(--success); }
progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; background: #eeeaf1; }
progress::-webkit-progress-bar { background: #eeeaf1; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.insight { display: grid; gap: 3px; padding: 8px 0; border-bottom: 1px solid #eeeaf1; }
.insight:last-child { border-bottom: 0; }
.insight strong { font-size: .8rem; }
.insight span { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.hot-project { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center; width: 100%; padding: 8px; color: var(--text); text-align: left; background: transparent; border: 0; border-radius: 8px; }
.hot-project:hover { background: var(--surface-soft); }
.hot-marker { width: 7px; height: 28px; border-radius: 4px; }
.hot-project span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.hot-project strong, .hot-project small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-project strong { font-size: .8rem; }
.hot-project small { color: var(--muted); font-size: .7rem; }
.hot-project b { font-size: .78rem; }

.explorer { display: grid; grid-template-columns: 260px 360px minmax(0, 1fr); min-height: 650px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.explorer-column { min-width: 0; border-right: 1px solid var(--line); }
.explorer-column:last-child { border-right: 0; }
.explorer-heading { display: flex; align-items: center; gap: 8px; min-height: 53px; padding: 0 13px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.explorer-heading h2 { margin: 0; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; }
.explorer-list { display: grid; gap: 2px; padding: 6px; }
.explorer-entry, .node-entry { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 9px; align-items: center; width: 100%; padding: 10px 8px; color: var(--text); text-align: left; background: transparent; border: 0; border-radius: 8px; }
.explorer-entry:hover, .explorer-entry.active, .node-entry:hover, .node-entry.active { background: var(--accent-soft); }
.explorer-entry > span:nth-child(2), .node-entry > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.explorer-entry strong, .node-entry strong { overflow-wrap: anywhere; font-size: .82rem; }
.explorer-entry small, .node-entry small { color: var(--muted); font-size: .7rem; }
.node-mark { width: 8px; height: 30px; border-radius: 4px; }
.tree-children { margin-left: 16px; border-left: 1px solid var(--line); }
.node-entry.depth-1 { padding-left: 14px; }
.node-entry.depth-2 { padding-left: 20px; }
.back-button { display: none; min-height: 34px; padding: 4px 7px; color: var(--accent); background: transparent; border: 0; border-radius: 7px; font-size: .75rem; font-weight: 750; }
.project-detail-copy { padding: 17px; }
.breadcrumbs { margin-bottom: 12px; color: var(--muted); font-size: .76rem; }
.detail-title { display: flex; gap: 10px; align-items: center; margin-bottom: 13px; }
.detail-title h3 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.detail-title p { margin-bottom: 3px; }
.detail-title .area-marker { width: 8px; height: 38px; border-radius: 4px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.detail-actions .button { min-height: 38px; padding: 7px 10px; font-size: .8rem; }
.detail-children { padding: 10px; color: var(--muted); background: var(--surface-soft); border-radius: 8px; font-size: .78rem; }
.detail-tasks { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-tasks h4 { margin-bottom: 8px; font-size: .9rem; }
.compact-list { margin-top: 0; }
.task-card.compact { grid-template-columns: 24px minmax(0, 1fr); }
.task-card.compact .task-actions { grid-column: 2; justify-content: flex-start; }
.task-card.compact .task-schedule { grid-column: 2; }
.completed-disclosure { margin-top: 15px; border-top: 1px solid var(--line); }
.completed-disclosure summary { padding: 11px 0; color: var(--muted); cursor: pointer; font-size: .8rem; font-weight: 750; }

.stats-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.stat-card, .stat-panel { min-width: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { grid-column: span 3; display: grid; gap: 4px; }
.stat-card > span, .stat-panel h2 { color: var(--muted); font-size: .78rem; font-weight: 750; }
.stat-card > strong { font-size: 2rem; letter-spacing: -.05em; }
.stat-card > small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.stat-card-link { width: fit-content; margin-top: 6px; color: var(--accent); font-size: .7rem; font-weight: 800; text-decoration: none; }
.stat-card-link:hover, .stat-card-link:focus-visible, .ranked-link:hover, .ranked-link:focus-visible { text-decoration: underline; }
.stats-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: end; }
.stats-filters label, .stats-custom-dates label { display: grid; gap: 4px; color: var(--muted); font-size: .68rem; font-weight: 750; }
.stats-filters select, .stats-filters input { min-width: 118px; max-width: 210px; padding: 8px 9px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.stats-custom-dates { display: flex; gap: 8px; }
.stats-custom-dates input { min-width: 132px; }
.stat-card.attention > strong { color: var(--danger); }
.stat-card.success > strong { color: var(--success); }
.stat-panel { grid-column: span 6; }
.stat-panel.wide { grid-column: span 12; }
.stats-comparison .section-heading { margin-bottom: 12px; }
.comparison-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.comparison-card { display: grid; gap: 4px; min-width: 0; padding: 11px; background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 9px; }
.comparison-card b { font-size: .76rem; }
.comparison-card strong { overflow: hidden; font-size: 1.3rem; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.comparison-card span, .comparison-card small { color: var(--muted); font-size: .66rem; line-height: 1.35; }
.stats-history .section-heading { margin-bottom: 12px; }
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.history-card { display: grid; gap: 4px; min-width: 0; padding: 11px; background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 9px; }
.history-card strong { overflow: hidden; font-size: 1.25rem; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.history-card b { font-size: .76rem; }
.history-card small { color: var(--muted); font-size: .66rem; line-height: 1.35; }
.sample-state { margin: 8px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.sample-state.insufficient_sample { color: var(--warning, #9a6a00); font-weight: 750; }
.sample-state.no-data { color: var(--muted); }
.stat-panel h2 { margin-bottom: 13px; color: var(--text); font-size: .9rem; }
.flow-table { display: grid; gap: 0; }
.flow-table-row { display: grid; grid-template-columns: minmax(78px, 1.2fr) repeat(4, minmax(72px, .8fr)); gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid #eeeaf1; }
.flow-table-row:last-child { border-bottom: 0; }
.flow-table-row > span:first-child { color: var(--muted); font-size: .74rem; }
.flow-table-row > strong { font-size: 1.05rem; letter-spacing: -.03em; text-align: right; }
.flow-table-head { padding: 0 0 8px; border-bottom: 1px solid var(--line); }
.flow-table-head > span { color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.flow-table-head > span:not(:first-child) { text-align: right; }
.flow-entry { color: var(--accent); }
.flow-exit { color: var(--success); }
.flow-balance.attention { color: var(--danger); }
.flow-balance.success { color: var(--success); }
.flow-backlog { color: var(--study); }
.success-progress::-webkit-progress-value { background: var(--success); }
.success-progress::-moz-progress-bar { background: var(--success); }
.chart-note { margin: 9px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.backlog-trend { display: grid; gap: 9px; }
.backlog-trend svg { display: block; width: 100%; height: auto; min-height: 150px; overflow: visible; }
.backlog-axis { stroke: var(--line); stroke-width: 2; }
.backlog-line { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.backlog-point { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.backlog-trend-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 5px; }
.backlog-trend-values span { display: grid; gap: 1px; padding: 6px; background: var(--surface-soft); border-radius: 7px; text-align: center; }
.backlog-trend-values b { font-size: .85rem; }
.backlog-trend-values small { color: var(--muted); font-size: .62rem; }
.attention-list { display: grid; gap: 0; }
.attention-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eeeaf1; }
.attention-row:last-child { border-bottom: 0; }
.attention-row > strong { color: var(--danger); font-size: 1.45rem; letter-spacing: -.04em; }
.attention-row.quiet > strong { color: var(--muted); }
.attention-row > div { display: grid; gap: 2px; min-width: 0; }
.attention-row b { font-size: .78rem; }
.attention-row span { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.due-hero { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.due-hero > div { display: grid; gap: 2px; }
.due-hero strong { color: var(--success); font-size: 2rem; letter-spacing: -.05em; }
.due-hero span { color: var(--muted); font-size: .7rem; }
.due-hero p { margin: 0; color: var(--muted); font-size: .72rem; text-align: right; }
.mini-stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.mini-stat-row > div { display: grid; gap: 2px; padding: 9px; background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 9px; }
.mini-stat-row strong { font-size: 1.15rem; }
.mini-stat-row span { color: var(--muted); font-size: .66rem; line-height: 1.3; }
.ranked-list { display: grid; gap: 14px; }
.ranked-row { display: grid; gap: 5px; min-width: 0; }
.ranked-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.ranked-head strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.ranked-link { overflow: hidden; color: var(--text); font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.ranked-head b { font-size: .95rem; }
.ranked-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .68rem; }
.load-bar { display: flex; width: 100%; height: 9px; overflow: hidden; background: var(--surface-soft); border-radius: 99px; }
.load-bar > span { display: block; min-width: 0; height: 100%; }
.load-pending { background: var(--accent); }
.load-completed { background: var(--success); }
.load-legend { display: flex; gap: 13px; margin: -5px 0 13px; color: var(--muted); font-size: .67rem; }
.load-legend span::before { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; content: ""; }
.legend-pending::before { background: var(--accent); }
.legend-completed::before { background: var(--success); }
.pending-share { height: 8px; }
.area-empresas::-webkit-progress-value { background: var(--business); }
.area-personal::-webkit-progress-value { background: var(--personal); }
.area-once::-webkit-progress-value { background: var(--work); }
.area-study::-webkit-progress-value { background: var(--study); }
.area-empresas::-moz-progress-bar { background: var(--business); }
.area-personal::-moz-progress-bar { background: var(--personal); }
.area-once::-moz-progress-bar { background: var(--work); }
.area-study::-moz-progress-bar { background: var(--study); }
.more-breakdown { margin-top: 15px; padding-top: 10px; border-top: 1px solid var(--line); }
.more-breakdown summary { color: var(--accent); cursor: pointer; font-size: .75rem; font-weight: 750; }
.more-breakdown .ranked-list { margin-top: 13px; }
.action-list { display: grid; gap: 0; }
.action-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid #eeeaf1; }
.action-row:last-child { border-bottom: 0; }
.action-row > strong { display: grid; width: 26px; height: 26px; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 8px; font-size: .75rem; }
.action-row > div { display: grid; gap: 2px; }
.action-row b { font-size: .8rem; }
.action-row span { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.calendar-stat-section h2, .calendar-combined-section h2 { margin-bottom: 0; color: var(--text); font-size: .9rem; }
.calendar-stat-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.calendar-stat-metrics > div { min-width: 0; padding: 9px; background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 9px; }
.calendar-stat-metrics small { display: block; color: var(--muted); font-size: .66rem; }
.calendar-stat-metrics strong { display: block; overflow: hidden; margin-top: 3px; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-stats-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: 18px; margin-top: 16px; }
.calendar-stats-grid h3 { margin-bottom: 9px; font-size: .82rem; }
.calendar-stat-rows { display: grid; gap: 7px; }
.calendar-stat-row { display: grid; grid-template-columns: minmax(75px, 1fr) auto auto minmax(50px, 1fr); gap: 7px; align-items: center; font-size: .72rem; }
.calendar-stat-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-stat-row > b { color: var(--muted); font-size: .68rem; white-space: nowrap; }
.calendar-combined-section { margin-top: 0; }
.calendar-combined-row { display: grid; grid-template-columns: minmax(95px, 1.2fr) repeat(3, minmax(70px, 1fr)) minmax(120px, 1.2fr); gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eeeaf1; font-size: .72rem; }
.calendar-combined-row:last-child { border-bottom: 0; }
.calendar-combined-row span { color: var(--muted); }
.calendar-combined-row b { color: var(--accent); font-size: .7rem; }

.inline-feedback { min-height: 20px; margin: -8px 0 12px; color: var(--muted); font-size: .8rem; }

.mobile-nav { display: none; }
dialog { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; background: var(--surface); border: 0; border-radius: 14px; box-shadow: 0 24px 70px rgb(20 17 26 / .25); }
dialog::backdrop { background: rgb(29 27 32 / .45); }
dialog form { max-height: calc(100dvh - 28px); overflow-y: auto; padding: 22px; -webkit-overflow-scrolling: touch; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.dialog-heading h2 { margin: 0; font-size: 1.35rem; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; padding: 0; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 1.5rem; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 13px; }
label { display: grid; gap: 6px; min-width: 0; font-size: .82rem; font-weight: 700; }
label.full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; color: var(--text); background: var(--surface); border: 1px solid #aaa2ae; border-radius: 8px; }
input[type="date"] { appearance: none; -webkit-appearance: none; }
textarea { resize: vertical; }
.form-error { min-height: 21px; margin: 12px 0 0; color: var(--danger); font-weight: 700; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Existing deep project route */
.project-page { max-width: 1040px; margin: 0 auto; padding: 20px 20px 55px; }
.project-detail { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.project-featured { border-color: #c8bde9; background: #fbfaff; }
.project-detail h2 { margin: 22px 0 13px; }
.breadcrumbs a { color: var(--accent); font-weight: 700; }
.children-section { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.children-section .section-heading { align-items: center; }
.child-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.child-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 9px; align-items: center; padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.child-card strong { overflow-wrap: anywhere; }
.child-card > span:not(.node-type) { color: var(--muted); font-size: .8rem; }
.node-type { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
#task-sections > section { margin-top: 22px; }
.task-item { display: grid; gap: 10px; padding: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.task-item + .task-item { margin-top: 8px; }
.task-item.task-completed { color: var(--muted); background: var(--surface-soft); }
.task-info { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.task-info strong { overflow-wrap: anywhere; }
.task-info span { color: var(--muted); font-size: .8rem; }
.task-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.task-edit-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 9px; align-items: end; padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.task-edit-panel label { font-size: .75rem; }
.task-edit-actions { display: flex; gap: 7px; grid-column: 1 / -1; }
.task-edit-actions .button { min-height: 37px; }
#task-form { display: grid; gap: 10px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
#task-form > label { font-size: 1rem; }
.task-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.task-due { display: grid; gap: 5px; color: var(--muted); font-size: .78rem; }
.task-due input { min-width: 0; }
#task-message { min-height: 20px; margin: 0; color: var(--success); font-weight: 700; }
.descendant-tasks { padding-top: 5px; }

@media (max-width: 1050px) {
  .home-grid, .home-secondary { grid-template-columns: 1fr; }
  .explorer { grid-template-columns: 230px 310px minmax(0, 1fr); }
}

/* El topbar se parte en dos filas cuando no cabe junto a las acciones (hasta 1300 px):
   así la nav puede desplazarse sola dentro de su fila. */
@media (min-width: 801px) and (max-width: 1300px) {
  .topbar { flex-wrap: wrap; padding: 9px 12px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .topbar-actions { margin-left: auto; }
}

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; padding: 9px 12px; }
  .main-nav { order: 3; width: 100%; overflow-x: auto; }
  .nav-button { flex: 1; padding-inline: 4px; font-size: .68rem; }
  .topbar-actions { margin-left: auto; }
  .search-box { width: min(230px, 36vw); }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card:nth-child(2) { border-right: 0; }
  .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .home-secondary { grid-template-columns: 1fr; }
  .explorer { display: block; min-height: 0; }
  .explorer-column { display: none; border-right: 0; }
  .explorer .areas-column { display: block; }
  .explorer.show-nodes .areas-column, .explorer.show-detail .areas-column { display: none; }
  .explorer.show-nodes .nodes-column { display: block; }
  .explorer.show-detail .detail-column { display: block; }
  .explorer.show-detail .nodes-column { display: none; }
  .explorer.show-nodes .back-button, .explorer.show-detail .back-button { display: inline-flex; }
  .stat-card { grid-column: span 6; }
  .stat-panel, .stat-panel.wide { grid-column: span 12; }
  .comparison-grid, .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-nav { position: fixed; z-index: 50; right: 10px; bottom: 9px; left: 10px; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; padding: 5px; background: rgb(250 249 252 / .96); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
  .mobile-nav button { min-height: 43px; padding-inline: 0; color: var(--muted); background: transparent; border: 0; border-radius: 9px; font-size: clamp(.32rem, calc((100vw - 54px) / 58), .62rem); font-weight: 800; }
  .mobile-nav button.active { color: var(--text); background: var(--accent-soft); }
  .mobile-nav .mobile-add { color: #fff; background: #2b2533; }
  main { padding-right: 12px; padding-bottom: 78px; padding-left: 12px; }
  .page-heading { align-items: start; flex-direction: column; }
  .stats-filters { width: 100%; justify-content: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-filters label, .stats-custom-dates label { min-width: 0; }
  .stats-filters select, .stats-filters input { width: 100%; min-width: 0; max-width: none; }
  .stats-custom-dates { grid-column: 1 / -1; }
  .day-heading { width: 100%; justify-content: space-between; }
  .page-heading .button { margin-left: 0; }
  .flow-table-row { grid-template-columns: minmax(65px, 1fr) repeat(4, minmax(50px, .8fr)); gap: 6px; }
  .ranked-meta { font-size: .65rem; }
  .calendar-stats-grid { grid-template-columns: 1fr; }
  .calendar-stat-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar-actions { width: 100%; margin-left: 0; }
  .stats-filters { grid-template-columns: 1fr; }
  .stats-custom-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { flex: 1; width: auto; }
  .topbar-actions > .button { min-width: 42px; padding-inline: 9px; }
  .topbar-actions > .button span { display: none; }
  .task-card { grid-template-columns: 26px minmax(0, 1fr); }
  .task-actions { grid-column: 2; justify-content: flex-start; }
  .task-schedule { grid-column: 2; }
  .task-copy span { white-space: normal; }
  .stat-card { grid-column: span 12; }
  .comparison-grid, .history-grid { grid-template-columns: 1fr; }
  .flow-table-head { display: none; }
  .flow-table-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 10px 0; }
  .flow-table-row > span:first-child { grid-column: 1 / -1; padding-bottom: 2px; font-weight: 800; }
  .flow-table-row > strong { display: grid; gap: 2px; font-size: .9rem; text-align: left; }
  .flow-table-row > strong::before { color: var(--muted); content: attr(data-label); font-size: .62rem; font-weight: 750; letter-spacing: 0; }
  .ranked-meta { font-size: .62rem; }
  .due-hero { align-items: start; flex-direction: column; gap: 5px; }
  .due-hero p { text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
  label.full { grid-column: auto; }
  dialog form { padding: 19px 15px; }
  .child-card { grid-template-columns: minmax(0, 1fr) auto; }
  .child-card .node-type, .child-card > span:not(.node-type) { grid-column: 1; }
  .child-card .button { grid-column: 2; grid-row: 1 / 4; }
  .task-edit-panel { grid-template-columns: 1fr; }
  .task-form-row { grid-template-columns: 1fr; }
  .task-form-row .button { width: 100%; }
  .calendar-timeline { height: 590px; }
  .calendar-event[data-overlap-depth="1"] { left: 10px; }
  .calendar-event[data-overlap-depth="2"] { left: 16px; }
  .flow-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; }
  .flow-row strong { font-size: .76rem; }
  .flow-row b { text-align: right; }
  .calendar-combined-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .calendar-combined-row strong { grid-column: 1 / -1; }
  .calendar-stat-row { grid-template-columns: minmax(70px, 1fr) auto auto; }
  .calendar-stat-row progress { grid-column: 1 / -1; }
}

#stats-content.stats-friendly { align-items: start; }
#stats-content.stats-friendly > .stats-friendly-intro { grid-column: 1 / -1; padding: 15px 17px; background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%); border-top: 4px solid var(--accent); }
.stats-friendly-intro .section-heading { align-items: center; margin-bottom: 10px; }
.stats-friendly-intro .section-heading h2 { margin-bottom: 3px; color: var(--text); font-size: 1.05rem; }
.stats-friendly-intro .eyebrow { margin-bottom: 3px; }
.stats-friendly-intro .muted { max-width: 720px; margin-bottom: 0; }
.stats-friendly-chip { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 30px; padding: 5px 9px; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.stats-friendly-chip.risk { color: var(--danger); }
.stats-friendly-chip.success { color: var(--success); }
.stats-friendly-chip.neutral { color: var(--muted); }
.stats-friendly-summary { display: flex; flex-wrap: wrap; gap: 7px; }
.stats-friendly-summary span { padding: 6px 9px; color: var(--muted); background: rgb(255 255 255 / .65); border: 1px solid rgb(221 217 226 / .9); border-radius: 8px; font-size: .7rem; }
.stats-friendly-summary b { color: var(--text); font-size: .9rem; }
#stats-content.stats-friendly > .stat-card { grid-column: span 3; border-top: 4px solid var(--accent); border-radius: var(--radius); }
#stats-content.stats-friendly > .stat-card.attention { border-top-color: var(--danger); }
#stats-content.stats-friendly > .stat-card.success { border-top-color: var(--success); }
#stats-content.stats-friendly > #stats-backlog { grid-column: span 8; }
#stats-content.stats-friendly > #stats-attention { grid-column: span 4; }
#stats-content.stats-friendly > #stats-flow { grid-column: span 8; }
#stats-content.stats-friendly > #stats-comparison { grid-column: span 4; }
#stats-content.stats-friendly > #stats-history,
#stats-content.stats-friendly > #stats-dates { grid-column: span 6; }
#stats-content.stats-friendly > #stats-area-load,
#stats-content.stats-friendly > #stats-project-load { grid-column: span 6; }
#stats-content.stats-friendly > .stats-action { grid-column: 1 / -1; }
#stats-content.stats-friendly > .calendar-stat-section,
#stats-content.stats-friendly > .calendar-combined-section { grid-column: 1 / -1; }
.attention-row { grid-template-columns: 52px minmax(0, 1fr) auto; }
.attention-row.warning > strong { color: var(--study); }
.stats-open { min-height: 31px; padding: 4px 8px; color: var(--accent); background: transparent; border: 1px solid var(--line); border-radius: 7px; font-size: .7rem; font-weight: 800; }
.stats-open:hover { color: var(--text); background: var(--accent-soft); }
.stats-change-table { display: grid; gap: 0; }
.stats-change-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(65px, .7fr)); gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eeeaf1; }
.stats-change-row:last-child { border-bottom: 0; }
.stats-change-row > span:first-child { display: grid; gap: 2px; min-width: 0; }
.stats-change-row b { font-size: .75rem; }
.stats-change-row small { color: var(--muted); font-size: .63rem; line-height: 1.25; }
.stats-change-row > span:not(:first-child), .stats-change-row > strong { font-size: .75rem; text-align: right; }
.stats-change-row > strong { font-weight: 850; }
.stats-change-head { padding: 0 0 7px; border-bottom: 1px solid var(--line); }
.stats-change-head > span { color: var(--muted); font-size: .63rem; font-weight: 800; text-align: right; text-transform: uppercase; }
.stats-change-head > span:first-child { text-align: left; }
.delta-up { color: var(--danger); }
.delta-down { color: var(--success); }
.delta-flat { color: var(--muted); }
.stats-drawer { width: min(520px, 94vw); height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 18px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-right: 0; border-radius: 16px 0 0 16px; box-shadow: 0 12px 42px rgb(30 25 42 / .2); }
.stats-drawer::backdrop { background: rgb(29 27 32 / .42); }
.stats-drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.stats-drawer-head h2 { margin-bottom: 4px; color: var(--text); font-size: 1.1rem; }
.stats-drawer-head p { margin-bottom: 0; }
.stats-drawer .icon-button { flex: 0 0 auto; }
.stats-drawer-list { max-height: calc(100dvh - 108px); overflow: auto; padding-top: 8px; }
.stats-drawer-list .task-card { background: var(--surface-soft); border: 1px solid #eeeaf1; border-radius: 9px; }

@media (max-width: 900px) {
  #stats-content.stats-friendly > .stat-card { grid-column: span 6; }
  #stats-content.stats-friendly > #stats-backlog,
  #stats-content.stats-friendly > #stats-attention,
  #stats-content.stats-friendly > #stats-flow,
  #stats-content.stats-friendly > #stats-comparison,
  #stats-content.stats-friendly > #stats-history,
  #stats-content.stats-friendly > #stats-dates,
  #stats-content.stats-friendly > #stats-area-load,
  #stats-content.stats-friendly > #stats-project-load { grid-column: 1 / -1; }
  .stats-friendly-intro .section-heading { align-items: start; flex-direction: column; }
  .stats-friendly-chip { align-self: start; }
}

@media (max-width: 560px) {
  #stats-content.stats-friendly > .stat-card { grid-column: 1 / -1; }
  .stats-friendly-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-friendly-summary span:last-child { grid-column: 1 / -1; }
  .attention-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 7px; }
  .attention-row > strong { font-size: 1.25rem; }
  .stats-open { padding-inline: 6px; }
  .stats-change-head { display: none; }
  .stats-change-row { grid-template-columns: minmax(0, 1fr) repeat(3, minmax(45px, .55fr)); gap: 5px; padding: 10px 0; }
  .stats-change-row > span:first-child { grid-column: 1 / -1; }
  .stats-change-row > span:not(:first-child), .stats-change-row > strong { font-size: .7rem; }
  .stats-change-row > span:not(:first-child)::before, .stats-change-row > strong::before { display: block; margin-bottom: 2px; color: var(--muted); font-size: .58rem; font-weight: 750; }
  .stats-change-row > span:nth-child(2)::before { content: "Antes"; }
  .stats-change-row > span:nth-child(3)::before { content: "Ahora"; }
  .stats-change-row > strong::before { content: "Cambio"; }
  .stats-drawer { width: 100%; border-right: 0; border-radius: 0; }
}

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

/* Ocho vistas + añadir tarea en el móvil: la celda mide (100vw − 51px)/8 y la etiqueta más
   larga («Patrimonio», diez caracteres) pide unos 6,2 cuerpos de letra, así que el cuerpo sale
   de la propia anchura (de ahí el /52, con margen) entre un mínimo y el tope de .62rem. */
@media (max-width: 350px) {
  .mobile-nav { right: 6px; left: 6px; gap: 2px; }
  .nav-button { padding-inline: 0; font-size: .6rem; }
}
.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 20px; background: var(--surface-soft); }
.login-card { width: min(420px, 100%); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-card h1 { margin: 4px 0 8px; }
.login-intro { margin: 0 0 22px; color: var(--muted); }
.login-card form { display: grid; gap: 16px; }
.login-card .error { margin: 0 0 16px; color: var(--danger); font-weight: 700; }
.login-submit { width: 100%; margin-top: 4px; }

/* El `viewport-fit=cover` del index deja la pantalla entera al navegador (lo necesita la maqueta para
   llegar al borde en un iPhone con isla dinámica). Estas dos reglas apartan la barra y la navegación
   del resto de vistas de la isla y del indicador de inicio; donde no hay isla, `env()` vale 0 y no
   cambia nada. */
.topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
.mobile-nav { bottom: calc(9px + env(safe-area-inset-bottom)); padding-right: calc(5px + env(safe-area-inset-right)); padding-left: calc(5px + env(safe-area-inset-left)); }

/* ------------------------------------------------------------ navegación del panel (28/09/2026)
   El diseño que envió él: en escritorio y tablet, una barra de pestañas fija abajo con las siete vistas;
   en el móvil, un botón flotante que abre el menú de secciones y los ajustes del taller. Sustituye a
   las pestañas de la barra de arriba y a la barra inferior vieja. La cabecera de la maqueta que va con
   este diseño vive en prototipo.css. */
/* Dejamos espacio real para la navegación: nunca tapa el último módulo. */
/* ---------- ESCRITORIO / TABLET: 8 pestañas ---------- */
.proto-bottom-nav { position: fixed; z-index: 80; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; width: min(1120px, calc(100vw - 24px)); padding: 6px; color: var(--proto-tinta, #0b0b09); background: rgba(247, 244, 236, .96); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: var(--proto-radio, 14px); box-shadow: var(--proto-sombra, 3px 3px 0 #0b0b09); transform: translateX(-50%); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.proto-bottom-tab, .proto-menu-item { position: relative; min-width: 0; color: var(--proto-tenue, #6d685e); background: transparent; border: 1px solid transparent; font-weight: 900; letter-spacing: -.01em; transition: transform 120ms cubic-bezier(.22,.78,.25,1), background-color 120ms ease, color 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.proto-bottom-tab { min-height: 48px; padding: 8px 9px; overflow: hidden; border-radius: 9px; font-size: clamp(.66rem, .72vw, .78rem); line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.proto-bottom-tab:hover, .proto-menu-item:hover { color: var(--proto-tinta, #0b0b09); background: #fff3bd; }
.proto-bottom-tab:active, .proto-menu-item:active, .proto-hamburger:active, .proto-sheet-close:active { transform: translate(2px, 2px); }
.proto-bottom-tab[aria-current="page"], .proto-menu-item[aria-current="page"] { z-index: 1; color: var(--proto-tinta, #0b0b09); background: var(--proto-amarillo, #fdd04a); border-color: var(--proto-tinta, #0b0b09); box-shadow: 2px 2px 0 var(--proto-tinta, #0b0b09); }
.proto-bottom-tab[aria-current="page"] { transform: translate(-1px, -1px); }
.proto-bottom-tab[aria-current="page"]::before { position: absolute; top: 5px; left: 50%; width: 18px; height: 3px; background: var(--proto-tinta, #0b0b09); border-radius: 999px; transform: translateX(-50%); content: ""; }
.proto-bottom-tab:focus-visible, .proto-mobile-current:focus-visible, .proto-hamburger:focus-visible, .proto-sheet-close:focus-visible, .proto-menu-item:focus-visible { outline: 3px solid var(--proto-tinta, #0b0b09); outline-offset: 3px; }
/* ---------- MÓVIL: sólo un botón flotante + menú compacto ---------- */
.proto-mobile-nav, .proto-mobile-sheet { display: none; }
@media (max-width: 760px) {
  /* Sólo reservamos un poco de espacio al final del scroll para que el último
       contenido pueda apartarse del botón flotante. No existe una barra inferior. */
  .proto-bottom-nav { display: none; }
  .proto-mobile-nav { position: fixed; z-index: 96; right: max(18px, calc(env(safe-area-inset-right) + 8px)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); display: block; width: 54px; height: 54px; }
  .proto-hamburger { position: relative; display: grid; width: 54px; height: 54px; place-items: center; padding: 0; color: var(--proto-tinta, #0b0b09); background: var(--proto-amarillo, #fdd04a); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: 11px; box-shadow: 3px 3px 0 var(--proto-tinta, #0b0b09); transition: transform 140ms cubic-bezier(.22,.78,.25,1), background-color 140ms ease, box-shadow 140ms ease; }
  .proto-hamburger:hover { background: #ffe173; }
  .proto-hamburger:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--proto-tinta, #0b0b09); }
  .proto-hamburger-lines { position: relative; display: block; width: 24px; height: 18px; }
  .proto-hamburger-lines span { position: absolute; left: 0; display: block; width: 24px; height: 3px; background: currentColor; border-radius: 999px; transform-origin: center; transition: top 180ms cubic-bezier(.22,.78,.25,1), transform 180ms cubic-bezier(.22,.78,.25,1), opacity 120ms ease; }
  .proto-hamburger-lines span:nth-child(1) { top: 0; }
  .proto-hamburger-lines span:nth-child(2) { top: 7.5px; }
  .proto-hamburger-lines span:nth-child(3) { top: 15px; }
  .proto-hamburger[aria-expanded="true"] .proto-hamburger-lines span:nth-child(1) { top: 7.5px; transform: rotate(45deg); }
  .proto-hamburger[aria-expanded="true"] .proto-hamburger-lines span:nth-child(2) { opacity: 0; transform: scaleX(.35); }
  .proto-hamburger[aria-expanded="true"] .proto-hamburger-lines span:nth-child(3) { top: 7.5px; transform: rotate(-45deg); }
  /* El menú nace del propio botón, no de toda la anchura de pantalla. */
  .proto-mobile-sheet { position: fixed; z-index: 95; right: max(18px, calc(env(safe-area-inset-right) + 8px)); bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 66px); display: block; width: min(286px, calc(100vw - 20px)); padding: 9px; color: var(--proto-tinta, #0b0b09); background: rgba(247, 244, 236, .98); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: 13px; box-shadow: 4px 4px 0 var(--proto-tinta, #0b0b09); transform: translateY(10px) scale(.96); transform-origin: calc(100% - 22px) 100%; opacity: 0; visibility: hidden; pointer-events: none; transition: transform 180ms cubic-bezier(.22,.78,.25,1), opacity 140ms ease, visibility 0s linear 180ms; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .proto-mobile-sheet[data-open="true"] { transform: translateY(0) scale(1); opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .proto-menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .proto-menu-item { position: relative; display: flex; align-items: center; min-width: 0; min-height: 44px; padding: 8px 9px; color: var(--proto-tenue, #6d685e); text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; font-weight: 900; transition: transform 120ms cubic-bezier(.22,.78,.25,1), background-color 120ms ease, color 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
  .proto-menu-item:hover { color: var(--proto-tinta, #0b0b09); background: #fff3bd; }
  .proto-menu-item:active { transform: translate(1px, 1px); }
  .proto-menu-item[aria-current="page"] { color: var(--proto-tinta, #0b0b09); background: var(--proto-amarillo, #fdd04a); border-color: var(--proto-tinta, #0b0b09); box-shadow: 2px 2px 0 var(--proto-tinta, #0b0b09); }
  .proto-menu-item strong { min-width: 0; overflow: hidden; color: inherit; font-size: .76rem; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
  .proto-hamburger:focus-visible, .proto-menu-item:focus-visible { outline: 3px solid var(--proto-tinta, #0b0b09); outline-offset: 3px; }
}
@media (max-width: 340px) {
  .proto-mobile-sheet { width: min(260px, calc(100vw - 14px)); right: 7px; }
  .proto-mobile-nav { right: 7px; }
  .proto-menu-grid { gap: 5px; }
  .proto-menu-item { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .proto-bottom-tab, .proto-menu-item, .proto-nav-backdrop, .proto-mobile-sheet { transition: none; }
}
/* ===== cabecera rediseñada (navegación compacta + utilidades) ===== */
.proto-mobile-sheet { display: grid; gap: 12px; }
.proto-menu-bloque { display: grid; gap: 8px; }
.proto-menu-etiqueta { margin: 0; color: var(--proto-tenue, #6d685e); font-size: .67rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.proto-menu-stack { display: grid; gap: 8px; }
.proto-menu-action { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; padding: 10px 11px; color: var(--proto-tinta, #0b0b09); text-align: left; background: var(--proto-tarjeta, #f7f4ec); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: 11px; box-shadow: 2px 2px 0 var(--proto-tinta, #0b0b09); font: inherit; font-size: .82rem; font-weight: 800; }
.proto-menu-action:hover { background: var(--proto-amarillo, #fdd04a); }
.proto-menu-action:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--proto-tinta, #0b0b09); }
.proto-menu-action span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-size: .92rem; }
@media (max-width: 600px) {
  .proto-mobile-sheet { width: min(300px, calc(100vw - 20px)); }
}
/* ===== revisión móvil: controles en UNA fila + menú nativo Safari ===== */
.proto-mobile-menu { display: none; }
@media (max-width: 760px) {
  .proto-mobile-nav { display: none !important; }
  /* La fecha conserva su propia línea; los cinco controles no compiten con la decoración. */
  /* Menú flotante realmente mínimo: cerrado sólo existe el botón. */
  .proto-mobile-menu { position: fixed; z-index: 120; right: max(18px, calc(env(safe-area-inset-right) + 8px)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); display: block; width: 54px; height: 54px; }
  .proto-mobile-menu[open] { width: auto; height: auto; }
  .proto-mobile-menu > summary { list-style: none; -webkit-appearance: none; appearance: none; }
  .proto-mobile-menu > summary::-webkit-details-marker { display: none; }
  .proto-mobile-menu > summary::marker { content: ''; }
  .proto-mobile-menu .proto-hamburger { position: fixed; z-index: 122; right: max(18px, calc(env(safe-area-inset-right) + 8px)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); display: grid; width: 54px; height: 54px; place-items: center; margin: 0; padding: 0; color: var(--proto-tinta, #0b0b09); background: var(--proto-amarillo, #fdd04a); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: 11px; box-shadow: 3px 3px 0 var(--proto-tinta, #0b0b09); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .proto-mobile-menu .proto-hamburger:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--proto-tinta, #0b0b09); }
  .proto-mobile-menu[open] .proto-hamburger-lines span:nth-child(1) { top: 7.5px; transform: rotate(45deg); }
  .proto-mobile-menu[open] .proto-hamburger-lines span:nth-child(2) { opacity: 0; transform: scaleX(.35); }
  .proto-mobile-menu[open] .proto-hamburger-lines span:nth-child(3) { top: 7.5px; transform: rotate(-45deg); }
  .proto-mobile-menu .proto-mobile-sheet { position: fixed; z-index: 121; opacity: 1; visibility: visible; pointer-events: auto; transform: none; right: max(18px, calc(env(safe-area-inset-right) + 8px)); bottom: calc(max(18px, calc(env(safe-area-inset-bottom) + 8px)) + 66px); display: grid; gap: 12px; width: min(300px, calc(100vw - 20px)); padding: 10px; color: var(--proto-tinta, #0b0b09); background: rgb(247 244 236 / .98); border: var(--proto-borde, 2px) solid var(--proto-tinta, #0b0b09); border-radius: 13px; box-shadow: 4px 4px 0 var(--proto-tinta, #0b0b09); transform-origin: calc(100% - 22px) 100%; animation: proto-menu-entrar 160ms cubic-bezier(.22,.78,.25,1) both; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  @keyframes proto-menu-entrar {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  .proto-mobile-menu .proto-menu-item { text-decoration: none; }
  .proto-mobile-menu:not([open]) > .proto-mobile-sheet { display: none; }
  .proto-mobile-menu[open] > .proto-mobile-sheet { display: grid; opacity: 1; visibility: visible; pointer-events: auto; }
}
/* El hueco de la barra: va fija abajo, así que las vistas que sí scrollean reservan su alto para que no
   tape el último bloque. La maqueta de la Home reserva su hueco en su propia regla (prototipo.css). */
@media (min-width: 761px) {
  main { padding-bottom: 108px; }
}