:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #334155;
  --muted: #475569;
  --line: #cbd5e1;
  --line-2: #e2e8f0;
  --paper: #f8fafc;
  --desk: #e2e8f0;
  --white: #ffffff;
  --accent: #38bdf8;
  --strong: #2563eb;
  --strong-hover: #1d4ed8;
  --on-strong: #ffffff;
  --link: #2563eb;
  --ok: #166534; --ok-bg: #dcfce7;
  --warn: #9a3412; --warn-bg: #ffedd5; --warn-line: #ea580c;
  --sans: Archivo, 'Helvetica Neue', Helvetica, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--desk); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--link); }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--line-2); padding: 1px 5px; }
.mono { font-family: var(--mono); }
.muted { color: #94a3b8; }
.muted-ink { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; color: var(--link); }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin: 8px 0 12px; }
.note { font-size: 13px; color: var(--muted); }
.intro { font-size: 16px; color: var(--ink-3); max-width: 70ch; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 18px;
  background: var(--strong); color: var(--on-strong); border: 0; text-decoration: none; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--strong-hover); color: var(--on-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.link-btn { align-self: flex-start; background: none; border: 0; padding: 6px 0; color: var(--link); font-weight: 700; font-size: 14px; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, .node:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── top bar ─────────────────────────────────── */
.topbar {
  background: var(--ink); color: #e2e8f0; display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 22px; padding: 0 28px; min-height: 56px; border-bottom: 3px solid var(--accent);
}
.brand { font-family: var(--mono); font-weight: 600; letter-spacing: 0.16em; font-size: 13px; color: #e2e8f0; text-decoration: none; padding: 16px 0; }
.brand span { color: var(--accent); }
.mainnav { display: flex; flex-wrap: wrap; gap: 2px; }
.mainnav a { color: #cbd5e1; text-decoration: none; font-weight: 600; font-size: 14px; padding: 0 12px; min-height: 56px; display: inline-flex; align-items: center; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.mainnav a:hover { color: #fff; }
.mainnav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
.crumb { display: inline-flex; gap: 10px; align-items: center; color: #64748b; margin-left: auto; }
.crumb a { color: #fff; font-weight: 700; text-decoration: none; }

.time-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 28px; background: #fef3c7; color: #713f12; border-bottom: 1px solid #fcd34d; }
.time-banner .mono { font-size: 11px; letter-spacing: .12em; }
.time-banner a:not(.btn) { color: #713f12; font-weight: 700; }
.time-banner .btn { background: #713f12; color: #fff; }

/* ── home / pages ─────────────────────────────── */
.home { width: 100%; max-width: 1240px; margin: 0 auto; padding: 40px 28px 64px; display: flex; flex-direction: column; gap: 26px; }
.home-head { display: flex; flex-direction: column; gap: 8px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.home-head h1 { font-size: clamp(40px, 6vw, 64px); font-weight: 900; letter-spacing: -0.04em; line-height: 0.95; }
.home-head p { color: var(--muted); max-width: 62ch; font-size: 17px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 24px; }

.book { display: flex; color: #f8fafc; background: var(--ink); min-height: 400px; box-shadow: 0 2px 4px rgba(15,23,42,.12), 0 20px 50px rgba(15,23,42,.18); transition: transform .15s ease, box-shadow .15s ease; }
.book:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(15,23,42,.14), 0 28px 60px rgba(15,23,42,.24); }
.book-spine { width: 14px; flex: none; background: var(--book-accent); }
.book-body { flex: 1; min-width: 0; padding: 28px 32px 24px; display: flex; flex-direction: column; gap: 10px; }
.book-top { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; color: var(--book-accent); }
.book-client { margin-top: 18px; color: #94a3b8; font-size: 14px; }
.book h2 { font-size: 52px; line-height: .95; font-weight: 900; letter-spacing: -0.04em; }
.book h2 a { color: inherit; text-decoration: none; }
.book p { color: #cbd5e1; font-size: 16px; max-width: 36ch; }
.book-parts { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.book-parts a { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 10px; font-size: 13px; color: #e2e8f0; text-decoration: none; box-shadow: inset 0 0 0 1px #334155; }
.book-parts a:hover { box-shadow: inset 0 0 0 1px var(--book-accent); color: #fff; }
.book-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.book-phase { display: flex; justify-content: space-between; font-size: 13px; color: #cbd5e1; }
.book-open { align-self: flex-start; margin-top: 4px; font-weight: 700; color: var(--book-accent); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.bar { height: 6px; background: var(--ink-2); }
.bar > div { height: 6px; background: var(--accent); }

/* ── cover / dashboard ────────────────────────── */
.cover-wrap { flex: 1; display: flex; justify-content: center; padding: 32px 28px; }
.spread { display: flex; flex-wrap: wrap; width: 100%; max-width: 1240px; box-shadow: 0 2px 4px rgba(15,23,42,.12), 0 24px 60px rgba(15,23,42,.18); }
.cover { flex: 1 1 400px; min-width: 0; background: var(--ink); color: #f8fafc; padding: 44px 44px 36px; display: flex; flex-direction: column; gap: 28px; }
.cover-top { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; color: var(--accent); }
.cover-title { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; }
.cover h1 { font-size: clamp(52px, 7vw, 76px); line-height: .92; font-weight: 900; letter-spacing: -0.04em; }
.cover-title p { font-size: 18px; color: #cbd5e1; max-width: 30ch; }
.cover-site { color: var(--accent); font-family: var(--mono); font-size: 13px; text-decoration: none; }
.cover-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.cover-phase { display: flex; justify-content: space-between; font-size: 13px; color: #cbd5e1; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; background: var(--ink-2); margin-top: 14px; }
.facts > div { background: var(--ink); padding: 12px 12px 12px 0; display: flex; flex-direction: column; gap: 2px; }
.facts > div + div { padding-left: 12px; }
.facts .mono:first-child { font-size: 11px; color: #64748b; }
.index { flex: 1.3 1 480px; min-width: 0; background: var(--paper); padding: 40px 40px 32px; display: flex; flex-direction: column; gap: 18px; }
.index-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.index-head h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.part { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; background: var(--white); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 108px; transition: border-color .12s, transform .12s; }
.part:hover { border-color: var(--ink); transform: translateY(-2px); }
.part .num { font-size: 12px; color: var(--link); font-weight: 600; }
.part strong { font-size: 18px; letter-spacing: -0.01em; }
.part span:last-child { font-size: 13px; color: var(--muted); }

/* ── chapter layout ──────────────────────────── */
.book-layout { flex: 1; display: flex; flex-wrap: wrap; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 28px; align-items: flex-start; }
.toc { flex: 1 1 210px; max-width: 240px; background: var(--ink); color: #cbd5e1; padding: 16px 0; position: sticky; top: 16px; }
.toc a { display: flex; align-items: center; gap: 10px; padding: 0 18px; min-height: 42px; text-decoration: none; font-size: 14px; color: #cbd5e1; border-left: 3px solid transparent; }
.toc a .mono { font-size: 12px; width: 22px; }
.toc a:hover { color: #fff; }
.toc a[aria-current="page"] { background: var(--ink-2); color: #fff; font-weight: 700; border-left-color: var(--accent); }
.toc .toc-back { font-size: 11px; letter-spacing: 0.14em; color: var(--accent); min-height: 32px; margin-bottom: 6px; }
.page { flex: 999 1 640px; min-width: 0; min-height: 760px; background: var(--paper); padding: 32px 40px; display: flex; flex-direction: column; gap: 22px; box-shadow: 0 2px 4px rgba(15,23,42,.08), 0 18px 40px rgba(15,23,42,.12); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.page-head h1 { margin-top: 4px; font-size: clamp(30px, 4vw, 40px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.pager { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.pager-prev { font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* tags & pills */
.tag { align-self: flex-start; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; background: var(--line-2); color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .tag { font-size: 11px; padding: 5px 10px; }
.t-avance { color: #1d4ed8; background: #dbeafe; }
.t-decision { color: #6d28d9; background: #ede9fe; }
.t-reunion { color: #0f766e; background: #ccfbf1; }
.t-entrega { color: #166534; background: #dcfce7; }
.t-agente { color: #9d174d; background: #fce7f3; }
.t-revision { color: #854d0e; background: #fef9c3; }
.t-cobro { color: #155e75; background: #cffafe; }
.t-pendiente { color: #9a3412; background: #ffedd5; }
.pill { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 4px 10px; white-space: nowrap; background: var(--line-2); color: var(--ink-3); }
.p-ok, .p-pagado { color: var(--ok); background: var(--ok-bg); }
.p-rev, .p-pendiente { color: var(--warn); background: var(--warn-bg); }
.empty { border: 2px dashed var(--line); padding: 32px 26px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty p { color: var(--muted); font-size: 16px; max-width: 56ch; }
.empty.wide { grid-column: 1 / -1; }

/* segmented / filters */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; box-shadow: inset 0 0 0 1px var(--line); background: var(--white); align-self: flex-start; }
.seg.wrap { gap: 0; }
.seg button { background: transparent; border: 0; padding: 8px 14px; min-height: 40px; font-weight: 600; font-size: 14px; color: var(--ink-3); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }

/* ── calendar ─────────────────────────────────── */
.timeline-wrap { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.cal-col { flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.calendar { background: var(--white); border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cal-head { display: flex; gap: 6px; align-items: center; }
.cal-head select { flex: 1; min-width: 0; min-height: 40px; border: 1px solid var(--line); background: var(--white); padding: 6px 8px; font-weight: 700; }
.icon-btn { flex: none; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 20px; }
.icon-btn:hover { border-color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-dow { font-size: 10.5px; color: #64748b; padding-bottom: 2px; }
.cal-day { position: relative; min-height: 42px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 13px; background: #f1f5f9; color: var(--ink); text-decoration: none; }
.cal-day:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day small { font-size: 9.5px; line-height: 1; }
.cal-day.future { color: #94a3b8; }
.cal-day.lo { background: #bfdbfe; font-weight: 700; }
.cal-day.mid { background: #60a5fa; color: #fff; font-weight: 700; }
.cal-day.hi { background: #1d4ed8; color: #fff; font-weight: 700; }
.cal-day.today { outline: 2px dashed var(--ink); outline-offset: -2px; }
.cal-day.sel { background: #f59e0b; color: #111; font-weight: 800; box-shadow: 0 0 0 2px #111; }
.cal-day .dots { position: absolute; bottom: 4px; display: flex; gap: 2px; }
.cal-day .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.snapshot { background: var(--ink); color: #e2e8f0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.snapshot .kicker { color: var(--accent); font-size: 11px; }
.snap-head { display: flex; flex-direction: column; gap: 2px; }
.snap-head strong { font-size: 22px; font-weight: 900; }
.snapshot .muted-ink { color: #94a3b8; }
.snap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #334155; }
.snap-grid a { background: var(--ink); padding: 10px; display: flex; flex-direction: column; gap: 2px; color: #fff; text-decoration: none; min-height: 64px; }
.snap-grid a:hover { background: var(--ink-2); }
.snap-grid a span { font-size: 12px; color: #94a3b8; }
.snapshot .pager-prev { color: var(--accent); min-height: 36px; }
.hint-box { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.hint-box .kicker { color: var(--link); }
.timeline { flex: 999 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.tl-day { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 18px; scroll-margin-top: 20px; }
.tl-day.is-sel .tl-date { border-top-color: #f59e0b; }
.tl-date { display: flex; flex-direction: column; border-top: 3px solid var(--ink); padding-top: 6px; color: var(--ink); text-decoration: none; }
.tl-date span:first-child { font-size: 38px; font-weight: 900; line-height: 1; }
.tl-date .mono { font-size: 11px; color: var(--muted); }
.tl-entries { display: flex; flex-direction: column; gap: 8px; }
.entry { background: var(--white); border: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.entry h3 { font-size: 16px; font-weight: 700; }
.entry p { font-size: 14px; color: var(--muted); }
.entry-link { text-decoration: none; color: var(--ink); box-shadow: inset 4px 0 0 var(--book-accent); }
.entry-link:hover { border-color: var(--ink); }
.entry-proj { font-size: 10.5px; letter-spacing: .1em; color: var(--muted); }

/* ── reviews ──────────────────────────────────── */
.review-stats { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.review-stats > div { background: var(--white); padding: 8px 14px; display: flex; flex-direction: column; }
.review-stats .mono { font-size: 22px; font-weight: 600; }
.review-stats span:last-child { font-size: 12px; color: var(--muted); }
.s-ok { color: var(--ok); } .s-rev { color: var(--warn); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--ink-3); border: 0; padding: 10px 14px; min-height: 44px; font-weight: 700; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.doc-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 14px; background: #eff6ff; border: 1px solid #bfdbfe; font-size: 14px; color: #1e3a8a; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.review { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.review.r-ok { border-top-color: var(--ok); } .review.r-rev { border-top-color: var(--warn-line); }
.review-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.review .code { font-size: 12px; font-weight: 600; color: var(--link); }
.review h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.review > p { font-size: 14px; color: var(--ink-3); }
dl { margin: 0; }
.review dl, .card dl, .conn dl, .agent dl, .infra dl, .flow-detail dl { border-top: 1px solid var(--line-2); }
.review dl div, .card dl div, .conn dl div, .agent dl div, .flow-detail dl div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
dt { font-size: 11px; color: #64748b; text-transform: uppercase; padding-top: 2px; }
dd { margin: 0; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.review-actions button { background: var(--white); padding: 8px 12px; min-height: 44px; font-weight: 700; border: 1.5px solid; }
.review-actions button:disabled { opacity: .45; cursor: not-allowed; }
.b-ok { border-color: var(--ok); color: var(--ok); } .b-rev { border-color: var(--warn); color: var(--warn); }
.b-ok[aria-pressed="true"] { background: var(--ok); color: #fff; }
.b-rev[aria-pressed="true"] { background: var(--warn); color: #fff; }

/* ── designs ──────────────────────────────────── */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 20px; }
.design { background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; }
.design-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--line-2); border: 0; padding: 0; border-bottom: 1px solid var(--line); }
.design-thumb iframe { position: absolute; left: 0; top: 0; width: 300%; height: 300%; border: 0; transform: scale(.3334); transform-origin: 0 0; pointer-events: none; }
.design-zoom { position: absolute; right: 10px; bottom: 10px; background: var(--ink); color: #fff; font-size: 11px; letter-spacing: .1em; padding: 6px 10px; }
.design-thumb:hover .design-zoom { background: var(--strong); }
.design-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.design-body h3 { font-size: 22px; font-weight: 800; }
.design-body p { color: var(--muted); }

/* ── pricing ──────────────────────────────────── */
.price-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.price-top section { padding: 18px; display: flex; flex-direction: column; gap: 6px; background: var(--white); border: 1px solid var(--line); }
.price-total { background: var(--ink) !important; color: #e2e8f0; border-color: var(--ink) !important; }
.price-total .kicker { color: var(--accent); font-size: 11px; }
.price-total strong { font-size: clamp(28px, 4vw, 38px); color: #fff; font-weight: 600; letter-spacing: -0.02em; }
.price-total .muted-ink { color: #94a3b8; }
.price-rate label { display: flex; flex-direction: column; gap: 4px; }
.price-rate strong { font-size: 26px; font-weight: 600; }
.price-rate input[type=range] { width: 100%; accent-color: var(--strong); min-height: 32px; }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); }
.price-monthly strong { font-size: 26px; font-weight: 600; }
.phases { display: flex; flex-direction: column; gap: 6px; }
.phase { background: var(--white); border: 1px solid var(--line); }
.phase summary { list-style: none; display: grid; grid-template-columns: minmax(0, 2fr) minmax(80px, 1.4fr) 56px 110px; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; min-height: 56px; }
.phase summary::-webkit-details-marker { display: none; }
.phase summary::after { content: none; }
.phase-name { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.phase-name strong { font-size: 16px; }
.phase-name strong::before { content: '▸ '; color: var(--muted); }
.phase[open] .phase-name strong::before { content: '▾ '; }
.phase-bar { height: 10px; background: var(--line-2); }
.phase-bar i { display: block; height: 10px; background: var(--strong); }
.phase.done .phase-bar i { background: var(--ok); }
.phase-h { color: var(--muted); text-align: right; }
.phase-amt { text-align: right; font-weight: 600; }
.phase ul { margin: 0; padding: 0 16px 14px 40px; color: var(--ink-3); display: grid; gap: 4px; }
.phase-sum { display: flex; justify-content: space-between; padding: 14px 16px; font-weight: 800; border-top: 2px solid var(--ink); }
.price-bottom { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.price-bottom > section { flex: 999 1 460px; min-width: 0; }
.infra { flex: 1 1 280px; background: var(--white); border: 1px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.infra .section-title { margin-top: 0; font-size: 17px; }
.infra dl div { padding: 8px 0; border-bottom: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.infra dt { font-size: 13px; color: var(--ink); text-transform: none; font-weight: 700; }
.pay-list { display: flex; flex-direction: column; gap: 8px; }
.pay { background: var(--white); border: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--line); padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.pay.s-pendiente { box-shadow: inset 4px 0 0 var(--warn-line); }
.pay.s-pagado { box-shadow: inset 4px 0 0 var(--ok); }
.pay-n { font-size: 20px; font-weight: 600; color: #94a3b8; width: 32px; }
.pay-t { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-t strong { font-size: 16px; font-weight: 800; }
.pay-t span { font-size: 13px; color: var(--muted); }
.pay-amount { font-size: 15px; min-width: 110px; text-align: right; font-weight: 600; }

/* ── connections ──────────────────────────────── */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; align-items: start; }
.conn { background: var(--white); border: 1px solid var(--line); padding: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.conn > p, .conn-more, .conn .card-link { padding: 0 16px; }
.conn > p { color: var(--muted); font-size: 14px; }
.conn-head { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); padding: 14px 16px; min-height: 64px; }
.conn-dot { width: 12px; height: 12px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 4px #f1f5f9; }
.conn.t-ok .conn-dot { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; }
.conn.t-warn .conn-dot { background: #ea580c; box-shadow: 0 0 0 4px #ffedd5; }
.conn.t-ok .pill { color: var(--ok); background: var(--ok-bg); }
.conn.t-warn .pill { color: var(--warn); background: var(--warn-bg); }
.conn-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conn-t strong { font-size: 17px; }
.conn-t .mono { font-size: 11.5px; color: var(--muted); }
.conn-more { display: none; flex-direction: column; gap: 6px; }
.conn.open .conn-more { display: flex; }
.card-link { font-weight: 700; font-size: 14px; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }

/* ── flow diagram ─────────────────────────────── */
.flow-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }
.flow { flex: 999 1 560px; min-width: 0; width: 100%; height: auto; background: var(--white); border: 1px solid var(--line); background-image: radial-gradient(#e2e8f0 1px, transparent 1px); background-size: 18px 18px; color: #94a3b8; }
.edge { fill: none; stroke: #94a3b8; stroke-width: 2; transition: stroke .15s, stroke-width .15s; }
.edge.on { stroke: var(--ink); stroke-width: 3; color: var(--ink); }
.node { cursor: pointer; transition: opacity .15s; }
.node rect { fill: var(--white); stroke: var(--ink); stroke-width: 1.5; }
.node .nt { font: 700 15px var(--sans); fill: var(--ink); }
.node .ns { font: 500 11px var(--mono); fill: #475569; }
.node.n-src rect { fill: #e0f2fe; } .node.n-core rect { fill: #f8fafc; } .node.n-agent rect { fill: #fce7f3; } .node.n-check rect { fill: #fef9c3; } .node.n-out rect { fill: #dcfce7; }
.node:hover rect, .node.on rect { stroke-width: 3; }
.node.on rect { stroke: var(--strong); }
.node.dim { opacity: .35; }
.flow-detail { flex: 1 1 240px; background: var(--ink); color: #e2e8f0; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.flow-detail .kicker { color: var(--accent); font-size: 11px; }
.flow-detail h3 { font-size: 22px; font-weight: 900; color: #fff; }
.flow-detail p { color: #cbd5e1; }
.flow-detail dl div { border-bottom-color: #1e293b; }
.flow-detail dt { color: #94a3b8; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; display: inline-block; border: 1.5px solid var(--ink); }
.lg.n-src { background: #e0f2fe; } .lg.n-core { background: #f8fafc; } .lg.n-agent { background: #fce7f3; } .lg.n-check { background: #fef9c3; } .lg.n-out { background: #dcfce7; }

/* ── agents ───────────────────────────────────── */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.agent { background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; }
.agent-head { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: var(--ink); color: #fff; border: 0; padding: 16px; min-height: 72px; }
.agent-head > span:last-child { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.agent-head strong { font-size: 20px; font-weight: 900; }
.agent-ico { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; background: #1e293b; color: var(--accent); flex: none; }
.agent.lv-2 .agent-ico, .agent.lv-3 .agent-ico { background: #be185d; color: #fff; }
.agent.lv-2 .pill { color: #9d174d; background: #fce7f3; }
.agent-pipe { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; padding: 16px; }
.pipe-in, .pipe-out { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: #f1f5f9; font-size: 14px; }
.pipe-in .mono, .pipe-out .mono { font-size: 10.5px; letter-spacing: .1em; color: var(--muted); }
.pipe-out { background: #dcfce7; }
.pipe-arrow { align-self: center; font-size: 22px; color: var(--muted); }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 0 16px 16px; }
.levels span { font-family: var(--mono); font-size: 10px; text-align: center; padding: 6px 2px; background: var(--line-2); color: #64748b; }
.levels span.on { background: var(--ink); color: #fff; }
.agent.lv-2 .levels span.on:nth-child(3) { background: #be185d; }
.agent-more { display: none; padding: 0 16px 16px; }
.agent.open .agent-more { display: block; }

/* ── deliverables (bento) ─────────────────────── */
.bento { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); grid-auto-flow: dense; gap: 12px; }
.deliv { background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; transition: box-shadow .2s; }
.deliv-face { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; background: transparent; border: 0; padding: 16px; min-height: 150px; color: var(--ink); }
.deliv-face:hover { background: #f8fafc; }
.deliv-face strong { font-size: 17px; line-height: 1.2; }
.deliv-face .mono { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.deliv-ico { width: 34px; height: 34px; color: var(--link); }
.deliv-more { display: none; padding: 0 16px 16px; flex-direction: column; gap: 12px; }
.deliv-more p { color: var(--ink-3); }
.deliv.open { grid-column: span 2; grid-row: span 2; box-shadow: 0 0 0 2px var(--ink), 0 16px 40px rgba(15,23,42,.16); }
.deliv.open .deliv-face { min-height: 0; }
.deliv.open .deliv-more { display: flex; }
.deliv-preview { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--line-2); border: 1px solid var(--line); }
.deliv-preview iframe { position: absolute; left: 0; top: 0; width: 300%; height: 300%; border: 0; transform: scale(.3334); transform-origin: 0 0; pointer-events: none; }

/* ── threads ──────────────────────────────────── */
.threads { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.th-side { flex: 1 1 240px; max-width: 290px; display: flex; flex-direction: column; gap: 12px; }
.search input, .sort select, .th-new input, .th-new select, .th-new textarea { width: 100%; border: 1px solid var(--line); background: var(--white); padding: 10px 12px; min-height: 44px; }
.th-filters, .th-topics { display: flex; flex-direction: column; gap: 2px; }
.th-filters button, .th-topics button { display: flex; justify-content: space-between; text-align: left; background: transparent; border: 0; padding: 8px 10px; min-height: 40px; font-weight: 600; color: var(--ink-3); }
.th-filters button[aria-pressed="true"], .th-topics button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.sort { display: flex; flex-direction: column; gap: 6px; }
.th-new summary { list-style: none; cursor: pointer; }
.th-new summary::-webkit-details-marker { display: none; }
.th-new form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; background: var(--white); border: 1px solid var(--line); padding: 14px; }
.th-new label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.th-new label.check { flex-direction: row; align-items: center; gap: 8px; }
.th-new label.check input { width: 18px; height: 18px; min-height: 0; }
.th-list { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.thread { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; background: var(--white); border: 1px solid var(--line); padding: 12px 14px 12px 8px; }
.thread.is-pending { box-shadow: inset 4px 0 0 var(--warn-line); }
.star { width: 44px; height: 44px; background: transparent; border: 0; font-size: 22px; color: #94a3b8; }
.star[aria-pressed="true"] { color: #d97706; }
.thread-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.thread-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.thread h3 { font-size: 16px; font-weight: 800; }
.thread p { font-size: 14px; color: var(--muted); }
.pend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); min-height: 44px; }
.pend input { width: 18px; height: 18px; accent-color: var(--warn-line); }

/* cards & layers */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.card { background: var(--white); border: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.card p { font-size: 14px; color: var(--muted); }
.layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.layers li { display: grid; grid-template-columns: 130px 150px minmax(0, 1fr); gap: 16px; align-items: center; padding: 16px 20px; background: var(--ink); color: #e2e8f0; margin-left: calc(var(--depth) * 18px); border-left: 4px solid var(--accent); }
.layer-role { font-size: 11px; letter-spacing: .12em; color: var(--accent); }
.layers strong { font-size: 20px; font-weight: 900; color: #fff; }
.layers li span:last-child { color: #cbd5e1; font-size: 14px; }

/* ── proposals / finance ──────────────────────── */
.prop-list { display: flex; flex-direction: column; gap: 14px; }
.prop { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center; background: var(--white); border: 1px solid var(--line); box-shadow: inset 6px 0 0 var(--book-accent); padding: 20px 22px 20px 28px; }
.prop-main { display: flex; flex-direction: column; gap: 6px; }
.prop-main h2 { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.prop-main p { color: var(--muted); }
.prop-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.prop-side strong { font-size: 24px; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kpis > div { background: var(--white); padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.kpis > div:first-child { background: var(--ink); color: #e2e8f0; }
.kpis > div:first-child .kicker { color: var(--accent); }
.kpis strong { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.kpis span:last-child { font-size: 13px; color: var(--muted); }
.kpis > div:first-child span:last-child { color: #94a3b8; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); }
.fin-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.fin-table th, .fin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.fin-table th { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.fin-table .num { text-align: right; }
.pay-bars { display: flex; flex-direction: column; gap: 6px; }
.pay-bar { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 110px; gap: 14px; align-items: center; background: var(--white); border: 1px solid var(--line); padding: 10px 14px; }
.pb-label { display: flex; flex-direction: column; }
.pb-track { height: 12px; background: var(--line-2); }
.pb-track i { display: block; height: 12px; background: #94a3b8; }
.pay-bar.s-pendiente .pb-track i { background: var(--warn-line); }
.pay-bar.s-pagado .pb-track i { background: var(--ok); }
.pb-amt { text-align: right; font-weight: 600; }

/* ── viewer ───────────────────────────────────── */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(2,6,23,.82); display: flex; flex-direction: column; padding: 16px; gap: 0; }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 10px 14px; }
.viewer-bar .btn.ghost { color: #fff; box-shadow: inset 0 0 0 1.5px #475569; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ── phone ───────────────────────────────────── */
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 0 10px; }
  .brand { padding: 12px 0 4px; flex-basis: 100%; }
  .mainnav { overflow-x: auto; flex-wrap: nowrap; flex-basis: 100%; }
  .mainnav a { min-height: 44px; padding: 0 10px; white-space: nowrap; }
  .crumb { margin-left: 0; padding: 0 0 10px; }
  .time-banner { padding: 10px 16px; }
  .home { padding: 28px 16px 48px; }
  .book h2 { font-size: 42px; }
  .book-body { padding: 22px 20px; }
  .cover-wrap, .book-layout { padding: 16px; }
  .cover, .index { padding: 26px 20px; }
  .toc { position: static; max-width: none; flex-basis: 100%; display: flex; overflow-x: auto; padding: 0; }
  .toc a { flex: none; border-left: 0; border-bottom: 3px solid transparent; padding: 0 14px; min-height: 48px; }
  .toc a[aria-current="page"] { border-bottom-color: var(--accent); }
  .toc .toc-back { margin: 0; }
  .page { padding: 22px 16px; min-height: 0; }
  .cal-col { max-width: none; }
  .tl-day { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
  .tl-date span:first-child { font-size: 30px; }
  .layers li { grid-template-columns: 1fr; gap: 4px; margin-left: 0; }
  .phase summary { grid-template-columns: minmax(0, 1fr) auto; }
  .phase-bar, .phase-h { display: none; }
  .pay-amount { text-align: left; min-width: 0; }
  .deliv.open { grid-column: 1 / -1; grid-row: auto; }
  .th-side { max-width: none; }
  .pay-bar { grid-template-columns: 1fr auto; }
  .pb-track { grid-column: 1 / -1; grid-row: 2; }
  .agent-pipe { grid-template-columns: 1fr; }
  .pipe-arrow { transform: rotate(90deg); justify-self: center; }
  .viewer { padding: 0; }
}
