:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #fdeee9;
  --text: #16202a;
  --muted: #5e6a73;
  --border: #d7dee2;
  --accent: #f04b23;
  --accent-dark: #cf3d16;
  --warning: #c23a17;
  --row: #fdf7f5;
  --shadow: 0 12px 35px rgba(22, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.calculator-shell {
  width: 100%;
  padding: 18px;
}

.calculator {
  max-width: 980px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.calculator-header p,
.empty p,
.status {
  color: var(--muted);
}

.data-note {
  flex: 0 0 auto;
  border: 1px solid #f6c6ae;
  color: var(--warning);
  background: #fdeee9;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 22px;
}

.city-field {
  position: relative;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.combo-wrap {
  position: relative;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid #a9cdee;
  border-radius: 6px;
  padding: 0 44px 0 14px;
  color: var(--text);
  font: inherit;
  background: #e9f3fd;
}

input:focus {
  outline: 3px solid rgba(240, 75, 35, 0.22);
  border-color: var(--accent);
}

/* Hide the browser's native search clear button; we render our own. */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.clear-button {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.clear-button:hover,
.clear-button:focus {
  background: var(--surface-soft);
  color: var(--text);
}

.search-button {
  height: 48px;
  min-width: 128px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.search-button:hover,
.search-button:focus {
  background: var(--accent-dark);
}

.search-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.suggestions {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 290px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.suggestion {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.suggestion:hover,
.suggestion:focus,
.suggestion[aria-selected="true"] {
  background: var(--surface-soft);
}

.suggestion strong {
  display: block;
}

.suggestion span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
}

.status.error {
  color: #b42318;
}

.selection-summary {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid #f7cdbf;
  border-radius: 6px;
}

.selection-summary p {
  margin: 0;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.result-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.result-panel header {
  padding: 14px 16px;
  background: #fef4f0;
  border-bottom: 1px solid var(--border);
}

.result-panel header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.result-panel.empty {
  padding: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 13px;
  color: var(--muted);
  background: #fff;
}

tbody tr:nth-child(even) {
  background: var(--row);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td:last-child,
th:last-child {
  text-align: right;
}

@media (max-width: 720px) {
  .calculator-shell {
    padding: 10px;
  }

  .calculator {
    padding: 16px;
  }

  .calculator-header,
  .search-form,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .calculator-header {
    display: grid;
  }

  .data-note,
  .search-button {
    width: 100%;
  }

  h1 {
    font-size: 23px;
  }
}
