:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f6;
  color: #17201d;
  --ink: #17201d;
  --muted: #62706b;
  --line: #d7dedb;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #b45309;
  --soft: #eef6f3;
  --shadow: 0 16px 45px rgba(19, 55, 49, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #e7f2ef 0, #f5f7f6 240px),
    #f5f7f6;
}

button,
input {
  font: inherit;
}

.app {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

.search-panel,
.result-panel,
.history-panel {
  background: var(--panel);
  border: 1px solid rgba(15, 118, 110, 0.11);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 10vw, 2.6rem);
  line-height: 0.98;
}

h2 {
  font-size: 1rem;
}

.status {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 8px;
}

input[type="search"] {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 1.05rem;
  outline: none;
  text-transform: uppercase;
}

input[type="search"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.input-row button,
.section-title button,
.chip {
  border: 0;
  cursor: pointer;
}

.input-row button {
  min-height: 52px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
}

.quick-actions,
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-actions {
  min-height: 0;
  margin-top: 12px;
}

.chip {
  max-width: 100%;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 12px;
  background: #edf1f0;
  color: #263430;
  font-size: 0.9rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-panel {
  margin-top: 12px;
  overflow: hidden;
}

.empty-state,
.not-found {
  display: grid;
  gap: 8px;
  padding: 22px 18px;
  color: var(--muted);
  line-height: 1.45;
}

.empty-state strong,
.not-found strong {
  color: var(--ink);
}

.result-card {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.result-card:last-child {
  border-bottom: 0;
}

.serial-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.serial-line strong {
  color: var(--teal-dark);
  font-size: 1.28rem;
  word-break: break-word;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff7ed;
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 800;
}

.station {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 850;
  line-height: 1.25;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.field {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #e2e8e6;
  border-radius: 8px;
  background: #fbfdfc;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.field strong {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.35;
  word-break: break-word;
}

.history-panel {
  margin-top: 12px;
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: #edf1f0;
  color: var(--muted);
  font-weight: 800;
}

.history-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (min-width: 680px) {
  .app {
    padding-top: 32px;
  }

  .search-panel {
    padding: 24px;
  }

  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
