/* EMOBA · Panel de administración (usa los tokens de assets/css/styles.css) */
body.admin { font-size: 15.5px; background: var(--bg); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 60% at 80% 0%, rgba(255,93,38,.16), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); padding: 36px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-card img { height: 54px; margin-bottom: 26px; }
.login-card h1 { font-size: 34px; font-style: italic; margin-bottom: 6px; }


.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.side .logo img { height: 34px; }
.side .logo span { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line-2); padding-left: 10px; }
.side nav { display: grid; gap: 2px; }
.side nav button { display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 44px; border-radius: 10px; border: 0; background: none; color: var(--text-2); font-weight: 500; text-align: left; transition: background var(--t), color var(--t); }
.side nav button svg { width: 19px; height: 19px; flex: none; }
.side nav button:hover { background: var(--surface); color: var(--text); }
.side nav button[aria-current='page'] { background: var(--orange-a12); color: var(--orange-hi); }
.side nav button .n { margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px; background: var(--orange); color: #111; font-size: 12px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }
.side .bottom { margin-top: auto; display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.side .mode { font-size: 12px; color: var(--muted); padding: 0 10px; line-height: 1.4; }
.side .mode b { color: var(--ok); }
.side .mode.demo b { color: var(--warn); }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.topbar h1 { font-size: clamp(30px, 3.4vw, 42px); font-style: italic; }
.topbar .tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mob-top { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 90; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform var(--t) var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .mob-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 40; }
  .mob-top img { height: 30px; }
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-display); font-size: 44px; font-weight: 800; font-style: italic; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat.o b { color: var(--orange); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 18px; }
.box h2 { font-size: 22px; margin-bottom: 14px; letter-spacing: .02em; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.box-head h2 { margin: 0; }

.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background var(--t-fast); }
table.t tbody tr:hover { background: rgba(255,255,255,.025); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t .act { white-space: nowrap; text-align: right; }
table.t .act .icon-btn { width: 36px; height: 36px; display: inline-grid; margin-left: 4px; }
table.t .act .icon-btn svg { width: 17px; height: 17px; }
.empty-row { text-align: center; color: var(--muted); padding: 34px !important; }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-nueva, .st-borrador { color: var(--warn); background: rgba(245,184,65,.12); }
.st-enviada, .st-contactada { color: #6CB4FF; background: rgba(108,180,255,.12); }
.st-aceptada, .st-cerrada { color: var(--ok); background: rgba(61,214,140,.12); }
.st-rechazada, .st-descartada { color: #FF8A8E; background: rgba(255,90,95,.12); }
.input.sm, .select.sm { min-height: 42px; font-size: 15px; border-radius: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 180px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.muted-sm { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); margin: 2px 4px 2px 0; }

/* Modal */
.modal-scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0,0,0,.65); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity var(--t); }
.modal-scrim.open { opacity: 1; }
.modal { width: min(var(--mw, 720px), 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow); transform: translateY(16px) scale(.98); transition: transform var(--t) var(--ease); }
.modal-scrim.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal-head h3 { font-size: 26px; font-style: italic; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* Importador */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 200px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 36px 20px; text-align: center; transition: border-color var(--t), background var(--t); cursor: pointer; }
.drop span { display: block; max-width: 46ch; }
.drop:focus-within { border-color: var(--orange); }
.drop:hover, .drop.over { border-color: var(--orange); background: var(--orange-a12); }
.drop svg { display: block; width: 46px; height: 46px; color: var(--orange); margin: 0 0 10px; flex: none; }
.drop b { display: block; font-size: 18px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; }
.steps span.on { background: var(--orange); color: #111; }
.steps span.done { color: var(--ok); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.map-item { padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.map-item .label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.conf { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.conf.hi { background: rgba(61,214,140,.15); color: var(--ok); }
.conf.mid { background: rgba(245,184,65,.15); color: var(--warn); }
.conf.lo { background: var(--surface-3); color: var(--muted); }
.kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.kpis span { padding: 8px 12px; border-radius: 10px; background: var(--surface); font-size: 14px; }
.kpis b { color: var(--orange-hi); font-variant-numeric: tabular-nums; }

/* Imágenes */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.img-card { border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
.img-card .pic { aspect-ratio: 1; background: radial-gradient(65% 65% at 50% 50%, #2b2b30, #111113); display: grid; place-items: center; position: relative; }
.img-card .pic img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.img-card .pic svg { width: 50%; color: #3a3a40; }
.img-card .pic .badge { position: absolute; top: 10px; left: 10px; }
.img-card .info { padding: 12px 14px; flex: 1; }
.img-card .info b { display: block; font-size: 15px; }
.img-card .info small { color: var(--muted); font-size: 12.5px; }
.img-card .btns { display: flex; gap: 6px; padding: 0 14px 14px; }
.img-card .btns .btn { flex: 1; min-height: 40px; padding: 0 10px; font-size: 14px; }
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cand { border: 2px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; transition: border-color var(--t), transform var(--t-fast); padding: 0; }
.cand:hover { border-color: var(--orange); transform: translateY(-2px); }
.cand img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.cand small { display: block; background: var(--surface); color: var(--muted); font-size: 11px; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Editor de cotización */
.q-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .q-grid { grid-template-columns: 1fr; } }
.q-items td input { min-height: 40px; font-size: 14.5px; padding: 0 10px; border-radius: 8px; }
.q-items td input.n { text-align: right; width: 90px; font-variant-numeric: tabular-nums; }
.q-items td input.d { width: 100%; min-width: 200px; }
.totals { display: grid; gap: 8px; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-family: var(--font-display); font-size: 34px; font-weight: 800; color: var(--orange); border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 4px; }
.sticky-side { position: sticky; top: 20px; }
.client-pick { position: relative; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; max-height: 280px; overflow-y: auto; box-shadow: var(--shadow); }
.suggest button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: none; border-bottom: 1px solid var(--line); }
.suggest button:hover, .suggest button.hl { background: var(--orange-a12); }
.suggest button small { display: block; color: var(--muted); }
.inv-pick table.t td { font-size: 14px; }
.stock { font-weight: 700; }
.stock.z { color: #FF8A8E; }

/* Campo de contraseña con ojo */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 10px; }
.pw-eye:hover { color: var(--orange-hi); }
.pw-eye svg { width: 20px; height: 20px; }
details summary::marker { color: var(--orange); }

/* Acceso simplificado */
.login-card .field { display: grid; gap: 8px; }
.login-card .input { min-height: 56px; font-size: 17px; }
.login-card .input[aria-invalid='true'] { border-color: var(--danger); }
.login-err { min-height: 22px; margin: 12px 0 10px; color: #FF8A8E; font-size: 14.5px; }
.login-err:empty { margin: 6px 0; }
.login-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.login-card .btn-primary { min-height: 56px; font-size: 17px; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
