:root {
  font-family: system-ui, sans-serif;
  color: #172237;
  min-height: 100%;
  background: #f4f6fa;
  line-height: 1.5;
  --muted: #505e73;
  --line: #d8dfe9;
  --blue: #1549c7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }

main {
  width: min(720px, calc(100% - 32px));
  margin: clamp(32px, 9vw, 80px) auto 48px;
}

h1, h2, h3, p { margin: 0; }

h1 {
  margin-bottom: 20px;
  font-size: clamp(2.1rem, 6vw, 2.75rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

h1::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--blue);
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(16px, 4vw, 24px);
  box-shadow: 0 4px 12px rgb(23 34 55 / 6%);
  overflow-wrap: anywhere;
}

.search-header {
  display: grid;
  gap: 8px;
  margin-block: -16px 20px;
}

.search-header h1 { margin-bottom: 0; }

#logout-button {
  justify-self: end;
  padding-inline: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#login-form { display: grid; gap: 8px; }
#login-button { justify-self: start; }
#session-retry { margin-top: 10px; }
#login-error, #logout-error { margin-top: 0; }
#login-error:empty { position: absolute; }
#logout-error:not(:empty) { margin-bottom: 10px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hint, .date, dt, #results-note { color: var(--muted); }
.hint { margin-top: 8px; font-size: 0.875rem; }

.search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.query-field { position: relative; min-width: 0; }
#query { padding-right: 52px; }
#photo-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  color: var(--blue);
  background: transparent;
}
#photo-button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--line);
}
#search-button { width: 44px; }

main input, main button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
}

main input {
  width: 100%;
  border-color: #8794a8;
  padding: 8px 12px;
  color: inherit;
  background: #fff;
}

input::placeholder { color: #637084; opacity: 1; }

main button {
  padding: 8px 18px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-icon {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  margin-right: 3px;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  top: 9px;
  left: 9px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

#search-button:hover:enabled { background: #113da9; }
main button:disabled { opacity: 0.7; cursor: wait; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

input[aria-invalid="true"] { border-color: #a82527; }
.error { margin-top: 10px; color: #a82527; }
#searched-query {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.875rem;
}

#searched-value {
  min-width: 0;
  padding: 3px 10px;
  border: 1px solid #bfcee7;
  border-radius: 999px;
  background: #fff;
  color: #1646a4;
  overflow-wrap: anywhere;
}

#status:not(:empty) { margin-top: 8px; font-size: 1.125rem; font-weight: 700; }

#results-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 24px;
  font-size: 0.8125rem;
}

#searched-query:not([hidden]) + #results-note { margin-top: 8px; }

.info-icon {
  display: inline-grid;
  flex: 0 0 15px;
  place-items: center;
  height: 15px;
  margin-top: 2px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

#results:not(:empty) { display: grid; gap: 16px; margin-top: 16px; }
#retry { margin-top: 10px; }

.secondary {
  color: var(--blue);
  background: #fff;
  border-color: var(--line);
}

.secondary:hover { background: #edf3ff; }

.route {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.route-arrow {
  display: inline-block;
  vertical-align: -0.1em;
}

.plate, .date { margin-top: 4px; }
.plate, .date, dt { font-size: 0.875rem; }

.trip-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  list-style: none;
  cursor: pointer;
}

.trip-header::-webkit-details-marker { display: none; }

.trip-toggle {
  display: grid;
  place-items: center;
  align-self: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
}

.trip-header:hover .trip-toggle,
.trip-header:focus-visible .trip-toggle,
details[open] .trip-toggle {
  background: #e8f0ff;
  color: var(--blue);
}

details[open] .trip-toggle svg { transform: rotate(180deg); }

h3 img {
  filter: invert(23%) sepia(84%) saturate(2215%) hue-rotate(217deg) brightness(88%);
}

.trip-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.state, .urgent {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
}

.state { background: #e8f0ff; color: #1646a4; }
.urgent { background: #fce8e7; color: #9b1c20; }

.detail-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #edf3fd;
  font-size: 1rem;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 12px 0 0;
  padding-inline: 12px;
}

dd { margin: 0; font-weight: 600; }

@media (max-width: 360px) {
  dl { padding-inline: 4px; }
}
