:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --border: #dddddd;
  --border-strong: #111111;
  --ok: #111111;
  --err: #111111;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b;
    --fg: #f2f2f2;
    --muted: #999999;
    --border: #2a2a2a;
    --border-strong: #f2f2f2;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --fg: #f2f2f2;
  --muted: #999999;
  --border: #2a2a2a;
  --border-strong: #f2f2f2;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}


h1, .field-label {
  font-family: "Lexend", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.content {
  flex: 1 0 auto;
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.legal {
  width: 100%;
  border-top: 1px solid var(--border);
}

.legal-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}

.legal p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 65ch;
}

.lede {
  color: var(--muted);
  margin: 0 0 2rem;
  max-width: 46ch;
}

.form {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.dcs-picker {
  margin-bottom: 1.25rem;
}

.dcs-picker select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
}

.dcs-airfields-wrap {
  margin-top: 0.5rem;
}

#dcs-airfields {
  min-height: 10rem;
}

.dcs-picker select:focus {
  border-color: var(--border-strong);
  outline: none;
}

.dcs-picker-actions {
  display: flex;
  gap: 0.5rem;
}

.dcs-picker-actions .secondary-btn,
.dcs-picker-actions .primary-btn {
  margin-top: 0.5rem;
}

#codes {
  width: 100%;
  resize: none;
  min-height: 2.75rem;
  max-height: 9rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

#codes:focus {
  border-color: var(--border-strong);
  outline: none;
}

#codes::placeholder {
  color: var(--muted);
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.hint.warn {
  color: var(--err);
  font-weight: 500;
}

.form-actions,
.summary-actions {
  display: flex;
  gap: 0.75rem;
}

.primary-btn,
.secondary-btn {
  margin-top: 1rem;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--border-strong);
  background: var(--fg);
  color: var(--bg);
}

.primary-btn:hover {
  opacity: 0.85;
}

.primary-btn:active {
  opacity: 0.7;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.secondary-btn {
  border: 1px solid var(--border);
  background: none;
  color: var(--fg);
}

.secondary-btn:hover {
  border-color: var(--border-strong);
}

.results {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
}

.result-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.result-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 500;
}

.result-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-state {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.step-dots {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.step-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--border);
}

.step-dot[data-state="current"] {
  background: var(--fg);
}

.step-dot[data-state="complete"] {
  background: var(--fg);
  opacity: 0.4;
}

.step-line {
  width: 0.5rem;
  height: 1px;
  background: var(--border);
}

.step-line[data-state="complete"] {
  background: var(--fg);
  opacity: 0.4;
}

.result-row[data-state="ok"] .result-state {
  color: var(--fg);
}

.result-row[data-state="error"] .result-state {
  color: var(--fg);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.summary {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-lines {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.summary-line-header {
  color: var(--fg);
  font-weight: 500;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.summary-actions .primary-btn,
.summary-actions .secondary-btn {
  margin-top: 0;
}

@media (max-width: 480px) {
  .result-row {
    grid-template-columns: 4.5rem 1fr;
  }

  .result-state {
    grid-column: 1 / -1;
  }
}
