/* ============================================================
   ControlRuta GPS — Design System v2
   Tema: Professional Light — limpio, corporativo, legible
   Fuentes: Plus Jakarta Sans (display) + Geist (mono/data)
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Superficie */
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f5f7fa;
  --bg-active: #eef2ff;

  /* Bordes */
  --border: #e2e6ec;
  --border-md: #c9d1dc;
  --border-focus: #3b6fe8;

  /* Primario — azul marino */
  --primary: #2355d4;
  --primary-dk: #1a42b0;
  --primary-lt: #eef2ff;
  --primary-mid: rgba(35, 85, 212, 0.12);

  /* Semánticos */
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #0284c7;
  --info-bg: #f0f9ff;

  /* Texto */
  --txt-1: #111827;
  --txt-2: #374151;
  --txt-3: #4b5563;
  --txt-4: #6b7280;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 56px;

  /* Radius */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Sombras */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.18s;
}

/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  height: 100%;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt-1);
  min-height: 100vh;
  display: flex;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--primary);
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
}
input,
select,
textarea {
  font: inherit;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition:
    width var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  overflow: hidden;
}
.sidebar.collapsed {
  width: 60px;
}
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item > span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-actions {
  display: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}
.sidebar.collapsed .user-card {
  justify-content: center;
}

/* Brand */
.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--primary);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-icon svg {
  width: 16px;
  height: 16px;
  color: #fff;
}
.brand-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--txt-1);
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.sidebar-toggle {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--txt-3);
  transition: all var(--dur);
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--txt-1);
}
.sidebar-toggle svg {
  width: 15px;
  height: 15px;
}
.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-section {
  margin-bottom: 4px;
}
.nav-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt-4);
  padding: 10px 8px 4px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--txt-3);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--dur);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--txt-2);
}
.nav-item.active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active .nav-icon {
  color: var(--primary);
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.danger {
  background: var(--danger);
}

/* Footer del sidebar */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: default;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-info strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.user-info small {
  display: block;
  font-size: 0.68rem;
  color: var(--txt-4);
}
.user-actions {
  display: flex;
  gap: 2px;
  padding: 0 4px;
}
.btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--txt-3);
  transition: all var(--dur);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--txt-1);
}
.btn-icon svg {
  width: 14px;
  height: 14px;
}

/* ── Main wrapper ─────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--dur) var(--ease);
}
.sidebar.collapsed ~ .main-wrapper {
  margin-left: 60px;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}
.mobile-toggle {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--txt-3);
}
.mobile-toggle svg {
  width: 18px;
  height: 18px;
}
.topbar-title {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--txt-2);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.clock {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--txt-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.conn-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--txt-3);
  background: var(--bg);
}
.conn-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--txt-4);
}
.conn-badge.connected {
  border-color: #bbf7d0;
  background: var(--success-bg);
  color: var(--success);
}
.conn-badge.connected .dot {
  background: var(--success);
  box-shadow: 0 0 5px var(--success);
}
.conn-badge.error {
  border-color: #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}
.conn-badge.error .dot {
  background: var(--danger);
}

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 22px 24px;
  overflow-y: auto;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--txt-1);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 0.78rem;
  color: var(--txt-3);
  margin-top: 2px;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--txt-1);
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-wrap {
  overflow-x: auto;
}

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition:
    box-shadow var(--dur),
    transform var(--dur);
}
.kpi-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txt-3);
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--txt-1);
  line-height: 1;
  letter-spacing: -0.5px;
}
.kpi-sub {
  font-size: 0.72rem;
  color: var(--txt-4);
  margin-top: 4px;
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg {
  width: 18px;
  height: 18px;
}
.kpi-icon.blue {
  background: #dbeafe;
  color: #1d4ed8;
}
.kpi-icon.green {
  background: #dcfce7;
  color: #15803d;
}
.kpi-icon.red {
  background: #fee2e2;
  color: #b91c1c;
}
.kpi-icon.amber {
  background: #fef3c7;
  color: #b45309;
}
.kpi-icon.indigo {
  background: #e0e7ff;
  color: #4338ca;
}

/* ── Table ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}
thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--txt-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--bg-hover);
}
tbody td {
  padding: 11px 14px;
  color: var(--txt-2);
  vertical-align: middle;
}
tbody td strong {
  color: var(--txt-1);
  font-weight: 600;
}
.table-actions {
  display: flex;
  gap: 4px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-green {
  background: #dcfce7;
  color: #15803d;
}
.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}
.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-amber {
  background: #fef3c7;
  color: #b45309;
}
.badge-gray {
  background: var(--bg);
  color: var(--txt-3);
  border: 1px solid var(--border);
}

/* aliases usados en código */
.badge-online {
  background: #dcfce7;
  color: #15803d;
}
.badge-offline {
  background: #fee2e2;
  color: #b91c1c;
}
.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge-warn {
  background: #fef3c7;
  color: #b45309;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--dur);
  white-space: nowrap;
  cursor: pointer;
}
.btn svg {
  width: 14px;
  height: 14px;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dk);
}
.btn-primary:hover {
  background: var(--primary-dk);
  box-shadow: 0 2px 8px rgba(35, 85, 212, 0.3);
}
.btn-ghost {
  background: transparent;
  color: var(--txt-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-md);
}
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger-ghost:hover {
  background: var(--danger-bg);
}
.btn-sm {
  padding: 5px 11px;
  font-size: 0.75rem;
}
.btn-xs {
  padding: 3px 8px;
  font-size: 0.68rem;
  border-radius: var(--r-sm);
}
.btn-icon-sm {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  color: var(--txt-3);
  transition: all var(--dur);
}
.btn-icon-sm:hover {
  background: var(--bg-hover);
  color: var(--txt-1);
  border-color: var(--border);
}
.btn-icon-sm.danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
}
.btn-icon-sm svg {
  width: 13px;
  height: 13px;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--txt-2);
  margin-bottom: 5px;
}
.form-input,
.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-md);
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-size: 0.82rem;
  color: var(--txt-1);
  transition:
    border-color var(--dur),
    box-shadow var(--dur);
  appearance: none;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 111, 232, 0.1);
}
.form-input::placeholder {
  color: var(--txt-4);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  padding-right: 30px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.form-hint {
  font-size: 0.68rem;
  color: var(--txt-4);
  margin-top: 3px;
  display: block;
}
.form-actions {
  display: flex;
  gap: 8px;
}

/* ── Tabs (empresa detail, etc.) ──────────────────────────── */
.cr-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.cr-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--txt-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition: color var(--dur);
}
.cr-tab:hover {
  color: var(--txt-1);
  background: var(--bg-2);
}
.cr-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-lt);
}
.cr-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--bg-2);
  color: var(--txt-3);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 4px;
}
.cr-tab.active .cr-tab-badge {
  background: var(--primary);
  color: #fff;
}
.cr-tab-panel {
  animation: fadeUp 0.18s ease;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s var(--ease);
}
.modal.modal-lg {
  max-width: 680px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--txt-1);
}
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--txt-3);
  transition: all var(--dur);
  font-size: 0.9rem;
  line-height: 1;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--txt-1);
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}
.auth-left {
  flex: 1;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}
