/* LB Enterprise · Finanzas
   Sistema visual: negro profundo, tarjetas con tinte violeta, morado #8D6CE6 como acción,
   rosa #D780D6 y turquesa #7ECED4 como apoyo. Tipografía General Sans. */

:root {
  --bg: #000000;
  --panel: #0C0B11;
  --card: #13111B;
  --card-2: #1A1824;
  --card-3: #221F2E;
  --line: #262334;
  --line-2: #322E43;
  --text: #F4F2F9;
  --muted: #9A96AB;
  --faint: #635F76;
  --purple: #8D6CE6;
  --purple-2: #A58CF0;
  --purple-soft: rgba(141, 108, 230, .14);
  --pink: #D780D6;
  --pink-soft: rgba(215, 128, 214, .14);
  --teal: #7ECED4;
  --teal-soft: rgba(126, 206, 212, .14);
  --danger: #F2849A;
  --danger-soft: rgba(242, 132, 154, .13);
  --warn: #F1C27D;
  --warn-soft: rgba(241, 194, 125, .13);
  --white: #FFFFFF;
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --rail: 88px;
  --font: "General Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.5; font-weight: 400; -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; }
p { margin: 0; }
.ic { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--purple-2); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--purple); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--teal); }
.neg { color: var(--danger); }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 18px 0 20px; gap: 10px;
}
.rail-logo, .rail a.rail-logo {
  width: 52px; height: 52px; border-radius: 18px; background: var(--purple); color: #fff;
  display: grid; place-items: center; margin-bottom: 14px; box-shadow: 0 10px 30px -10px rgba(141,108,230,.8);
}
.rail-logo img { width: 26px; height: auto; }
.rail a.rail-logo:hover { background: var(--purple-2); }
.rail-group {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.rail-group + .rail-group { margin-top: 6px; }
.rail-spacer { flex: 1; }
.rail a, .rail button {
  position: relative; width: 48px; height: 48px; border-radius: 999px; display: grid; place-items: center;
  color: var(--muted); background: none; border: 0; cursor: pointer; transition: background .15s, color .15s;
}
.rail a:hover, .rail button:hover { color: var(--text); background: var(--card-2); }
.rail a.on { color: var(--purple-2); background: var(--card-3); }
.rail .dot {
  position: absolute; top: 7px; right: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--pink); color: #1a0b1a; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; line-height: 1;
}
.rail [data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--card-3); border: 1px solid var(--line-2); color: var(--text); font-size: 13px; padding: 6px 10px;
  border-radius: 10px; white-space: nowrap; z-index: 50; pointer-events: none;
}

