/* JF Developers · Panel de control */
:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1b1c1e;
  --ink-2: #3d3e41;
  --muted: #76716a;
  --line: #e7e2d9;
  --line-2: #d9d2c5;
  --side: #16181b;
  --side-ink: #c9c4bb;
  --side-muted: #7c776f;
  --accent: #a8834c;
  --accent-soft: #f3ebdd;
  --primary: #1b1c1e;
  --primary-ink: #ffffff;
  --red: #b4432f;  --red-soft: #f8e6e1;
  --green: #2f7a52; --green-soft: #e3f1e8;
  --blue: #2f5f9a; --blue-soft: #e4ecf6;
  --amber: #a46a12; --amber-soft: #f8edd8;
  --violet: #6a4ea0; --violet-soft: #ece6f6;
  --teal: #237273; --teal-soft: #dff0ef;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(27, 28, 30, .05), 0 1px 1px rgba(27, 28, 30, .03);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-family: var(--serif); font-size: 28px; font-weight: 600; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 15px; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; margin: 0; color: var(--ink-2); }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: 0 0 248px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 28px 36px 60px; max-width: 1240px; width: 100%; }
.topbar { display: none; }

.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .02em; }
.brand-lockup small { display: block; font-weight: 400; color: var(--side-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }
.brand-lockup.dark { color: var(--ink); padding: 0 0 22px; }
.brand-lockup.dark small { color: var(--muted); }
.brand-lockup:hover { color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-size: 16px; font-weight: 700; letter-spacing: 0; }

.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 1px; flex: 1; }
.nav-group { margin: 18px 10px 6px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); text-decoration: none; font-size: 13.5px; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: rgba(168, 131, 76, .18); color: #fff; }
.nav-link.active .ico { color: var(--accent); }
.nav-link.disabled { color: var(--side-muted); cursor: default; }
.nav-link.disabled:hover { background: none; color: var(--side-muted); }
.ico { width: 17px; height: 17px; flex: 0 0 17px; }

