/* NuMetric · estilos */
:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 16px; --r-sm: 11px;
  --accent: #3a46e6; --accent-2: #5b66ff; --accent-soft: #eceefe;
  --good: #11875a; --good-soft: #e3f4ec; --bad: #d23f3a; --bad-soft: #fbe9e8; --warn: #b86e00; --warn-soft: #fbf0dc;
}
[data-theme="light"] {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f1f1ed; --ink: #121317; --ink-2: #4b4d55; --muted: #80828b; --line: #e6e6e1; --line-2: #d8d8d2;
  --hero: #121317; --hero-ink: #f6f6f3; --hero-muted: #a2a4ad; --shadow: 0 1px 2px rgba(18, 19, 23, .04), 0 8px 24px -12px rgba(18, 19, 23, .10);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e0f13; --surface: #16181e; --surface-2: #1e2028; --ink: #f1f1ee; --ink-2: #c1c3ca; --muted: #8b8e98; --line: #262832; --line-2: #33363f;
  --hero: #1d2030; --hero-ink: #f1f1ee; --hero-muted: #9ea1b4; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --accent: #6d78ff; --accent-2: #8a93ff; --accent-soft: #23264a;
  --good: #39c48a; --good-soft: #15302a; --bad: #ff6e66; --bad-soft: #3a1d1e; --warn: #f0a63a; --warn-soft: #382a14;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
body.noscroll { overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; margin-bottom: 4px; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 6px 0; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 14px; } .mt2 { margin-top: 16px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); }
[hidden] { display: none !important; }

/* íconos */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.logo { width: 30px; height: 30px; flex: none; }

/* ---------- estructura ---------- */
#app { min-height: 100vh; }
.view { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; outline: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.sidenav { display: none; }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; font-size: 11px; font-weight: 550; color: var(--muted); text-decoration: none; border-radius: 12px; }
.tabbar a .ic { width: 22px; height: 22px; }
.tabbar a.on { color: var(--accent); }
.tabbar a.on .ic { stroke-width: 2.1; }

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 236px 1fr; }
  .topbar, .tabbar { display: none; }
  .sidenav { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); }
  .sidenav .brand { padding: 0 10px 24px; }
  .sidenav nav { display: grid; gap: 2px; }
  .sidenav a[data-nav] { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--ink-2); text-decoration: none; font-weight: 550; }
  .sidenav a[data-nav]:hover { background: var(--surface-2); color: var(--ink); }
  .sidenav a[data-nav].on { background: var(--accent-soft); color: var(--accent); }
  .side-bottom { margin-top: auto; }
  .view { padding: 34px 40px 60px; width: 100%; }
  h1 { font-size: 32px; }
}

/* ---------- encabezado de vista ---------- */
.vhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.vhead p { max-width: 60ch; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; font-weight: 650; color: var(--accent); margin-bottom: 6px; }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .card + .grid2, .grid2 + .card, .kpis + .card, .kpis + .grid2, .banner + .kpis, .banner + .banner { margin-top: 14px; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } .card { padding: 22px; } }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi.hero { grid-column: 1 / -1; background: var(--hero); color: var(--hero-ink); border-color: transparent; position: relative; overflow: hidden; }
.kpi.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 55%, transparent), transparent); opacity: .7; }
.kpi.hero .lbl { color: var(--hero-muted); }
.kpi .big { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 6px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.hero .big { font-size: 40px; }
.lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.meter { position: relative; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); margin-top: 14px; z-index: 1; }
.meter b { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), #9ba3ff); }
.meter i { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--hero-ink); opacity: .8; border-radius: 2px; }
@media (min-width: 900px) { .kpis { grid-template-columns: 1.4fr 1fr 1fr 1fr; } .kpi.hero { grid-column: auto; } .kpi .big { font-size: 30px; } .kpi.hero .big { font-size: 40px; } }