/* Decorative circles (hidden when custom bg image is used) */
.auth-left::before {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  top: -150px;
  right: -150px;
}
.auth-left::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  bottom: -80px;
  left: 20px;
}
/* When a custom background image is set */
.auth-left.has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.auth-left.has-bg::before,
.auth-left.has-bg::after {
  display: none;
}
.auth-left-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    145deg,
    rgba(35, 85, 212, 0.062) 0%,
    rgba(10, 20, 80, 0.7) 100%
  );
}
.auth-left.has-bg .auth-left-overlay {
  display: block;
}

.auth-left-content {
  position: relative;
  z-index: 1;
  max-width: 400px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}
.auth-logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-logo-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}
.auth-logo-img {
  max-height: 44px;
  max-width: 160px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
.auth-logo-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}
.auth-tagline {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 36px;
  line-height: 1.6;
}
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-feature-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-feature-icon svg {
  width: 15px;
  height: 15px;
  color: #fff;
}
.auth-feature-text {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* Sidebar brand logo image */
.brand-logo-img {
  max-height: 28px;
  max-width: 130px;
  object-fit: contain;
}

.auth-right {
  width: 440px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
}
.login-box {
  width: 100%;
}
.login-box h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--txt-1);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.login-box .sub {
  font-size: 0.8rem;
  color: var(--txt-3);
  margin-bottom: 28px;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--r-md);
  padding: 9px 13px;
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.input-wrapper {
  position: relative;
}
.input-wrapper .form-input {
  padding-left: 36px;
}
.input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-4);
  pointer-events: none;
}
.input-icon svg {
  width: 15px;
  height: 15px;
}
.btn-login {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--dur);
  margin-top: 6px;
}
.btn-login:hover {
  background: var(--primary-dk);
  box-shadow: 0 4px 12px rgba(35, 85, 212, 0.35);
}

