/* ==========================================================================
   Atalaya · Sistema de cotizaciones — sistema de diseño
   Claro / oscuro · menú adaptable · tarjetas en móvil · gráficos validados
   ========================================================================== */

/* ---------- Tokens: modo claro ---------- */
:root {
  color-scheme: light;
  --bg: #f3f5fa;
  --glow: rgba(37, 99, 235, .09);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --ink: #0b1324;
  --ink-2: #46536b;
  --ink-3: #687489;
  --line: #e3e8f1;
  --line-2: #cfd7e4;
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-soft: #eaf1ff;
  --brand-soft-2: #d7e4ff;
  --cyan: #06b6d4;
  --on-brand: #ffffff;

  --good: #0e7a3a;  --good-bg: #e6f6ec;  --good-dot: #16a34a;
  --warn: #9a5b00;  --warn-bg: #fff3d6;  --warn-dot: #f59e0b;
  --bad: #b4232c;   --bad-bg: #fde8e9;   --bad-dot: #dc2626;
  --info: #1d4ed8;  --info-bg: #e4edff;  --info-dot: #2563eb;
  --neu: #46536b;   --neu-bg: #edf1f7;   --neu-dot: #94a3b8;

  /* gráficos (validados con el script de dataviz sobre #ffffff) */
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --grid: #e7ebf2;
  --axis: #c9d1de;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -10px rgba(16, 24, 40, .14);
  --shadow-lg: 0 28px 60px -18px rgba(16, 24, 40, .35);
  --ring: 0 0 0 4px rgba(37, 99, 235, .18);

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --side-w: 264px; --side-w-mini: 78px; --top-h: 64px;
  --pad: clamp(16px, 2.4vw, 40px);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- Tokens: modo oscuro (seleccionados, no invertidos) ---------- */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #070b14; --glow: rgba(79, 140, 255, .13);
    --surface: #121a2b; --surface-2: #0f1626; --surface-3: #1a2439;
    --ink: #e8edf7; --ink-2: #b3bdd1; --ink-3: #8b97ad;
    --line: #222d44; --line-2: #2f3c58;
    --brand: #4f8cff; --brand-600: #3b7bff; --brand-700: #2f6df0;
    --brand-soft: rgba(79, 140, 255, .14); --brand-soft-2: rgba(79, 140, 255, .24);
    --good: #4ade80; --good-bg: rgba(74, 222, 128, .12); --good-dot: #22c55e;
    --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .13); --warn-dot: #f59e0b;
    --bad: #ff7b7b;  --bad-bg: rgba(255, 123, 123, .13); --bad-dot: #ef4444;
    --info: #8db4ff; --info-bg: rgba(79, 140, 255, .16); --info-dot: #4f8cff;
    --neu: #b3bdd1;  --neu-bg: rgba(148, 163, 184, .14); --neu-dot: #8b97ad;
    --chart-1: #3987e5; --chart-2: #d95926; --grid: #1f2a40; --axis: #33415e;
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02), 0 10px 30px -18px rgba(0,0,0,.7);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8); --ring: 0 0 0 4px rgba(79, 140, 255, .28);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14; --glow: rgba(79, 140, 255, .13);
  --surface: #121a2b; --surface-2: #0f1626; --surface-3: #1a2439;
  --ink: #e8edf7; --ink-2: #b3bdd1; --ink-3: #8b97ad;
  --line: #222d44; --line-2: #2f3c58;
  --brand: #4f8cff; --brand-600: #3b7bff; --brand-700: #2f6df0;
  --brand-soft: rgba(79, 140, 255, .14); --brand-soft-2: rgba(79, 140, 255, .24);
  --good: #4ade80; --good-bg: rgba(74, 222, 128, .12); --good-dot: #22c55e;
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .13); --warn-dot: #f59e0b;
  --bad: #ff7b7b;  --bad-bg: rgba(255, 123, 123, .13); --bad-dot: #ef4444;
  --info: #8db4ff; --info-bg: rgba(79, 140, 255, .16); --info-dot: #4f8cff;
  --neu: #b3bdd1;  --neu-bg: rgba(148, 163, 184, .14); --neu-dot: #8b97ad;
  --chart-1: #3987e5; --chart-2: #d95926; --grid: #1f2a40; --axis: #33415e;
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255,255,255,.02), 0 10px 30px -18px rgba(0,0,0,.7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8); --ring: 0 0 0 4px rgba(79, 140, 255, .28);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--font);
  font-size: clamp(14px, .3vw + 13px, 15.5px); line-height: 1.55;
  background: radial-gradient(1100px 420px at 75% -220px, var(--glow), transparent 70%), var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0 0 .6em; }
