:root {
  --bg-0: #05030a;
  --bg-1: #0d0718;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --border: rgba(168, 85, 247, 0.18);
  --border-strong: rgba(168, 85, 247, 0.42);
  --primary: #a855f7;
  --primary-glow: #c084fc;
  --primary-deep: #7c3aed;
  --text: #f5f3ff;
  --text-muted: #b8a7d9;
  --text-dim: #7a6b99;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 15% 0%, rgba(168, 85, 247, 0.18), transparent 65%),
    radial-gradient(650px circle at 85% 5%, rgba(124, 58, 237, 0.16), transparent 65%),
    radial-gradient(800px circle at 50% 100%, rgba(192, 132, 252, 0.12), transparent 70%);
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 3, 10, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-logo { filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.55)); }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.brand-name strong { color: var(--primary-glow); font-weight: 800; }

.topbar-status { display: flex; align-items: center; gap: 14px; }

.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.health-dot.green { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulseDot 2s infinite; }
.health-dot.yellow { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.health-dot.red { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.health-dot.gray { background: var(--text-dim); }

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

.quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.quota-track {
  width: 54px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quota-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width 0.35s ease, background-color 0.35s ease;
}

.quota-fill.warn { background: var(--warn); }
.quota-fill.danger { background: var(--danger); }

.btn-logout {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.32);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.btn-logout:hover { background: rgba(248, 113, 113, 0.22); }
main { flex: 1; }

.login-section { padding: 56px 0 72px; }

.login-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(168, 85, 247, 0.14);
  text-align: center;
}

.login-title { font-size: 28px; font-weight: 800; margin-top: 14px; letter-spacing: -0.02em; }
.login-sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }

.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.turnstile-box, .turnstile-inline {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 68px;
}

.turnstile-inline { margin-top: 16px; }

.login-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.hero { padding: 56px 0 32px; text-align: center; }
.hero-inner { max-width: 720px; }

.hero-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid var(--border-strong);
  color: #e9d5ff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-top: 18px;
}

.gradient-text {
  background: linear-gradient(135deg, #e9d5ff 0%, #c084fc 45%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle { color: var(--text-muted); font-size: 16px; max-width: 560px; margin: 16px auto 32px; }
.search-card { max-width: 560px; margin: 0 auto; }

.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: 0 0 36px rgba(168, 85, 247, 0.22);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-pill:focus-within {
  border-color: var(--primary-glow);
  box-shadow: 0 0 48px rgba(168, 85, 247, 0.35);
}

#placaInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 16px;
  outline: none;
  min-width: 0;
}

#placaInput::placeholder { color: var(--text-dim); opacity: 0.6; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.btn-full { width: 100%; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(168, 85, 247, 0.55); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.hero-hint { margin-top: 14px; font-size: 12px; color: var(--text-dim); }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.timer-ring { transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: rgba(255, 255, 255, 0.2); stroke-width: 3.5; }
.timer-fill { fill: none; stroke: #ffffff; stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }

.results-section { padding: 16px 0 48px; }

.state-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}

.state-card.error { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.06); }
.state-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.state-desc { color: var(--text-muted); font-size: 14px; }

.result-header {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.eyebrow-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.placa-chip {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid var(--border-strong);
  color: #e9d5ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 6px;
}

.cache-badge {
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
}

.vehicle-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.vehicle-sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

.status-pill { padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 1px solid transparent; }
.status-pill.ok { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.35); color: var(--ok); }
.status-pill.warn { background: rgba(251, 191, 36, 0.14); border-color: rgba(251, 191, 36, 0.35); color: var(--warn); }
.status-pill.danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: var(--danger); }

.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.info-card h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-glow);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.kv-list { display: flex; flex-direction: column; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; font-size: 14px; }
.kv-key { color: var(--text-dim); flex-shrink: 0; }
.kv-val { color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }

.restricao-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.badge-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  font-size: 12px;
}

.badge-tag { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.badge-tag.ok { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.badge-tag.warn { background: rgba(251, 191, 36, 0.16); color: var(--warn); }
.result-meta { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-dim); }

.footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-dim); font-size: 13px; }
.footer-inner { display: flex; justify-content: center; align-items: center; text-align: center; }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; padding: 12px 20px; }
  .search-pill { flex-direction: column; align-items: stretch; }
  #placaInput { text-align: center; }
  .restricao-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}