/* ── Auth GPS Panel (shared por login / forgot / reset) ──── */
.auth-left {
  background: linear-gradient(135deg, #061028 0%, #0d1b3e 55%, #0a1f5e 100%);
  padding: 40px 32px;
  align-items: center;
}
.auth-left::before, .auth-left::after { display: none; }
.auth-gps-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
}
.auth-gps-glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 65% 55%, rgba(37,99,235,.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 20% 25%, rgba(96,165,250,.07) 0%, transparent 60%);
}
.auth-left-content {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 340px;
}
.auth-brand {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 28px; align-self: flex-start;
}
.auth-brand img {
  height: 80px; width: auto;
  background: rgba(255,255,255,.92); border-radius: 18px; padding: 10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25), 0 8px 28px rgba(255,255,255,.18);
}
.auth-brand-name {
  font-size: 1.05rem; font-weight: 800; color: #fff;
  letter-spacing: -.3px; line-height: 1.1;
}
.auth-brand-name small {
  display: block; font-size: .65rem; font-weight: 500;
  color: rgba(255,255,255,.45); letter-spacing: .06em; text-transform: uppercase;
}
.auth-mockup-wrap {
  position: relative; display: flex; justify-content: center;
  margin-bottom: 24px; width: 100%;
  animation: authFloat 6s ease-in-out infinite;
}
@keyframes authFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.auth-fc {
  position: absolute; background: rgba(255,255,255,.96); border-radius: 10px;
  padding: 8px 12px; box-shadow: 0 10px 32px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
  font-size: .68rem; font-weight: 600; color: #0f172a; white-space: nowrap; z-index: 3;
}
.auth-fc.fc1 { top:-14px; left:-16px; animation: authFc1 5s ease-in-out infinite; }
.auth-fc.fc2 { bottom:28px; right:-16px; animation: authFc2 6s ease-in-out infinite; }
@keyframes authFc1 { 0%,100%{transform:translateY(0) rotate(-1deg)} 50%{transform:translateY(-6px) rotate(1deg)} }
@keyframes authFc2 { 0%,100%{transform:translateY(0) rotate(1deg)} 50%{transform:translateY(-5px) rotate(-1deg)} }
.auth-fc-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.auth-fc-dot.amber { background:#f59e0b; }
.auth-fc-dot.green { background:#16a34a; }
.auth-mockup-card {
  background: rgba(255,255,255,.06); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 18px; overflow: hidden;
  width: 300px; box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
}
.auth-m-header {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  background: rgba(0,0,0,.2); border-bottom: 1px solid rgba(255,255,255,.07);
}
.auth-m-dot { width:9px; height:9px; border-radius:50%; }
.auth-m-dot.r{background:#ff5f57} .auth-m-dot.a{background:#febc2e} .auth-m-dot.g{background:#28c840}
.auth-m-title { flex:1; text-align:center; font-size:.66rem; font-weight:600; color:rgba(255,255,255,.4); }
.auth-m-live {
  display:flex; align-items:center; gap:4px;
  font-size:.6rem; font-weight:700; color:#28c840; text-transform:uppercase; letter-spacing:.04em;
}
.auth-m-live::before {
  content:''; width:5px; height:5px; border-radius:50%;
  background:#28c840; animation: authPulse 1.5s infinite;
}
@keyframes authPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }
.auth-m-map {
  position:relative; height:158px;
  background:linear-gradient(135deg,#0a1628 0%,#0f2044 100%); overflow:hidden;
}
.auth-map-lines {
  position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(37,99,235,.07) 1px,transparent 1px),
    linear-gradient(90deg,rgba(37,99,235,.07) 1px,transparent 1px);
  background-size:22px 22px;
}
.auth-map-road { position:absolute; background:rgba(255,255,255,.05); border-radius:2px; }
.auth-map-road.h1{left:0;right:0;top:43%;height:7px}
.auth-map-road.v1{top:0;bottom:0;left:28%;width:7px}
.auth-map-road.h2{left:0;right:0;top:70%;height:5px}
.auth-map-road.v2{top:0;bottom:0;left:68%;width:5px}
.auth-pin { position:absolute; display:flex; flex-direction:column; align-items:center; z-index:2; }
.auth-pin.p1{left:26%;top:26%;animation:aPin1 12s ease-in-out infinite}
.auth-pin.p2{left:54%;top:47%;animation:aPin2 15s ease-in-out infinite}
.auth-pin.p3{left:72%;top:20%;animation:aPin3 10s ease-in-out infinite}
.auth-pin-icon {
  width:22px; height:22px; border-radius:50% 50% 50% 0;
  transform:rotate(-45deg); display:flex; align-items:center; justify-content:center;
  position:relative; box-shadow:0 3px 10px rgba(0,0,0,.4);
}
.auth-pin-icon::after {
  content:''; position:absolute; inset:0; border-radius:50% 50% 50% 0;
  border:2px solid rgba(255,255,255,.3); animation:aPing 2s ease-out infinite;
}
.auth-pin-dot { width:6px; height:6px; border-radius:50%; background:#fff; transform:rotate(45deg); }
.auth-pin-label {
  margin-top:3px; background:rgba(0,0,0,.72); color:#fff;
  font-size:.54rem; font-weight:700; padding:2px 5px; border-radius:3px; white-space:nowrap;
}
@keyframes aPin1 {
  0%,100%{transform:translate(0,0)} 30%{transform:translate(18px,-10px)}
  60%{transform:translate(34px,6px)} 80%{transform:translate(12px,14px)}
}
@keyframes aPin2 {
  0%,100%{transform:translate(0,0)} 40%{transform:translate(-14px,10px)} 70%{transform:translate(10px,-7px)}
}
@keyframes aPin3 {
  0%,100%{transform:translate(0,0)} 35%{transform:translate(-12px,14px)} 65%{transform:translate(7px,-5px)}
}
@keyframes aPing { 0%{transform:scale(1);opacity:.8} 100%{transform:scale(2.2);opacity:0} }
.auth-m-stats {
  display:grid; grid-template-columns:repeat(3,1fr);
  border-top:1px solid rgba(255,255,255,.07);
}
.auth-m-stat { padding:10px 8px; text-align:center; border-right:1px solid rgba(255,255,255,.06); }
.auth-m-stat:last-child { border-right:none; }
.auth-m-stat-val { display:block; font-size:.95rem; font-weight:900; color:#fff; line-height:1; }
.auth-m-stat-lbl {
  display:block; font-size:.52rem; color:rgba(255,255,255,.38);
  text-transform:uppercase; letter-spacing:.04em; margin-top:3px;
}
.auth-gps-tagline {
  font-size:.8rem; color:rgba(255,255,255,.55); text-align:center;
  line-height:1.6; max-width:260px; margin-bottom:24px;
}
.auth-app-links { display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; }
.auth-app-btn {
  display:inline-flex; align-items:center; gap:10px;
  background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.13);
  border-radius:10px; padding:10px 18px; color:rgba(255,255,255,.85);
  font-size:.75rem; font-weight:600; text-decoration:none; transition:all .2s;
}
.auth-app-btn:hover { background:rgba(255,255,255,.14); border-color:rgba(255,255,255,.25); transform:translateY(-1px); }
.auth-app-btn--android {
  background:rgba(61,220,132,.12); border-color:rgba(61,220,132,.3); color:#3ddc84;
}
.auth-app-btn--android:hover { background:rgba(61,220,132,.2); border-color:rgba(61,220,132,.5); color:#3ddc84; }
.auth-app-btn--android svg { flex-shrink:0; }
.auth-app-btn-text { display:flex; flex-direction:column; line-height:1.2; }
.auth-app-btn-text small { font-size:.6rem; font-weight:500; opacity:.75; text-transform:uppercase; letter-spacing:.05em; }
.auth-app-note {
  font-size:.65rem; color:rgba(255,255,255,.4); text-align:center;
  line-height:1.5; max-width:220px; margin:0;
}
.auth-forgot-link {
  display:block; text-align:center; margin-top:16px;
  font-size:.78rem; color:var(--primary); font-weight:600; text-decoration:none;
}
.auth-forgot-link:hover { text-decoration:underline; }
.auth-back-link {
  display:inline-flex; align-items:center; gap:5px; margin-bottom:20px;
  font-size:.78rem; color:var(--txt-3); font-weight:500; text-decoration:none;
}
.auth-back-link:hover { color:var(--primary); }
.auth-info-box {
  background:#eff6ff; border:1px solid #bfdbfe; border-radius:var(--r-md);
  padding:14px 16px; font-size:.82rem; color:#1e40af; line-height:1.6; margin-bottom:20px;
}
.auth-success-box {
  background:var(--success-bg); border:1px solid #bbf7d0; border-radius:var(--r-md);
  padding:20px; text-align:center;
}
.auth-success-box .auth-success-icon { font-size:2rem; margin-bottom:10px; }
.auth-success-box h3 { font-size:1rem; font-weight:800; color:#15803d; margin-bottom:6px; }
.auth-success-box p { font-size:.82rem; color:#166534; line-height:1.6; margin-bottom:16px; }

/* Responsive panel tweaks */
@media (max-width: 768px) {
  .auth-left { padding:16px 20px; min-height:auto !important; }
  .auth-left-content {
    max-width:100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
  }
  .auth-brand { align-self:center; margin-bottom:0; }
  .auth-brand img { height:64px; }
  .auth-brand-name { font-size:1rem; }
  .auth-mockup-wrap { display:none; }
  .auth-fc { display:none; }
  .auth-gps-tagline { display:none; }
  .auth-gps-grid, .auth-gps-glow { display:none; }
  .auth-app-links {
    display:flex !important;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: auto;
  }
  .auth-app-btn--android { padding:9px 16px; font-size:.72rem; }
  .auth-app-btn-text small { display:none; }
  .auth-app-note { display:none; }
}

/* ── Map layout ───────────────────────────────────────────── */
.map-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--topbar-h) - 88px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* Páginas de mapa: sin padding, mapa ocupa toda la altura disponible */
body.map-page .page-content {
  padding: 0;
  overflow: hidden;
}
body.map-page .map-layout {
  height: calc(100vh - var(--topbar-h));
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  border-top: 1px solid var(--border);
}
/* Historial: descontar controles del formulario superiores */
body.map-page .history-controls {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  margin-bottom: 0;
}
body.map-page .map-layout.history-map {
  height: calc(100vh - var(--topbar-h) - 90px);
}
.device-panel {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.device-panel-header {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.device-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--txt-1);
}
.device-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.device-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur);
}
.device-item:hover {
  background: var(--bg-hover);
}
.device-item.selected {
  background: var(--primary-lt);
}
.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.device-dot.online {
  background: var(--success);
  animation: pulse 2s infinite;
}
.device-dot.offline {
  background: var(--txt-4);
}
.device-info {
  flex: 1;
  min-width: 0;
}
.device-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-meta {
  font-size: 0.69rem;
  color: var(--txt-3);
}
.device-speed {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}
.map-wrapper {
  position: relative;
  overflow: hidden;
  min-width: 0;
}
#liveMap,
#historyMap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Map controls overlay */
.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1000;
}
.map-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--txt-2);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--dur);
}
.map-btn:hover {
  border-color: var(--border-md);
  background: var(--bg-hover);
}
.map-btn svg {
  width: 13px;
  height: 13px;
}

