:root {
  color: #090909;
  background: #fff;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  --gap: 6px;
  --blue: #0969da;
  --line: #090909;
}

* {
  box-sizing: border-box;
}

html {
  background: #fff;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background: #fff;
  color: #090909;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: #f3f4f6;
}

.auth-card,
.password-form {
  width: min(100%, 390px);
  padding: 24px;
  border: 2px solid #111;
  background: #fff;
  box-shadow: 6px 6px 0 #111;
}

.auth-brand {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.auth-card h1 {
  margin: 7px 0 2px;
  font-size: 1.6rem;
}

.auth-note {
  margin: 0 0 22px;
  color: #4b5563;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin: 0 0 15px;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 16px;
}

.auth-field input:focus {
  outline: 3px solid #93c5fd;
  outline-offset: 1px;
}

.auth-primary {
  width: 100%;
  min-height: 46px;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.auth-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-error {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: #b91c1c;
  font-size: 0.88rem;
}

.session-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 6px max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  border-bottom: 2px solid #111;
  background: rgba(255, 255, 255, 0.97);
}

.session-bar strong,
.session-bar span {
  display: block;
}

.session-bar span {
  max-width: 48vw;
  overflow: hidden;
  color: #4b5563;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-actions {
  display: flex;
  gap: 6px;
}

.session-actions button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid #111;
  background: #fff;
  color: #111;
  font-size: 0.78rem;
  font-weight: 700;
}

.password-dialog {
  width: min(calc(100% - 24px), 430px);
  padding: 0;
  border: 0;
  background: transparent;
}

.password-dialog::backdrop {
  background: rgba(0, 0, 0, 0.52);
}

.password-form {
  width: 100%;
  box-shadow: none;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

#board {
  width: 100%;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.board-layer {
  width: 100%;
  padding: 6px 6px 9px;
  border-bottom: 5px solid var(--line);
  background: #fff;
}

.board-layer:first-child {
  padding-top: 4px;
}

.board-layer:last-child {
  border-bottom: 0;
}

.section-title {
  margin: 0 0 5px;
  color: #000;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.compact-title {
  min-height: 2.35em;
  display: flex;
  align-items: flex-end;
  font-size: 0.92rem;
  line-height: 1.12;
}

.vehicle-track {
  display: grid;
  grid-auto-flow: column;
  gap: var(--gap);
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af transparent;
  padding: 0 0 3px;
}

.vehicle-track::-webkit-scrollbar {
  height: 3px;
}

.vehicle-track::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 999px;
}

.four-up {
  grid-auto-columns: calc((100% - (3 * var(--gap))) / 4);
}

.two-up {
  grid-auto-columns: calc((100% - var(--gap)) / 2);
}

.vehicle-card {
  min-width: 0;
  appearance: none;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #000;
  text-align: center;
  cursor: pointer;
  scroll-snap-align: start;
}

.vehicle-card:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.vehicle-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #111;
  background: #eef2f6;
}

.vehicle-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-info {
  padding-top: 2px;
  color: #000;
  font-size: 0.875rem;
  line-height: 1.16;
  text-align: center;
}

.vehicle-info-line {
  min-width: 0;
  min-height: 1.16em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plate {
  color: #000;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.timer {
  color: var(--blue);
  width: 125%;
  margin-left: -12.5%;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
  transform: scaleX(0.8);
}

.empty-track {
  grid-column: 1;
  width: max-content;
  min-width: 100%;
  padding: 8px 4px;
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
}

.repair-row {
  padding: 6px 0 5px;
  border-top: 1px solid var(--line);
}

.repair-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.repair-owner-name {
  margin: 0 0 4px;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.2;
}

.waiting-layer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 0;
}

.waiting-column {
  min-width: 0;
  padding: 6px 5px 8px;
}

.waiting-column-right {
  border-left: 4px solid var(--line);
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #111;
  font-size: 1rem;
  font-weight: 700;
}

.loading[hidden] {
  display: none;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  display: none;
  max-width: 520px;
  margin: auto;
  padding: 11px 14px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 0.94rem;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.toast.visible {
  display: block;
}

.toast.error {
  background: #b91c1c;
}

.vehicle-dialog {
  width: min(100%, 560px);
  max-width: none;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 18px 18px 0 0;
  color: #111;
  background: #fff;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.25);
  overflow-y: auto;
}

.vehicle-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 9px;
  border-radius: 999px;
  background: #9ca3af;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid #111;
}

.dialog-plate {
  display: block;
  font-size: 1.35rem;
  line-height: 1.2;
}

.dialog-stage {
  margin-top: 2px;
  color: #4b5563;
  font-size: 0.9rem;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #9ca3af;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-size: 1.6rem;
  line-height: 1;
}

.detail-photo {
  display: block;
  width: min(54vw, 220px);
  aspect-ratio: 1;
  margin: 0 auto 12px;
  border: 1px solid #111;
  object-fit: cover;
  background: #eef2f6;
}

.detail-grid {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 6px 10px;
  margin: 0 0 14px;
  font-size: 0.94rem;
}

.detail-grid dt {
  color: #6b7280;
}

.detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.detail-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #c7cbd1;
}

.detail-section-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 800;
}

.job-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.job-item {
  padding: 9px 10px;
  border: 1px solid #c7cbd1;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.9rem;
}

.job-employee {
  display: block;
  margin-top: 3px;
  color: #4b5563;
  font-weight: 700;
}

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

.action-button,
.employee-button,
.upload-label {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 2px solid #111;
  border-radius: 9px;
  background: #111;
  color: #fff;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}

.action-button.secondary,
.employee-button {
  background: #fff;
  color: #111;
}

.action-button:disabled,
.employee-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.upload-label {
  background: #fff;
  color: #111;
}

.upload-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.detail-note {
  margin: 6px 0 0;
  color: #6b7280;
  font-size: 0.84rem;
  line-height: 1.4;
}

@media (min-width: 720px) {
  #board {
    max-width: 720px;
    margin: 0 auto;
    border-right: 1px solid #d1d5db;
    border-left: 1px solid #d1d5db;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vehicle-track {
    scroll-behavior: auto;
  }
}
