:root {
  color-scheme: light;
  --bg: #eef7fb;
  --card: #ffffff;
  --ink: #173042;
  --muted: #5d7280;
  --brand: #087ea4;
  --brand-dark: #05627f;
  --line: #d6e5ed;
  --danger: #b42318;
  --success: #027a48;
  --shadow: 0 24px 60px rgba(22, 63, 86, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(8, 126, 164, 0.22), transparent 34rem),
    linear-gradient(180deg, #f8fcfe 0%, var(--bg) 100%);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 229, 237, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.search-form {
  padding: 24px;
}

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

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fbfdff;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(8, 126, 164, 0.14);
}

.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  color: #fff;
  background: var(--brand);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
  transform: none;
}

.hint,
.status,
.summary p,
.empty {
  color: var(--muted);
}

.hint {
  margin: 0;
  font-size: 0.93rem;
}

.status {
  min-height: 28px;
  margin: 18px 4px;
  font-weight: 700;
}

.status.error {
  color: var(--danger);
}

.results {
  display: grid;
  gap: 18px;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--brand);
  background: #fff;
  white-space: nowrap;
}

.secondary-button:hover {
  color: #fff;
  background: var(--brand-dark);
}

.summary h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.summary p {
  margin: 0;
}

.legs {
  display: grid;
  gap: 18px;
}

.leg-card {
  padding: 22px;
}

.leg-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.leg-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.leg-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--success);
  background: #ecfdf3;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.price {
  font-weight: 900;
}

.inline-status {
  color: var(--muted);
  font-weight: 800;
}

.inline-error {
  color: var(--danger);
  font-weight: 800;
}

.error-box {
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 18px;
  padding: 14px;
  color: var(--danger);
  background: #fff4f2;
}

@media (max-width: 900px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding: 32px 0;
  }

  .search-form,
  .leg-card {
    padding: 18px;
    border-radius: 22px;
  }

  .field-grid,
  .actions,
  .results-header,
  .leg-header {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }
}