/* Leaflet overrides */
.leaflet-popup-content-wrapper {
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-md) !important;
  border: 1px solid var(--border) !important;
  font-family: "Plus Jakarta Sans", sans-serif !important;
  font-size: 0.8rem !important;
}
.leaflet-popup-content {
  margin: 12px 14px !important;
}
.popup-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  font-size: 0.83rem;
}
.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.popup-row span:first-child {
  color: var(--txt-3);
  font-size: 0.73rem;
}
.popup-row span:last-child {
  font-weight: 600;
  color: var(--txt-1);
}

/* History controls */
.history-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}
.history-controls .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 160px;
}

/* Playback bar */
.playback-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  font-size: 0.75rem;
}
.playback-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur);
}
.playback-btn:hover {
  background: var(--primary-dk);
}
.playback-btn svg {
  width: 12px;
  height: 12px;
}

/* ── Toast ────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.25s var(--ease);
  pointer-events: all;
}
.toast.success {
  border-left: 3px solid var(--success);
}
.toast.error {
  border-left: 3px solid var(--danger);
}
.toast.info {
  border-left: 3px solid var(--primary);
}
.toast.warn {
  border-left: 3px solid var(--warning);
}
.toast-icon svg {
  width: 16px;
  height: 16px;
}
.toast.success .toast-icon {
  color: var(--success);
}
.toast.error .toast-icon {
  color: var(--danger);
}
.toast.info .toast-icon {
  color: var(--primary);
}
.toast-msg {
  font-size: 0.8rem;
  color: var(--txt-2);
}

/* ── Utilities ────────────────────────────────────────────── */
.text-muted {
  color: var(--txt-3) !important;
}
.text-sm {
  font-size: 0.78rem;
}
.fw-600 {
  font-weight: 600;
}
.fw-700 {
  font-weight: 700;
}
.text-center {
  text-align: center;
}
.d-flex {
  display: flex;
}
.align-center {
  align-items: center;
}
.gap-8 {
  gap: 8px;
}
.ml-auto {
  margin-left: auto;
}
.mb-0 {
  margin-bottom: 0;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-bar .form-group {
  margin-bottom: 0;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.page-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--txt-3);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--dur);
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Config sections */
.config-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.config-section {
  padding: 0;
}
.config-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.config-section-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--txt-1);
}
.config-section-sub {
  font-size: 0.72rem;
  color: var(--txt-3);
}
.config-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.config-icon-blue {
  background: #dbeafe;
  color: #1d4ed8;
}
.config-icon-green {
  background: #dcfce7;
  color: #15803d;
}
.config-icon-amber {
  background: #fef3c7;
  color: #b45309;
}
.config-icon-gray {
  background: var(--bg);
  color: var(--txt-3);
}
.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  padding: 14px 18px;
}
.sys-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 11px;
  background: var(--bg);
  border-radius: var(--r-sm);
}
.sys-info-key {
  font-size: 0.72rem;
  color: var(--txt-3);
}
.sys-info-val {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--txt-1);
}

