:root { --brand: #1e6cf0; --bg: #f5f7fb; --panel: #fff; --ink: #14203a; --muted: #667085; --line: #e3e8f0; --bad: #d92d20; --warn: #b54708; --ok: #079455; --radius: 14px; color-scheme: light; }
@media (prefers-color-scheme: dark) { :root { --bg: #0e131c; --panel: #161c27; --ink: #e8edf5; --muted: #98a2b3; --line: #273041; color-scheme: dark; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; color: var(--ink); font-size: 17px; white-space: nowrap; }
.brand img { height: 36px; max-width: 150px; object-fit: contain; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--ink); font-weight: 600; font-size: 14px; }
.nav a:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.nav a.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; text-align: center; }
.spacer { flex: 1; }
.menu-btn { font-size: 20px; padding: 6px 12px; }
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; }
  .nav { position: absolute; top: 57px; left: 0; right: 0; flex-direction: column; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px 12px 14px; }
  .nav:not(.open) { display: none; }
  .nav a { padding: 12px; }
}
@media (min-width: 761px) { .menu-btn { display: none !important; } }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 30px; }
h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 19px; margin: 26px 0 12px; }
h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.center { display: grid; place-items: center; min-height: 40vh; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 10px 0; }
.check input { width: auto; margin-top: 3px; accent-color: var(--brand); }
button, .btn { font: inherit; font-weight: 650; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
button.ghost { background: transparent; border-color: transparent; }
button.sm { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
.full { width: 100%; margin-top: 16px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }
.pill { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 15%, transparent); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.note { background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); border-radius: 12px; padding: 12px 14px; }
.note.info { background: color-mix(in srgb, var(--brand) 7%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; max-width: 92vw; box-shadow: 0 8px 24px rgba(0,0,0,.25); margin: 0; z-index: 50; }

/* Acceso */
.auth { max-width: 460px; margin: 4vh auto; }
.auth .logo-big { max-height: 80px; max-width: 220px; margin: 0 auto 12px; }
.auth h1 { text-align: center; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin: 14px 0 4px; }
.seg button { border: 0; background: transparent; }
.seg button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--brand); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.role { display: flex; flex-direction: column; gap: 4px; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 500; margin: 0; }
.role b { font-size: 15px; }
.role small { color: var(--muted); }
.role input { width: auto; accent-color: var(--brand); }
.role:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2, .roles { grid-template-columns: 1fr; } }

/* Catálogo */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 14px 0; }
@media (max-width: 700px) { .filters { grid-template-columns: 1fr 1fr; } .filters .q { grid-column: 1 / -1; } }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr 1fr; gap: 10px; } .prices { grid-template-columns: 1fr; gap: 6px; } .pcard .body { padding: 10px; } }
.pcard { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; color: var(--ink); }
.pcard:hover { box-shadow: 0 10px 28px rgba(16, 24, 40, .1); text-decoration: none; }
.pcard .img { aspect-ratio: 1; background: var(--bg); display: grid; place-items: center; color: var(--muted); font-size: 40px; }
.pcard .img img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .t { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .sup { font-size: 12px; color: var(--muted); }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: auto; padding-top: 6px; font-size: 13px; }
.prices small { display: block; color: var(--muted); font-size: 11px; }
.prices b { font-size: 15px; }
.gain { color: var(--ok); }
.fav { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%; padding: 0; background: rgba(255,255,255,.92); border: 0; font-size: 18px; color: #98a2b3; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.fav.on { color: #e11d48; }
.more { display: flex; justify-content: center; margin-top: 18px; }

/* Ficha del producto */
.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
@media (max-width: 820px) { .pd { grid-template-columns: 1fr; } }
.gallery .main { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { padding: 0; width: 64px; height: 64px; flex: none; border-radius: 10px; overflow: hidden; }
.thumbs button.on { outline: 2px solid var(--brand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.bigprices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.bigprices div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.bigprices small { display: block; color: var(--muted); font-size: 12px; }
.bigprices b { font-size: 20px; }
.calc { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.calc .res { font-size: 18px; font-weight: 750; padding-bottom: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 650; }
td.num, th.num { text-align: right; }
.desc { white-space: pre-wrap; }

/* Proveedor */
.plist { display: flex; flex-direction: column; gap: 10px; }
.prow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; color: var(--ink); padding: 12px; }
.prow .im { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.prow .im img { width: 100%; height: 100%; object-fit: cover; }
.tabsbar { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0; }
.tabsbar button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 10px 12px; white-space: nowrap; color: var(--muted); }
.tabsbar button.on { color: var(--brand); border-bottom-color: var(--brand); }
.vtable input { padding: 8px; }
.vtable td { padding: 6px 4px; }
.imgs { display: flex; gap: 10px; flex-wrap: wrap; }
.imgs .it { position: relative; width: 110px; }
.imgs .it img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.imgs .it .acts { display: flex; justify-content: space-between; margin-top: 4px; }
.imgs .it .acts button { padding: 4px 8px; font-size: 13px; }
.imgs .add { width: 110px; height: 110px; border: 2px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; background: transparent; }
.margin { font-size: 14px; color: var(--ok); font-weight: 650; margin-top: 6px; }
.status-card { display: flex; gap: 14px; align-items: flex-start; }
.status-card .big { font-size: 28px; }
.vtable td:nth-child(1) input { min-width: 150px; }
.vtable td:nth-child(2) input { min-width: 110px; }
@media (max-width: 640px) { .status-card { flex-direction: column; } .status-card > .row { width: 100%; } }
