
:root{
  --bg:#f8f2ea;
  --surface:#fffaf4;
  --surface2:#fff;
  --text:#251c15;
  --muted:#776a5f;
  --line:#eadfce;
  --accent:#d97706;
  --accent2:#f59e0b;
  --green:#15803d;
  --red:#b91c1c;
  --blue:#2563eb;
  --shadow:0 10px 30px rgba(95, 66, 35, .12);
  --radius:22px;
  --tap:56px;
}
[data-theme="dark"]{
  --bg:#171412;
  --surface:#231e1a;
  --surface2:#2b251f;
  --text:#f7efe7;
  --muted:#c5b8aa;
  --line:#40362e;
  --accent:#f59e0b;
  --accent2:#fbbf24;
  --shadow:0 12px 32px rgba(0,0,0,.28);
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:linear-gradient(180deg,var(--bg),#fff8f0 48%,var(--bg));}
[data-theme="dark"] body{background:var(--bg)}
button,input,select,textarea{font:inherit}
button{border:0;border-radius:18px;padding:13px 16px;min-height:48px;background:var(--accent);color:white;font-weight:800;cursor:pointer;box-shadow:0 4px 12px rgba(217,119,6,.18)}
button.secondary{background:var(--surface2);color:var(--text);border:1px solid var(--line);box-shadow:none}
button.ghost{background:transparent;color:var(--text);border:1px solid var(--line);box-shadow:none}
button.danger{background:#fee2e2;color:#991b1b;border:1px solid #fecaca;box-shadow:none}
button.good{background:#dcfce7;color:#166534;border:1px solid #bbf7d0;box-shadow:none}
button.small{min-height:38px;padding:9px 11px;border-radius:14px;font-size:.92rem}
button.cart{background:#1f8a45}
button.unknown{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa;box-shadow:none}
button.activeToggle{outline:3px solid rgba(21,128,61,.22)}
input,select,textarea{width:100%;border:1px solid var(--line);border-radius:16px;background:var(--surface2);color:var(--text);padding:13px 14px;min-height:48px}
textarea{min-height:94px;resize:vertical}
label{display:block;font-size:.87rem;font-weight:800;color:var(--muted);margin:0 0 6px}
.app-shell{max-width:1060px;margin:0 auto;padding:14px 14px 92px}
.topbar{position:sticky;top:0;z-index:20;background:rgba(248,242,234,.94);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 -14px 14px;padding:14px}
[data-theme="dark"] .topbar{background:rgba(23,20,18,.92)}
.eyebrow{font-size:.82rem;font-weight:900;color:var(--accent);letter-spacing:.02em}
h1{margin:2px 0 0;font-size:1.25rem;line-height:1.08}
h2{margin:0 0 10px;font-size:1.35rem}
h3{margin:0 0 10px;font-size:1.08rem}
p{line-height:1.45}
.top-actions{display:flex;gap:8px;align-items:center}
.top-actions .ghost{min-height:40px;padding:8px 10px;border-radius:14px;font-size:.84rem}
.view{display:none}
.view.active{display:block}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin:0 0 14px}
.row{display:flex;gap:10px;align-items:center;justify-content:space-between}
.row.start{justify-content:flex-start}
.wrap{flex-wrap:wrap}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.stat{background:var(--surface2);border:1px solid var(--line);border-radius:18px;padding:13px}
.label,.small{font-size:.86rem;color:var(--muted)}
.value{display:block;margin-top:3px;font-size:1.25rem;font-weight:950}
.money{font-weight:950;color:var(--accent)}
.mini-list{display:grid;gap:8px}
.empty{padding:16px;border:1px dashed var(--line);border-radius:18px;color:var(--muted);background:rgba(255,255,255,.35)}
.notice{padding:13px;border-radius:18px;background:var(--surface2);border:1px solid var(--line)}
.alert{border-color:#fed7aa;background:#fff7ed}
[data-theme="dark"] .alert{background:#332518;border-color:#684117}
.sticky-summary{position:sticky;top:74px;z-index:18;background:var(--surface);border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:12px;margin:0 0 12px}
.progress{height:10px;background:var(--line);border-radius:999px;overflow:hidden;margin-top:8px}
.progress > span{display:block;height:100%;background:var(--accent);width:0}
.badge{display:inline-flex;align-items:center;gap:4px;background:var(--surface2);border:1px solid var(--line);border-radius:999px;padding:6px 10px;font-weight:850;font-size:.8rem;color:var(--muted)}
.badge.good{background:#dcfce7;color:#166534;border-color:#bbf7d0}
.badge.warn{background:#fef3c7;color:#92400e;border-color:#fde68a}
.badge.danger{background:#fee2e2;color:#991b1b;border-color:#fecaca}
.accordion{overflow:hidden;border-radius:22px;border:1px solid var(--line);background:var(--surface);margin:0 0 12px}
.accordion summary{list-style:none;cursor:pointer;padding:16px;display:flex;justify-content:space-between;align-items:center;font-weight:950}
.accordion summary::-webkit-details-marker{display:none}
.accordion .content{padding:0 12px 12px;display:grid;gap:10px}
.product-card{background:var(--surface2);border:1px solid var(--line);border-radius:20px;padding:13px;box-shadow:0 2px 10px rgba(0,0,0,.03)}
.product-card.selected{border-color:rgba(217,119,6,.45);background:linear-gradient(180deg,var(--surface2),rgba(245,158,11,.06))}
.product-card.incart{border-color:rgba(21,128,61,.38);background:linear-gradient(180deg,var(--surface2),rgba(21,128,61,.07))}
.product-title{font-size:1.05rem;font-weight:950;margin-bottom:4px}
.product-meta{font-size:.86rem;color:var(--muted);line-height:1.3}
.product-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.product-actions button{flex:1 1 108px}
.check-pill{display:inline-flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:999px;background:var(--surface2);padding:9px 12px;font-weight:900;min-height:44px;cursor:pointer}
.check-pill input{width:20px;min-height:auto;height:20px;margin:0;accent-color:var(--accent)}
.price-line{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:10px}
.price-box{background:rgba(0,0,0,.03);border-radius:14px;padding:9px;text-align:center}
[data-theme="dark"] .price-box{background:rgba(255,255,255,.05)}
.price-box .small{display:block;font-size:.75rem}
.price-box strong{font-size:.95rem}
.quick-status{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.quick-status button{flex:1 1 105px}
.bottom-nav{position:fixed;left:0;right:0;bottom:0;z-index:40;background:rgba(255,250,244,.96);backdrop-filter:blur(14px);border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(6,1fr);padding:8px max(8px,env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-right));gap:4px}
[data-theme="dark"] .bottom-nav{background:rgba(35,30,26,.95)}
.bottom-nav button{min-height:54px;padding:6px 4px;border-radius:16px;background:transparent;color:var(--muted);box-shadow:none;font-size:1.18rem;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.bottom-nav button span{font-size:.68rem;font-weight:850}
.bottom-nav button.active{background:var(--accent);color:white}
.toast{position:fixed;left:14px;right:14px;bottom:88px;z-index:80;max-width:580px;margin:auto;padding:14px 16px;border-radius:18px;background:#251c15;color:white;box-shadow:var(--shadow);transform:translateY(140%);transition:.25s ease;font-weight:800}
.toast.show{transform:translateY(0)}
.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.42);z-index:100;display:flex;align-items:flex-end;justify-content:center;padding:12px}
.modal{width:min(640px,100%);background:var(--surface);border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow);padding:16px;max-height:88vh;overflow:auto}
.modal h2{margin-bottom:14px}
body.one-hand .product-title{font-size:1.15rem}
body.one-hand .product-card{padding:16px;border-radius:24px}
body.one-hand .product-actions button{min-height:60px;font-size:1.02rem}
body.one-hand .sticky-summary{top:72px}
body.one-hand .bottom-nav button{min-height:60px}
@media(max-width:760px){
  .grid2,.grid3{grid-template-columns:1fr}
  .topbar{align-items:flex-start}
  .top-actions{flex-direction:column;gap:6px}
  .price-line{grid-template-columns:repeat(2,minmax(0,1fr))}
  .app-shell{padding-left:10px;padding-right:10px}
  .bottom-nav{grid-template-columns:repeat(6,1fr)}
}
@media(max-width:420px){
  .bottom-nav button span{font-size:.6rem}
  .bottom-nav button{font-size:1.06rem}
  h1{font-size:1.1rem}
}
@media print{
  .topbar,.bottom-nav,.sticky-summary,.top-actions{display:none}
  .view{display:block}
  body{background:white}
  .card,.product-card,.accordion{box-shadow:none;break-inside:avoid}
}

/* v2.1: filosofía Sheet/Keep: filas compactas, categorías con color y menos captura vertical */
.app-shell{max-width:1120px;padding-bottom:84px}
.card.slim-card{padding:14px;margin-bottom:12px}
.hero-card{padding:16px}
.quick-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.compact-stats .stat{padding:10px 12px;border-radius:16px}
.compact-stats .value{font-size:1.12rem}
.tight-grid{gap:10px}
.main-actions{gap:10px;justify-content:space-between}
.main-actions button{flex:1 1 150px}
.small-empty{padding:12px}
.compact-notice{padding:10px;margin-bottom:7px}
.compact-summary{top:72px;padding:10px 12px;border-radius:18px}
.summary-line{display:flex;align-items:center;gap:14px;justify-content:space-between;flex-wrap:wrap;font-size:.94rem}
.summary-line b{color:var(--accent)}
.accordion{box-shadow:0 5px 18px rgba(95,66,35,.06);margin-bottom:10px}
.accordion summary{padding:12px 14px;border-left:8px solid var(--accent)}
.accordion .content{padding:0 10px 10px;gap:8px}
.cat-color-1 summary{border-left-color:#e07a2f;background:linear-gradient(90deg,rgba(224,122,47,.10),transparent)}
.cat-color-2 summary{border-left-color:#2f8f4e;background:linear-gradient(90deg,rgba(47,143,78,.10),transparent)}
.cat-color-3 summary{border-left-color:#3b82f6;background:linear-gradient(90deg,rgba(59,130,246,.10),transparent)}
.cat-color-4 summary{border-left-color:#a855f7;background:linear-gradient(90deg,rgba(168,85,247,.10),transparent)}
.cat-color-5 summary{border-left-color:#f59e0b;background:linear-gradient(90deg,rgba(245,158,11,.13),transparent)}
.cat-color-6 summary{border-left-color:#ec4899;background:linear-gradient(90deg,rgba(236,72,153,.10),transparent)}
.cat-color-7 summary{border-left-color:#14b8a6;background:linear-gradient(90deg,rgba(20,184,166,.10),transparent)}
.cat-color-8 summary{border-left-color:#64748b;background:linear-gradient(90deg,rgba(100,116,139,.10),transparent)}
.product-grid-two{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}
.list-tile{display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--surface2);border:1px solid var(--line);border-radius:16px;padding:10px 11px;min-height:68px;cursor:pointer}
.list-tile.selected{border-color:rgba(217,119,6,.55);background:linear-gradient(180deg,var(--surface2),rgba(217,119,6,.08))}
.tile-text{min-width:0;display:flex;flex-direction:column;gap:3px}
.tile-text strong{font-size:.98rem;line-height:1.12;overflow:hidden;text-overflow:ellipsis}
.tile-text span{font-size:.76rem;color:var(--muted);line-height:1.15}
.mini-check{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--line);border-radius:999px;padding:7px 9px;background:var(--surface2);font-weight:850;white-space:nowrap;font-size:.82rem}
.mini-check input{width:18px;height:18px;margin:0;accent-color:var(--accent)}
.table-wrap{display:grid;gap:6px;padding:8px 10px 10px;overflow-x:auto}
.table-head,.table-row{display:grid;align-items:center;gap:6px;min-width:780px}
.table-head{font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:950;padding:0 8px 2px}
.ched-head,.ched-row{grid-template-columns:minmax(190px,2.2fr) 72px 92px 92px 94px 54px 44px 44px}
.market-row{grid-template-columns:minmax(220px,2.2fr) 95px 58px 58px 44px;min-width:560px}
.inv-head,.inv-row{grid-template-columns:minmax(190px,2fr) 150px 110px 145px;min-width:560px}
.mini-inv-row{grid-template-columns:minmax(190px,2fr) 120px 48px;min-width:360px}
.table-row{background:var(--surface2);border:1px solid var(--line);border-radius:14px;padding:7px 8px;min-height:54px}
.table-row.selected{border-color:rgba(217,119,6,.4)}
.table-row.incart{border-color:rgba(21,128,61,.42);background:linear-gradient(180deg,var(--surface2),rgba(21,128,61,.07))}
.table-row.unknown-row{box-shadow:inset 0 0 0 2px rgba(245,158,11,.18)}
.cell{min-width:0;display:flex;align-items:center;gap:6px}
.product-cell{flex-direction:column!important;align-items:flex-start!important;gap:2px}
.product-cell strong{line-height:1.12;font-size:.94rem}
.product-cell small{font-size:.74rem;color:var(--muted);line-height:1.1}
.price-ref,.total-cell,.date-cell{font-weight:850;font-size:.87rem}
.total-cell{color:var(--accent)}
.mini-input,.status-select{min-height:38px;border-radius:12px;padding:8px 9px;font-size:.92rem}
.qty-input{text-align:center}
.price-input{text-align:right}
.icon-btn{min-height:38px;min-width:38px;border-radius:12px;padding:6px 8px;box-shadow:none;display:inline-flex;align-items:center;justify-content:center;font-size:.95rem}
.icon-btn.secondary{background:var(--surface2);color:var(--text);border:1px solid var(--line)}
.icon-btn.danger{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.inv-actions{gap:5px;justify-content:flex-start}
.product-card{padding:10px 12px;border-radius:16px}
.product-title{font-size:.98rem}
.product-actions{margin-top:8px}
button{border-radius:16px}
.bottom-nav{padding-top:5px;padding-bottom:calc(5px + env(safe-area-inset-bottom))}
.bottom-nav button{min-height:50px;border-radius:14px}
body.one-hand .product-card{padding:10px 12px;border-radius:16px}
body.one-hand .product-title{font-size:.98rem}
body.one-hand .product-actions button{min-height:46px;font-size:.94rem}
body.one-hand .bottom-nav button{min-height:54px}
@media(max-width:760px){
  .quick-stats{grid-template-columns:1fr 1fr}
  .quick-stats .stat:last-child{grid-column:1/-1}
  .product-grid-two{grid-template-columns:1fr}
  .summary-line{gap:8px;font-size:.86rem}
  .compact-summary{top:70px}
  .topbar{position:sticky}
  .top-actions{flex-direction:row;align-items:center}
  .top-actions .ghost{font-size:.76rem;min-height:36px;padding:6px 8px}
  h1{font-size:1.1rem}
  h2{font-size:1.16rem}
  h3{font-size:1rem}
  .table-wrap{margin-left:-4px;margin-right:-4px;padding-left:4px;padding-right:4px}
  .bottom-nav{grid-template-columns:repeat(6,1fr)}
  .bottom-nav button span{font-size:.62rem}
}
@media(max-width:430px){
  .app-shell{padding-left:8px;padding-right:8px}
  .card.slim-card,.hero-card{padding:12px}
  .quick-stats{grid-template-columns:1fr}
  .quick-stats .stat:last-child{grid-column:auto}
  .main-actions button{flex:1 1 130px;min-height:46px}
  .summary-line{justify-content:flex-start}
  .ched-head,.ched-row{grid-template-columns:180px 66px 84px 84px 84px 48px 42px 42px;min-width:675px}
  .market-row{grid-template-columns:190px 86px 52px 52px 42px;min-width:470px}
  .inv-head,.inv-row{grid-template-columns:180px 138px 95px 132px;min-width:500px}
}
