:root {
  color-scheme: light;
  --background: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #edf6ea;
  --verify-surface: #fdf3e2;
  --border: #dbe4d7;
  --text: #192026;
  --muted: #66717b;
  --primary: #f18230;
  --primary-hover: #d96f22;
  --accent: #83bb6b;
  --danger: #a53f35;
  --shadow: 0 10px 30px rgb(25 32 38 / 8%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

.loginShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loginBox {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.loginBox h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.loginBox p {
  margin: 0 0 22px;
  color: var(--muted);
}

.formStack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 14px;
}

.field input,
.toolbar input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

.primaryButton,
.secondaryButton,
.dangerButton {
  min-height: 40px;
  border-radius: 6px;
  padding: 8px 13px;
  font-weight: 650;
}

.primaryButton {
  background: var(--primary);
  color: #fff;
}

.primaryButton:hover {
  background: var(--primary-hover);
}

.secondaryButton {
  background: #edf6ea;
  color: var(--text);
}

.secondaryButton:hover {
  background: #dcefd5;
}

.dangerButton {
  background: #f4e4e1;
  color: var(--danger);
}

.errorText {
  color: var(--danger);
  font-size: 14px;
}

.appShell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.topbarActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}

.statusLine {
  justify-self: end;
  color: var(--muted);
  font-size: 14px;
}

.containerGrid,
.imageGrid {
  display: grid;
  gap: 12px;
}

.containerGrid {
  grid-template-columns: 1fr;
}

.vehicleCard {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 4px 14px rgb(25 32 38 / 4%);
}

.vehicleCard.needsVerification {
  background: var(--verify-surface);
}

.vehicleHeader {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr auto auto;
  align-items: start;
  gap: 16px;
}

.vehicleActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.checkedLabel {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.vehicleTitleWrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.vehiclePlate {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.vehicleCount {
  border-radius: 999px;
  background: #edf6ea;
  color: #3c7330;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 650;
}

.vehicleMeta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.imageGrid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.imageTile {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgb(25 32 38 / 4%);
}

.thumbButton {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  background: #dfe5e7;
  padding: 0;
  display: block;
}

.thumbButton img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbButton:focus-visible {
  outline: 3px solid rgb(241 130 48 / 35%);
  outline-offset: -3px;
}

.imageMeta {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.imageName {
  min-height: 38px;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.imageDetails {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tileActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.emptyState {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: rgb(255 255 255 / 55%);
}

.previewOverlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgb(10 14 18 / 78%);
}

.previewPanel {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.previewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.previewTitle {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.previewImageWrap {
  min-height: 0;
  display: grid;
  place-items: center;
  background: #11171b;
}

.previewImageWrap img {
  max-width: 100%;
  max-height: calc(100vh - 118px);
  display: block;
  object-fit: contain;
}

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgb(10 14 18 / 78%);
}

.modalPanel {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modalHeader h2 {
  margin: 0;
  font-size: 18px;
}

.modalActions {
  display: flex;
  justify-content: flex-end;
}

.confirmBox {
  display: grid;
  gap: 16px;
}

.confirmBox p {
  margin: 0;
  color: var(--text);
}

.folderPicker {
  display: grid;
  gap: 14px;
}

.folderPicker p {
  margin: 0;
  color: var(--text);
}

.folderList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.folderButton {
  justify-content: center;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

.folderListMessage {
  color: var(--muted);
  font-size: 14px;
}

.logModalPanel {
  width: min(920px, 100%);
}

.logOutput {
  min-height: 360px;
  max-height: min(620px, calc(100vh - 180px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #11171b;
  color: #eef2f3;
  margin: 0;
  padding: 12px;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbarActions,
  .toolbar {
    width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .statusLine {
    justify-self: start;
  }

  .vehicleHeader {
    grid-template-columns: 1fr;
  }

  .vehicleMeta {
    justify-content: flex-start;
  }

  .imageGrid {
    grid-template-columns: 1fr;
  }

  .previewOverlay {
    padding: 10px;
  }

  .previewPanel {
    max-height: calc(100vh - 20px);
  }
}
