/* Precios · Reusalia — estilo alineado con altas/caja/reposición */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --ok: #16a34a;
  --amber: #d97706;
  --err: #dc2626;
  --wallapop: #13c1ac;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --panel: #171b21; --ink: #e8eaed; --muted: #9aa3af;
    --line: #262b33; --brand: #6366f1; --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 26px; }
.brand h1 { font-size: 17px; margin: 0; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.conn { display: flex; align-items: center; gap: 8px; }
.conn-text { font-size: 13px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.dot-off { background: #9ca3af; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 15px; }

/* Settings */
.settings { background: var(--panel); border-bottom: 1px solid var(--line); padding: 12px 18px; }
.settings-grid { display: flex; gap: 18px; align-items: end; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* Tabs */
.tabs { display: flex; gap: 6px; padding: 12px 18px 0; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px;
}
.tab.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Layout */
.layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; padding: 16px 18px 40px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }

/* Item panel */
.item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress { font-size: 13px; color: var(--muted); }
.item-card { border: 1px dashed var(--line); border-radius: 12px; padding: 16px; min-height: 120px; }
.item-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-title h2 { margin: 0; font-size: 20px; }
.lpn { display: inline-block; margin: 8px 0; font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 6px; }
.specs { margin: 6px 0 12px; color: var(--ink); }
.refs { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.ref { flex: 1; min-width: 100px; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.ref-l { display: block; font-size: 11.5px; color: var(--muted); }
.ref-v { font-size: 17px; font-weight: 700; }
.ref-v.hl { color: var(--brand); }
.kw { margin: 6px 0 0; }
.descripcion { margin: 8px 0; font-size: 14.5px; line-height: 1.5; }
.specs { margin: 4px 0; font-size: 13px; }
.features { margin: 6px 0; font-size: 13px; }
.features summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
.features p { margin: 6px 0 0; white-space: pre-line; color: var(--muted); }
.wptitle { margin: 8px 0 0; }

.badge { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.badge-done { background: rgba(22,163,74,.12); color: var(--ok); border-color: transparent; }

/* Price form */
.price-form { margin-top: 16px; }
.btn-wallapop { display: inline-flex; align-items: center; gap: 6px; background: var(--wallapop); color: #04211d; font-weight: 700; text-decoration: none; padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; }
.preview { min-height: 18px; margin: 4px 0 12px; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input, .field select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font-size: 15px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 .narrow { max-width: 100%; }
.lpn-row { display: flex; gap: 8px; }
.lpn-row input { flex: 1; }

/* Buttons */
.actions { display: flex; gap: 10px; margin-top: 14px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 10px 16px; cursor: pointer; font-size: 14.5px; font-weight: 600; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; }

/* Side panel */
.sec-title { font-size: 15px; margin: 0; }
.sub-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.hist-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.queue, .done { display: flex; flex-direction: column; gap: 4px; }
.q-row, .d-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; background: var(--bg); border-radius: 8px; font-size: 13px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-price { color: var(--muted); font-variant-numeric: tabular-nums; }
.q-price.ok { color: var(--ok); font-weight: 700; }

.chip { display: inline-block; min-width: 20px; text-align: center; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.chip-amber { background: var(--amber); }

.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 13.5px; }
.empty.error { color: var(--err); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 11px 18px; border-radius: 10px; color: #fff; box-shadow: var(--shadow); z-index: 50; font-weight: 600; }
.toast-ok { background: var(--ok); }
.toast-warn { background: var(--amber); }
.toast-error { background: var(--err); }