.main { min-width: 0; padding: 18px 28px 48px 8px; }
.topbar { display: flex; align-items: center; gap: 14px; min-height: 64px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .brand { display: none; }
.page-head { flex: 1; min-width: 220px; }
.page-head h1 { font-size: 28px; font-weight: 500; }
.page-head p { color: var(--muted); margin-top: 3px; font-size: 14.5px; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; margin-bottom: 4px; }
.crumbs a:hover { color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.head-extra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; position: relative;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn .pip { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 9px; background: var(--pink); box-shadow: 0 0 0 2px var(--panel); }
.user-pill {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; position: relative;
}
.avatar {
  width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--purple), var(--pink)); color: #fff; flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.user-pill .who { line-height: 1.15; }
.user-pill .who b { display: block; font-weight: 500; font-size: 14px; }
.user-pill .who span { font-size: 12px; color: var(--muted); }

/* Menús desplegables */
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 6px; z-index: 60; box-shadow: 0 20px 50px -12px rgba(0,0,0,.8); display: none;
}
.menu.open { display: block; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: 10px;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); font-size: 14px;
}
.menu a:hover, .menu button:hover { background: var(--card-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text);
  font-weight: 500; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s, border-color .15s;
}
.btn:hover { background: var(--card-3); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-2); border-color: var(--purple-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--card-2); }
.btn-ok { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.btn-ok:hover { background: rgba(126,206,212,.24); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(242,132,154,.22); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn.loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 99px; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tarjetas y rejilla ---------- */
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.g-dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr) minmax(0, 1.05fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 22px 20px; min-width: 0; position: relative;
}
.card.flat { background: var(--panel); }
.card.tight { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { font-size: 18px; font-weight: 500; flex: 1; min-width: 0; }
.card-head .sub { font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.round-link {
  width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--text); flex-shrink: 0;
}
.round-link:hover { background: var(--card-3); }

/* Cifra principal */
.big { font-size: 38px; font-weight: 500; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.big .cents { color: var(--faint); }
.mid { font-size: 26px; font-weight: 500; letter-spacing: -.015em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.label { color: var(--muted); font-size: 13.5px; }
.delta {
  display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 500; padding: 3px 8px; border-radius: 99px;
  background: var(--teal-soft); color: var(--teal); vertical-align: middle;
}
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--card-3); color: var(--muted); }

.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.kpi-row .mid { font-size: 22px; margin-top: 2px; }

/* Barra segmentada (como el límite diario de la referencia) */
.seg { display: flex; gap: 5px; height: 8px; margin: 14px 0 10px; }
.seg i { flex: 1; border-radius: 99px; background: var(--card-3); }
.seg i.on { background: var(--purple); }
.seg.pink i.on { background: var(--pink); }
.seg.teal i.on { background: var(--teal); }
.seg.over i.on { background: var(--danger); }
.seg-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.seg-foot b { color: var(--text); font-weight: 500; }

/* Medidor de recuperación: la pieza clave del sistema */
.meter { position: relative; height: 10px; border-radius: 99px; background: var(--card-3); overflow: visible; margin: 12px 0 8px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--purple), var(--pink)); max-width: 100%; }
.meter.done .fill { background: linear-gradient(90deg, var(--purple), var(--teal)); }
.meter .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--white); opacity: .8; }
.meter-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* Pastillas de navegación interna */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.pill:hover { color: var(--text); }
.pill.on { background: var(--card-3); color: var(--text); border-color: var(--line-2); }
.pill .n { font-size: 12px; color: var(--faint); }
.pill.on .n { color: var(--purple-2); }

