/* Estilos de NET Fiber Stock. Tokens y componentes tomados de los bocetos (docs/bocetos). */
/* Layout: sidebar de módulos + barra superior con buscador global; área de venta en dos columnas (líneas | resumen) */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --line: #d9e0e6;
  --fg: #16212b;
  --muted: #5b6b78;
  --side: #0f2430;
  --side-fg: #c9d6de;
  --side-active: #1b3a4a;
  --accent: #0b7a83;
  --accent-soft: #dff1f2;
  --accent-fg: #ffffff;
  --good: #1f7a3f;
  --good-soft: #e1f3e7;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-code: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d151b; --surface: #142028; --surface-2: #1a2933; --line: #26363f;
    --fg: #e4ecf1; --muted: #93a5b1; --side: #091117; --side-fg: #a9bcc7; --side-active: #16303c;
    --accent: #3cb7bf; --accent-soft: #123a3e; --accent-fg: #06191b;
    --good: #5cc883; --good-soft: #143222; --warn: #e3a64a; --warn-soft: #3a2a10; --bad: #f08a80; --bad-soft: #3d1715;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d151b; --surface: #142028; --surface-2: #1a2933; --line: #26363f;
  --fg: #e4ecf1; --muted: #93a5b1; --side: #091117; --side-fg: #a9bcc7; --side-active: #16303c;
  --accent: #3cb7bf; --accent-soft: #123a3e; --accent-fg: #06191b;
  --good: #5cc883; --good-soft: #143222; --warn: #e3a64a; --warn-soft: #3a2a10; --bad: #f08a80; --bad-soft: #3d1715;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 14px; }