/* Profile */
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}
.avatar-section {
  display: flex;
  justify-content: center;
  padding: 24px 18px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.avatar-xl {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}
.avatar-placeholder {
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-edit-btn {
  position: absolute;
  bottom: 18px;
  right: calc(50% - 52px);
  background: var(--primary);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.avatar-info {
  text-align: center;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.avatar-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--txt-1);
}
.avatar-role {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}
.avatar-meta {
  padding: 10px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
}
.meta-key {
  color: var(--txt-3);
}
.meta-val {
  font-weight: 600;
  color: var(--txt-1);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-forms {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.input-password {
  position: relative;
}
.input-password .form-input {
  padding-right: 36px;
}
.pw-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--txt-4);
  cursor: pointer;
  padding: 2px;
}
.pw-strength {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.pw-bar {
  height: 100%;
  border-radius: 2px;
  transition: all 0.3s;
  width: 0;
}
.session-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.session-title {
  font-size: 0.8rem;
  font-weight: 600;
}
.session-detail {
  font-size: 0.69rem;
  color: var(--txt-3);
  margin-top: 2px;
}

/* Roles perms */
.perm-checker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}
.perm-check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 0.77rem;
  transition: all var(--dur);
  color: var(--txt-2);
}
.perm-check-item:hover {
  border-color: var(--primary);
  background: var(--primary-lt);
}
.perm-check-item input {
  accent-color: var(--primary);
}
.perm-ref-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px 16px;
}
.perm-ref-chip {
  background: var(--primary-lt);
  color: var(--primary);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-sm);
  font-weight: 600;
}
.perm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.perm-tag {
  background: var(--primary-lt);
  color: var(--primary);
  font-size: 0.67rem;
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}
.perm-tag-more {
  background: var(--bg);
  color: var(--txt-3);
}

