/* =========================================================
   Antenaz — hoja de estilos única (tema claro por defecto)
   ========================================================= */
:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --glass: rgba(255, 255, 255, .92);
  --line: #e7ebf1;
  --line-2: #dfe4ec;
  --text: #0f1728;
  --text-2: #344054;
  --muted: #667085;
  --blue: #1766ff;
  --blue-600: #0f55e0;
  --blue-soft: #e9f1ff;
  --green: #12b76a;
  --green-soft: #e7f8ef;
  --red: #f04438;
  --red-soft: #feeceb;
  --yellow: #f5b100;
  --yellow-soft: #fff6db;
  --purple: #7a3cf0;
  --gray: #667085;
  --shadow: 0 10px 30px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .14);
  --r: 20px;
  --r-sm: 12px;
  --dock-h: 84px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121a2b;
  --surface-2: #172136;
  --surface-3: #1d2942;
  --glass: rgba(18, 26, 43, .92);
  --line: #223050;
  --line-2: #2a3a5c;
  --text: #eef2f8;
  --text-2: #c9d2e3;
  --muted: #8b98b3;
  --blue-soft: #16264a;
  --green-soft: #0f2d22;
  --red-soft: #3a1717;
  --yellow-soft: #3a2f0f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }
:root:not([data-theme="dark"]) .only-dark, :root[data-theme="dark"] .only-light { display: none; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font: 600 15px/1 Inter, sans-serif; cursor: pointer; white-space: nowrap; transition: .15s;
  background: var(--surface-3); color: var(--text);
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(23, 102, 255, .28); }
.btn-primary:hover { background: var(--blue-600); filter: none; }
.btn-soft { background: var(--blue-soft); color: var(--blue); }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 500; cursor: pointer; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search],
input[type=datetime-local], input[type=date], input[type=color], select, textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: 15px Inter, sans-serif; outline: none; transition: border .15s, box-shadow .15s;
}
input[type=color] { padding: 4px; width: 64px; }
textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(23, 102, 255, .12); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; border: 1px solid var(--line); }
.card.narrow { max-width: 440px; margin: 0 auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.chip-online { background: var(--green-soft); color: #067647; } .chip-online i { background: var(--green); }
.chip-offline { background: var(--red-soft); color: #b42318; } .chip-offline i { background: var(--red); }
.chip-lastpos { background: var(--yellow-soft); color: #9a6700; } .chip-lastpos i { background: var(--yellow); }
.chip-inactive i { background: var(--gray); }
:root[data-theme="dark"] .chip-online { color: #6ce9a6; } :root[data-theme="dark"] .chip-offline { color: #fda29b; } :root[data-theme="dark"] .chip-lastpos { color: #fec84b; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-green { background: var(--green-soft); color: #067647; }
.pill-red { background: var(--red-soft); color: #b42318; }
.pill-yellow { background: var(--yellow-soft); color: #9a6700; }

.toast { position: fixed; z-index: 90; left: 50%; top: 18px; transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--surface); font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; max-width: calc(100vw - 32px); }
.toast-ok { background: #067647; color: #fff; } .toast-err { background: #b42318; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty.small { padding: 18px; font-size: 14px; }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-3); color: var(--text); font-weight: 600; }
.pager a.active { background: var(--blue); color: #fff; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; font-weight: 800; font-size: 27px; letter-spacing: -.04em; color: var(--text); }
.logo img { height: 34px; width: auto; display: block; }

/* =========================================================
   Barra superior de la app
   ========================================================= */
.topbar { position: relative; z-index: 30; display: flex; align-items: center; gap: 20px; padding: 16px 24px; }
.topbar.floating { position: fixed; top: 0; left: 0; right: 0; pointer-events: none; }
.topbar.floating > * { pointer-events: auto; }
.topbar .logo { min-width: 150px; text-shadow: 0 1px 12px rgba(255,255,255,.7); }
:root[data-theme="dark"] .topbar .logo { text-shadow: 0 1px 12px rgba(0,0,0,.6); }
.searchbar {
  flex: 1; max-width: 690px; margin: 0 auto; height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow); color: var(--muted); font: 14px Inter, sans-serif; cursor: text; text-align: left;
}
.searchbar span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font: 600 12px Inter, sans-serif; background: var(--surface-3); color: var(--text-2); border-radius: 8px; padding: 5px 8px; letter-spacing: .1em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { position: relative; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); box-shadow: var(--shadow); background: var(--glass); }
.badge-dot { position: absolute; top: 9px; right: 10px; min-width: 10px; height: 10px; border-radius: 99px; background: var(--red); border: 2px solid var(--surface); }
.account-btn { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px 0 6px; border-radius: 16px; border: 1px solid var(--line); cursor: pointer; color: var(--text); box-shadow: var(--shadow); font: inherit; text-align: left; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #13233f; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex: none; }
.acc-text { display: flex; flex-direction: column; line-height: 1.2; }
.acc-text b { font-size: 14px; font-weight: 600; } .acc-text small { color: var(--muted); font-size: 12.5px; }

.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 60; }
.dropdown.open .menu { display: block; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; font-size: 14px; }
.menu a:hover { background: var(--surface-2); }
.menu-user { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-user small { color: var(--muted); }
.menu-wide { width: 380px; padding: 0; }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.menu-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.menu-foot { justify-content: center; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px !important; color: var(--blue) !important; }

/* ---------- Dock inferior ---------- */
.dock {
  position: fixed; z-index: 30; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 26px;
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.dock-item { width: 86px; height: 66px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; transition: .15s; }
.dock-item:hover { color: var(--text); }
.dock-item.active { background: var(--blue-soft); color: var(--blue); }
.dock-plus { width: 60px; height: 60px; margin: 0 28px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(23, 102, 255, .45); transition: transform .15s; }
.dock-plus:hover { transform: scale(1.06); }

/* =========================================================
   Mapa principal
   ========================================================= */
.mode-app.map-page { overflow: hidden; height: 100vh; height: 100dvh; }
#map { position: fixed; inset: 0; z-index: 1; background: #e9eef2; }
.float { position: fixed; z-index: 20; }

.stats-card { left: 24px; top: 88px; width: 380px; padding: 20px 20px 18px; }
.stats-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stats-top h3 { font-size: 16px; margin-bottom: 8px; }
.stats-total { display: flex; align-items: center; gap: 10px; }
.stats-total b { font-size: 34px; font-weight: 700; letter-spacing: -.03em; }
.trend { display: inline-flex; align-items: center; gap: 4px; background: var(--green-soft); color: #067647; font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.donut-wrap { display: flex; align-items: center; gap: 10px; }
.donut { width: 76px; height: 76px; }
.round-btn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-2); border: 0; cursor: pointer; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); cursor: pointer; border: 1px solid transparent; transition: .15s; }
.stat:hover, .stat.on { border-color: var(--line-2); background: var(--surface); }
.stat i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.stat span { flex: 1; }
.stat b { font-size: 13px; padding: 2px 8px; border-radius: 8px; background: var(--surface); }
.stat.s-online i { background: var(--green); } .stat.s-online b { background: var(--green-soft); color: #067647; }
.stat.s-offline i { background: var(--red); } .stat.s-offline b { background: var(--red-soft); color: #b42318; }
.stat.s-lastpos i { background: var(--yellow); } .stat.s-lastpos b { background: var(--yellow-soft); color: #9a6700; }
.stat.s-inactive i { background: var(--gray); } .stat.s-inactive b { background: var(--surface-3); }

.devlist { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; max-height: 34vh; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.devrow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.devrow:hover, .devrow.sel { background: var(--surface-2); }
.devrow .dname { flex: 1; min-width: 0; }
.devrow .dname b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.devrow .dname small { color: var(--muted); font-size: 12.5px; }
.devrow .spd { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.map-tools { left: 24px; top: 50%; transform: translateY(-20%); display: flex; flex-direction: column; gap: 12px; }
.tool { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.tool-group { background: var(--surface); box-shadow: var(--shadow); border-radius: 14px; border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.tool-group .tool { box-shadow: none; border: 0; border-radius: 0; }
.tool-group .tool + .tool { border-top: 1px solid var(--line); }

.style-switch { left: 24px; bottom: 90px; display: flex; align-items: center; gap: 14px; padding: 6px 16px 6px 6px; border-radius: 16px; cursor: pointer; }
.style-switch .thumb { width: 70px; height: 60px; border-radius: 12px; background-size: cover; background-position: center; }
.style-switch b { font-weight: 500; font-size: 15px; }
.style-menu { position: absolute; bottom: calc(100% + 8px); left: 0; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; border: 1px solid var(--line); }
.style-menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--text); font: 500 14px Inter, sans-serif; cursor: pointer; }
.style-menu button:hover, .style-menu button.on { background: var(--blue-soft); color: var(--blue); }

/* Panel derecho */
.right-col { right: 22px; top: 88px; width: 370px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 110px); }
.detail-card { padding: 16px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.detail-head { display: flex; align-items: center; gap: 14px; padding: 2px 2px 14px; }
.dev-ico { width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.detail-head h3 { font-size: 18px; margin: 0 0 4px; }
.detail-head .x { margin-left: auto; align-self: flex-start; background: none; border: 0; cursor: pointer; color: var(--text-2); padding: 4px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 8px; }
.tabs button { flex: 1; height: 38px; border: 0; background: none; border-radius: 9px; font: 500 14px Inter, sans-serif; color: var(--text-2); cursor: pointer; position: relative; }
.tabs button.on { color: var(--blue); background: var(--surface); box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.tab-body { overflow-y: auto; min-height: 0; }
.info-row { display: flex; align-items: center; gap: 16px; padding: 11px 8px; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row .ii { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex: none; }
.info-row small { display: block; color: var(--muted); font-size: 13px; }
.info-row b { font-size: 15.5px; font-weight: 600; }
.info-split { display: grid; grid-template-columns: 1fr 1fr; }
.info-split .info-row { border-bottom: 0; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 14px; }
.detail-actions .btn { height: 48px; }

.alerts-card { padding: 18px 16px 10px; }
.alerts-card .card-head { margin-bottom: 8px; padding: 0 4px; }
.alerts-card .card-head a { font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 4px; border-radius: 12px; cursor: pointer; }
.alert-row:hover { background: var(--surface-2); }
.alert-ico { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.alert-time { font-size: 13.5px; color: var(--text-2); width: 44px; flex: none; padding-top: 5px; }
.alert-body { flex: 1; min-width: 0; }
.alert-body b { display: block; font-size: 14px; font-weight: 600; }
.alert-body small { display: block; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row.unread .alert-body b::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-left: 6px; vertical-align: middle; }
.ev-danger .alert-ico { background: var(--red); } .ev-danger b { color: var(--red); }
.ev-warn .alert-ico { background: var(--yellow); }
.ev-info .alert-ico { background: #3b6cf6; }
.ev-ok .alert-ico { background: var(--green); } .ev-ok b { color: #079455; }

/* Marcadores del mapa */
.mk { position: absolute; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; background: var(--surface); border-radius: 16px; box-shadow: 0 6px 18px rgba(16,24,40,.16); cursor: pointer; white-space: nowrap; border: 2px solid transparent; transition: border-color .15s; }
.mk.sel { border-color: var(--blue); }
.mk-ico { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; box-shadow: 0 4px 10px rgba(0,0,0,.18); position: relative; }
.mk-ico .dir { position: absolute; top: -7px; left: 50%; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid currentColor; transform-origin: 50% 28px; margin-left: -5px; }
.mk-txt b { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text); }
.mk-txt b i { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.mk-txt small { display: block; color: var(--text-2); font-size: 13px; line-height: 1.25; }
.mk.st-online .mk-txt b i { background: var(--green); } .mk.st-offline .mk-txt b i { background: var(--red); } .mk.st-lastpos .mk-txt b i { background: var(--yellow); }
.mk.compact { padding: 3px; border-radius: 50%; }
.mk.compact .mk-txt { display: none; }
.mk.compact .mk-ico { width: 34px; height: 34px; }
.mk-pulse::before { content: ''; position: absolute; left: 6px; top: 6px; width: 42px; height: 42px; border-radius: 50%; background: currentColor; opacity: .3; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .35; } 100% { transform: scale(1.9); opacity: 0; } }
.fence-label { background: var(--red); color: #fff; padding: 7px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 16px rgba(240, 68, 56, .3); line-height: 1.25; white-space: nowrap; }
.fence-label small { display: block; font-weight: 400; opacity: .9; font-size: 12.5px; }
.fence-label.blue { background: var(--blue); box-shadow: 0 6px 16px rgba(23, 102, 255, .3); }
.fence-pin { width: 38px; height: 38px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 0 0 6px rgba(240,68,56,.2); }
.fence-pin.blue { background: none; box-shadow: none; color: var(--blue); }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-bottom-right { bottom: 0; }

/* Paleta de búsqueda */
.palette { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 40, .35); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.palette-box { width: min(640px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input input { border: 0; box-shadow: none !important; height: 36px; padding: 0; font-size: 16px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; color: var(--text); }
.pal-item.on, .pal-item:hover { background: var(--blue-soft); }
.pal-item small { color: var(--muted); display: block; font-size: 12.5px; }
.pal-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 12px 4px; }

/* =========================================================
   Páginas internas de la app
   ========================================================= */
.mode-app:not(.map-page) { background: var(--bg) radial-gradient(circle at 20% 0%, rgba(23,102,255,.06), transparent 40%); min-height: 100vh; }
.page { max-width: 1240px; margin: 0 auto; padding: 8px 24px calc(var(--dock-h) + 48px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.split { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.map-box { height: 560px; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); position: relative; border: 1px solid var(--line); }
.map-box .inner { position: absolute; inset: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.kpi small { color: var(--muted); font-size: 13px; display: block; }
.kpi b { font-size: 24px; letter-spacing: -.02em; }
.dev-cell { display: flex; align-items: center; gap: 12px; }
.dev-cell .ci { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.dev-cell b { display: block; } .dev-cell small { color: var(--muted); }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.int-card { background: var(--surface); border-radius: 16px; border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.int-card .row b { font-size: 15px; }
.int-card .ic-wrap { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.int-card p { font-size: 13.5px; color: var(--text-2); margin: 0; }
.int-card .models { font-size: 12.5px; color: var(--muted); }
label.int-pick { cursor: pointer; }
label.int-pick input { display: none; }
label.int-pick:has(input:checked) .int-card { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,102,255,.15); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.copy-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--line-2); padding: 10px 12px; border-radius: 12px; font-family: ui-monospace, monospace; font-size: 14px; }
.copy-box span { flex: 1; word-break: break-all; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 18px 0 10px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs-line a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs-line a.on { color: var(--blue); border-color: var(--blue); }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,40,.4); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.playback { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.playback input[type=range] { flex: 1; accent-color: var(--blue); }

/* =========================================================
   Público: landing, login
   ========================================================= */
.mode-plain { background: var(--bg); }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { position: relative; overflow: hidden; background: #0b1b3a; color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .logo { color: #fff; }
.auth-side h2 { font-size: 34px; max-width: 420px; }
.auth-side p { color: #c9d6f2; max-width: 440px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-form .box { width: min(420px, 100%); }
.auth-form h1 { font-size: 30px; }
.divider { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0; }

.lp-nav { max-width: 1200px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lp-nav nav { display: flex; gap: 22px; align-items: center; }
.lp-nav nav a:not(.btn) { color: var(--text-2); font-weight: 500; }
.hero { max-width: 1200px; margin: 0 auto; padding: 40px 24px 20px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 58px; line-height: 1.02; letter-spacing: -.045em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--blue); }
.hero p.lead { font-size: 19px; color: var(--text-2); max-width: 540px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 18px; }
.hero-cta .btn { height: 52px; padding: 0 24px; font-size: 16px; }
.hero-art { position: relative; height: 520px; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.hero-art #heroMap { position: absolute; inset: 0; }
.hero-art .mini { position: absolute; z-index: 5; }
.lp-section { max-width: 1200px; margin: 0 auto; padding: 60px 24px; }
.lp-section h2 { font-size: 36px; letter-spacing: -.035em; text-align: center; }
.lp-section > p.sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 34px; font-size: 17px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.feat .ic-wrap { width: 46px; height: 46px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feat p { color: var(--text-2); margin: 0; font-size: 14.5px; }
.logos-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.logos-row span { background: var(--surface); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.plan { background: var(--surface); border-radius: 22px; border: 1px solid var(--line); padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.plan.hl { border: 2px solid var(--blue); }
.plan .price { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 12px 0 22px; flex: 1; }
.plan li { display: flex; gap: 8px; padding: 6px 0; color: var(--text-2); font-size: 14.5px; }
.plan li .ic { color: var(--green); }
.lp-foot { border-top: 1px solid var(--line); padding: 30px 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* =========================================================
   Admin
   ========================================================= */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 20px; }
.side-top .logo { font-size: 23px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.side a:hover { background: var(--surface-2); color: var(--text); }
.side a.active { background: var(--blue-soft); color: var(--blue); }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-foot small { padding: 8px 12px 0; overflow: hidden; text-overflow: ellipsis; }
.admin-main { padding: 28px 32px 60px; min-width: 0; }
.admin-main .page-head { margin-top: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cols-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.logbox { background: #0b1220; color: #d7e1f5; border-radius: 14px; padding: 14px; font: 12.5px/1.5 ui-monospace, monospace; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.dropzone { display: block; border: 2px dashed var(--line-2); border-radius: 18px; padding: 32px; text-align: center; cursor: pointer; transition: .15s; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: var(--blue-soft); }

/* =========================================================
   Responsivo
   ========================================================= */
@media (max-width: 1180px) {
  .right-col { width: 340px; }
  .stats-card { width: 340px; }
  .dock-item { width: 72px; }
}
@media (max-width: 980px) {
  .split, .cols-2, .cols-2-1, .hero, .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 42px; }
  .hero-art { height: 380px; }
  .admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .side-foot { display: none; }
  .admin-main { padding: 20px 16px 60px; }
  .acc-text { display: none; }
  .searchbar span { font-size: 13px; }
  .searchbar kbd { display: none; }
  .topbar .logo { min-width: 0; font-size: 22px; }
  .right-col { left: 12px; right: 12px; width: auto; top: auto; bottom: 102px; max-height: 52dvh; }
  .right-col .alerts-card { display: none; }
  .stats-card { left: 12px; right: 12px; width: auto; top: 76px; padding: 14px; }
  .stats-card .devlist, .stats-card .donut-wrap { display: none; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
  .stat { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: 11px; text-align: center; }
  .stat span { display: none; }
  .map-tools { left: auto; right: 12px; top: 250px; transform: none; }
  .style-switch { left: 12px; bottom: 100px; }
  .style-switch .thumb { width: 44px; height: 40px; }
  .topbar { padding: 12px; gap: 10px; }
  .top-actions { gap: 8px; }
  .icon-btn { width: 42px; height: 42px; }
  .account-btn { height: 46px; padding: 0 6px; gap: 4px; }
  .account-btn .ic { display: none; }
  .dock { left: 8px; right: 8px; transform: none; justify-content: space-between; bottom: 10px; padding: 6px; }
  .dock-item { width: auto; flex: 1; font-size: 11px; height: 58px; }
  .dock-plus { margin: 0 6px; width: 52px; height: 52px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page { padding: 4px 14px calc(var(--dock-h) + 40px); }
  .menu-wide { width: min(360px, calc(100vw - 24px)); right: -60px; }
  .lp-nav nav a:not(.btn) { display: none; }
}
@media (max-width: 560px) {
  .feat-grid, .kpis { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .searchbar { display: none; }
  .topbar .top-actions { margin-left: auto; }
}

.only-mobile { display: none; }
@media (max-width: 980px) { .only-mobile { display: block; } }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.maplibregl-popup-content { border-radius: 12px; font: 13px Inter, sans-serif; color: #0f1728; }
