/* CELECT · Control de Marcaje — hoja de estilos basada en la identidad de celectcac.com */
:root {
  --bg: #04050a;
  --bg2: #070910;
  --bg3: #0a0d18;
  --panel: #0a0d18;
  --panel2: #0e1222;
  --ink: #eef1fb;
  --muted: #8a93b2;
  --muted2: #5a6280;
  --wire: #00f5d4;
  --wire2: #00d4ff;
  --wire3: #9b5cff;
  --amber: #ffb454;
  --danger: #ff5c7a;
  --ok: #2ee6a6;
  --line: #161b2e;
  --line2: #222842;
  --grad: linear-gradient(90deg, #9b33ff, #6fa8ff);
  --grad-wire: linear-gradient(90deg, #00f5d4, #00d4ff);
  /* Colores de gráficas (validados para fondo oscuro y daltonismo) */
  --c-entrada: #00a892;
  --c-salida: #9b5cff;
  --c-3: #c27a1e;
  --c-4: #4f86e8;
  --font-d: 'Space Grotesk', system-ui, sans-serif;
  --font-b: 'Inter', system-ui, sans-serif;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.grid-bg {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 212, 255, .12), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
}
a { color: var(--wire2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-d); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wire-text { color: var(--wire); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-d); font-size: 11px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--wire2);
}
.eyebrow::before, .eyebrow.both::after {
  content: ''; width: 28px; height: 1px; background: linear-gradient(90deg, transparent, var(--wire2));
}
.eyebrow.both::after { background: linear-gradient(90deg, var(--wire2), transparent); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line2);
  background: transparent; color: var(--ink); font: 600 14px var(--font-d); cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s; white-space: nowrap;
}
.btn:hover { border-color: var(--muted2); background: rgba(255, 255, 255, .03); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--wire); color: #031512; border-color: transparent; box-shadow: 0 0 24px rgba(0, 245, 212, .35); }
.btn-primary:hover { background: #3dffe2; border-color: transparent; box-shadow: 0 0 34px rgba(0, 245, 212, .5); }
.btn-violet { background: var(--wire3); color: #fff; border-color: transparent; box-shadow: 0 0 24px rgba(155, 92, 255, .35); }
.btn-violet:hover { background: #ab73ff; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: rgba(255, 92, 122, .35); }
.btn-danger:hover { background: rgba(255, 92, 122, .08); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line2); background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted2); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font: 600 11px var(--font-d); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--ink); font: 400 15px var(--font-b); outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea.input { height: auto; min-height: 70px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--wire2); box-shadow: 0 0 0 3px rgba(0, 212, 255, .15); }
.input::placeholder { color: var(--muted2); }
input[type="date"].input::-webkit-calendar-picker-indicator { filter: invert(.7); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .icon-btn { position: absolute; right: 5px; top: 5px; border: 0; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--wire); }
.form-error {
  display: none; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px;
  background: rgba(255, 92, 122, .08); border: 1px solid rgba(255, 92, 122, .3); color: #ff9db0; font-size: 14px;
}
.form-error.show { display: block; }

/* ---------- Tarjetas ---------- */
.card {
  background: linear-gradient(180deg, rgba(14, 18, 34, .9), rgba(10, 13, 24, .9));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; }