/* ---------- banners ---------- */
.banner { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; margin-bottom: 14px; }
.banner > .btn { grid-column: 1 / -1; justify-self: start; }
.banner-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.warn-b .banner-ic { background: var(--warn-soft); color: var(--warn); }
@media (min-width: 700px) { .banner { grid-template-columns: auto 1fr auto; } .banner > .btn { grid-column: auto; } }

/* ---------- listas ---------- */
.list { display: grid; margin-top: 8px; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line); text-decoration: none; min-width: 0; }
.li:first-child { border-top: 0; }
a.li:hover .li-main b { color: var(--accent); }
.li-main { flex: 1; min-width: 0; display: grid; }
.li-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-main small { color: var(--muted); font-size: 13px; }
.li-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.li-ic.bad { background: var(--bad-soft); color: var(--bad); } .li-ic.warn { background: var(--warn-soft); color: var(--warn); }
.chev { color: var(--muted); width: 16px; height: 16px; }
.ok-msg { display: flex; gap: 8px; align-items: center; color: var(--good); font-weight: 550; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 13px; font-weight: 650; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }

/* primeros pasos */
.steps { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.steps a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); text-decoration: none; font-weight: 550; }
.steps a .chev { margin-left: auto; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface); border: 1px solid var(--line-2); flex: none; }
.steps .done a { color: var(--muted); text-decoration: line-through; }
.steps .done .n { background: var(--good); border-color: var(--good); color: #fff; }
.steps .done .n .ic { width: 14px; height: 14px; stroke-width: 3; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.98); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px var(--accent); }
.btn.pri:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost-danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.ghost-danger:hover { background: var(--bad-soft); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { color: var(--accent); }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.acts.end { justify-content: flex-end; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- formularios ---------- */
.row { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 560px) { .row.r2 { grid-template-columns: 1fr 1fr; } .row.r3 { grid-template-columns: 1.4fr 1fr 1fr; } }
.f { display: grid; gap: 6px; min-width: 0; }
label, .lbl-b { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lbl-b { display: block; margin-top: 14px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; text-overflow: ellipsis; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:disabled { opacity: .5; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.search { position: relative; margin-bottom: 14px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 42px; border-radius: 14px; }

.switch { display: flex; align-items: center; gap: 12px; margin-top: 16px; cursor: pointer; font-size: 14.5px; font-weight: 550; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; flex: none; transition: background .2s; }
.sw::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, .25); transition: transform .2s; }
.switch input:checked + .sw { background: var(--accent); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }

.chks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chk { cursor: pointer; }
.chk input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chk span { display: inline-block; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 550; color: var(--ink-2); user-select: none; }
.chk input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chk input:focus-visible + span { outline: 2px solid var(--accent); }
.add-tipo { grid-template-columns: 1fr auto !important; align-items: end; }

.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); gap: 2px; margin-top: 10px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- productos ---------- */
.pgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pcard { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.pcard:hover { transform: translateY(-2px); border-color: var(--line-2); }
.pcard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pcard h3 { font-size: 16.5px; }
.pcard-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pcard-nums > div { display: grid; gap: 3px; min-width: 0; }
.pcard-nums b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-nums b.pill { justify-self: start; }
.flag { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
.flag .ic { width: 16px; height: 16px; }

/* editor */
.ed { display: grid; gap: 14px; }
.ed-main { display: grid; gap: 14px; min-width: 0; }
.ed-main > .card + .card { margin-top: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--ink); }
.ed-title { margin: 10px 0 4px; font-size: 24px; word-break: break-word; }
.item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 10px; background: var(--surface); }
.item.s { background: var(--surface-2); }
.item-h { display: flex; align-items: center; gap: 8px; }
.item-h .lc { margin-left: auto; font-weight: 700; font-size: 15px; }
.item-h .icon-btn { width: 32px; height: 32px; margin-right: -6px; }
.kind { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.kind.svc { color: var(--warn); }
.item .row { margin-top: 8px; }
.r-m { grid-template-columns: minmax(0, 1fr) 92px; } .r-s { grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .r-m { grid-template-columns: minmax(0, 1fr) 150px; } }
@media (min-width: 1240px) { .r-s { grid-template-columns: 150px 1fr 1fr 130px; } }
.helper { margin-top: 8px; font-size: 13.5px; }
.helper summary { cursor: pointer; color: var(--accent); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; list-style: none; }
.helper summary::-webkit-details-marker { display: none; }
.helper summary .ic { width: 16px; height: 16px; }
.helper-b { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 10px; border-radius: 12px; background: var(--accent-soft); color: var(--ink-2); }
.helper-b input { width: 76px; min-height: 36px; padding: 6px 8px; font-size: 15px; }
.sticky-acts { display: flex; align-items: center; gap: 10px; }
.sticky-acts .btn { margin-left: auto; }
.mini { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini b { font-size: 16px; white-space: nowrap; }
.dirty { color: var(--warn); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dirty::before { content: "● "; }
.sec-acts { margin-top: 0; }
.item { padding: 10px 12px; }
@media (max-width: 899px) {
  .sticky-acts { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .35); }
}
@media (min-width: 900px) { .mini { display: none; } }
@media (min-width: 900px) {
  .ed { grid-template-columns: minmax(0, 1fr) 370px; align-items: start; }
  .ed-side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; border-radius: var(--r); scrollbar-width: thin; }
}

/* panel de resultado */
.result { background: var(--hero); color: var(--hero-ink); border-color: transparent; }
.result .lbl, .result .muted, .result label { color: var(--hero-muted); }
.result .big { font-size: 42px; font-weight: 750; letter-spacing: -.035em; margin: 4px 0 6px; }
.result .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.result input { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: var(--hero-ink); }
.result input:focus { border-color: var(--accent-2); }
.result .good { color: #4fdb9f; } .result .bad { color: #ff8a83; }
.result .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 16px 0; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.bars { display: grid; gap: 10px; margin-top: 14px; }
.bar-t { display: flex; justify-content: space-between; font-size: 13px; gap: 8px; }
.bar-t span:last-child { color: var(--hero-muted); white-space: nowrap; }
.bar i { display: block; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .1); margin-top: 5px; }
.bar b { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent-2), #a7adff); }
.pr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; margin-top: 12px; }
.mtab { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.mtab button { display: grid; gap: 2px; padding: 8px 4px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .04); color: var(--hero-ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mtab button b { font-size: 12px; font-weight: 500; color: var(--hero-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtab button:hover { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.mtab button.lo { opacity: .55; }
@media (min-width: 420px) { .mtab { grid-template-columns: repeat(7, 1fr); } }
@media (min-width: 900px) { .mtab { grid-template-columns: repeat(4, 1fr); } }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 10px 12px; border-radius: 12px; margin-top: 10px; }
.note .ic { margin-top: 1px; }
.result .note.bad { background: rgba(255, 110, 102, .14); color: #ffb0ab; }
.result .note.good { background: rgba(57, 196, 138, .14); color: #8ce8bf; }
.warn { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(255, 166, 58, .14); color: #ffd394; font-size: 13.5px; }
.warn .ic { flex: none; margin-top: 1px; }
.warn b { color: #fff; }
.result p.small { margin-top: 12px; }

/* compras */
.grid-form { display: grid; gap: 14px; }
.grid-form > .card + .card { margin-top: 0; }
@media (min-width: 900px) { .grid-form { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .grid-form .result { position: sticky; top: 24px; } }

/* tablas → tarjetas en el celular */
.tbl-wrap { margin-top: 6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td small { display: block; font-size: 12.5px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; white-space: nowrap; }
.cost-in { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.cost-in input { width: 96px; min-height: 36px; padding: 6px 8px; text-align: right; font-size: 15px; color: var(--ink); font-weight: 600; }
@media (max-width: 759px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { position: relative; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; }
  .tbl td:first-child { display: block; text-align: left; padding-right: 80px; font-size: 15px; }
  .tbl td:first-child::before { display: none; }
  .tbl td:not([data-l]) { position: absolute; top: 8px; right: 0; width: auto; padding: 0; }
  .tbl td:not([data-l])::before { display: none; }
  .tbl td.n { text-align: right; }
}

/* proveedores */
.provgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.provgrid .card + .card { margin-top: 0; }
.prov-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.prov-h .icon-btn { margin: -6px -8px 0 0; }

/* vacío */
.empty { text-align: center; padding: 36px 16px; }
.empty-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent); }
.empty-ic .ic { width: 26px; height: 26px; }
.empty p { color: var(--muted); max-width: 40ch; margin: 6px auto 16px; }

/* ---------- ventanas ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 11, 15, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.modal.on { opacity: 1; }
.sheet { width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(24px); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
.modal.on .sheet { transform: none; }
.sheet h2 { font-size: 20px; margin-bottom: 6px; }
@media (min-width: 700px) { .modal { align-items: center; padding: 24px; } .sheet { max-width: 520px; border-radius: 22px; padding: 26px; } }

/* onboarding */
.onb { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 70%, rgba(10, 11, 15, .6)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: flex-end; justify-content: center; }
.onb-card { width: 100%; max-height: 96vh; overflow: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: up .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) { .onb { align-items: center; } .onb-card { max-width: 500px; border-radius: 26px; padding: 30px; } }
.dots { display: flex; gap: 6px; margin-bottom: 18px; }
.dots i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.dots i.on, .dots i.past { background: var(--accent); }
.onb-body h2 { font-size: 23px; margin-bottom: 8px; }
.onb-body > p { color: var(--ink-2); font-size: 15.5px; }
.onb-art { height: 150px; border-radius: 20px; margin-bottom: 20px; background: var(--hero); position: relative; overflow: hidden; display: grid; place-items: center; }
.onb-art::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 60%, transparent), transparent); }
.onb-art .logo { width: 64px; height: 64px; position: relative; z-index: 1; }
.onb-figs { position: absolute; left: 18px; bottom: 16px; z-index: 1; display: flex; gap: 8px; }
.onb-figs span { padding: 5px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: var(--hero-ink); font-size: 13px; font-weight: 650; }
.onb-figs .good { color: #4fdb9f; }
.flow { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 14px; }
.flow li { display: flex; gap: 14px; }
.flow .n { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; flex: none; }
.flow p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.choice-b { display: grid; justify-items: start; gap: 4px; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.choice-b .ic { color: var(--accent); margin-bottom: 4px; }
.choice-b small { color: var(--muted); }
.choice-b.on { border-color: var(--accent); background: var(--accent-soft); }

/* activación */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1000px 500px at 80% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.gate-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 30px 24px; box-shadow: var(--shadow); }
.gate-card .logo { width: 48px; height: 48px; margin-bottom: 18px; }
.gate-card h1 { font-size: 26px; margin-bottom: 4px; }
.gate-card form { display: grid; gap: 8px; margin: 18px 0 14px; }
.gate-card input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; font-size: 15px; }
.err { color: var(--bad); font-size: 13.5px; min-height: 1em; margin: 2px 0 6px; }

/* avisos */
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: up .25s ease-out; transition: opacity .4s, transform .4s; border: 0; font-family: inherit; text-align: left; }
.toast.good::before { content: "✓  "; color: #4fdb9f; }
.toast.bad::before { content: "!  "; color: #ff8a83; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast.update { background: var(--accent); color: #fff; cursor: pointer; }
@media (min-width: 900px) { .toasts { bottom: 28px; left: auto; right: 28px; transform: none; } }

.devbar { padding: 4px 12px; background: #f0a63a; color: #1a1300; font-size: 12px; font-weight: 600; text-align: center; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .sidenav, .topbar, .tabbar, .acts, .toasts { display: none !important; } body { background: #fff; } }