/* Branch stats */
.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.stat-mini {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}
.stat-mini-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--txt-1);
  letter-spacing: -0.3px;
}
.stat-mini-lbl {
  font-size: 0.68rem;
  color: var(--txt-3);
  margin-top: 2px;
}

/* Branch logos */
.branch-name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}
.branch-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  object-fit: contain;
  background: var(--bg);
  padding: 2px;
  border: 1px solid var(--border);
}
.branch-logo-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-md);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--txt-4);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px transparent;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spin {
  animation: spin 1s linear infinite;
}

/* ── Device Card (tarjeta flotante en el mapa) ────────────── */
.device-card {
  position: absolute;
  bottom: 20px;
  left: 14px;
  width: 300px;
  z-index: 900;
  background: #ffffff;
  border: 1px solid rgba(200, 210, 230, 0.6);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
  animation: slideUp 0.2s var(--ease);
}
.dc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dc-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-sub {
  font-size: 0.67rem;
  color: var(--txt-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-close {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--txt-4);
  cursor: pointer;
  transition: all var(--dur);
  margin-left: auto;
}
.dc-close:hover {
  background: var(--bg-hover);
  color: var(--txt-1);
}
.dc-close svg {
  width: 13px;
  height: 13px;
}

.dc-info {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dc-val {
  display: block;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--txt-1);
}
.dc-lbl {
  display: block;
  font-size: 0.6rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dc-addr {
  font-size: 0.73rem;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-coords {
  font-size: 0.65rem;
  color: #475569;
  margin-top: 2px;
}

.dc-toggle-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-lt);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-top: none;
  transition: background var(--dur);
  flex-shrink: 0;
}
.dc-toggle-btn:hover {
  background: #e0e9ff;
}
.dc-toggle-btn svg {
  flex-shrink: 0;
}

.dc-actions-panel {
  overflow-y: auto;
  flex: 1;
  padding: 12px 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.dc-group {
  margin-bottom: 12px;
}
.dc-group:last-child {
  margin-bottom: 0;
}
.dc-group-title {
  font-size: 0.61rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #334155;
  margin-bottom: 4px;
}
.dc-group-desc {
  font-size: .67rem;
  color: #475569;
  line-height: 1.45;
  margin: 0 0 8px;
}
.dc-cmd-hints {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: .63rem;
  color: #475569;
  line-height: 1.4;
}
/* Badges de estado en tarjeta dispositivo */
.dc-badge {
  display:inline-flex; align-items:center; gap:3px;
  font-size:.6rem; font-weight:600; padding:2px 7px;
  border-radius:20px; white-space:nowrap;
}
.badge-green  { background:#dcfce7; color:#15803d; }
.badge-blue   { background:#dbeafe; color:#1d4ed8; }
.badge-gray   { background:#f1f5f9; color:#64748b; }
.badge-yellow { background:#fef9c3; color:#a16207; }
.badge-red    { background:#fee2e2; color:#dc2626; }

/* Admin-only group indicator */
.dc-admin-group { border-left: 2px solid #e0e7ff; padding-left: 8px; }
.dc-admin-badge {
  display: inline-block; font-size: .55rem; font-weight: 700;
  background: #e0e7ff; color: #4338ca; border-radius: 4px;
  padding: 1px 5px; text-transform: uppercase; letter-spacing: .04em;
  margin-left: 5px; vertical-align: middle;
}
/* Nota de seguridad motor */
.dc-safety-note {
  display: flex; align-items: center; gap: 5px;
  font-size: .63rem; color: #92400e;
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 6px; padding: 5px 8px; margin-top: 7px;
  line-height: 1.4;
}
/* SMS alarm cards */
.sms-alarm-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 12px;
}
.sac-icon { font-size: 1.05rem; flex-shrink: 0; line-height: 1; }
.sac-body { flex: 1; min-width: 0; }
.sac-name { font-size: .73rem; font-weight: 700; color: #0f172a; }
.sac-desc { font-size: .65rem; color: #475569; line-height: 1.4; }
.sac-cmd  { font-size: .63rem; color: #2563eb; font-family: monospace; display: block; margin-top: 2px; }
.sac-copy {
  flex-shrink: 0;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 5px 7px;
  color: #2563eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .15s;
}
.sac-copy:hover { background: #dbeafe; }
/* Confirmation modal */
.cut-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}
.cut-modal-overlay.open { display: flex; }
.cut-modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: 0 32px 80px rgba(0,0,0,.25);
  text-align: center;
  animation: cmFadeIn .2s ease;
}
@keyframes cmFadeIn {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.dc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.dc-row.dc-row4 {
  grid-template-columns: repeat(4, 1fr);
}

.dc-cmd {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 5px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--txt-2);
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: all var(--dur);
  font-family: inherit;
}
.dc-cmd svg {
  flex-shrink: 0;
}
.dc-cmd:hover {
  border-color: var(--border-md);
  background: var(--bg-hover);
}
.dc-cmd:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dc-cmd.danger {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}
.dc-cmd.danger:hover {
  background: #fee2e2;
}
.dc-cmd.success {
  background: var(--success-bg);
  border-color: #bbf7d0;
  color: var(--success);
}
.dc-cmd.success:hover {
  background: #dcfce7;
}
.dc-cmd.primary {
  background: var(--primary-lt);
  border-color: #c7d7fa;
  color: var(--primary);
}
.dc-cmd.primary:hover {
  background: #e0e9ff;
}
.dc-cmd.warning {
  background: var(--warning-bg);
  border-color: #fde68a;
  color: var(--warning);
}
.dc-cmd.warning:hover {
  background: #fef3c7;
}
.dc-cmd.indigo {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #7c3aed;
}
.dc-cmd.indigo:hover {
  background: #f5f3ff;
}
.dc-cmd.neutral {
  background: var(--bg-card);
}
.dc-cmd.neutral:hover {
  background: var(--bg-hover);
}

/* ── Device Command Modal ─────────────────────────────────── */
.device-modal {
  max-width: 580px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}
.device-modal .modal-header {
  flex-shrink: 0;
}

/* Info bar */
.cmd-info-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cmd-info-item {
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.cmd-info-item:last-child {
  border-right: none;
}
.cmd-info-item.span2 {
  grid-column: span 2;
}
.cmd-info-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt-4);
  margin-bottom: 3px;
}
.cmd-info-val {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Command sections */
.cmd-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px 18px;
}
.cmd-section {
  margin-bottom: 18px;
}
.cmd-section:last-child {
  margin-bottom: 0;
}
.cmd-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--txt-3);
  margin-bottom: 9px;
}
.cmd-section-title svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.cmd-section-title .note {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--txt-4);
  text-transform: none;
  letter-spacing: 0;
}

/* Command button grids */
.cmd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cmd-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* Command buttons */
.cmd-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all var(--dur);
  min-height: 68px;
}
.cmd-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.cmd-btn span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--txt-2);
  line-height: 1.2;
}
.cmd-btn small {
  font-size: 0.64rem;
  color: var(--txt-4);
  font-weight: 400;
}
.cmd-btn:hover {
  border-color: var(--border-md);
  background: var(--bg-hover);
}
.cmd-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}
.cmd-btn:not(:disabled):active {
  transform: scale(0.97);
}

.cmd-btn.danger {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}
.cmd-btn.danger svg,
.cmd-btn.danger span {
  color: var(--danger);
}
.cmd-btn.danger:hover {
  background: #fee2e2;
}

.cmd-btn.success {
  background: var(--success-bg);
  border-color: #bbf7d0;
}
.cmd-btn.success svg,
.cmd-btn.success span {
  color: var(--success);
}
.cmd-btn.success:hover {
  background: #dcfce7;
}

.cmd-btn.primary {
  background: var(--primary-lt);
  border-color: #c7d7fa;
}
.cmd-btn.primary svg,
.cmd-btn.primary span {
  color: var(--primary);
}
.cmd-btn.primary:hover {
  background: #e0e9ff;
}

.cmd-btn.warning {
  background: var(--warning-bg);
  border-color: #fde68a;
}
.cmd-btn.warning svg,
.cmd-btn.warning span {
  color: var(--warning);
}
.cmd-btn.warning:hover {
  background: #fef3c7;
}

.cmd-btn.indigo {
  background: #ede9fe;
  border-color: #ddd6fe;
}
.cmd-btn.indigo svg,
.cmd-btn.indigo span {
  color: #7c3aed;
}
.cmd-btn.indigo:hover {
  background: #f5f3ff;
}

.cmd-btn.neutral {
  background: var(--bg-card);
  border-color: var(--border);
}
.cmd-btn.neutral:hover {
  background: var(--bg-hover);
}

/* Compact variant for 4-col grids */
.cmd-grid-4 .cmd-btn {
  min-height: 56px;
  padding: 8px 4px;
}
.cmd-grid-4 .cmd-btn svg {
  width: 15px;
  height: 15px;
}
.cmd-grid-4 .cmd-btn span {
  font-size: 0.69rem;
}

/* Command feedback & log */
.cmd-feedback {
  border-radius: var(--r-md);
  padding: 9px 13px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.cmd-feedback svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.cmd-feedback.ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}
.cmd-feedback.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.cmd-feedback.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid #bae6fd;
}