.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 13px; min-width: 0; }
.me small { display: block; color: var(--side-muted); font-size: 11px; }
.me:hover { color: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #2a2d31; display: grid; place-items: center; font-weight: 600; color: var(--accent); flex: 0 0 30px; }
.link-btn { background: none; border: 0; color: var(--side-muted); cursor: pointer; font: inherit; font-size: 12px; padding: 4px; }
.link-btn:hover { color: #fff; }

/* ---------- Encabezados ---------- */
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 13.5px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #000; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); border-color: var(--red-soft); color: var(--red); }
form.inline { display: inline; }

/* ---------- Tarjetas y KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow-x: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head a:not(.btn) { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.card-head a:not(.btn):hover { color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; }
.grid-2.wide-left { grid-template-columns: 1.6fr 1fr; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi strong { display: block; font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi strong.kpi-text { font-family: var(--font); font-size: 17px; margin: 9px 0 6px; }
.kpi small { color: var(--muted); font-size: 12px; }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--line-2); font-weight: 600; padding: 10px 14px; }
.card:not(.flush) .table th, .card:not(.flush) .table td, .card:not(.flush) .table tfoot td { padding-left: 0; }
.card:not(.flush) .table th { background: transparent; }
.table.compact td { padding-top: 9px; padding-bottom: 9px; }
.table .num { text-align: right; white-space: nowrap; }
.table .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--surface-2); }
.row-muted td { color: var(--muted); }
.row-actions { text-align: right; white-space: nowrap; }

/* ---------- Badges, pills, chips ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font: 600 11px/1.6 var(--font); letter-spacing: .02em; white-space: nowrap; vertical-align: middle; }
.badge-neutral { background: #eeebe5; color: #5e5a53; }
.badge-muted { background: #efefef; color: #8a8a8a; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
h1 .badge { font-size: 12px; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 12.5px; text-decoration: none; color: var(--ink-2); background: var(--surface); }
.pill span { color: var(--muted); font-size: 11.5px; }
.pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.active span { color: #bbb; }
.search { margin-left: auto; }
.search input { height: 34px; width: 260px; }

.chip-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--accent-soft); color: #6d5226; font-size: 12.5px; text-decoration: none; }
.chip:hover { background: #ead9bd; color: #4d3915; }

/* ---------- Tablero ---------- */
.stage-bars { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-2); font-size: 13px; padding: 2px 0; }
.stage-row:hover .stage-label { color: var(--accent); }
.stage-track { height: 10px; background: #f0ece5; border-radius: 99px; overflow: hidden; }
.stage-fill { display: block; height: 100%; border-radius: 99px; }
.stage-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tone-neutral { background: #bdb6aa; } .tone-violet { background: var(--violet); } .tone-amber { background: #d29a3a; }
.tone-blue { background: var(--blue); } .tone-teal { background: var(--teal); } .tone-green { background: var(--green); } .tone-muted { background: #c8c8c8; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.activity li:last-child { border-bottom: 0; }
.activity time { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- Cap table ---------- */
.captable { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #f0ece5; margin-bottom: 16px; }
.seg { display: block; height: 100%; border-right: 2px solid var(--surface); }
.seg-jf { background: var(--accent); }
.seg-0 { background: #1f3a5f; } .seg-1 { background: #3f7d6e; } .seg-2 { background: #7b5ea7; }
.seg-3 { background: #b9733a; } .seg-4 { background: #4f86c6; } .seg-5 { background: #8e8a82; }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0 0 12px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.danger-zone { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- Formularios ---------- */
.form h2 { margin: 6px 0 14px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.form h2:not(:first-of-type) { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.form.narrow { max-width: 520px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 0; }
.form > .field { margin-bottom: 14px; }
.field span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 11.5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); font: 14px var(--font);
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin: 6px 0 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 6px; }

/* ---------- Alertas y vacíos ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-ok { background: var(--green-soft); color: #1f5a3b; border-color: #cde5d5; }
.alert-error { background: var(--red-soft); color: #8b2f1f; border-color: #efcfc7; }
.alert-warn { background: var(--amber-soft); color: #7b4f0b; border-color: #efdcb7; }
.alert-info { background: var(--blue-soft); color: #244a78; border-color: #d0dcec; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty h2 { font-family: var(--serif); font-size: 40px; color: var(--ink); }

/* ---------- Login ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 0% 0%, #ece4d6 0%, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 34px 32px; box-shadow: 0 20px 50px -20px rgba(27, 28, 30, .18); }
.auth-card h1 { font-size: 26px; }
.auth-card > p { margin: 6px 0 20px; }
.auth-foot { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Celular y tablet ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20; }
  .menu-btn { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; padding: 2px 6px; }
  .topbar-title { font-weight: 600; }
  .content { padding: 20px 16px 48px; }
  h1 { font-size: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .kpi strong { font-size: 23px; }
  .dl { grid-template-columns: 110px 1fr; }
  .stage-row { grid-template-columns: 96px 1fr 28px; }
}

/* ======================= v2 ======================= */
.nav-group:first-child { margin-top: 6px; }
a.kpi { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--accent); color: inherit; }
.kpis-6 { grid-template-columns: repeat(6, 1fr); }
.kpis-6 .kpi strong { font-size: 24px; }
.kpi strong.neg, .neg { color: var(--red); }
.kpi strong.warn, .warn { color: var(--amber); }
.card.slim { padding-top: 14px; padding-bottom: 14px; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: #efebe4; color: var(--muted); font-size: 11px; font-weight: 600; text-align: center; line-height: 18px; vertical-align: middle; }
.subhead { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; font-weight: 600; }
.meta-line { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.table-wrap { overflow-x: auto; }
.clip { display: inline-block; max-width: 360px; }
.empty-inline { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-inline p { margin: 0 0 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

/* Encabezado de proyecto + pestañas */
.id-line { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; color: var(--ink-2); font-size: 13.5px; }
.id-line b { color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin: -6px 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a.on .count { background: var(--accent-soft); color: #6d5226; }

/* Toggle tabla/tarjetas */
.seg-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-toggle a { padding: 0 12px; line-height: 34px; font-size: 13px; text-decoration: none; color: var(--ink-2); }
.seg-toggle a.on { background: var(--ink); color: #fff; }

/* Tarjetas de proyectos */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--accent); color: inherit; box-shadow: 0 6px 20px -10px rgba(27, 28, 30, .25); }
.project-card h3 { margin: 8px 0 0; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-permits { font-size: 11.5px; color: var(--amber); font-weight: 600; }
.pc-llc { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.pc-addr { font-size: 12.5px; color: var(--muted); }
.pc-progress { height: 6px; background: #f0ece5; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.pc-progress span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.pc-progress-label { font-size: 11.5px; color: var(--muted); }
.pc-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.pc-nums dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pc-nums dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13.5px; }

/* Barras */
.bar-track { display: block; height: 10px; background: #f0ece5; border-radius: 99px; overflow: hidden; }
.bar-track.sm { height: 7px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-fill.alt { background: #3f7d6e; }
.bar-fill.over { background: var(--red); }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: minmax(120px, 32%) 1fr auto; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-2); font-size: 13px; }
.hbar-row:hover .hbar-label { color: var(--accent); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label small { display: block; color: var(--muted); font-size: 11px; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 70px; text-align: right; }
.vs-bars { display: flex; flex-direction: column; gap: 10px; }
.vs-row { display: grid; grid-template-columns: 70px 1fr 60px; gap: 12px; align-items: center; font-size: 13px; }
.vs-row b { text-align: right; font-variant-numeric: tabular-nums; }
.vs-mini { display: flex; flex-direction: column; gap: 3px; }
.legend-line { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin: -10px 0 20px; }
.legend-line .dot { margin-left: 10px; }
.fill-a { background: var(--accent); } .fill-b { background: #3f7d6e; }

/* Estado de permisos */
.status-strip { display: flex; gap: 2px; height: 12px; border-radius: 99px; overflow: hidden; margin: 2px 0 10px; }
.ss-seg { display: block; min-width: 8px; }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; margin-bottom: 20px; }
.status-legend a { text-decoration: none; color: var(--ink-2); }
.status-legend b { color: var(--ink); }
.card .status-legend { margin-bottom: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* Agenda y línea de tiempo */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li a { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 13px; }
.agenda li:last-child a { border-bottom: 0; }
.agenda li a:hover { color: var(--ink); }
.agenda time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; }
.agenda time small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.agenda time.late { color: var(--red); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline p { margin: 4px 0 0; color: var(--ink-2); }

/* Fichas genéricas */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; margin: 0; }
.detail-grid dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.detail-grid dd { margin: 0; font-size: 14px; }
.detail-grid .span-all { grid-column: 1 / -1; }

/* Filtros */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.mini { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.mini.grow { flex: 1; min-width: 200px; }
.mini span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mini select, .mini input { height: 34px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-row { margin-bottom: 14px; }
.multi { border: 0; padding: 0; margin: 0; }
.multi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 14px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; max-height: 220px; overflow-y: auto; }
.multi-grid .check { margin: 3px 0; font-size: 13px; }

/* Planos */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.doc-icon { width: 42px; height: 50px; flex: 0 0 42px; border-radius: 6px; display: grid; place-items: center; font: 700 10.5px var(--font); letter-spacing: .04em; color: #fff; background: #8e8a82; text-decoration: none; }
.doc-icon:hover { color: #fff; filter: brightness(1.1); }
.ext-pdf { background: #b4432f; } .ext-dwg, .ext-dxf { background: #2f5f9a; } .ext-jpg, .ext-jpeg, .ext-png, .ext-webp { background: #3f7d6e; }
.ext-xls, .ext-xlsx { background: #2f7a52; } .ext-doc, .ext-docx { background: #4f86c6; } .ext-link { background: var(--accent); }
.doc-body { flex: 1; min-width: 0; }
.doc-title { display: block; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .sub { color: var(--muted); font-size: 12px; }

/* Tablero de ventas */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.board-col { background: #ece7de; border-radius: var(--radius); padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.board-head { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 2px 4px 4px; display: flex; align-items: center; gap: 4px; }
.board-head .count { margin-left: auto; background: rgba(255,255,255,.6); }
.board-card { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border-radius: 8px; padding: 10px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); border: 1px solid transparent; }
.board-card:hover { border-color: var(--accent); color: inherit; }
.board-card .sub { color: var(--muted); font-size: 12px; }
.bc-amount { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.bc-next { font-size: 11.5px; color: var(--ink-2); }
.bc-next.late { color: var(--red); }
.board-empty { color: var(--muted); text-align: center; font-size: 12px; padding: 10px; }

/* Reportes */
.report-layout { display: grid; grid-template-columns: 290px 1fr; gap: 20px; align-items: start; }
.report-builder { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.report-builder .field select + select { margin-top: 6px; }
.filter-group { border: 1px solid var(--line); border-radius: 8px; padding: 0; }
.filter-group summary { cursor: pointer; padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.filter-group summary::-webkit-details-marker { display: none; }
.filter-group summary::after { content: '+'; color: var(--muted); font-weight: 400; }
.filter-group[open] summary::after { content: '–'; }
.check-list { padding: 2px 10px 8px; max-height: 220px; overflow-y: auto; }
.check-list .check { margin: 4px 0; font-size: 13px; }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.builder-actions { display: flex; flex-direction: column; gap: 6px; }
.saved-reports h2 { font-size: 13px; margin-bottom: 8px; }
.saved-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.saved-item:last-child { border-bottom: 0; }
.saved-item a { text-decoration: none; font-size: 13px; font-weight: 500; }
.saved-item small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.link-x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px; }
.link-x:hover { color: var(--red); }
.report-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.report-header h2 { font-family: var(--serif); font-size: 24px; }
.report-header p { margin: 4px 0 14px; font-size: 12.5px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.save-form { display: flex; gap: 6px; margin-left: auto; }
.save-form input { height: 30px; width: 200px; font-size: 13px; }
.report-chart { margin-bottom: 18px; }
.report-chart h3 { font-size: 13px; margin: 0 0 12px; color: var(--ink-2); }
.report-table td, .report-table th { padding-left: 0; }
.print-brand { display: none; }
a.sort { color: inherit; text-decoration: none; }
a.sort:hover { color: var(--accent); }

/* Chat de agentes */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.chat-list { padding: 14px; }
.chat-list h2 { font-size: 13px; margin-bottom: 8px; }
.chat-list a { display: block; padding: 8px 10px; border-radius: 7px; text-decoration: none; font-size: 13px; }
.chat-list a small { display: block; color: var(--muted); font-size: 11.5px; }
.chat-list a.on, .chat-list a:hover { background: var(--surface-2); }
.chat-main { padding: 0; display: flex; flex-direction: column; min-height: 460px; }
.chat-thread { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.chat-empty { margin: auto; color: var(--muted); text-align: center; max-width: 360px; }
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.msg-user .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-agent .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-form { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-actions { display: flex; justify-content: flex-end; gap: 8px; }
.prompt { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 14px; border-radius: 8px; max-height: 360px; overflow: auto; }
details.card > summary { cursor: pointer; font-weight: 600; }

@media (max-width: 1300px) { .kpis-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) {
  .report-layout, .chat-layout { grid-template-columns: 1fr; }
  .report-builder { position: static; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .kpis-6 { grid-template-columns: repeat(2, 1fr); }
  .detail-grid, .form-grid.three { grid-template-columns: 1fr; }
  .save-form { margin-left: 0; width: 100%; }
  .save-form input { flex: 1; }
  .hbar-row { grid-template-columns: 110px 1fr auto; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* Impresión (reportes y fichas) */
@media print {
  body { background: #fff; font-size: 11px; }
  .sidebar, .topbar, .no-print, .report-side, .tabs, .actions, .danger-zone, .row-actions, .alert { display: none !important; }
  .content { padding: 0; max-width: none; }
  .report-layout { display: block; }
  .report-sheet, .card { border: 0; box-shadow: none; padding: 0; }
  .print-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
  .print-brand .brand-mark { width: 26px; height: 26px; font-size: 12px; }
  .table th { background: #f4f1ec !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-fill, .stage-fill, .ss-seg, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { text-decoration: none; color: inherit; }
  tr { page-break-inside: avoid; }
}

/* Ajustes de grilla: que el contenido ancho haga scroll dentro de su tarjeta */
.grid-2 > *, .report-layout > *, .chat-layout > *, .kpis > * { min-width: 0; }
.date-pair { grid-template-columns: 1fr; }
.date-pair input { min-width: 0; }
.shell { background: linear-gradient(to right, var(--side) 248px, var(--bg) 248px); }
@media (max-width: 820px) { .shell { background: var(--bg); } }

/* ---------- v3: estado de obra ---------- */
.obra-status .os-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.obra-status.compact .os-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.os-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.os-item > span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-item strong { font: 600 21px/1.2 var(--serif); }
.os-item small { color: var(--muted); font-size: 12px; }
.os-item .bar-track { margin-top: 4px; }
.src { font: italic 10px var(--font); color: var(--muted); background: #eeebe5; border-radius: 4px; padding: 0 4px; vertical-align: middle; }
.os-note { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.os-note.warn { background: var(--amber-soft); color: #6d470c; }
.os-note.ok { background: var(--green-soft); color: #1f5538; }
.os-sub { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); }
.bar-fill.loan { background: var(--blue); }
.obra-cards { display: grid; gap: 14px; }
.form-sub { font-size: 13px; margin: 20px 0 6px; color: var(--ink-2); }

/* ---------- v3: sociedades ---------- */
.matrix th.rot { vertical-align: bottom; height: 120px; white-space: nowrap; padding: 4px 6px; }
.matrix th.rot span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 112px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.matrix { width: auto; min-width: 50%; }
.matrix th.rot { text-align: center; }
.matrix td.cell { text-align: center; min-width: 56px; }
.matrix td.cell .badge { margin: 1px; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.entity-grid .card { margin: 0; }
.people { list-style: none; margin: 10px 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.people li > span:first-child { flex: 1; min-width: 0; }
.people li b { font-size: 12px; }

/* ---------- v3: fotos ---------- */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row .field { margin: 0; }
.form-row .grow { flex: 1 1 260px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-grid figure { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.photo-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eeebe5; border-radius: 6px; }
.photo-grid figure img { border-radius: 0; }
.photo-grid figcaption { padding: 6px 8px; font-size: 12px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }

/* ---------- v3: pendientes ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.urgente { box-shadow: inset 3px 0 0 var(--red); padding-left: 10px; }
.task.importante { box-shadow: inset 3px 0 0 var(--amber); padding-left: 10px; }
.task.done .task-body a { text-decoration: line-through; color: var(--muted); }
.task-body { flex: 1; min-width: 0; }
.task-body .sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.check-btn { width: 20px; height: 20px; border: 1.5px solid var(--line-2); border-radius: 5px; background: var(--surface); cursor: pointer; font-size: 12px; line-height: 1; color: var(--green); padding: 0; margin-top: 1px; }
.check-btn:hover { border-color: var(--green); background: var(--green-soft); }
.warn-text { color: var(--amber); }
.mini-bars { list-style: none; margin: 0; padding: 0; }
.mini-bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.mini-bars li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head.pad { padding: 14px 16px 0; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 380px; }
.chip-row.small .badge { font-size: 10.5px; }

@media (max-width: 1100px) { .obra-status .os-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .obra-status .os-grid { grid-template-columns: minmax(0, 1fr); } .mini-bars li { grid-template-columns: minmax(0, 1fr) 80px auto; } }
@media print { .check-btn, .form-row { display: none; } }

.inline-search { display: flex; gap: 8px; margin: 0 0 14px; max-width: 520px; }
.inline-search input { flex: 1; }

/* ---------- v4: equity JF ---------- */
.eq-bars { list-style: none; margin: 0; padding: 0; }
.eq-bars li { display: grid; grid-template-columns: minmax(0, 150px) 1fr auto; gap: 12px; align-items: center; padding: 5px 0; }
.eq-bars li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-bars b { font-size: 12.5px; white-space: nowrap; }
.eq-track { position: relative; height: 16px; background: #f0ece5; border-radius: 6px; overflow: hidden; }
.eq-track span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.eq-end { background: #cfe0d6; }
.eq-now { background: var(--accent); z-index: 1; height: 8px !important; top: 4px !important; }
.legend .sw { display: inline-block; width: 12px; height: 8px; border-radius: 3px; vertical-align: middle; margin: 0 3px 0 10px; }
.sw-now { background: var(--accent); } .sw-end { background: #cfe0d6; }
@media (max-width: 640px) { .eq-bars li { grid-template-columns: 1fr; gap: 3px; } }

.kpis.kpis-5{grid-template-columns:repeat(5,minmax(0,1fr))}
@media (max-width:1100px){.kpis.kpis-5{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:640px){.kpis.kpis-5{grid-template-columns:repeat(2,minmax(0,1fr))}}
.kpi.kpi-hero{border-color:var(--accent,#9a7b4f);box-shadow:inset 0 0 0 1px var(--accent,#9a7b4f)}

/* Mostrar / ocultar contraseña */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--ink); background: var(--accent-soft); outline: none; }

/* Fotos y videos */
.subtabs { display: flex; gap: 6px; margin: 0 0 14px; }
.subtabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: 13.5px; background: var(--surface); }
.subtabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.subtabs .count { opacity: .7; margin-left: 4px; }
.video-grid video { width: 100%; aspect-ratio: 16 / 9; background: #111; border-radius: 10px; display: block; object-fit: contain; }
.upload-progress { margin-top: 12px; }
.upload-progress .bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* CRM · conversación con leads */
.thread { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; max-height: 560px; overflow-y: auto; }
.thread .msg { display: block; max-width: 82%; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--line); }
.msg-in { align-self: flex-start; background: #f6f3ee; }
.msg-out { align-self: flex-end; background: var(--accent-soft); border-color: #ead9bd; }
.thread .msg > div { display: block; }
.msg-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.msg-subj { font-weight: 600; margin-bottom: 3px; }
.thread-form { border-top: 1px solid var(--line); padding-top: 14px; }
textarea.code { width: 100%; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f6f3ee; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
@media (max-width: 700px) { .msg { max-width: 100%; } }