.code { font-family: var(--font-code); }
.num { font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-fg); padding-block: 18px; padding-inline: 12px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding-inline: 8px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--side-fg); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6f8794; padding: 10px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.on { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.side-foot { margin-top: auto; font-size: 12px; padding-inline: 10px; color: #6f8794; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding-block: 10px; padding-inline: 20px; }
.gsearch { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; }
.gsearch input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: inherit; padding: 9px 0; outline: none; }
.gsearch:focus-within { border-color: var(--accent); }
.kbd { font-family: var(--font-code); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; }

.page { padding-block: 20px 28px; padding-inline: 20px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; text-wrap: balance; }
.crumb { color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; }
.pill.draft { background: var(--warn-soft); color: var(--warn); }
.pill.isp { background: var(--accent-soft); color: var(--accent); }
.pill.cf { background: var(--surface-2); color: var(--muted); }
.sample { margin-left: auto; font-size: 12px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.header-grid { display: grid; grid-template-columns: 150px 140px minmax(0, 1fr) 160px; gap: 14px; padding: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field .ro { padding: 8px 0; font-weight: 500; }
select, input.inp { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
select:focus, input.inp:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.client-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.scan { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.scan-row { display: flex; gap: 10px; align-items: stretch; }
.scan-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 2px solid var(--accent); border-radius: var(--r); padding: 0 12px; background: var(--surface); }
.scan-box svg { color: var(--accent); flex: none; }
.scan-box input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--fg); font-family: var(--font-code); font-size: 17px; padding: 12px 0; }
.qty-box { width: 92px; }
.qty-box input { text-align: right; font-size: 17px; height: 100%; }
.hint { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-family: var(--font-code); font-size: 12px; border: 1px dashed var(--line); background: var(--surface-2); color: var(--fg); border-radius: 5px; padding: 3px 7px; cursor: pointer; }
.chip:hover, .chip:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.msg { font-size: 13px; padding: 8px 12px; border-radius: 6px; display: flex; gap: 8px; align-items: center; }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.err { background: var(--bad-soft); color: var(--bad); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { text-align: left; font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th.r, td.r { text-align: right; }
tr.flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.prod b { font-weight: 500; display: block; }
.prod small { color: var(--muted); font-size: 12px; }
.serial { font-family: var(--font-code); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.dash { color: var(--muted); }
td input.cell { width: 84px; text-align: right; font: inherit; font-variant-numeric: tabular-nums; color: var(--fg); background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; }
td input.cell.price { width: 110px; }
td input.cell:hover { border-color: var(--line); }
td input.cell:focus { border-color: var(--accent); outline: none; background: var(--surface); }
td input.cell:disabled { color: var(--muted); }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 5px; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--bad); background: var(--bad-soft); outline: none; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

.summary { padding: 16px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; }
.summary h2 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 500; }
.srow { display: flex; justify-content: space-between; gap: 12px; }
.srow span:first-child { color: var(--muted); }
.total { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; display: flex; justify-content: space-between; align-items: baseline; }
.total b { font-size: 24px; font-weight: 600; }
.btn { font: inherit; font-weight: 500; border-radius: var(--r); padding: 11px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary .kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.price-note { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }

.overlay { position: fixed; inset: 0; background: rgba(8, 18, 24, .55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.dialog { background: var(--surface); border-radius: 10px; border: 1px solid var(--line); width: min(480px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dialog h3 { margin: 0; font-size: 17px; }
.dialog p { margin: 0; color: var(--muted); }
.serial-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.serial-opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; text-align: left; }
.serial-opt:hover, .serial-opt:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.serial-opt small { color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn { justify-content: center; }

@media (max-width: 1080px) {
  .header-grid { grid-template-columns: 1fr 1fr; }
  .work { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; overflow-x: auto; padding-block: 10px; gap: 10px; }
  .nav { flex-direction: row; }
  .nav-label, .side-foot, .brand small, .nav a span.txt { display: none; }
  .user span.uname { display: none; }
  .page, .top { padding-inline: 16px; }
}
@media (max-width: 520px) {
  .header-grid { grid-template-columns: 1fr; }
  .qty-box { width: 72px; }
}
@media (prefers-reduced-motion: reduce) { tr.flash td { animation: none; } }

.loc { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; }
.loc svg { width: 11px; height: 11px; }
.prod .loc { display: flex; width: fit-content; white-space: nowrap; }
td.prod { min-width: 210px; }
td.r, td.code { white-space: nowrap; }
.work table { min-width: 760px; }
[hidden] { display: none !important; }
.route { display: flex; flex-wrap: wrap; gap: 6px; }

/* Ingresos */
.ing-head { grid-template-columns: 150px 170px minmax(0, 1fr) 180px 150px; }
.ing-row .mini { display: flex; flex-direction: column; gap: 4px; width: 96px; }
.ing-row .mini.wide { width: 150px; }
.ing-row .mini label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ing-row .mini input { flex: 1; text-align: right; }
.work.ing { grid-template-columns: minmax(0, 1fr) 340px; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.work.ing .summary { position: static; }
.sbadge { font: inherit; font-size: 12.5px; font-weight: 500; border-radius: 999px; padding: 4px 10px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.sbadge.todo { background: var(--warn-soft); color: var(--warn); }
.sbadge.done { background: var(--good-soft); color: var(--good); }
.sbadge.on { border-color: currentColor; }
.sbadge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.serial-panel { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ph h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 500; }
.pname { font-weight: 600; margin-top: 2px; }
.pname-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.count { color: var(--muted); white-space: nowrap; }
.count b { font-size: 22px; color: var(--fg); font-weight: 600; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.scan-box.small input { font-size: 15px; padding: 10px 0; }
.slist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.slist:empty { display: none; }
.slist li { display: grid; grid-template-columns: 22px minmax(0, 1fr) 108px 26px; gap: 6px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.slist li:last-child { border-bottom: 0; }
.slist .idx { color: var(--muted); font-size: 11.5px; }
.slist .code { overflow: hidden; text-overflow: ellipsis; }
.mac { font-size: 11.5px; width: 100%; border: 1px solid transparent; background: transparent; color: var(--fg); border-radius: 4px; padding: 3px 5px; }
.mac:hover { border-color: var(--line); }
.mac:focus { border-color: var(--accent); outline: none; background: var(--surface); }
.mac.bad { border-color: var(--bad); }
.paste { display: flex; flex-direction: column; gap: 8px; }
.paste textarea { font-family: var(--font-code); font-size: 12.5px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px; resize: vertical; }
.paste .btn { justify-content: center; }
.pempty b { display: block; margin-bottom: 4px; }
.pempty p { margin: 0; color: var(--muted); }
.warnbox { background: var(--warn-soft); color: var(--warn); }
.okbody { display: flex; flex-direction: column; gap: 10px; }
.okbody p { margin: 0; color: var(--muted); }
table.mini-t { min-width: 0; }
td small.eq { display: block; color: var(--muted); font-size: 11.5px; padding-right: 7px; }
table.mini-t td, table.mini-t th { padding: 7px 8px; font-size: 13px; }
@media (max-width: 1180px) { .ing-head { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 1080px) { .work { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .ing-head { grid-template-columns: 1fr; } .ing-row { flex-wrap: wrap; } .ing-row .scan-box { flex-basis: 100%; } .ing-row .mini, .ing-row .mini.wide { flex: 1; width: auto; } }



/* Aplicación (pantallas que no estaban en los bocetos) */
a { color: var(--accent); }
.btn { text-decoration: none; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-card { overflow: hidden; }
.list-card table { min-width: 640px; }
.list-card tr:hover td { background: var(--surface-2); }
.list-card td a.rowlink { color: var(--fg); text-decoration: none; font-weight: 500; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--surface-2); color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.box { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.box h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 500; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.big { font-size: 28px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { padding: 14px 16px; }
.stat span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-size: 24px; font-weight: 600; }
.messages { display: flex; flex-direction: column; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
textarea.inp { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-height: 70px; }
.errorlist { color: var(--bad); margin: 0; padding-left: 18px; font-size: 13px; }
.login-wrap { min-height: 100%; display: grid; place-items: center; padding-block: 24px; padding-inline: 16px; }
.login { width: min(380px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 20px; }
.htmx-request .scan-box { opacity: .7; }
.result-list { display: flex; flex-direction: column; }
.result-list a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.result-list a:hover { background: var(--surface-2); }
.nav a.disabled { opacity: .45; pointer-events: none; }
details.paste > summary { list-style: none; cursor: pointer; width: fit-content; }
details.paste > summary::-webkit-details-marker { display: none; }
.envio-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; padding: 0; }
.work.ing table { min-width: 680px; }
.work.ing td.prod { min-width: 150px; }
.work.ing .cell.price { width: 104px; }
.work.ing th, .work.ing td { padding-left: 8px; padding-right: 8px; }
.work.ing td input.cell { width: 64px; }
.work.ing td input.cell.price { width: 96px; }
.work.ing table { min-width: 0; }
.toolbar select { width: auto; }