.cmd-log-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
}
.cmd-log-ok {
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}
.cmd-log-fail {
  color: var(--danger);
  font-weight: 700;
  flex-shrink: 0;
}
.cmd-log-body {
  flex: 1;
  color: var(--txt-2);
}
.cmd-log-time {
  color: var(--txt-4);
  white-space: nowrap;
}

@media (max-width: 540px) {
  .cmd-info-bar {
    grid-template-columns: 1fr 1fr;
  }
  .cmd-info-item.span2 {
    grid-column: span 2;
  }
  .cmd-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Traccar status in config */
.traccar-status-badge {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 700;
  margin-left: auto;
}
.traccar-status-badge.online {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}
.traccar-status-badge.offline {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* Dashboard activity */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
  border-bottom: none;
}
.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 280px 1fr;
    height: auto;
    min-height: 80vh;
  }
  .device-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .profile-layout {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
    width: 240px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .mobile-toggle {
    display: flex;
  }
  .page-content {
    padding: 14px;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .auth-wrapper {
    flex-direction: column;
  }
  .auth-left {
    min-height: 35vh;
  }
  .auth-right {
    width: 100%;
    padding: 32px 24px;
  }
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .stats-row {
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard bottom grid ────────────────────────────────────── */
.db-bottom {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 14px;
  align-items: start;
}

/* Fleet status rows */
.fleet-progress-bar {
  height: 3px;
  background: var(--border);
  margin: 0 0 2px;
}
.fleet-progress-fill {
  height: 100%;
  background: var(--success);
  transition: width .6s var(--ease);
}
.fleet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
.fleet-row:last-child { border-bottom: none; }
.fleet-row:hover { background: var(--bg-hover); }
.fleet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fleet-dot.on  { background: var(--success); box-shadow: 0 0 0 3px #dcfce7; }
.fleet-dot.off { background: var(--txt-4); }
.fleet-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--txt-1);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fleet-badge-online {
  font-size: .67rem;
  font-weight: 700;
  color: var(--success);
  background: #dcfce7;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}
.fleet-badge-offline {
  font-size: .67rem;
  font-weight: 700;
  color: var(--txt-4);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.fleet-speed {
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 54px;
  text-align: right;
}
.fleet-time {
  font-size: .66rem;
  color: var(--txt-4);
  min-width: 72px;
  text-align: right;
}

/* Empresa stat cards (master dashboard) */
.empresa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
}
.empresa-stat-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--bg);
  transition: box-shadow var(--dur);
}
.empresa-stat-card:hover { box-shadow: var(--shadow-sm); background: var(--bg-card); }
.empresa-stat-name {
  font-size: .78rem;
  font-weight: 700;
  color: var(--txt-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 7px;
}
.empresa-progress {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  margin-bottom: 5px;
  overflow: hidden;
}
.empresa-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s var(--ease);
}
.empresa-counts {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--txt-3);
}

/* Activity feed */
.activity-feed { padding: 4px 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-dot.danger  { background: var(--danger); }
.activity-dot.success { background: var(--success); }

/* ── Reports page ─────────────────────────────────────────────── */
.report-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.report-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-xs);
}
.report-stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--txt-1);
  line-height: 1;
  letter-spacing: -.3px;
}
.report-stat-lbl {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--txt-3);
  margin-top: 5px;
}
.report-empty {
  text-align: center;
  padding: 40px;
  color: var(--txt-3);
  font-size: .8rem;
}
.dur-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--primary-lt);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 700;
}

/* Event type badges */
.evt-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.evt-sos      { background: #fee2e2; color: #b91c1c; }
.evt-speed    { background: #fef3c7; color: #b45309; }
.evt-geo      { background: #dbeafe; color: #1d4ed8; }
.evt-move     { background: #dcfce7; color: #15803d; }
.evt-stop     { background: var(--bg); color: var(--txt-3); border: 1px solid var(--border); }
.evt-ignition { background: #f3e8ff; color: #7e22ce; }
.evt-device   { background: #e0e7ff; color: #4338ca; }
.evt-default  { background: var(--bg); color: var(--txt-3); border: 1px solid var(--border); }

/* ── Responsive additions ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .db-bottom      { grid-template-columns: 1fr; }
  .report-summary { grid-template-columns: 1fr 1fr; }
  .empresa-grid   { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .report-filter { flex-direction: column; align-items: stretch; }
  .report-summary { grid-template-columns: 1fr 1fr; }
}