svg { flex-shrink: 0; }
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft-2); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); }
.skip:focus { left: 8px; }
.num, .tnum, td.r, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .86em; }
.nowrap { white-space: nowrap; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ==========================================================================
   Estructura: menú lateral + columna principal
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
html.side-mini .shell { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: 60; width: var(--side-w);
  display: flex; flex-direction: column; gap: 6px; padding: 16px 14px 14px; color: #c8d3e6;
  background:
    radial-gradient(520px 260px at -20% -8%, rgba(37, 99, 235, .38), transparent 62%),
    radial-gradient(360px 240px at 130% 4%, rgba(6, 182, 212, .16), transparent 60%),
    linear-gradient(180deg, #0c1428 0%, #090f1e 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  transition: width .22s ease, transform .25s ease;
  overflow: hidden auto; scrollbar-width: thin; scrollbar-color: #263553 transparent;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; color: #fff; text-decoration: none !important; }
.brand-plate { display: grid; place-items: center; background: #fff; border-radius: 14px; padding: 7px 10px; height: 56px; width: 100%; box-shadow: 0 10px 30px -12px rgba(37, 99, 235, .6); transition: all .22s ease; }
.brand-plate img { height: 42px; width: auto; display: block; }
.brand-plate .brand-fallback { font-weight: 800; color: #0b1324; }
.sb-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #6a7a98; font-weight: 700; padding: 14px 12px 6px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: 12px; color: #a9b6cf; font-weight: 550; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { color: #fff; background: linear-gradient(90deg, rgba(59, 130, 246, .32), rgba(59, 130, 246, .08)); box-shadow: inset 0 0 0 1px rgba(99, 155, 255, .22); }
.nav-item.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(#38bdf8, #2563eb); box-shadow: 0 0 14px #38bdf8; }
.nav-item .pill { margin-left: auto; font-size: 11.5px; font-weight: 700; background: rgba(255, 255, 255, .1); color: #dbe6ff; border-radius: 99px; padding: 1px 8px; }
.sb-cta {
  margin: 14px 0 6px; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  border-radius: 14px; color: #fff !important; font-weight: 700; text-decoration: none !important; white-space: nowrap;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%); box-shadow: 0 12px 28px -12px rgba(14, 165, 233, .8);
  transition: transform .15s, box-shadow .15s;
}
.sb-cta:hover { transform: translateY(-1px); box-shadow: 0 16px 32px -12px rgba(14, 165, 233, .9); }
.sb-cta svg { width: 18px; height: 18px; }
.sb-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sb-company { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sb-company .dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); flex-shrink: 0; }
.sb-company .txt { min-width: 0; line-height: 1.25; }
.sb-company b { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-company small { color: #7d8ba6; font-size: 11.5px; }
.sb-collapse { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .04); color: #9fb0cc; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.sb-collapse:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sb-collapse svg { width: 18px; height: 18px; }

/* Riel compacto (tablet, o escritorio contraído) */
html.side-mini:not(.menu-abierto) .sidebar { width: var(--side-w-mini); padding-inline: 12px; }
html.side-mini:not(.menu-abierto) .sidebar :is(.sb-label, .nav-item span, .nav-item .pill, .sb-cta span, .sb-company .txt) { display: none; }
html.side-mini:not(.menu-abierto) .brand { justify-content: center; padding-inline: 0; }
html.side-mini:not(.menu-abierto) .brand-plate { width: 52px; height: 52px; padding: 4px; border-radius: 14px; overflow: hidden; }
html.side-mini:not(.menu-abierto) .brand-plate img { height: 44px; width: 44px; object-fit: cover; object-position: 2px center; }
html.side-mini:not(.menu-abierto) .nav-item { justify-content: center; padding: 0; }
html.side-mini:not(.menu-abierto) .nav-item.on::before { left: -12px; }
html.side-mini:not(.menu-abierto) .sb-cta { width: 52px; height: 52px; margin-inline: auto; border-radius: 16px; }
html.side-mini:not(.menu-abierto) .sb-foot { flex-direction: column; padding-inline: 0; }
html.side-mini:not(.menu-abierto) .sb-collapse svg { transform: scaleX(-1); }
/* Globo con el nombre en el riel */
html.side-mini:not(.menu-abierto) .sidebar [data-tip] { position: relative; }
.tip-flotante {
  position: fixed; z-index: 90; pointer-events: none; background: #0b1324; color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateX(-4px); transition: opacity .12s, transform .12s;
}
.tip-flotante.visible { opacity: 1; transform: none; }

.scrim { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 var(--pad); border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
}
.tb-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; margin-right: auto; }
.tb-crumb { font-size: 12px; color: var(--ink-3); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-page { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search {
  display: flex; align-items: center; gap: 10px; height: 42px; width: clamp(220px, 26vw, 400px); padding: 0 8px 0 14px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink-3); font: inherit; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.tb-search:hover { border-color: var(--brand); box-shadow: var(--ring); }
.tb-search svg { width: 18px; height: 18px; }
.tb-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 600 11.5px/1 var(--font); color: var(--ink-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 4px 6px; background: var(--surface-2); white-space: nowrap; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all .15s; flex-shrink: 0; padding: 0;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.icon-btn svg { width: 19px; height: 19px; }
.only-compact { display: none; }
.theme-ico-dark { display: none; }
:root[data-theme="dark"] .theme-ico-dark { display: inline; } :root[data-theme="dark"] .theme-ico-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-ico-dark { display: inline; } :root:not([data-theme="light"]) .theme-ico-light { display: none; } }

/* Menú de usuario */
.user-menu > summary { list-style: none; cursor: pointer; border-radius: 12px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-btn .avatar { width: 42px; height: 42px; border-radius: 12px; }
.menu-who { display: flex; align-items: center; gap: 10px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-who .avatar { width: 36px; height: 36px; font-size: 13px; }
.menu-who b { display: block; font-size: 14px; } .menu-who small { color: var(--ink-3); font-size: 12px; }

/* ---------- Pantalla de acceso (login / instalación) ---------- */
body.auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; background: radial-gradient(700px 380px at 15% 0%, rgba(37, 99, 235, .45), transparent 60%), radial-gradient(520px 320px at 100% 100%, rgba(6, 182, 212, .22), transparent 60%), linear-gradient(160deg, #0c1428 0%, #070b14 100%); }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .75); padding: clamp(24px, 5vw, 38px); animation: pop .3s ease; }
.auth-card.ancha { width: min(680px, 100%); }
.auth-logo { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 10px; margin-bottom: 22px; border: 1px solid var(--line); }
.auth-logo img { height: 54px; }
.auth-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-3); margin-bottom: 22px; }
.auth-card form { display: grid; gap: 16px; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, .55); }
.auth-foot svg { width: 14px; height: 14px; vertical-align: -2px; }
.btn-google { background: #fff; color: #1f1f1f !important; border: 1px solid #dadce0; font-weight: 600; }
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(60, 64, 67, .3); }
.btn-google svg { width: 20px; height: 20px; }
.sep-o { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-3); font-size: 13px; }
.sep-o::before, .sep-o::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 48px !important; }
.pass-wrap button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 38px; border: 0; background: none; color: var(--ink-3); border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.pass-wrap button:hover { color: var(--brand); background: var(--surface-3); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.check-list li { display: flex; gap: 8px; align-items: center; }
.check-list svg { width: 16px; height: 16px; }
.check-list .ok { color: var(--good); } .check-list .no { color: var(--bad); }

/* ---------- Contenido ---------- */
.content { width: 100%; max-width: 1720px; margin-inline: auto; padding: clamp(18px, 2.2vw, 34px) var(--pad) 64px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: clamp(16px, 2vw, 26px); }
.page-head h1 { font-size: clamp(22px, 1.1vw + 16px, 31px); font-weight: 800; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 6px; font-size: .97em; }
.page-head .back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.page-head .back svg { width: 16px; height: 16px; }
.page-head .back:hover { color: var(--brand); text-decoration: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(16px, 1.4vw, 24px); min-width: 0; }
.card + .card { margin-top: clamp(14px, 1.2vw, 20px); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 16.5px; font-weight: 750; display: flex; align-items: center; gap: 10px; }
.card-h .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; font-weight: 450; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-h { padding: clamp(16px, 1.4vw, 22px) clamp(16px, 1.4vw, 24px) 0; }
.step { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--brand); background: var(--brand-soft); flex-shrink: 0; }
.ico-tile { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.ico-tile svg { width: 20px; height: 20px; }
.grid-auto { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.stack > * + * { margin-top: clamp(14px, 1.2vw, 20px); }

/* ---------- Botones ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 11px; border: 1px solid transparent; font: 650 14.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--brand) 0%, var(--brand-600) 100%); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 20px -10px var(--brand); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 12px 26px -10px var(--brand); transform: translateY(-1px); }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { color: var(--bad); background: var(--bad-bg); }
.btn-danger:hover { filter: brightness(.97); box-shadow: 0 0 0 1px var(--bad) inset; }
.btn-success { color: #fff; background: linear-gradient(180deg, #16a34a, #15803d); }
.btn-wa { color: #fff; background: linear-gradient(180deg, #22c55e, #16a34a); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
@media (pointer: coarse) { .btn { min-height: 46px; } .btn-sm { min-height: 40px; } .btn-icon.btn-sm { width: 40px; } }

/* Menú desplegable simple (<details>) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s ease; }
.menu-panel form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--ink); font: 550 14px var(--font); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu-item svg { width: 18px; height: 18px; color: var(--ink-3); }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--bad); } .menu-item.danger svg { color: var(--bad); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea, .ctl {
  width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface);
  color: var(--ink); font: 450 15px/1.4 var(--font); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.field select, select.ctl { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea.ctl, .field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .ctl:focus, .input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field input::placeholder, .field textarea::placeholder, .ctl::placeholder { color: var(--ink-3); opacity: .75; }
.field input[type="date"] { min-height: 44px; }
.field input[type="file"] { font: inherit; color: var(--ink-2); }
.field input[type="file"]::file-selector-button { font: 600 13.5px var(--font); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); padding: 9px 14px; border-radius: 10px; margin-right: 12px; cursor: pointer; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: auto; } }
.affix { position: relative; display: flex; align-items: center; }
.affix > i { position: absolute; left: 12px; font-style: normal; color: var(--ink-3); font-weight: 600; pointer-events: none; }
.affix > i.r { left: auto; right: 12px; }
.affix input { padding-left: 26px !important; }
.affix.suf input { padding-left: 13px !important; padding-right: 30px !important; }

/* Interruptor (checkbox) */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 550; color: var(--ink); user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex-shrink: 0; transition: background .18s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { box-shadow: var(--ring); outline: none; }

/* Control segmentado (radios) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; }
.seg label { position: relative; display: grid; place-items: center; text-align: center; min-height: 40px; padding: 6px 8px; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--ink-2); cursor: pointer; line-height: 1.2; transition: all .15s; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12), 0 0 0 1px var(--line); }
.seg label:has(input:focus-visible) { box-shadow: var(--ring); }

/* ---------- Estados (siempre ícono + texto) ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.st svg { width: 14px; height: 14px; }
.st-borrador { color: var(--neu); background: var(--neu-bg); }
.st-enviada { color: var(--info); background: var(--info-bg); }
.st-aceptada { color: var(--good); background: var(--good-bg); }
.st-rechazada { color: var(--bad); background: var(--bad-bg); }
.st-lg { font-size: 13.5px; padding: 6px 12px 6px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.info { background: var(--info-bg); color: var(--info); }

/* ---------- Avatar ---------- */
.avatar { --h: 220; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 14px; letter-spacing: .02em; color: hsl(var(--h) 70% 34%); background: hsl(var(--h) 85% 93%); }
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 90% 78%); background: hsl(var(--h) 45% 22%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: hsl(var(--h) 90% 78%); background: hsl(var(--h) 45% 22%); } }
.avatar-lg { width: 52px; height: 52px; border-radius: 16px; font-size: 17px; }

/* ---------- Avisos dentro de la página ---------- */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid; font-size: 14px; }
.note svg { width: 20px; height: 20px; margin-top: 1px; }
.note b { display: block; margin-bottom: 2px; }
.note-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.note-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.note-ok { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.note p { margin: 0; color: var(--ink-2); }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: clamp(28px, 5vw, 56px) 20px; color: var(--ink-3); }
.empty .ico-big { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); }
.empty .ico-big svg { width: 30px; height: 30px; }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }

/* ==========================================================================
   Panel de inicio
   ========================================================================== */
.hero-greet h1 { font-size: clamp(24px, 1.4vw + 16px, 34px); }
.kpis { display: grid; gap: clamp(12px, 1.2vw, 18px); grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: clamp(14px, 1.4vw, 22px); }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(14px, 1.3vw, 22px); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 650; }
.kpi-top .ico-tile { width: 36px; height: 36px; border-radius: 11px; }
.kpi-top .ico-tile svg { width: 18px; height: 18px; }
.kpi-val { font-size: clamp(22px, 1.25vw + 13px, 32px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-weight: 700; font-size: 12px; }
.delta svg { width: 13px; height: 13px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--ink-2); background: var(--surface-3); }
.kpi.hero { background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #0891b2 120%); border-color: transparent; color: #fff; box-shadow: 0 18px 40px -20px rgba(37, 99, 235, .9); }
.kpi.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 65%); }
.kpi.hero .kpi-top { color: rgba(255, 255, 255, .86); }
.kpi.hero .ico-tile { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi.hero .kpi-foot { color: rgba(255, 255, 255, .8); }
.kpi.hero .delta { background: rgba(255, 255, 255, .18); color: #fff; }
.meter { height: 8px; border-radius: 99px; background: var(--brand-soft-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

.dash-grid { display: grid; gap: clamp(14px, 1.2vw, 20px); grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); align-items: start; }
.dash-grid > * { min-width: 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 550; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.chart { position: relative; width: 100%; min-height: 260px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tick { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .bar { transition: opacity .15s; }
.chart .bar.s1 { fill: var(--chart-1); } .chart .bar.s2 { fill: var(--chart-2); }
.chart .lbl-val { fill: var(--ink); font-size: 11.5px; font-weight: 700; font-family: var(--font); }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: var(--brand-soft); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 170px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 12.5px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.chart-tip.visible { opacity: 1; transform: none; }
.chart-tip .t-mes { color: var(--ink-3); font-weight: 650; margin-bottom: 6px; text-transform: capitalize; }
.chart-tip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .t-row b { font-size: 14px; color: var(--ink); }
.chart-tip .t-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip .t-key i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
details.tabla-datos { margin-top: 10px; }
details.tabla-datos summary { cursor: pointer; color: var(--ink-3); font-size: 13px; font-weight: 600; }
details.tabla-datos table { margin-top: 10px; }

.pipeline-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: 4px 0 18px; }
.pipeline-bar span { display: block; height: 100%; }
.pipe-list { display: flex; flex-direction: column; gap: 4px; }
.pipe-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: inherit; text-decoration: none !important; }
.pipe-row:hover { background: var(--surface-2); }
.pipe-row .n { margin-left: auto; text-align: right; line-height: 1.25; }
.pipe-row .n b { display: block; font-variant-numeric: tabular-nums; }
.pipe-row .n small { color: var(--ink-3); font-size: 12px; }

.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); border-radius: 12px; }
.list-row .main { min-width: 0; flex: 1; }
.list-row .main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .main small { color: var(--ink-3); }
.list-row .end { text-align: right; }
.quick { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quick a { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 650; font-size: 13.5px; text-decoration: none !important; transition: all .15s; }
.quick a:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick a .ico-tile { width: 36px; height: 36px; }

/* ==========================================================================
   Tablas
   ========================================================================== */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tbody tr[data-href] { cursor: pointer; transition: background .12s; }
.tbl tbody tr[data-href]:hover td { background: var(--surface-2); }
.tbl .c-num a { font-weight: 750; color: var(--ink); }
.tbl .c-num a:hover { color: var(--brand); }
.cli-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cli-cell .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12.5px; }
.cli-cell b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 280px; }
.tbl .total { font-weight: 750; font-size: 15px; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; flex-wrap: wrap; }
.tbl-foot b { color: var(--ink); font-size: 15px; }

/* Barra de herramientas de lista */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--line); }
.searchbox { position: relative; flex: 1 1 260px; max-width: 460px; }
.searchbox svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.searchbox input { width: 100%; min-height: 42px; padding: 9px 12px 9px 40px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); color: var(--ink); font: 450 14.5px var(--font); }
.searchbox input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px; color: var(--ink-2); font-weight: 650; font-size: 13.5px; white-space: nowrap; text-decoration: none !important; border: 1px solid transparent; }
.tab:hover { background: var(--surface-3); color: var(--ink); }
.tab.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft-2); }
.tab .count { font-size: 11.5px; font-weight: 750; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); }
.tab.on .count { background: var(--brand); color: #fff; }

/* ==========================================================================
   Vista de cotización (documento)
   ========================================================================== */
.view-grid { display: grid; gap: clamp(14px, 1.4vw, 24px); grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.view-side { position: sticky; top: calc(var(--top-h) + 18px); display: flex; flex-direction: column; gap: 14px; }
.view-side .card + .card { margin-top: 0; }
.total-big { font-size: clamp(28px, 1.8vw + 16px, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.estado-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.estado-btn { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 650 13.5px var(--font); cursor: pointer; transition: all .15s; }
.estado-btn svg { width: 17px; height: 17px; }
.estado-btn:hover { border-color: var(--brand); color: var(--ink); }
.estado-btn.on.st-borrador { border-color: var(--neu-dot); background: var(--neu-bg); color: var(--neu); }
.estado-btn.on.st-enviada { border-color: var(--info-dot); background: var(--info-bg); color: var(--info); }
.estado-btn.on.st-aceptada { border-color: var(--good-dot); background: var(--good-bg); color: var(--good); }
.estado-btn.on.st-rechazada { border-color: var(--bad-dot); background: var(--bad-bg); color: var(--bad); }
.kv { display: flex; flex-direction: column; gap: 10px; }
.kv-row { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-2); font-size: 14px; min-width: 0; }
.kv-row svg { width: 17px; height: 17px; margin-top: 2px; color: var(--ink-3); }
.kv-row a, .kv-row span { min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 28px; font-size: 13.5px; color: var(--ink-2); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.timeline li::after { content: ""; position: absolute; left: 10.5px; top: 20px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline li b { color: var(--ink); display: block; font-weight: 650; }
.timeline li.gris::before { background: var(--neu-dot); box-shadow: 0 0 0 4px var(--neu-bg); }
.timeline li.ok::before { background: var(--good-dot); box-shadow: 0 0 0 4px var(--good-bg); }
.timeline li.mal::before { background: var(--bad-dot); box-shadow: 0 0 0 4px var(--bad-bg); }

/* Hoja (se ve como el PDF, siempre clara) */
.paper-wrap { background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(148, 163, 184, .05) 12px 24px), var(--surface-3); border-radius: var(--r-xl); padding: clamp(10px, 2.4vw, 34px); border: 1px solid var(--line); }
.paper { color-scheme: light; --p-ink: #0f172a; --p-mut: #64748b; --p-line: #e2e8f0; max-width: 940px; margin: 0 auto; background: #fff; color: var(--p-ink); border-radius: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 24px 60px -24px rgba(15, 23, 42, .45); padding: clamp(18px, 4vw, 52px); font-size: 14px; }
.paper .pp-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 2px solid #0f172a; }
.paper .pp-logo { height: 54px; width: auto; display: block; margin-bottom: 10px; }
.paper .pp-emp b { font-size: 16px; display: block; }
.paper .pp-emp div { color: var(--p-mut); font-size: 12.5px; line-height: 1.6; }
.paper .pp-num { text-align: right; }
.paper .pp-num .lbl { color: #1d4ed8; font-weight: 800; font-size: clamp(18px, 2vw, 24px); letter-spacing: .04em; }
.paper .pp-num .n { font-weight: 800; font-size: 17px; }
.paper .pp-num div { color: var(--p-mut); font-size: 12.5px; }
.paper .pp-cli { margin: 22px 0; padding: 14px 16px; border: 1px solid var(--p-line); border-radius: 10px; background: #f8fafc; }
.paper .pp-cli small { color: var(--p-mut); letter-spacing: .1em; font-weight: 700; font-size: 11px; }
.paper .pp-cli b { display: block; font-size: 15px; margin: 2px 0; }
.paper .pp-cli div { color: #334155; font-size: 13px; }
.paper table.pp-items { width: 100%; border-collapse: collapse; }
.paper .pp-items th { background: #0f172a; color: #fff; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; text-align: left; }
.paper .pp-items th.r, .paper .pp-items td.r { text-align: right; }
.paper .pp-items td { padding: 12px; border-bottom: 1px solid var(--p-line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.paper .pp-items tr:nth-child(even) td { background: #f8fafc; }
.paper .pp-desc { display: flex; align-items: center; gap: 12px; }
.paper .pp-desc img { width: 54px; height: 54px; object-fit: contain; border: 1px solid var(--p-line); border-radius: 8px; background: #fff; flex-shrink: 0; }
.paper .pp-desc a { font-size: 12px; color: #1d4ed8; }
.paper .pp-mob { display: none; }
.paper .pp-tot { margin: 18px 0 0 auto; width: min(100%, 340px); }
.paper .pp-tot div { display: flex; justify-content: space-between; padding: 6px 2px; color: #334155; font-variant-numeric: tabular-nums; }
.paper .pp-tot .fin { margin-top: 6px; padding: 12px 14px; border-radius: 8px; background: #1d4ed8; color: #fff; font-weight: 800; font-size: 16px; }
.paper .pp-aviso { margin-top: 24px; padding: 14px 16px; border: 1px solid #f59e0b; border-left-width: 5px; border-radius: 8px; background: #fffbeb; color: #78350f; font-size: 13px; }
.paper .pp-aviso b { color: #92400e; display: block; margin-bottom: 4px; letter-spacing: .03em; }
.paper .pp-blk { margin-top: 18px; font-size: 13.5px; }
.paper .pp-blk b { display: block; margin-bottom: 4px; }
.paper .pp-blk div { color: #475569; }

/* ==========================================================================
   Editor de cotización
   ========================================================================== */
.editor-grid { display: grid; gap: clamp(14px, 1.4vw, 24px); grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.editor-main { min-width: 0; container-type: inline-size; }
.editor-side { position: sticky; top: calc(var(--top-h) + 18px); }
.serv-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; margin-bottom: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.serv-bar > span { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-right: 4px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--brand-soft-2); background: var(--brand-soft); color: var(--brand); font: 650 13px var(--font); cursor: pointer; transition: all .15s; }
.chip-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-btn svg { width: 15px; height: 15px; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.li-head, .li { display: grid; grid-template-columns: 30px minmax(0, 1fr) 92px 148px 118px 42px; gap: 10px; align-items: start; }
.li-head { padding: 0 12px 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }
/* Escritorio: cada parte en su columna (los botones viven en .li-acts, que no genera caja) */
.li > * { grid-row: 1; }
.li-acts { display: contents; }
.li-move { grid-column: 1; grid-row: 1; }
.li-desc { grid-column: 2; } .li-cant { grid-column: 3; } .li-precio { grid-column: 4; } .li-sub { grid-column: 5; }
.li-del { grid-column: 6; grid-row: 1; }
.li-head .r { text-align: right; }
.li { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .2s; }
.li:hover { border-color: var(--line-2); }
.li:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.li.entra { animation: rise .28s ease; }
.li-move { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.li-btn { width: 30px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer; padding: 0; }
.li-btn:hover { background: var(--surface-3); color: var(--ink); }
.li-btn svg { width: 16px; height: 16px; }
.li-desc { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.li-img { width: 58px; height: 58px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.li textarea, .li input:not([type="hidden"]) { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink); font: 450 14.5px/1.45 var(--font); }
.li textarea { resize: none; overflow: hidden; min-height: 44px; }
.li input { font-variant-numeric: tabular-nums; }
.li textarea:focus, .li input:focus { outline: none; border-color: var(--brand); }
.li .cell-lbl { display: none; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.li-sub { text-align: right; padding-top: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li-del { width: 42px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-3); cursor: pointer; }
.li-del:hover { color: var(--bad); background: var(--bad-bg); }
.li-del svg { width: 18px; height: 18px; }
.add-line { width: 100%; min-height: 50px; margin-top: 12px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: transparent; color: var(--ink-2); font: 650 14.5px var(--font); display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all .15s; }
.add-line:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.add-line svg { width: 18px; height: 18px; }
@container (max-width: 700px) {
  .li-head { display: none; }
  .li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "desc desc" "cant precio" "acts sub"; gap: 12px; }
  .li > * { grid-row: auto; }
  .li .cell-lbl { display: block; }
  .li-desc { grid-area: desc; }
  .li-cant { grid-area: cant; } .li-precio { grid-area: precio; }
  .li-acts { display: flex; align-items: center; gap: 6px; grid-area: acts; }
  .li-move { flex-direction: row; align-items: center; padding-top: 0; gap: 6px; }
  .li-btn { width: 40px; height: 40px; border: 1px solid var(--line); }
  .li-del { width: 40px; height: 40px; border-color: var(--line); }
  .li-sub { grid-area: sub; align-self: center; padding-top: 0; font-size: 15.5px; }
  .li-sub .cell-lbl { display: inline; margin-right: 6px; }
}
.resumen .tot-rows { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 6px; }
.tot-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tot-row.final { margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--line-2); color: var(--ink); font-weight: 800; font-size: 15px; }
.tot-row.final .total-big { font-size: clamp(26px, 1.4vw + 16px, 34px); }
.resumen .btns { display: grid; gap: 8px; margin-top: 16px; }
.savebar { display: none; }

/* ==========================================================================
   Clientes
   ========================================================================== */
.cli-grid { display: grid; gap: clamp(12px, 1.2vw, 18px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.cli-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; min-width: 0; }
.cli-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.cli-card .top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cli-card .top .nm { min-width: 0; flex: 1; }
.cli-card .top b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli-card .top small { color: var(--ink-3); }
.cli-card .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cli-card .stats div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.cli-card .stats small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.cli-card .stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cli-card .foot { display: flex; gap: 8px; margin-top: auto; }
.cli-card .foot form { margin: 0; }

/* ==========================================================================
   Configuración
   ========================================================================== */
.settings { display: grid; gap: clamp(14px, 1.6vw, 28px); grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
.set-nav { position: sticky; top: calc(var(--top-h) + 18px); display: flex; flex-direction: column; gap: 4px; }
.set-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 11px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.set-nav a svg { width: 18px; height: 18px; }
.set-nav a:hover { background: var(--surface-3); color: var(--ink); }
.set-nav a.on { background: var(--brand-soft); color: var(--brand); }
.set-sec { scroll-margin-top: calc(var(--top-h) + 20px); }
.logo-prev { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev .plate { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.logo-prev img { height: 52px; display: block; }
.serv-rows { display: flex; flex-direction: column; gap: 10px; }
.serv-row { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(0, 2fr) 84px 130px 96px; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.serv-row .cell-lbl { display: none; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.serv-row.nueva { border-style: dashed; background: transparent; }
.serv-head { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(0, 2fr) 84px 130px 96px; gap: 10px; padding: 0 12px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.serv-row .pred { display: flex; justify-content: center; }
.savebar-set { position: sticky; bottom: 0; z-index: 20; margin-top: 20px; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 10px; background: linear-gradient(transparent, var(--bg) 35%); }

/* ==========================================================================
   Mercado Libre
   ========================================================================== */
.ml-hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: clamp(22px, 3vw, 40px); color: #fff; background: radial-gradient(500px 240px at 90% 0%, rgba(255, 230, 0, .28), transparent 60%), linear-gradient(135deg, #0c1428 0%, #1e3a8a 60%, #1d4ed8 100%); box-shadow: var(--shadow-lg); }
.ml-hero h2 { font-size: clamp(20px, 1.4vw + 14px, 28px); font-weight: 800; margin-bottom: 8px; }
.ml-hero p { color: rgba(255, 255, 255, .82); max-width: 640px; }
.bookmarklet { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 22px; border-radius: 14px; background: #ffe600; color: #1f2937 !important; font-weight: 800; font-size: 15.5px; text-decoration: none !important; cursor: grab; box-shadow: 0 14px 30px -12px rgba(255, 230, 0, .7); border: 2px dashed rgba(31, 41, 55, .35); }
.bookmarklet:active { cursor: grabbing; }
.steps { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.step-card { padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.step-card .step { margin-bottom: 12px; width: 34px; height: 34px; font-size: 15px; }
.step-card b { display: block; margin-bottom: 4px; }
.step-card p { color: var(--ink-2); margin: 0; font-size: 14px; }
.prod-card { display: grid; gap: 22px; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.prod-img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 16px; background: #fff; border: 1px solid var(--line); padding: 10px; }
.calc-box { display: grid; gap: 8px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.calc-box .tot-row { padding: 4px 0; }

/* ==========================================================================
   Navegación inferior (celular), avisos, búsqueda rápida, ventanas
   ========================================================================== */
.bottom-nav { display: none; }
.toasts { position: fixed; z-index: 120; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.2); }
.toast .ti { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast .ti svg { width: 18px; height: 18px; }
.toast.ok .ti { background: var(--good-bg); color: var(--good); }
.toast.error .ti { background: var(--bad-bg); color: var(--bad); }
.toast .tm { flex: 1; padding-top: 4px; font-weight: 550; font-size: 14px; }
.toast .tx { border: 0; background: none; color: var(--ink-3); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.toast .tx:hover { background: var(--surface-3); }
.toast.sale { animation: toast-out .25s ease forwards; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(5, 10, 20, .55); backdrop-filter: blur(3px); }
.modal { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal[open] { animation: pop .18s ease; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 18px; }
.modal-b { padding: 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 20px 20px; }

.cmdk { width: min(640px, calc(100vw - 24px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk[open] { animation: pop .16s ease; }
.cmdk-in { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.cmdk-in svg { width: 20px; height: 20px; color: var(--ink-3); }
.cmdk-in input { flex: 1; min-height: 60px; border: 0; background: transparent; color: var(--ink); font: 500 17px var(--font); outline: none; }
.cmdk-list { max-height: min(60vh, 460px); overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; padding: 10px 10px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none !important; cursor: pointer; }
.cmdk-item .ico-tile { width: 34px; height: 34px; border-radius: 10px; }
.cmdk-item .ico-tile svg { width: 17px; height: 17px; }
.cmdk-item .t { flex: 1; min-width: 0; }
.cmdk-item .t b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .t small { color: var(--ink-3); }
.cmdk-item.sel, .cmdk-item:hover { background: var(--brand-soft); }
.cmdk-vacio { padding: 26px; text-align: center; color: var(--ink-3); }
.cmdk-pie { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); background: var(--surface-2); flex-wrap: wrap; }

/* ---------- Animaciones ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.content > * { animation: rise .35s ease both; }
.content > *:nth-child(2) { animation-delay: .04s; } .content > *:nth-child(3) { animation-delay: .08s; } .content > *:nth-child(4) { animation-delay: .12s; } .content > *:nth-child(5) { animation-delay: .16s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ==========================================================================
   Adaptación por tamaño de pantalla
   ========================================================================== */
@media (max-width: 1399px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .kpis.k4 { grid-template-columns: 1.3fr 1fr 1fr 1fr; }
}
@media (max-width: 1279px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .view-grid { grid-template-columns: minmax(0, 1fr); }
  .view-side { position: static; order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; }
}
@media (max-width: 1199px) {
  .only-compact { display: inline-grid; }
  html.menu-abierto .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); box-shadow: var(--shadow-lg); }
  html.menu-abierto .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 10, 20, .5); backdrop-filter: blur(2px); animation: rise .2s ease; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: sticky; top: var(--top-h); z-index: 15; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 10px 0; margin: -6px 0 4px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); }
  .serv-head { display: none; }
  .serv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .serv-row .c-desc { grid-column: 1 / -1; }
  .serv-row .cell-lbl { display: block; }
  .serv-row .pred { justify-content: flex-start; }
}
@media (max-width: 767px) {
  :root { --top-h: 58px; }
  .shell, html.side-mini .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); transform: translateX(-105%); }
  html.menu-abierto .sidebar { transform: none; }
  .topbar { gap: 8px; }
  .tb-crumb { display: none; }
  .tb-page { font-size: 16.5px; }
  .tb-search { width: 42px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd, .tb-new { display: none; }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; gap: 8px; }
  .kpi-top { font-size: 12.5px; }
  .kpi-top .ico-tile { display: none; }
  .kpi-val { font-size: clamp(18px, 5.2vw, 24px); }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi.hero .kpi-val { font-size: clamp(26px, 8vw, 34px); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Tablas de cotizaciones → tarjetas */
  .tbl-cot thead { display: none; }
  .tbl-cot, .tbl-cot tbody { display: block; }
  .tbl-cot tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num st" "cli cli" "fecha tot"; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .tbl-cot tbody tr:last-child { border-bottom: 0; }
  .tbl-cot td { display: block; padding: 0; border: 0 !important; background: transparent !important; }
  .tbl-cot .c-num { grid-area: num; } .tbl-cot .c-st { grid-area: st; justify-self: end; }
  .tbl-cot .c-cli { grid-area: cli; } .tbl-cot .c-fecha { grid-area: fecha; color: var(--ink-3); font-size: 13px; align-self: center; }
  .tbl-cot .c-tot { grid-area: tot; text-align: right; }
  .tbl-cot .c-vence, .tbl-cot .c-acc { display: none !important; }
  .tbl-plain thead { display: none; }
  .tbl-plain td { display: block; padding: 4px 16px; border: 0; }
  .tbl-plain tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .toolbar { padding: 12px; }
  .searchbox { max-width: none; }

  /* Documento en celular */
  .paper { font-size: 13.5px; }
  .paper .pp-num { text-align: left; }
  .paper .pp-items thead { display: none; }
  .paper .pp-items, .paper .pp-items tbody, .paper .pp-items tr, .paper .pp-items td { display: block; width: 100%; }
  .paper .pp-items tr { padding: 12px 0; border-bottom: 1px solid var(--p-line); }
  .paper .pp-items td { padding: 0; border: 0; background: transparent !important; }
  .paper .pp-items td.pp-c-cant, .paper .pp-items td.pp-c-precio { display: none; }
  .paper .pp-items td.pp-c-sub { text-align: right; font-weight: 750; margin-top: 4px; }
  .paper .pp-mob { display: block; color: #64748b; font-size: 12.5px; margin-top: 3px; }

  /* Editor: barra fija con total y guardar */
  .savebar { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, .4); }
  .savebar .sb-t { flex: 1; line-height: 1.2; }
  .savebar .sb-t small { color: var(--ink-3); font-size: 12px; display: block; }
  .savebar .sb-t b { font-size: 20px; font-variant-numeric: tabular-nums; }
  body.pagina-editor .bottom-nav { display: none !important; }
  body.pagina-editor .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .resumen .btns { display: none; }

  .prod-card { grid-template-columns: minmax(0, 1fr); }
  .prod-img { max-width: 240px; }
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .modal-f { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1 1 0; padding: 0 10px; }
  .modal-f .btn-ghost { display: none; }
  .cmdk { margin-top: 8px; }
  .toasts { left: 16px; right: 16px; width: auto; bottom: calc(86px + env(safe-area-inset-bottom)); }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-top: 1px solid var(--line);
  }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center; color: var(--ink-3); font-size: 11px; font-weight: 650; text-decoration: none !important; border: 0; background: none; font-family: var(--font); cursor: pointer; padding: 0; }
  .bn-item svg { width: 22px; height: 22px; }
  .bn-item.on { color: var(--brand); }
  .bn-fab { display: grid; place-items: center; width: 56px; height: 56px; margin: -22px auto 2px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #2563eb, #0ea5e9); box-shadow: 0 12px 26px -8px rgba(37, 99, 235, .8), 0 0 0 5px var(--bg); }
  .bn-fab svg { width: 26px; height: 26px; }
}
@media (max-width: 767px) { .hide-sm { display: none !important; } }
@media (max-width: 340px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- App instalada en la pantalla de inicio (iPhone / Android) ----------
   La barra de estado del teléfono (hora, batería) queda sobre la app: la barra superior
   pasa a azul noche y se corre lo justo (env(safe-area-inset-top)). En el navegador no cambia nada. */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top));
    background: linear-gradient(180deg, #0a1122 0%, #0f1b35 100%); border-bottom-color: rgba(255, 255, 255, .08);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .topbar .tb-page { color: #fff; }
  .topbar .tb-crumb { color: #8fa1c2; }
  .topbar .icon-btn, .topbar .tb-search { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .14); color: #dbe6ff; box-shadow: none; }
  .topbar .icon-btn:hover, .topbar .tb-search:hover { border-color: #60a5fa; color: #fff; }
  .topbar kbd { background: transparent; color: #8fa1c2; border-color: rgba(255, 255, 255, .18); }
  .sidebar { padding-top: calc(16px + env(safe-area-inset-top)); }
  .view-side, .editor-side { top: calc(var(--top-h) + env(safe-area-inset-top) + 18px); }
  body.auth { padding-top: calc(24px + env(safe-area-inset-top)); }
}
@media (display-mode: standalone) and (max-width: 1199px) {
  .set-nav { top: calc(var(--top-h) + env(safe-area-inset-top)); }
}

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .toasts, .view-side, .page-head .actions, .savebar, .scrim { display: none !important; }
  .shell { display: block; } body { background: #fff; }
  .paper-wrap { background: none; border: 0; padding: 0; } .paper { box-shadow: none; }
}
