:root {
  --bg: #060707;
  --bg-card: #121414;
  --bg-card-alt: #1a1d1d;
  --border: #262b2b;
  --text: #f5f7f7;
  --text-dim: #8f9a9a;
  --teal: #10b8b1;
  --teal-dim: #0a615d;
  --accent: #d72364;
  --accent-dim: #6e1235;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* Textura de fundo: glows + watermark + grain, pra nunca deixar o preto parecer vazio/quebrado */
#bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#bg-fx::before {
  content: '';
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(ellipse 55% 30% at 25% 12%, rgba(16,184,177,0.32), transparent 62%),
    radial-gradient(ellipse 50% 32% at 78% 88%, rgba(215,35,100,0.26), transparent 62%),
    var(--bg);
  animation: bg-flow 18s ease-in-out infinite alternate;
}

@keyframes bg-flow {
  0%   { transform: translate(0%, 0%) scale(1) rotate(0deg); }
  50%  { transform: translate(-3%, 3%) scale(1.08) rotate(3deg); }
  100% { transform: translate(3%, -2%) scale(1.05) rotate(-2deg); }
}

#bg-fx::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

.bg-mark {
  position: absolute;
  width: 640px;
  max-width: none;
  opacity: 0.09;
  right: -160px;
  bottom: 60px;
  transform: rotate(-8deg);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 20px 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-tagline {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Logo em HTML/CSS/SVG - nitida em qualquer tamanho, com runner animado */
.cdc-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cdc-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.cdc-logo-text strong {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  text-transform: uppercase;
}

.cdc-logo-text em {
  font-style: normal;
  font-weight: 500;
  letter-spacing: 1.2px;
  color: var(--text);
  opacity: 0.75;
  text-transform: lowercase;
  margin-top: 2px;
}

.cdc-runner {
  flex-shrink: 0;
  object-fit: contain;
  animation: runner-bounce 1.3s ease-in-out infinite;
  filter: drop-shadow(0 0 0 rgba(16,184,177,0));
}

@keyframes runner-bounce {
  0%, 100% { transform: translateY(0) translateX(0); filter: drop-shadow(0 2px 6px rgba(16,184,177,0.25)); }
  50% { transform: translateY(-4px) translateX(1px); filter: drop-shadow(0 8px 14px rgba(16,184,177,0.45)); }
}

.cdc-logo--sm .cdc-logo-text strong { font-size: 15px; }
.cdc-logo--sm .cdc-logo-text em { font-size: 8.5px; }
.cdc-logo--sm .cdc-runner { width: 24px; height: 24px; }

.cdc-logo--lg { margin: 0 auto 30px; }
.cdc-logo--lg .cdc-logo-text strong { font-size: 30px; }
.cdc-logo--lg .cdc-logo-text em { font-size: 13px; }
.cdc-logo--lg .cdc-runner { width: 46px; height: 46px; }

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* Login */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: subir-fade 0.6s cubic-bezier(.16,1,.3,1) both;
}

.login-card h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 10px;
}

.login-card p {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0 0 34px;
}

@keyframes subir-fade {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Content */
main {
  flex: 1;
  padding: 8px 20px 110px;
  display: flex;
  flex-direction: column;
}

.view { display: flex; flex-direction: column; gap: 22px; flex: 1; }

/* Bloco de acao principal: sem caixa, tipografia grande estilo hero */
.hero-block {
  padding: 22px 2px 6px;
}

.hero-block .eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 10px;
}

.hero-block h2 {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.08;
  color: var(--text);
  text-transform: none;
}

.hero-block .sub {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 34ch;
}

/* Moldura de "escaneamento" - preenche o espaço ocioso com algo funcional, nao vazio */
.scan-frame {
  margin: 18px auto 0;
  width: min(260px, 74%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.scan-frame-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 5;
  border-radius: 26px;
  border: 1.5px dashed rgba(16,184,177,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(16,184,177,0.07), transparent 70%);
}

.scan-frame-inner .glyph-icon {
  width: 46px;
  height: 46px;
  color: var(--teal);
  opacity: 0.55;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.scan-frame .corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--teal);
  opacity: 0.7;
}
.scan-frame .corner.tl { top: 12px; left: 12px; border-top: 2px solid; border-left: 2px solid; border-radius: 8px 0 0 0; }
.scan-frame .corner.tr { top: 12px; right: 12px; border-top: 2px solid; border-right: 2px solid; border-radius: 0 8px 0 0; }
.scan-frame .corner.bl { bottom: 12px; left: 12px; border-bottom: 2px solid; border-left: 2px solid; border-radius: 0 0 0 8px; }
.scan-frame .corner.br { bottom: 12px; right: 12px; border-bottom: 2px solid; border-right: 2px solid; border-radius: 0 0 8px 0; }

.scan-frame .scan-caption {
  font-size: 11px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--teal);
  text-transform: uppercase;
}

.card .sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 16px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  margin-bottom: 12px;
}

input:focus { outline: 2px solid var(--teal); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 24px -8px rgba(215,35,100,0.6); }
.btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:active { border-color: var(--teal); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1.5px solid var(--border); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }

.btn-camera {
  background: linear-gradient(135deg, var(--teal), #0a615d);
  color: #04201e;
  padding: 26px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 14px 34px -12px rgba(16,184,177,0.6);
}

.photo-preview {
  width: 100%;
  border-radius: 14px;
  margin: 14px 0;
  border: 1px solid var(--border);
  max-height: 220px;
  object-fit: cover;
}

.plate-badge {
  display: inline-block;
  background: #fff;
  color: #111;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 20px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 3px solid #1e3a8a;
  margin: 10px 0;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin: 8px 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.dot.ok { background: var(--green); }
.dot.warn { background: var(--teal); }
.dot.err { background: var(--red); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.row-item {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-item .top-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.row-item .top-line .row-nome {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-item .meta {
  font-size: 12px;
  color: var(--text-dim);
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header-row h2 { margin-bottom: 0; }

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:active { background: rgba(239,68,68,0.14); color: var(--red); }
.icon-btn .icon { width: 16px; height: 16px; }

.edit-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.edit-row input {
  margin-bottom: 0;
  font-size: 13px;
  padding: 10px 12px;
}

.edit-row .remove-btn {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
}

.filters {
  display: flex;
  gap: 8px;
}

.filters input { margin-bottom: 0; }

.export-row {
  display: flex;
  gap: 10px;
}

/* Bottom nav */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: rgba(18,20,20,0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
}

.tab-btn.active { color: var(--teal); background: rgba(16,184,177,0.12); }

/* Icones SVG inline (botoes e tab bar) - sem emoji */
.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
  vertical-align: -3px;
}

.tab-btn .icon { width: 21px; height: 21px; }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px 0;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 50;
  max-width: 90%;
  text-align: center;
}
.toast.err { border-color: rgba(239,68,68,0.4); color: #fecaca; }
