:root {
  --sky: #3fa4dc;
  --sky-deep: #0d4d80;
  --navy: #12324f;
  --green: #687f58;
  --green-deep: #48653f;
  --amber: #f2bf61;
  --cloud: #f5fbff;
  --paper: #ffffff;
  --line: #d8e8f2;
  --soft-line: #e9f2f6;
  --muted: #6d7f8e;
  --danger: #8f1d1d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    linear-gradient(180deg, rgba(63, 164, 220, 0.16), rgba(245, 251, 255, 0) 260px),
    var(--cloud);
  color: var(--navy);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  margin: 0 auto;
  max-width: 1320px;
  min-height: 100vh;
  padding: 0 22px 34px;
}

.topbar {
  align-items: center;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(216, 232, 242, 0.9);
  display: flex;
  justify-content: space-between;
  margin: 0 -22px;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(18, 50, 79, 0.12);
  height: 48px;
  width: 48px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.kicker,
.module-title,
.metric span,
.air-aqi-group span,
.pollen-item span {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.02;
  margin: 2px 0 0;
}

h2 {
  font-size: 18px;
  line-height: 1.1;
  margin: 0;
}

p {
  margin: 0;
}

.icon-button,
.text-button,
.search-row button,
.tab,
.segment {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.icon-button {
  background: #f4fbff;
  color: var(--green-deep);
  min-height: 42px;
  padding: 0 12px;
}

.primary-action,
.search-row button {
  background: var(--sky-deep);
  border-color: var(--sky-deep);
  color: #fff;
}

.text-button {
  background: #f4fbff;
  color: var(--sky-deep);
  min-height: 32px;
  padding: 0 9px;
}

.page-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr);
  padding-top: 18px;
}

.place-rail {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 86px;
}

.forecast-page {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.current-card,
.module,
.air-panel,
.day-detail {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 7px 20px rgba(18, 50, 79, 0.06);
  overflow: hidden;
}

.current-card {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 34%);
  min-height: 220px;
  padding: 22px;
}

.current-copy {
  align-self: end;
}

.condition {
  font-size: 19px;
  font-weight: 900;
}

.meta,
.module-header p,
.row-detail,
.source-footer,
.tooltip,
.air-panel p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.temperature-line {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.temperature {
  color: var(--sky-deep);
  font-size: clamp(76px, 10vw, 118px);
  font-weight: 900;
  line-height: 0.88;
}

.unit {
  color: var(--sky);
  font-size: 28px;
  font-weight: 900;
}

.comfort {
  color: var(--green-deep);
  font-size: 15px;
  font-weight: 900;
}

.current-metrics {
  background: #f8fbfd;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  display: grid;
  gap: 0;
}

.current-metrics div {
  align-content: center;
  border-bottom: 1px solid var(--soft-line);
  min-height: 70px;
  padding: 14px;
}

.current-metrics div:last-child {
  border-bottom: 0;
}

.current-metrics span {
  color: var(--green);
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.current-metrics strong {
  display: block;
  font-size: 19px;
  margin-top: 4px;
}

.tabs {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px;
  position: sticky;
  top: 73px;
  z-index: 8;
}

.tab {
  background: transparent;
  color: var(--muted);
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.tab.active {
  background: #eef8ff;
  color: var(--sky-deep);
}

.tab-panel {
  display: grid;
  gap: 14px;
  scroll-margin-top: 126px;
}

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

.source-footer {
  grid-column: 1 / -1;
  padding: 0 4px 2px;
}

.compact-module {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.flush-header {
  border-bottom: 0;
  padding: 0;
}

.card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.forecast-card {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  min-height: 92px;
  padding: 12px;
  text-align: left;
}

.forecast-card:hover,
.data-row:hover,
.place-row:hover {
  background: #eef8ff;
}

#smartPrepSlot:empty {
  display: none;
}

.mobile-guidance {
  display: none;
}

.activity-conditions-module[hidden] {
  display: none;
}

.activity-condition-grid {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
  padding: 4px 0;
}

.activity-condition-row {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  gap: 9px;
  min-height: 34px;
  padding: 7px 12px;
}

.activity-condition-row:last-child {
  border-bottom: 0;
}

.activity-status-dot {
  border-radius: 50%;
  flex: 0 0 auto;
  height: 12px;
  width: 12px;
}

.activity-condition-row.green .activity-status-dot {
  background: #16833a;
}

.activity-condition-row.yellow .activity-status-dot {
  background: #c98600;
}

.activity-condition-row.red .activity-status-dot {
  background: #c22f22;
}

.activity-condition-text {
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  min-width: 0;
}

.app-promo-note {
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.3;
}

.activity-conditions-module .app-promo-note {
  border-top: 1px solid var(--soft-line);
  padding: 7px 12px 9px;
}

.smart-prep-card {
  align-items: center;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  color: inherit;
  display: flex;
  gap: 14px;
  grid-column: 1 / -1;
  justify-content: space-between;
  min-height: 86px;
  padding: 13px 14px;
  text-decoration: none;
}

.smart-prep-card:hover {
  background: #f4fbff;
}

.smart-prep-card strong {
  display: block;
  font-size: 17px;
  margin-top: 3px;
}

.smart-prep-card p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  margin-top: 4px;
}

.smart-prep-card .app-promo-note {
  color: var(--green-deep);
  font-size: 11px;
  margin-top: 7px;
}

.smart-prep-card span {
  color: var(--sky-deep);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 900;
}

.forecast-card .primary {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.forecast-card .secondary {
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
  margin-top: 8px;
}

.forecast-card .tertiary {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
}

#hourlyPanel .module-header {
  padding: 9px 14px;
}

#hourlyPanel .module-header h2 {
  font-size: 18px;
  line-height: 1.05;
}

#hourlyPanel .module-header p {
  line-height: 1.15;
}

