:root {
  --bg: #0e1116;
  --surface: #171c24;
  --surface-2: #1f2630;
  --border: #2a323d;
  --text: #e8edf3;
  --muted: #8b97a7;
  --primary: #2f6fed;
  --primary-hover: #2560d4;
  --danger: #e5484d;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #e5484d;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.screen { min-height: 100vh; }
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}

.brand { font-weight: 800; letter-spacing: 3px; font-size: 26px; color: var(--text); }
.brand.small { font-size: 16px; letter-spacing: 2px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.foot-note { margin-top: 18px; }

/* Spinner */
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.login-card { display: flex; flex-direction: column; gap: 6px; }
.login-card h1 { font-size: 18px; margin: 12px 0 2px; }

label { font-size: 13px; color: var(--muted); margin-top: 8px; }

input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
input:focus { border-color: var(--primary); }
#login-form { display: flex; flex-direction: column; }

/* Buttons */
.btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #283040; }
.btn.primary { background: var(--primary); border-color: var(--primary); margin-top: 12px; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: transparent; }
.btn.ghost.small { margin-top: 8px; padding: 6px; font-size: 13px; }
.btn.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(229, 72, 77, 0.12); }

/* Google button */
.btn-google {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  background: #fff;
  color: #1f1f1f;
  border-color: #fff;
}
.btn-google:hover { background: #f1f1f1; }
.g-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #4285f4;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 53px;
  z-index: 9;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

/* Container */
.container { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.page-title { font-size: 22px; margin: 0; }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 18px;
}
.view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 220px;
}
.search-input:focus { border-color: var(--primary); }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.metric-value { font-size: 30px; font-weight: 800; }
.metric-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h2 { font-size: 16px; margin: 0; }

.list { display: flex; flex-direction: column; }
.list.cards { gap: 12px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-title { font-size: 14px; font-weight: 600; }
.row-sub { margin-top: 2px; }
.empty { padding: 8px 4px; }

/* Vehicle cards */
.vehicle-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.vehicle-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.vehicle-thumb {
  width: 64px; height: 64px;
  border-radius: 10px;
  background: var(--surface-2) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}
.vehicle-main { flex: 1; min-width: 0; }
.vehicle-title { font-size: 15px; font-weight: 700; }
.vehicle-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.vehicle-metric { color: var(--muted); font-size: 12px; margin-top: 4px; }
.vehicle-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Health semáforo */
.health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.health.green .health-dot { background: var(--green); box-shadow: 0 0 8px #3fb95066; }
.health.green { color: var(--green); }
.health.yellow .health-dot { background: var(--yellow); box-shadow: 0 0 8px #d2992266; }
.health.yellow { color: var(--yellow); }
.health.red .health-dot { background: var(--red); box-shadow: 0 0 8px #e5484d66; }
.health.red { color: var(--red); }

/* Pills */
.pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
}
.pill-active { color: #3fb950; border-color: #2ea04326; background: #2ea04318; }
.pill-pending { color: #d29922; border-color: #d2992226; background: #d2992218; }
.pill-disputed, .pill-suspended { color: var(--danger); border-color: #e5484d26; background: #e5484d18; }
.pill-verified { color: var(--primary); border-color: var(--primary); }
.pill-cat { color: var(--text); }

/* Detail header */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.detail-hero .vehicle-thumb { width: 80px; height: 80px; font-size: 34px; }
.detail-hero h1 { font-size: 20px; margin: 0 0 4px; }

/* Log rows */
.log-row { align-items: flex-start; }
.log-icon { font-size: 18px; margin-right: 8px; }
.log-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Profile */
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.foot { padding: 28px; text-align: center; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.toast.ok { border-color: #2ea043; }
.toast.err { border-color: var(--danger); }