/* Insignias */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 500; background: var(--card-3); color: var(--muted); white-space: nowrap;
}
.badge.purple { background: var(--purple-soft); color: var(--purple-2); }
.badge.pink { background: var(--pink-soft); color: var(--pink); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.swatch { width: 9px; height: 9px; border-radius: 99px; display: inline-block; flex-shrink: 0; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--card-2);
  border: 1px solid transparent; transition: border-color .15s;
}
a.row-item:hover { border-color: var(--line-2); }
.row-ic {
  width: 42px; height: 42px; border-radius: 99px; display: grid; place-items: center; background: var(--card-3); flex-shrink: 0; color: var(--text);
}
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { font-size: 12.5px; color: var(--muted); }
.row-end { text-align: right; flex-shrink: 0; }
.row-end b { display: block; font-weight: 500; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.row-end span { font-size: 12px; color: var(--muted); }

.divided > * + * { border-top: 1px solid var(--line); }

/* Metas / videos (como "Financial goals") */
.goal { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 14px 0; }
.goal:first-child { padding-top: 0; }
.ring { width: 58px; height: 58px; position: relative; }
.ring svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; }
.goal-t b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-t span { font-size: 12.5px; color: var(--muted); }
.goal-n { text-align: left; min-width: 92px; }
.goal-n span { font-size: 12px; color: var(--muted); display: block; }
.goal-n b { font-weight: 500; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--card-2); }
.tbl td:first-child, .tbl th:first-child { padding-left: 4px; }
.tbl .r { text-align: right; }
.tbl .desc b { font-weight: 500; display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .desc span { color: var(--muted); font-size: 12.5px; }
.tbl tfoot td { font-weight: 500; border-top: 1px solid var(--line-2); border-bottom: 0; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 12.5px; color: var(--faint); }
.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line-2);
  color: var(--text); font-size: 15px; transition: border-color .15s, background .15s; outline: none;
}
.textarea { height: auto; min-height: 96px; padding: 13px 16px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--purple); background: var(--card); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select {
  appearance: none; padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239A96AB' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select option { background: var(--card-2); }
.input-money { position: relative; }
.input-money .input { padding-left: 34px; font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 500; }
.input-money::before { content: "$"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.input-sm { height: 38px; font-size: 14px; border-radius: 11px; padding: 0 12px; }
.select.input-sm { padding-right: 36px; background-position: right 10px center; }
.input-money .input.input-sm { padding-left: 28px; font-size: 14.5px; }
.input-money:has(.input-sm)::before { left: 12px; font-size: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--purple); margin-top: 2px; flex-shrink: 0; }
.seg-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg-toggle input { display: none; }
.seg-toggle label { height: 38px; padding: 0 18px; border-radius: 99px; display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 14px; }
.seg-toggle input:checked + label { background: var(--card-3); color: var(--text); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .input, .filters .select { height: 40px; font-size: 14px; border-radius: 99px; width: auto; min-width: 150px; }
.filters .select { padding-right: 36px; background-position: right 12px center; }
.search-box { position: relative; }
.search-box .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box .input { padding-left: 40px; min-width: 230px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(420px, calc(100vw - 44px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--card-3);
  border: 1px solid var(--line-2); box-shadow: 0 20px 40px -12px rgba(0,0,0,.8); font-size: 14px; animation: toastIn .3s var(--ease);
}
.toast .ic { margin-top: 1px; }
.toast.success .ic { color: var(--teal); }
.toast.error .ic { color: var(--danger); }
.toast.info .ic { color: var(--purple-2); }
.toast button { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; margin-left: auto; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line-2); font-size: 14px; }
.notice .ic { color: var(--purple-2); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); border-color: transparent; }
.notice.warn .ic { color: var(--warn); }
.notice.danger { background: var(--danger-soft); border-color: transparent; }
.notice.danger .ic { color: var(--danger); }
.notice.ok { background: var(--teal-soft); border-color: transparent; }
.notice.ok .ic { color: var(--teal); }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .ic { color: var(--faint); margin: 0 auto 12px; }
.empty b { display: block; color: var(--text); font-weight: 500; font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 120; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  width: 100%; max-width: 620px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--card); border: 1px solid var(--line-2);
  border-radius: 28px; padding: 26px; animation: modalIn .28s var(--ease);
}
.modal.sm { max-width: 440px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 21px; flex: 1; }
.modal-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Registro con IA */
.capture-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; padding: 6px; transition: border-color .15s; }
.capture-box:focus-within { border-color: var(--purple); }
.capture-box textarea { width: 100%; min-height: 110px; border: 0; background: none; resize: none; outline: none; padding: 12px 14px; font-size: 16px; line-height: 1.5; }
.capture-tools { display: flex; align-items: center; gap: 8px; padding: 6px; flex-wrap: wrap; }
.capture-tools .grow { flex: 1; }
.rec-btn.recording { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.rec-dot { width: 8px; height: 8px; border-radius: 9px; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 99px; background: var(--card-3);
  font-size: 13px; max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chip button { width: 22px; height: 22px; border-radius: 99px; border: 0; background: var(--line-2); color: var(--text); cursor: pointer; display: grid; place-items: center; padding: 0; }
.examples { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.examples button {
  text-align: left; background: none; border: 1px dashed var(--line-2); color: var(--muted); padding: 9px 14px; border-radius: 14px; cursor: pointer; font-size: 13.5px;
}
.examples button:hover { color: var(--text); border-color: var(--purple); }
.ai-result { margin-top: 18px; }
.ai-summary { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--purple-soft); margin-bottom: 16px; font-size: 14.5px; }
.ai-summary .ic { color: var(--purple-2); margin-top: 2px; }
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.conf i { width: 44px; height: 5px; border-radius: 9px; background: var(--card-3); position: relative; overflow: hidden; }
.conf i::after { content: ""; position: absolute; inset: 0; width: var(--v); background: var(--teal); border-radius: 9px; }
.field.needs .select, .field.needs .input { border-color: var(--warn); }
.field.needs > label::after { content: "Revisa este dato"; color: var(--warn); font-size: 12px; margin-left: auto; }

/* Comprobantes */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb {
  position: relative; aspect-ratio: 3/4; border-radius: 16px; overflow: hidden; background: var(--card-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: 12.5px; text-align: center; padding: 8px;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb audio, .thumb video { width: 100%; }
.thumb .cap { position: absolute; left: 8px; bottom: 8px; right: 8px; font-size: 11.5px; background: rgba(0,0,0,.65); border-radius: 9px; padding: 3px 7px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb.media { aspect-ratio: auto; min-height: 90px; }
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: 18px; padding: 20px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; font-size: 14px;
}
.dropzone:hover, .dropzone.over { border-color: var(--purple); background: var(--purple-soft); color: var(--text); }
.dropzone input { display: none; }
.dropzone .ic { margin: 0 auto 8px; color: var(--purple-2); }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 150; display: none; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* Detalle clave-valor */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Línea de tiempo */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.tl { display: flex; gap: 12px; font-size: 13.5px; }
.tl i { width: 9px; height: 9px; border-radius: 9px; background: var(--purple); margin-top: 6px; flex-shrink: 0; box-shadow: 0 0 0 4px var(--purple-soft); }
.tl .t { color: var(--faint); font-size: 12px; }

/* Tarjeta de video */
.vcard { display: flex; flex-direction: column; gap: 14px; }
.vthumb { aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: var(--card-2); position: relative; display: grid; place-items: center; color: var(--faint); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vthumb .badge { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.7); color: #fff; }
.vcard h3 { font-size: 16.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vstats span { display: block; font-size: 12px; color: var(--muted); }
.vstats b { font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Presupuesto editable */
.budget-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 170px 38px; gap: 10px; align-items: center; }
.budget-rows { display: flex; flex-direction: column; gap: 10px; }
.budget-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 4px 0; margin-top: 12px; border-top: 1px solid var(--line); }

/* Barras presupuesto vs real */
.cmp { display: flex; flex-direction: column; gap: 14px; }
.cmp-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 7px; }
.cmp-row .top b { font-weight: 500; }
.cmp-bar { height: 8px; border-radius: 99px; background: var(--card-3); position: relative; overflow: hidden; }
.cmp-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }

/* Leyenda de donut */
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 16px; font-size: 13.5px; }
.legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-wrap { position: relative; height: 210px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center span { display: block; color: var(--muted); font-size: 13px; }
.donut-center b { font-weight: 500; font-size: 22px; font-variant-numeric: tabular-nums; }
.chart-box { position: relative; height: 260px; }
.chart-legend { display: flex; gap: 16px; font-size: 13.5px; color: var(--text); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }

/* Selección masiva en revisión */
.review-card { display: grid; grid-template-columns: 26px 110px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px; }
.review-card + .review-card { border-top: 1px solid var(--line); }
.review-thumb { width: 110px; aspect-ratio: 3/4; border-radius: 14px; background: var(--card-2); overflow: hidden; display: grid; place-items: center; color: var(--faint); cursor: zoom-in; position: relative; }
.review-thumb img { width: 100%; height: 100%; object-fit: cover; }
.review-thumb .more { position: absolute; right: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.7); color: #fff; border-radius: 8px; padding: 1px 6px; }
.review-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.review-body .title { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.review-body .title b { font-weight: 500; font-size: 16px; }
.review-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.review-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 130px; }
.review-card.done { opacity: .4; pointer-events: none; }
.bulkbar {
  position: sticky; bottom: 16px; margin-top: 16px; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px;
  border-radius: 999px; background: var(--card-3); border: 1px solid var(--line-2); box-shadow: 0 20px 40px -10px rgba(0,0,0,.8); z-index: 20;
}

/* Paginación */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }

/* Barra inferior móvil */
.tabbar { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 110; display: none; }
.sheet-bg.open { display: block; }
.sheet {
  visibility: hidden; position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 111; background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 26px; padding: 12px; transform: translateY(120%); transition: transform .28s var(--ease);
}
.sheet.open { transform: none; visibility: visible; }
@media (min-width: 861px) { .sheet, .sheet-bg { display: none !important; } }
.sheet a, .sheet button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border-radius: 14px; background: none; border: 0; color: var(--text); font-size: 15px; text-align: left; }
.sheet a:hover { background: var(--card-3); }

/* ---------- Acceso (login / instalación) ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
}
.auth-art {
  position: relative; overflow: hidden; padding: 44px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(141,108,230,.95) 0%, rgba(141,108,230,.55) 35%, transparent 70%),
    radial-gradient(90% 80% at 100% 10%, rgba(255,255,255,.9) 0%, rgba(255,255,255,.2) 35%, transparent 60%),
    radial-gradient(80% 70% at 30% 100%, rgba(215,128,214,.35), transparent 60%),
    #0d0b16;
  border-radius: 0 34px 34px 0;
}
.auth-art .mark { width: 64px; height: auto; }
.auth-art h2 { font-size: clamp(40px, 5.2vw, 76px); font-weight: 500; letter-spacing: -.035em; line-height: .98; color: #0d0b16; max-width: 9ch; }
.auth-art .foot { color: rgba(255,255,255,.75); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 30px; margin-bottom: 6px; }
.auth-card > p { color: var(--muted); margin-bottom: 28px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-card .btn-primary { width: 100%; height: 50px; margin-top: 24px; font-size: 15.5px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap button { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.install { max-width: 760px; margin: 0 auto; padding: 44px 22px 60px; }
.checklist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 14px; }
.checklist div { display: flex; align-items: center; gap: 8px; }

/* Pasos de configuración */
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: var(--muted); padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 99px; background: var(--card-3); color: var(--text); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.steps b, .steps code { color: var(--text); }
code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--panel); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 7px; word-break: break-all;
}
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.st-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.st-val { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; text-align: right; }
.status-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 99px; background: var(--faint); display: inline-block; }
.status-dot.on { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
details.more summary { cursor: pointer; color: var(--purple-2); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 14px; }

/* ---------- Adaptación ---------- */
@media (max-width: 1280px) {
  .g-dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
  .g-dash .col-3 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .g-side { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --rail: 0px; }
  body { font-size: 14.5px; }
  .app { display: block; }
  .rail { display: none; }
  .main { padding: 12px 14px 110px; }
  .topbar { gap: 10px; margin-bottom: 14px; }
  .topbar .brand { display: flex; align-items: center; gap: 10px; flex: 1; }
  .topbar .brand img { width: 36px; height: 36px; padding: 8px; border-radius: 12px; background: var(--purple); }
  .topbar .brand b { font-weight: 500; }
  .page-head { flex-basis: 100%; order: 3; }
  .head-extra { order: 4; flex-basis: 100%; }
  .head-extra .btn { flex: 1; }
  .head-extra .filters, .head-extra .select { width: 100%; }
  .page-head h1 { font-size: 24px; }
  .user-pill .who, .user-pill .ic { display: none; }
  .user-pill { padding: 4px; }
  .top-actions .btn-primary { display: none; }
  .g-dash, .g-2, .g-3, .g-4, .g-dash .col-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .card { padding: 18px 16px; border-radius: 22px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .big { font-size: 32px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .goal { grid-template-columns: 50px minmax(0, 1fr) auto; }
  .goal .goal-n.hide-sm { display: none; }
  .ring, .ring svg { width: 50px; height: 50px; }
  .budget-row { grid-template-columns: minmax(0, 1fr) 38px; }
  .budget-row .select, .budget-row .input-money { grid-column: 1 / 2; }
  .budget-row .input:first-child { grid-column: 1 / 2; }
  .budget-row button { grid-row: 1; grid-column: 2; }
  .review-card { grid-template-columns: 22px 80px minmax(0, 1fr); }
  .review-thumb { width: 80px; }
  .review-actions { grid-column: 1 / -1; flex-direction: row; }
  .review-actions .btn { flex: 1; }
  .review-quick { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { min-height: 260px; border-radius: 0 0 30px 30px; padding: 28px; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 26px 26px 0 0; max-height: 92vh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .toasts { left: 14px; right: 14px; bottom: 96px; max-width: none; }
  .filters .input, .filters .select { flex: 1 1 140px; min-width: 0; }
  .search-box { flex: 1 1 100%; }
  .search-box .input { min-width: 0; width: 100%; }
  .checklist { grid-template-columns: 1fr; }
  .st-row { grid-template-columns: 10px minmax(0, 1fr); }
  .st-val { grid-column: 2; justify-content: flex-start; text-align: left; }
  .bulkbar { bottom: 92px; padding-left: 16px; }
  #bulk-count { font-size: 13px !important; line-height: 1.3; }
  .capture-tools .grow { display: none; }
  #capture-analyze { flex: 1 1 100%; height: 42px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    height: 68px; background: rgba(26,24,36,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line-2); border-radius: 26px; z-index: 90; align-items: center; padding: 0 6px;
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); background: none; border: 0; position: relative; padding: 6px 0;
  }
  .tabbar a.on { color: var(--text); }
  .tabbar .fab { width: 52px; height: 52px; border-radius: 18px; background: var(--purple); color: #fff; display: grid; place-items: center; margin: 0 auto; box-shadow: 0 10px 24px -8px rgba(141,108,230,.9); }
  .tabbar .dot { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 9px; background: var(--pink); color: #1a0b1a; font-size: 10px; font-weight: 600; display: grid; place-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