.rail-header {
  padding: 12px;
}

.data-row,
.place-row,
.place-list-item {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  color: inherit;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 58px;
  padding: 11px 14px;
  text-decoration: none;
  width: 100%;
}

.place-list-item {
  background: #ffffff;
  min-height: 62px;
  padding: 0;
}

.place-list-item.current {
  background: #eef8ff;
}

button.data-row,
button.place-row,
.place-main {
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  text-align: left;
}

.place-main {
  align-items: center;
  border-bottom: 0;
  color: inherit;
  display: flex;
  flex: 1;
  gap: 10px;
  justify-content: space-between;
  min-height: 62px;
  min-width: 0;
  padding: 10px 12px;
}

.place-main:hover {
  background: #eef8ff;
}

.row-label {
  font-size: 15px;
  font-weight: 900;
}

.place-text-group {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.place-name {
  color: var(--navy);
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-detail {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-value {
  color: var(--green-deep);
  flex-shrink: 0;
  font-weight: 900;
  margin-left: 12px;
  text-align: right;
}

.place-status {
  color: var(--green-deep);
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 900;
}

.place-actions-inline {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  padding-right: 10px;
}

.place-action {
  background: #f4fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sky-deep);
  font-weight: 900;
}

.place-action.small {
  min-height: 32px;
  padding: 0 9px;
}

.place-action.danger {
  background: #fff5f2;
  border-color: #f0c3ba;
  color: var(--danger);
}

.place-action:disabled {
  background: #f4f7f9;
  color: #9aa8b2;
  cursor: default;
}

.chart-scroll {
  overflow-x: auto;
  padding: 12px 0 8px;
}

.chart-stage {
  min-width: 760px;
  padding: 0 10px;
}

.chart-block {
  padding: 4px 0 10px;
}

.chart-title {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin: 0 8px 4px;
}

.chart-title strong {
  font-size: 14px;
}

.chart-title span,
.legend span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 8px 0;
}

.hourly-rows {
  display: grid;
}

.hourly-rows[hidden],
.chart-scroll[hidden] {
  display: none;
}

.segmented-control {
  background: #f4fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  padding: 2px;
}

.segment {
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 30px;
  padding: 0 10px;
}

.segment.active {
  background: #fff;
  color: var(--sky-deep);
  box-shadow: 0 1px 4px rgba(18, 50, 79, 0.08);
}

.tooltip {
  background: #f8fbfd;
  border-top: 1px solid var(--soft-line);
  padding: 10px 14px;
}

.air-panel {
  padding: 14px;
}

.air-top-line {
  align-items: center;
  display: flex;
  gap: 14px;
}

.air-aqi-group {
  border-right: 1px solid var(--soft-line);
  min-width: 78px;
  padding-right: 14px;
  text-align: center;
}

.air-aqi-group strong {
  color: var(--sky-deep);
  display: block;
  font-size: 38px;
  line-height: 1;
}

.air-pollen-row {
  border-top: 1px solid var(--soft-line);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  padding-top: 12px;
}

.pollen-item strong {
  display: block;
  font-size: 14px;
  margin-top: 2px;
}

.pollen-item em {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.search-module,
.saved-module,
.places-module {
  padding: 12px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  flex: 1;
  font-weight: 800;
  min-height: 44px;
  min-width: 0;
  padding: 0 12px;
}

.search-row button {
  min-height: 44px;
  padding: 0 12px;
}

#searchResults,
#savedPlaces,
#placesSearchResults,
#placesSaved {
  margin-top: 10px;
}

.places-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.day-detail {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.day-detail[hidden] {
  display: none;
}

.day-detail .stats-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-tile {
  background: #f8fbfd;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  min-height: 84px;
  padding: 12px;
}

.stat-tile span {
  color: var(--green);
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-tile strong {
  display: block;
  font-size: 20px;
  margin-top: 10px;
}

.back-button {
  background: #f4fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sky-deep);
  font-weight: 900;
  min-height: 38px;
  padding: 0 12px;
  width: fit-content;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 12px 2px;
}

.app-promo-footer {
  align-items: flex-start;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-top: 22px;
  padding: 18px 2px 0;
}

.app-promo-footer p {
  color: var(--navy);
  font-size: 14px;
  font-weight: 850;
  margin-top: 4px;
}

.app-promo-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  max-width: 620px;
  padding: 0;
}

.app-promo-footer li {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.gear-page {
  grid-column: 1 / -1;
  margin: 0 auto;
  max-width: 780px;
  width: 100%;
}

.gear-module {
  margin-top: 12px;
}

.gear-copy {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.gear-copy p {
  color: var(--navy);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
}

.affiliate-disclosure {
  background: #f8fbfd;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  color: var(--muted) !important;
  font-size: 12px !important;
  padding: 10px 12px;
}

.gear-links {
  display: grid;
}

.gear-link {
  align-items: center;
  border-top: 1px solid var(--soft-line);
  color: inherit;
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 12px 16px;
  text-decoration: none;
}

.gear-link:hover {
  background: #eef8ff;
}

.gear-link span {
  font-weight: 900;
}

.gear-link strong {
  color: var(--green-deep);
  font-size: 12px;
}

.gear-route-list {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
}

.gear-route-list a,
.back-link {
  background: #f4fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--sky-deep);
  font-size: 13px;
  font-weight: 900;
  padding: 8px 10px;
  text-decoration: none;
}

.back-link {
  display: inline-flex;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 0 12px 24px;
  }

  .topbar {
    margin: 0 -12px;
    padding: 10px 14px;
  }

  .brand-mark {
    height: 40px;
    width: 40px;
  }

  .page-layout {
    grid-template-columns: 1fr;
  }

  .place-rail {
    position: static;
  }

  .current-card,
  .overview-grid,
  .air-grid,
  .places-grid {
    grid-template-columns: 1fr;
  }

  .current-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .current-metrics div {
    border-bottom: 0;
    border-right: 1px solid var(--soft-line);
    min-height: 76px;
  }

  .current-metrics div:last-child {
    border-right: 0;
  }

  .tabs {
    top: 61px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .top-actions {
    flex-direction: column;
  }

  .icon-button {
    min-height: 36px;
    padding: 0 9px;
  }

  .temperature {
    font-size: 72px;
  }

  .card-grid,
  .current-metrics,
  .air-pollen-row,
  .day-detail .stats-grid {
    grid-template-columns: 1fr;
  }

  .current-metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
  }

  .module-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-promo-footer {
    display: grid;
    gap: 10px;
  }

  .app-promo-footer ul {
    justify-content: flex-start;
  }

  .place-list-item {
    align-items: stretch;
  }

  .place-main {
    padding-right: 8px;
  }

  .place-status {
    display: none;
  }

  .place-actions-inline {
    padding-right: 8px;
  }
}

@media (max-width: 700px) {
  body {
    padding-bottom: 82px;
  }

  .app-shell {
    padding-bottom: 18px;
  }

  .page-layout {
    gap: 10px;
    padding-top: 10px;
  }

  .place-rail {
    display: none;
    gap: 10px;
  }

  .desktop-guidance {
    display: none !important;
  }

  .mobile-guidance {
    display: block;
    grid-column: 1 / -1;
  }

  .mobile-guidance:empty {
    display: none;
  }

  body[data-active-tab="places"] .place-rail {
    display: grid;
  }

  .forecast-page {
    gap: 10px;
  }

  .current-card {
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }

  .condition {
    font-size: 15px;
  }

  .meta {
    font-size: 11px;
  }

  .temperature-line {
    margin-top: 8px;
  }

  .temperature {
    font-size: 58px;
    line-height: 0.94;
  }

  .unit {
    font-size: 20px;
  }

  .comfort {
    font-size: 12px;
  }

  .current-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .current-metrics div {
    border-bottom: 0;
    border-right: 1px solid var(--soft-line);
    min-height: 58px;
    padding: 8px;
  }

  .current-metrics div:last-child {
    border-right: 0;
  }

  .current-metrics strong {
    font-size: 14px;
  }

  .tabs {
    border-radius: 0;
    border-width: 1px 0 0;
    bottom: 0;
    box-shadow: 0 -6px 18px rgba(18, 50, 79, 0.08);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    padding: 7px 6px max(8px, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: auto;
  }

  .tab {
    min-height: 46px;
    padding: 0 4px;
    white-space: normal;
  }

  .tab-panel {
    display: none;
  }

  .tab-panel.active {
    display: grid;
  }

  .overview-grid,
  .air-grid,
  .places-grid {
    grid-template-columns: 1fr;
  }

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

  .forecast-card {
    min-height: 74px;
    padding: 10px;
  }

  .forecast-card .secondary {
    font-size: 15px;
  }

  .chart-stage {
    min-width: 760px;
  }

  .module-header {
    padding: 12px 14px;
  }

  #hourlyPanel .module-header {
    align-items: center;
    flex-direction: row;
    padding: 7px 10px;
  }

  #hourlyPanel .module-header h2 {
    font-size: 16px;
  }

  #hourlyPanel .module-header p {
    font-size: 11px;
  }

  #hourlyPanel .segment {
    min-height: 28px;
    padding: 0 8px;
  }
}