.card-head .sub { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font: 600 12px var(--font-d); letter-spacing: .02em; border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.in { color: var(--wire); background: rgba(0, 245, 212, .08); border-color: rgba(0, 245, 212, .25); }
.badge.out { color: #c4a3ff; background: rgba(155, 92, 255, .1); border-color: rgba(155, 92, 255, .3); }
.badge.warn { color: var(--amber); background: rgba(255, 180, 84, .08); border-color: rgba(255, 180, 84, .3); }
.badge.off { color: var(--muted); background: rgba(138, 147, 178, .08); border-color: var(--line2); }
.badge.admin { color: var(--wire2); background: rgba(0, 212, 255, .08); border-color: rgba(0, 212, 255, .25); }
.badge.danger { color: var(--danger); background: rgba(255, 92, 122, .08); border-color: rgba(255, 92, 122, .3); }
.badge.nodot::before { display: none; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: rgba(4, 5, 10, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 22px; width: auto; display: block; }
.brand .tag { font: 600 10px var(--font-d); letter-spacing: .2em; color: var(--muted); text-transform: uppercase; padding-left: 12px; border-left: 1px solid var(--line2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(0, 245, 212, .25), rgba(155, 92, 255, .3)); color: var(--ink);
  font: 600 13px var(--font-d); border: 1px solid var(--line2); flex: none;
}

/* ---------- Modales ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(2, 3, 8, .72); backdrop-filter: blur(6px); animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
.modal.wide { max-width: 720px; }
.modal h3 { font-size: 20px; margin-bottom: 6px; }
.modal .lead { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Avisos ---------- */
#toasts { position: fixed; z-index: 300; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  padding: 12px 16px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2);
  box-shadow: var(--shadow); font-size: 14px; animation: pop .2s ease-out; display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { border-color: rgba(0, 245, 212, .4); }
.toast.err { border-color: rgba(255, 92, 122, .45); color: #ffc2cd; }

.secret-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg2); border: 1px dashed var(--wire); font: 600 18px var(--font-d); letter-spacing: .04em; color: var(--wire);
}

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font: 600 11px var(--font-d); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  padding: 12px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nowrap { white-space: nowrap; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl .actions .icon-btn { width: 30px; height: 30px; }
.tbl .badges { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
#usr-body td { padding: 10px 10px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.cell-user .n { font-weight: 500; }
.cell-user .u { font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 8px; }

/* ---------- Mapas ---------- */
.map { width: 100%; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #0b0f1c; z-index: 0; }
.leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(.85) contrast(.9) saturate(.6); }
.leaflet-container { font-family: var(--font-b); background: #0b0f1c; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel2); color: var(--ink); border: 1px solid var(--line2); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; line-height: 1.5; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: rgba(4, 5, 10, .7) !important; color: var(--muted2) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--panel2) !important; color: var(--ink) !important; border-color: var(--line2) !important; }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #04050a; box-shadow: 0 0 0 2px currentColor, 0 0 14px currentColor; background: currentColor; }
.pin.in { color: var(--wire); }
.pin.out { color: var(--wire3); }
.pin.me { color: var(--wire2); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(0, 212, 255, .2), 0 0 18px var(--wire2); } }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; }
.login-card .card { padding: 32px 28px; box-shadow: var(--shadow); }
.login-logo { display: flex; justify-content: center; margin-bottom: 26px; }
.login-logo img { height: 34px; }
.login-title { text-align: center; margin-bottom: 26px; }
.login-title h1 { font-size: 34px; line-height: 1.1; margin-top: 14px; }
.login-title p { color: var(--muted); margin: 10px 0 0; font-size: 14px; }
.login-foot { text-align: center; color: var(--muted2); font-size: 12px; margin-top: 22px; }
.login-foot .live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); letter-spacing: .14em; font: 600 10px var(--font-d); text-transform: uppercase; margin-bottom: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wire); box-shadow: 0 0 10px var(--wire); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- App del colaborador ---------- */
.app-main { max-width: 560px; margin: 0 auto; padding: 22px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.clock-card { text-align: center; padding: 28px 20px 24px; position: relative; overflow: hidden; }
.clock-card::after {
  content: ''; position: absolute; left: 10%; right: 10%; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--wire), transparent); opacity: .6;
}
.greeting { font-size: 15px; color: var(--muted); margin-top: 10px; }
.greeting b { color: var(--ink); font-weight: 600; }
.clock { font: 600 clamp(54px, 17vw, 78px)/1 var(--font-d); letter-spacing: -.03em; margin: 14px 0 6px; font-variant-numeric: tabular-nums; }
.clock .sec { color: var(--muted2); font-size: .45em; letter-spacing: 0; margin-left: 4px; }
.date-line { color: var(--muted); }
.date-line::first-letter { text-transform: uppercase; }
.status-row { display: flex; align-items: center; gap: 14px; }
.status-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--bg2); border: 1px solid var(--line2); color: var(--muted); flex: none; }
.status-ico.on { color: var(--wire); border-color: rgba(0, 245, 212, .35); box-shadow: 0 0 18px rgba(0, 245, 212, .15); }
.status-ico.done { color: #c4a3ff; border-color: rgba(155, 92, 255, .35); }
.status-row .t { font-weight: 600; font-family: var(--font-d); }
.status-row .s { color: var(--muted); font-size: 13px; }

.geo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.geo-state { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.geo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); animation: blink 1.4s infinite; flex: none; }
.geo-dot.ok { background: var(--wire); box-shadow: 0 0 10px var(--wire); animation: none; }
.geo-dot.err { background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: none; }
.geo-coords { color: var(--muted); font-size: 12px; margin-top: 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#mini-map { height: 180px; }
.geo-help { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 180, 84, .06); border: 1px solid rgba(255, 180, 84, .25); color: #ffd7a3; font-size: 13px; }

.mark-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-mark {
  position: relative; height: 112px; border-radius: var(--r-lg); border: 1px solid var(--line2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel); color: var(--ink); font: 600 17px var(--font-d); transition: transform .15s, box-shadow .25s, border-color .2s, opacity .2s;
}
.btn-mark svg.i { width: 28px; height: 28px; }
.btn-mark small { font: 500 11px var(--font-d); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.btn-mark.in.suggested { background: var(--wire); color: #031512; border-color: transparent; box-shadow: 0 0 40px rgba(0, 245, 212, .35); }
.btn-mark.in.suggested small { color: rgba(3, 21, 18, .65); }
.btn-mark.out.suggested { background: var(--wire3); color: #fff; border-color: transparent; box-shadow: 0 0 40px rgba(155, 92, 255, .4); }
.btn-mark.out.suggested small { color: rgba(255, 255, 255, .7); }
.btn-mark:active { transform: scale(.98); }
.btn-mark:disabled { opacity: .28; cursor: not-allowed; box-shadow: none; }
.project-pick {
  width: 100%; margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--ink); cursor: pointer; text-align: left; font: inherit;
}
.project-pick:hover { border-color: var(--wire2); }
.project-pick.need { border-color: rgba(255, 180, 84, .5); box-shadow: 0 0 0 3px rgba(255, 180, 84, .1); }
.project-pick.locked { cursor: default; }
.project-pick.locked:hover { border-color: var(--line2); }
.project-pick svg.i:first-child { color: var(--wire); }
.pp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pp-name { font: 600 16px var(--font-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-sub { color: var(--muted); font-size: 12px; }
.proj-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.proj-list li button {
  width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit;
}
.proj-list li:last-child button { border-bottom: 0; }
.proj-list li button:hover, .proj-list li button.sel { background: rgba(0, 245, 212, .07); }
.proj-list li button.sel .pn { color: var(--wire); }
.proj-list .pn { font-weight: 600; }
.proj-list .pc { color: var(--muted); font-size: 12px; }
.alert-text { color: var(--amber); font-size: 12px; }
.note-toggle { color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
.note-toggle summary { list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.note-toggle summary::-webkit-details-marker { display: none; }
.note-toggle[open] summary { margin-bottom: 10px; }

.hist-day { margin-top: 6px; }
.hist-day + .hist-day { margin-top: 16px; }
.hist-day h4 { font: 600 11px var(--font-d); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.hist-item:first-of-type { border-top: 0; }
.hist-item .tm { font: 600 17px var(--font-d); font-variant-numeric: tabular-nums; min-width: 78px; }
.hist-item .meta { flex: 1; color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.success-overlay { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; background: rgba(2, 3, 8, .85); backdrop-filter: blur(8px); animation: fade .2s; padding: 16px; }
.success-box { text-align: center; max-width: 360px; }
.success-ring { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 20px; display: grid; place-items: center; border: 2px solid var(--wire); box-shadow: 0 0 50px rgba(0, 245, 212, .4), inset 0 0 30px rgba(0, 245, 212, .15); color: var(--wire); animation: pop .3s ease-out; }
.success-ring.out { border-color: var(--wire3); color: var(--wire3); box-shadow: 0 0 50px rgba(155, 92, 255, .45), inset 0 0 30px rgba(155, 92, 255, .2); }
.success-ring svg.i { width: 52px; height: 52px; stroke-width: 2.2; }
.success-box .big { font: 600 54px/1 var(--font-d); font-variant-numeric: tabular-nums; margin: 6px 0 10px; }

/* ---------- Panel administrador ---------- */
.admin-layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 16px;
  background: rgba(7, 9, 16, .92); border-right: 1px solid var(--line);
}
.sidebar .brand { padding: 4px 8px 22px; flex-direction: column; align-items: flex-start; gap: 10px; }
.sidebar .brand .tag { border-left: 0; padding-left: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted);
  font: 500 14px var(--font-d); cursor: pointer; border: 1px solid transparent; background: none; width: 100%; text-align: left;
}
.nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, .03); text-decoration: none; }
.nav-item.active { color: var(--ink); background: linear-gradient(90deg, rgba(0, 245, 212, .1), rgba(0, 245, 212, 0)); border-color: rgba(0, 245, 212, .18); }
.nav-item.active svg.i { color: var(--wire); }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-top: 1px solid var(--line); margin-top: 8px; font-size: 13px; }
.sidebar .me .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me .icon-btn { width: 30px; height: 30px; }
.sidebar .me .r { color: var(--muted); font-size: 12px; }

.admin-main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.15; margin-top: 8px; }
.page-head p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin: 0; }
.filters .input { height: 40px; font-size: 14px; }
.filters .grow { flex: 1; min-width: 180px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line2); }
.seg button { height: 32px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font-d); cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 18px 20px; }
.kpi .label { display: flex; align-items: center; gap: 8px; }
.kpi .value { font: 600 36px/1.1 var(--font-d); margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .foot { color: var(--muted); font-size: 12px; margin-top: 6px; }
.kpi .value .unit { font-size: 16px; color: var(--muted); margin-left: 4px; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.grid-2 > *, .kpis > *, .admin-main > section { min-width: 0; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.list-plain { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.list-plain li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list-plain li:first-child { border-top: 0; }
#dash-map { height: 340px; }
#reg-map { height: 520px; }
#detail-map { height: 280px; }
.view-toggle { margin-left: auto; }

/* ---------- En vivo (ubicación continua) ---------- */
.live-layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.live-map { height: 600px; }
.live-list { list-style: none; margin: 0; padding: 0; max-height: 600px; overflow: auto; }
.live-list li + li { border-top: 1px solid var(--line); }
.live-list li.empty { padding: 18px 4px; color: var(--muted); font-size: 14px; }
.live-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 8px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 12px; color: var(--ink); cursor: pointer; font: inherit;
}
.live-list button:hover { background: var(--bg2); }
.live-list button.sel { border-color: rgba(0, 245, 212, .4); background: rgba(0, 245, 212, .06); }
.live-list .avatar { flex: none; }
.lv-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lv-txt .n { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-txt .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaflet-tooltip.live-label {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line2); border-radius: 8px;
  padding: 3px 8px; font-size: 12px; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.leaflet-tooltip.live-label::before { border-top-color: var(--line2); }
.leaflet-tooltip.live-label.dim { opacity: .45 !important; }
.pin.stale { color: var(--amber); }
.status-ico.live { animation: pulse-live 2s infinite; }
@keyframes pulse-live { 50% { box-shadow: 0 0 0 6px rgba(0, 245, 212, .15), 0 0 18px rgba(0, 245, 212, .3); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .live-layout { grid-template-columns: 1fr; }
  .live-map { height: 460px; }
  .live-list { max-height: 320px; }
}
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 60; height: auto; flex-direction: row; align-items: center; overflow-x: auto;
    padding: 10px 12px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand { padding: 0 8px 0 0; }
  .sidebar .brand .tag, .sidebar .spacer, .sidebar .me .meta { display: none; }
  .sidebar .me { border: 0; margin: 0; padding: 0 0 0 6px; }
  .nav-item { width: auto; padding: 9px 10px; white-space: nowrap; }
  .nav-item .lbl { display: none; }
  .nav-item.active .lbl { display: inline; }
  .admin-main { padding: 20px 16px 50px; }
  .page-head h1 { font-size: 24px; }
}
@media (max-width: 520px) {
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 28px; }
  .brand .tag { display: none; }
  .user-chip .nm { display: none; }
  .card { padding: 18px 16px; }
  .btn-mark { height: 100px; }
  .clock-card .eyebrow::before, .clock-card .eyebrow::after { display: none; }
  .clock-card .eyebrow { letter-spacing: .14em; }
  .modal { padding: 20px 18px; }
  .modal-actions .btn { flex: 1 1 auto; padding: 0 14px; }
}
