:root {
  --ink: #102033;
  --muted: #65758a;
  --line: #dce4ee;
  --panel: #ffffff;
  --soft: #f3f7fb;
  --blue: #1165d8;
  --cyan: #00a6c8;
  --green: #16895a;
  --orange: #be6515;
  --navy: #0d2a52;
  --shadow: 0 18px 50px rgba(16, 32, 51, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(17, 101, 216, .08), transparent 32%),
    linear-gradient(225deg, rgba(0, 166, 200, .08), transparent 26%),
    var(--soft);
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a { color: var(--blue); }

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.metrics-grid,
.workbench,
.data-grid {
  margin-bottom: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand.center {
  justify-content: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.top-actions,
.scan-controls,
.console-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.primary,
.secondary,
.ghost {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 760;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.primary {
  color: white;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(17, 101, 216, .22);
}

.secondary {
  color: var(--navy);
  background: #eaf2ff;
}

.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.action-card:hover,
.vehicle-row:hover {
  transform: translateY(-1px);
}

.primary:disabled {
  opacity: .55;
  cursor: default;
}

.full { width: 100%; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 112px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span,
.metric em {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.metric strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 26px;
  line-height: 1.05;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(360px, .98fr) minmax(420px, 1.02fr);
  gap: 16px;
}

.scanner-panel,
.operations-panel,
.table-panel,
.payment-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scanner-panel,
.operations-panel,
.table-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head.compact {
  align-items: center;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

.status-dot {
  white-space: nowrap;
  color: var(--orange);
  background: #fff3e8;
  border: 1px solid #ffd2ad;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.status-dot.ok {
  color: var(--green);
  background: #eafaf3;
  border-color: #c5eadb;
}

.camera-box {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #0a1628;
}

video,
canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

canvas {
  display: none;
}

.scan-overlay {
  position: absolute;
  inset: 16%;
  border: 2px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  box-shadow: inset 0 0 0 999px rgba(7, 15, 28, .18);
}

.scan-overlay:after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: var(--cyan);
  animation: scan 2.2s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(-54px); opacity: .25; }
  50% { transform: translateY(54px); opacity: 1; }
}

.scan-controls {
  margin: 12px 0;
}

.plate-form {
  display: grid;
  grid-template-columns: 1.2fr .8fr .9fr auto;
  gap: 9px;
  align-items: end;
}

.plate-form label {
  display: none;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input {
  font-weight: 900;
  text-transform: uppercase;
}

.result-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--navy);
  background: #edf6ff;
  border: 1px solid #cde5ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.selected-vehicle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.selected-vehicle div {
  min-height: 82px;
  padding: 12px;
  border-radius: 8px;
  background: #f7fafe;
  border: 1px solid var(--line);
}

.selected-vehicle span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.selected-vehicle strong {
  display: block;
  margin-top: 8px;
  line-height: 1.1;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-card {
  min-height: 104px;
  padding: 14px;
  text-align: left;
  background: #f7fafe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.action-card strong,
.action-card span {
  display: block;
}

.action-card span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.qr-panel {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 124px;
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid var(--line);
}

#qrBox {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
}

#qrBox img {
  width: 84px;
  height: 84px;
}

.qr-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.data-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr 1fr;
  gap: 16px;
}

.vehicle-list,
.membership-list,
.event-list {
  display: grid;
  gap: 8px;
}

.vehicle-row,
.membership-row,
.event-list div {
  min-height: 64px;
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
  background: #f9fbfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.vehicle-row {
  grid-template-columns: 86px 1fr 140px 98px;
  align-items: center;
}

.vehicle-row.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(17, 101, 216, .12);
}

.vehicle-row span,
.vehicle-row em,
.membership-row span,
.membership-row em,
.event-list span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.vehicle-row b {
  justify-self: end;
}

.event-list div {
  grid-template-columns: 54px 1fr;
  align-items: center;
}

.payment-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.payment-box {
  width: min(420px, 100%);
  padding: 24px;
  text-align: center;
}

.payment-box h1 {
  margin: 14px 0 6px;
  font-size: 46px;
}

.payment-box p {
  color: var(--muted);
}

.pay-amount {
  margin: 22px 0 10px;
  font-size: 34px;
  font-weight: 900;
}

.payment-status {
  width: fit-content;
  margin: 0 auto 18px;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 900;
}

.payment-status.pending {
  color: var(--orange);
  background: #fff3e8;
}

.payment-status.paid {
  color: var(--green);
  background: #eafaf3;
}

.ghost-link {
  display: inline-block;
  margin-top: 14px;
  text-decoration: none;
  font-weight: 800;
}

@media (max-width: 1060px) {
  .metrics-grid,
  .workbench,
  .data-grid {
    grid-template-columns: 1fr 1fr;
  }
  .workbench,
  .data-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell { padding: 10px; }
  .topbar,
  .section-head,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .metrics-grid,
  .selected-vehicle,
  .action-grid {
    grid-template-columns: 1fr;
  }
  .plate-form {
    grid-template-columns: 1fr;
  }
  .plate-form label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin-top: 2px;
  }
  .vehicle-row {
    grid-template-columns: 1fr;
  }
  .vehicle-row b {
    justify-self: start;
  }
  h1 {
    font-size: 25px;
  }
}
