
:root{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#20242a;background:#f5f6fa;--blue:#1758b5;--purple:#5c32b7;--red:#cd2627;--slate:#4a6570;--green:#2d8b3c;--border:#d9dbe3}*{box-sizing:border-box}body{margin:0}.app{min-height:100vh;padding-bottom:76px}.top{color:white;padding:18px 20px;font-size:28px;font-weight:650;display:flex;justify-content:space-between;align-items:center}.top.blue{background:var(--blue)}.top.slate{background:var(--slate)}.top.red{background:var(--red)}.top.purple{background:var(--purple)}.wrap{max-width:820px;margin:auto;padding:20px}.card{background:white;border-radius:18px;padding:18px;box-shadow:0 2px 10px #00000013;margin-bottom:16px}.field{display:flex;flex-direction:column;gap:7px;margin-bottom:14px}.field label{font-size:13px;color:#676b74;font-weight:600}.field input,.field select{width:100%;padding:15px 16px;border:1.5px solid #868992;border-radius:12px;font-size:18px;background:white}.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.btn{border:0;border-radius:999px;padding:14px 20px;font-size:17px;font-weight:700;cursor:pointer;color:white;background:var(--blue)}.btn.red{background:var(--red)}.btn.purple{background:var(--purple)}.btn.gray{background:#68717b}.btn.green{background:var(--green)}.btn.block{width:100%}.product{font-size:18px;font-weight:800;background:#e5f2ff;border:1px solid #54a6df;border-radius:12px;padding:15px;text-align:center;margin:10px 0 18px}.muted{color:#727782;font-size:14px}.nav{position:fixed;bottom:0;left:0;right:0;height:70px;background:white;border-top:1px solid #ddd;display:grid;grid-template-columns:repeat(4,1fr);z-index:5}.nav button{border:0;background:white;color:#6f7077;font-size:13px;font-weight:600}.nav button.active{color:var(--purple)}.nav span{display:block;font-size:24px;margin-bottom:3px}.stock-card{border-radius:18px;padding:16px;background:#d7f0d8;border:2px solid transparent;margin-bottom:14px}.stock-card.first{border-color:#2e8d40}.stock-title{font-weight:800;font-size:18px}.badge{display:inline-block;border-radius:999px;padding:6px 10px;font-size:12px;font-weight:800;color:white}.badge.red{background:#d42a2a}.badge.orange{background:#ef6c00}.badge.green{background:#2f8c3f}.searchrow{display:grid;grid-template-columns:1fr auto;gap:10px}.kpi{background:#f0f2f5;border-radius:14px;padding:14px;text-align:center}.kpi strong{display:block;font-size:24px}.alert-card{border-radius:18px;padding:16px;margin-bottom:14px;box-shadow:0 2px 7px #0002}.alert-card.ok{background:#d8efdc}.alert-card.warn{background:#fff1a9}.alert-card.urgent{background:#ffd08a}.alert-card.expired{background:#f4aaaa}.login{min-height:100vh;display:grid;place-items:center;padding:24px;background:#f5f6fa}.loginbox{width:min(440px,100%);background:white;border-radius:24px;padding:28px;box-shadow:0 5px 25px #0001}.brand{text-align:center;font-size:42px;font-weight:900;font-style:italic;letter-spacing:1px}.title{text-align:center;color:#1e2c76}.toast{position:fixed;top:18px;left:50%;transform:translateX(-50%);background:#20242a;color:white;padding:12px 18px;border-radius:12px;z-index:20;max-width:90%;box-shadow:0 4px 18px #0004}.tabs{display:flex;gap:8px;margin-bottom:14px}.tabs button{flex:1;border:0;border-radius:12px;padding:11px}.table{width:100%;border-collapse:collapse}.table th,.table td{padding:9px;border-bottom:1px solid #e4e4e4;text-align:left;font-size:13px}.small{font-size:12px}@media(max-width:580px){.top{font-size:24px}.wrap{padding:14px}.grid3{grid-template-columns:repeat(3,1fr)}.grid{grid-template-columns:1fr}.field input,.field select{font-size:17px}.brand{font-size:34px}}
.alert-head{display:flex;gap:10px;justify-content:space-between;align-items:flex-start;margin-bottom:8px}.smallbtn{padding:8px 11px;font-size:12px;white-space:nowrap}.btn.block+.btn.block{display:block}@media(max-width:580px){.alert-head{align-items:stretch;flex-direction:column}.smallbtn{align-self:flex-end}.searchrow .field{min-width:0}}
.scanrow{display:grid;grid-template-columns:1fr auto;gap:10px}.scanrow input{min-width:0}.camera-btn{border-radius:12px;min-width:58px;font-size:24px;padding:10px 14px}.scan-search{grid-template-columns:minmax(0,1fr) auto auto}.scanner-modal{position:fixed;inset:0;background:#000c;z-index:100;display:grid;place-items:center;padding:16px}.scanner-box{position:relative;width:min(560px,100%);background:#111;border-radius:20px;padding:14px;color:white;box-shadow:0 15px 50px #0008}.scanner-head{display:flex;justify-content:space-between;align-items:center;font-size:18px;margin:2px 2px 10px}.scanner-close{border:0;background:transparent;color:white;font-size:34px;line-height:1;cursor:pointer}.scanner-box video{width:100%;aspect-ratio:4/3;object-fit:cover;background:#000;border-radius:14px;display:block}.scan-guide{position:absolute;left:12%;right:12%;top:47%;height:86px;border:3px solid #fff;border-radius:12px;box-shadow:0 0 0 9999px #0002;pointer-events:none}.scanner-status{text-align:center;padding:12px 6px;color:#ddd;font-size:14px}@media(max-width:580px){.scan-search{grid-template-columns:minmax(0,1fr) 58px}.scan-search>.btn:last-child{grid-column:1/-1}.camera-btn{min-width:58px}.scanner-box{padding:10px}.scan-guide{top:44%}}
.trace{margin-top:10px;padding-top:9px;border-top:1px solid #e5e7eb;color:#263238}.first .trace{border-top-color:#cfe7d3}

/* v7 - mayor jerarquia visual para stock y ubicaciones */
.stock-summary{padding:20px 22px;border:1px solid #dfe3eb;background:linear-gradient(135deg,#ffffff 0%,#f5f8fb 100%)}
.stock-summary-product{font-size:20px;font-weight:900;line-height:1.2;margin-bottom:14px;color:#20242a}
.stock-summary-grid{display:flex;align-items:end;justify-content:space-between;gap:18px}
.stock-summary-label{display:block;font-size:12px;font-weight:900;letter-spacing:.08em;color:#65707b}
.stock-summary-total{display:inline-block;font-size:44px;line-height:1;font-weight:950;color:#263e91;margin-top:3px}
.stock-summary-unit{font-size:17px;font-weight:800;color:#59616b;margin-left:6px}
.stock-summary-locs{min-width:118px;text-align:center;background:#e8eefc;border-radius:14px;padding:10px 14px;color:#263e91}
.stock-summary-locs strong{display:block;font-size:26px;line-height:1;font-weight:950}
.stock-summary-locs span{font-size:12px;font-weight:800}
.withdraw-summary{background:linear-gradient(135deg,#d22627 0%,#b91f20 100%);color:white;border:0}
.withdraw-summary .stock-summary-product,.withdraw-summary .stock-summary-label,.withdraw-summary .stock-summary-total,.withdraw-summary .stock-summary-unit{color:white}
.withdraw-summary .stock-summary-locs{background:#ffffff26;color:white}
.location-hero{display:flex;align-items:center;gap:12px;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid #b9ddb9}
.location-rack{display:grid;place-items:center;flex:0 0 50px;width:50px;height:50px;border-radius:50%;background:#46636f;color:white;font-size:25px;font-weight:950}
.location-label{display:block;font-size:11px;line-height:1;font-weight:900;letter-spacing:.08em;color:#5c6870;margin-bottom:3px}
.location-code{display:block;font-size:29px;line-height:1.05;font-weight:950;color:#172229;letter-spacing:.02em}
.first .location-code{color:#196d2d}
.first .location-label{color:#196d2d}
.first-badge{margin-left:auto}
.stock-qty{font-size:17px;margin-bottom:5px}
.trace{margin-top:12px;padding-top:10px;border-top:1px solid #b9ddb9}
@media(max-width:580px){.stock-summary-total{font-size:38px}.stock-summary-product{font-size:18px}.location-code{font-size:27px}.stock-summary-locs{min-width:100px}.location-rack{flex-basis:46px;width:46px;height:46px}.first-badge{font-size:10px;padding:5px 8px}}


/* v8 - control fisico por pasillo */
.nav.nav5{grid-template-columns:repeat(5,1fr)}
.control-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.control-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;background:linear-gradient(135deg,#4a6570,#334b55);color:white}
.control-summary>div{padding:8px 12px;border-right:1px solid #ffffff33}.control-summary>div:last-child{border-right:0}.control-summary strong{display:block;font-size:34px;line-height:1.05;margin-top:5px}.control-summary .stock-summary-label{color:#e7eef1}
.control-report{padding:0;overflow:hidden}.print-head{padding:18px 20px;border-bottom:1px solid #e4e7ea}.print-head h2{margin:0 0 5px}.table-scroll{overflow:auto}.control-table{min-width:900px}.control-table th{background:#435b66;color:#fff;position:sticky;top:0}.control-table td{vertical-align:middle}.ctrl-loc{font-size:20px;color:#1e3a8a}.empty-location{background:#fafafa}.print-only{display:none}
.adjust-modal{position:fixed;inset:0;background:#000b;z-index:120;display:grid;place-items:center;padding:16px}.adjust-box{width:min(520px,100%);max-height:94vh;overflow:auto;background:white;border-radius:20px;padding:18px;box-shadow:0 18px 60px #0007}.adjust-box .scanner-head{color:#20242a}.adjust-box .scanner-close{color:#20242a}.adjust-product{display:flex;flex-direction:column;gap:4px;padding:14px;background:#eef2f7;border-radius:12px;margin-bottom:12px}.adjust-product strong{font-size:28px;color:#1e3a8a}.adjust-box textarea{width:100%;padding:12px 14px;border:1.5px solid #868992;border-radius:12px;font:inherit;resize:vertical}.adjust-diff{font-weight:900;font-size:18px;margin:-2px 0 14px;padding:10px 12px;border-radius:10px;background:#f3f4f6}
@media(max-width:700px){.control-summary{grid-template-columns:1fr}.control-summary>div{border-right:0;border-bottom:1px solid #ffffff33}.control-summary>div:last-child{border-bottom:0}.control-summary strong{font-size:30px}.nav.nav5 button{font-size:11px}.nav.nav5 span{font-size:20px}.control-actions .btn{width:100%}}
@media print{body{background:white}.top,.nav,.control-toolbar,.no-print,.toast{display:none!important}.app{padding:0}.wrap{max-width:none;padding:0}.card{box-shadow:none;border-radius:0;margin:0}.control-summary{display:grid!important;margin-bottom:12px;-webkit-print-color-adjust:exact;print-color-adjust:exact}.control-report{overflow:visible}.table-scroll{overflow:visible}.control-table{min-width:0;width:100%;font-size:9px}.control-table th,.control-table td{font-size:9px;padding:5px}.control-table th{position:static;-webkit-print-color-adjust:exact;print-color-adjust:exact}.print-only{display:table-cell!important}.print-head{padding:8px 0 10px}.print-head h2{font-size:18px}.ctrl-loc{font-size:12px}}
.logout{background:transparent;border:1px solid #ffffff66;color:#fff;border-radius:10px;padding:7px 10px;cursor:pointer}.top-actions{display:flex;gap:10px;align-items:center}.report-actions{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0}.report-actions a{text-decoration:none}.error-box{padding:12px;background:#fee2e2;border:1px solid #fecaca;border-radius:10px;color:#991b1b}.success-box{padding:12px;background:#dcfce7;border:1px solid #bbf7d0;border-radius:10px;color:#166534}.adjust-modal{position:fixed;inset:0;background:#0009;display:grid;place-items:center;z-index:9999;padding:15px}.adjust-modal .card{width:min(520px,100%);max-height:90vh;overflow:auto}.top .small{white-space:nowrap}

/* v3 - stock visible al ingresar */
.overview-header{
  display:grid;grid-template-columns:2fr 1fr 1fr;gap:12px;margin:14px 0;
}
.overview-header>div{
  background:#fff;border-radius:16px;padding:14px 18px;box-shadow:0 2px 10px #00000012;
  display:flex;flex-direction:column;justify-content:center;
}
.overview-header span{font-size:11px;font-weight:900;letter-spacing:.08em;color:#66737c}
.overview-header strong{font-size:32px;line-height:1.05;color:#38505b}
.overview-header small{font-size:12px;color:#7a8187}
.overview-red strong{color:#c62828}
.overview-help{
  background:#fff;border-left:5px solid #4a6570;border-radius:12px;
  padding:12px 15px;margin-bottom:12px;color:#59656d;font-size:13px;
}
.overview-list{display:grid;gap:10px}
.overview-product{
  display:grid;grid-template-columns:minmax(0,1fr) 230px 180px;
  gap:14px;align-items:center;background:#fff;border-radius:16px;
  padding:14px 16px;box-shadow:0 2px 9px #00000010;border:1px solid #e8ecef;
}
.clickable-product{cursor:pointer;transition:.15s}
.clickable-product:hover{transform:translateY(-1px);box-shadow:0 4px 14px #00000018;border-color:#d0d8dd}
.overview-product-name{font-size:16px;font-weight:850;line-height:1.2}
.overview-code{font-size:12px;color:#6c747a;margin-top:4px}
.overview-kpis{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.overview-kpis>div,.overview-fefo{
  background:#f3f6f8;border-radius:12px;padding:8px 10px;text-align:center;
}
.overview-kpis span,.overview-fefo span{display:block;font-size:9px;font-weight:900;letter-spacing:.07em;color:#6b747a}
.overview-kpis strong{font-size:22px;display:block;color:#304b59}
.overview-kpis small{font-size:10px;color:#727b80}
.overview-fefo strong{display:block;font-size:23px;color:#2f6f3a;margin:2px 0}
.overview-fefo small{font-size:10px;color:#69747a}
.loading-stock{text-align:center;color:#69747a}
@media(max-width:760px){
  .overview-header{grid-template-columns:repeat(3,1fr)}
  .overview-header>div{padding:10px}
  .overview-header strong{font-size:24px}
  .overview-product{grid-template-columns:1fr}
  .overview-kpis{grid-template-columns:1fr 1fr}
  .overview-fefo{text-align:left}
}

/* v4: vista general idéntica al detalle de búsqueda */
.all-stock-product{margin-bottom:28px}
.all-stock-product .stock-summary{margin-bottom:14px}
.all-stock-code{display:block;font-size:12px;font-weight:500;color:#6b747a;margin-top:4px}
.all-stock-product .stock-card{margin-bottom:12px}

/* v5 - Historial de movimientos */
.nav.nav6{grid-template-columns:repeat(6,1fr)}
.history-filters{padding-bottom:14px}
.history-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.history-wide{grid-column:span 2}
.history-actions{display:flex;gap:10px;justify-content:flex-end}
.history-kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:14px}
.history-table-wrap{background:white;border-radius:16px;box-shadow:0 2px 10px #00000012;overflow:auto}
.history-table{width:100%;border-collapse:collapse;min-width:1250px}
.history-table th{position:sticky;top:0;background:#4a6570;color:#fff;padding:10px 8px;text-align:left;font-size:12px;z-index:1}
.history-table td{padding:9px 8px;border-bottom:1px solid #e7ebee;font-size:12px;vertical-align:middle}
.history-table tr:nth-child(even){background:#fafbfc}
.history-code{font-weight:800}
.history-num{text-align:center;font-weight:800}
.mov-badge{display:inline-block;border-radius:999px;padding:5px 8px;color:white;font-size:10px;font-weight:900}
.mov-carga{background:#2f8c3f}.mov-retiro{background:#cd2627}.mov-ajuste{background:#ef6c00}
@media(max-width:760px){
  .nav.nav6{grid-template-columns:repeat(6,1fr);overflow-x:auto}
  .history-grid{grid-template-columns:1fr}
  .history-wide{grid-column:auto}
  .history-kpis{grid-template-columns:repeat(2,1fr)}
  .history-actions{justify-content:stretch}
  .history-actions .btn{flex:1}
}
