:root {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-elevated: #222c3d;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --accent: #5b9cf8;
  --mark: #f0c14b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.shell {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

h1 {
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 0 0.35rem;
}

h2 {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.panel {
  margin-top: 2.25rem;
}

.panel > .hint {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

.hint code {
  font-size: 0.85em;
  color: #a8b8d0;
}

.field {
  margin: 0;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

/* Input + dropdown share one anchor so the list opens directly under the box */
.field-combo {
  position: relative;
}

.typeahead-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.typeahead-input::placeholder {
  color: #6b7c94;
}

.typeahead-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 156, 248, 0.25);
}

.field-status {
  min-height: 1.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.field-status.is-error {
  color: #f0a07a;
}

.field-status.is-empty {
  color: #8b9bb4;
}

.locality-block {
  margin-top: 1.1rem;
}

.locality-block:first-of-type {
  margin-top: 0.5rem;
}

.selection-box {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 35, 50, 0.65);
}

.selection-box h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.selection-grid {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.95rem;
}

.selection-grid dt {
  margin: 0;
  color: var(--muted);
}

.selection-grid dd {
  margin: 0;
  font-weight: 500;
}

/* Dropdown panel — anchored under input */
.field-combo .suggestions {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 17rem;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.45);
}

.suggestions.suggestions-grid {
  padding: 0;
}

/* Column header row (non-interactive) */
.suggestions.suggestions-grid li.suggestion-head {
  display: grid;
  grid-template-columns: 1fr 5.5rem 2.75rem;
  gap: 0.5rem 0.65rem;
  align-items: center;
  padding: 0.45rem 0.75rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(15, 20, 25, 0.92);
  border-bottom: 1px solid var(--border);
  cursor: default;
  pointer-events: none;
}

.suggestions.suggestions-grid li.suggestion-head .cell-state {
  text-align: right;
}

.suggestions.suggestions-grid li:not(.suggestion-head) {
  display: grid;
  grid-template-columns: 1fr 5.5rem 2.75rem;
  gap: 0.5rem 0.65rem;
  align-items: start;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.35;
  border-bottom: 1px solid var(--border);
}

.suggestions.suggestions-grid li:not(.suggestion-head):last-child {
  border-bottom: none;
}

.suggestions.suggestions-grid li:not(.suggestion-head):hover,
.suggestions.suggestions-grid li:not(.suggestion-head)[aria-selected="true"] {
  background: rgba(91, 156, 248, 0.15);
}

.suggestions.suggestions-grid .cell-suburb {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.suggestions.suggestions-grid .cell-pc {
  font-variant-numeric: tabular-nums;
  color: #c5d4eb;
  white-space: nowrap;
}

.suggestions.suggestions-grid .cell-state {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.suggestions li mark {
  background: transparent;
  color: var(--mark);
  font-weight: 600;
}

/* Address — single-column rows */
.suggestions:not(.suggestions-grid) li {
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.35;
  border-bottom: 1px solid var(--border);
}

.suggestions:not(.suggestions-grid) li:last-child {
  border-bottom: none;
}

.suggestions:not(.suggestions-grid) li:hover,
.suggestions:not(.suggestions-grid) li[aria-selected="true"] {
  background: rgba(91, 156, 248, 0.15);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
