:root,
[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-text: #042f2e;
  --header: #111827;
  --line: #334155;
  --input: #0b1220;
  --ok: #10b981;
  --danger: #f43f5e;
  --logo-plate: #f4f6f7;
}
[data-theme="light"] {
  --bg: #f4f6f7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #5b6b73;
  --accent: #006e6e;
  --accent-text: #ffffff;
  --header: #ffffff;
  --line: #d5dce0;
  --input: #eef2f4;
  --ok: #0f766e;
  --danger: #c41e1e;
  --logo-plate: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; }
body { min-height: 100dvh; }
a { color: var(--accent); }
header.app {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 10px 16px; background: var(--header); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo-wrap {
  display: flex; align-items: center; justify-content: center;
  background: var(--logo-plate);
  border-radius: 12px;
  padding: 4px 8px;
}
.brand-logo { height: 44px; width: auto; display: block; }
.header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
main { padding: 16px; max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 0 rgba(15, 23, 42, .04); }
.login-brand {
  display: flex; justify-content: center; margin-bottom: 12px;
}
.login-brand .brand-logo-wrap { padding: 10px 16px; }
.login-brand .brand-logo { height: 120px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
input, textarea, select, button {
  width: 100%; padding: 12px; border-radius: 10px; border: 0; font-size: 16px;
}
input, textarea, select { background: var(--input); color: var(--text); }
button { background: var(--accent); color: var(--accent-text); font-weight: 800; cursor: pointer; }
button.secondary { background: var(--line); color: var(--text); }
button.ghost { background: transparent; color: var(--accent); width: auto; padding: 8px 10px; font-size: 14px; }
button.icon-btn {
  width: 42px; height: 42px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
button.icon-btn svg { width: 22px; height: 22px; }
.icon-sun { fill: currentColor; }
.icon-moon { fill: currentColor; }
[data-theme="dark"] button.icon-btn .icon-sun { display: none; }
[data-theme="light"] button.icon-btn .icon-moon { display: none; }
nav.tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
nav.tabs.tabs-admin { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 520px) {
  nav.tabs,
  nav.tabs.tabs-admin { grid-template-columns: 1fr 1fr; }
}
.map-toolbar select { margin-bottom: 10px; }
.check-inline {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; margin: 0 0 10px;
}
.check-inline input[type="checkbox"] {
  width: 18px; height: 18px; padding: 0; flex-shrink: 0;
}
.map-card { padding: 0; overflow: hidden; }
#mapaClientes { height: 380px; width: 100%; z-index: 1; }
.ficha-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.trace-block h4 { margin: 14px 0 6px; font-size: 14px; }
.trace-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.trace-item small { display: block; color: var(--muted); }
.trace-line { font-size: 13px; color: var(--muted); padding: 2px 0 2px 8px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.item small { color: var(--muted); display: block; }
.prices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.price {
  flex: 1 1 120px; min-width: 110px; border-radius: 14px; padding: 10px;
  background: linear-gradient(145deg, #006e6e, #0f766e); color: #fff;
}
.price.scale { background: linear-gradient(145deg, #c41e1e, #9f1239); }
.price b { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.price-qty { margin-top: 6px; font-size: 18px; font-weight: 800; line-height: 1.1; }
.price-qty-u { font-size: 12px; font-weight: 700; opacity: .9; }
.price-val { margin-top: 8px; font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); margin: 8px 0; }
.ok { color: var(--ok); }
.row { display: grid; grid-template-columns: 1fr 90px; gap: 8px; align-items: end; }
.hidden { display: none !important; }
#installHint { font-size: 13px; color: var(--muted); margin-top: 8px; }
button:disabled { opacity: .65; cursor: wait; }
.status-bar {
  position: sticky;
  top: 64px;
  z-index: 6;
  margin: 0;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.status-bar.status-loading {
  background: var(--accent);
  color: var(--accent-text);
}
.status-bar.status-ok {
  background: var(--ok);
  color: #fff;
}
.status-bar.status-error {
  background: var(--danger);
  color: #fff;
}
.status-progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: rgba(255, 255, 255, .25);
}
.status-bar.status-loading .status-progress {
  display: block;
}
.status-progress::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: #fff;
  animation: statusSlide 1s ease-in-out infinite;
}
@keyframes statusSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
