:root {
  color-scheme: light;
  --ink: #111;
  --muted: #636b73;
  --line: rgba(255, 255, 255, 0.36);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #fff;
  --soft: rgba(255, 255, 255, 0.58);
  --blue: #2776f2;
  --green: #74b742;
  --storm: #111820;
  --danger: #b9363f;
  --warning: #986514;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

body.dark {
  color-scheme: dark;
  --ink: #f5f6f7;
  --muted: #b5bcc4;
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(18, 24, 29, 0.78);
  --panel-solid: #151b20;
  --soft: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eef2ed 0, #ffffff 360px),
    #ffffff;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.dark {
  background:
    linear-gradient(180deg, #121a16 0, #0f1110 360px),
    #0f1110;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  padding: 0 12px;
}

body.dark input,
body.dark select,
body.dark textarea {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

.signin {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(7, 12, 18, 0.62), rgba(7, 12, 18, 0.18)),
    url("assets/plains-weather-logo.png") center / cover no-repeat;
}

.signin-card {
  display: grid;
  width: min(420px, 100%);
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

body.dark .signin-card {
  background: rgba(18, 24, 29, 0.88);
}

.signin-card .brand {
  justify-self: center;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-image {
  width: 176px;
  height: 54px;
  object-fit: cover;
  object-position: left center;
  border-radius: 10px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.signin-copy p,
.station-main small,
.station-details,
.setup-panel p,
.upload-panel p,
.empty-state span,
.condition-row,
.section-title span,
.utility-bar {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signin-copy h1 {
  margin: 4px 0 8px;
  font-size: 2rem;
  line-height: 1.08;
  text-align: center;
}

.signin-copy p {
  margin: 0;
  line-height: 1.45;
  text-align: center;
}

.signin-form,
.station-form {
  display: grid;
  gap: 13px;
}

.signin-form label,
.station-form label,
.station-select {
  display: grid;
  gap: 7px;
}

.signin-form span,
.station-form span,
.station-select span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.signin-form input {
  min-height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.signin-form .primary-button {
  min-height: 48px;
  margin-top: 4px;
  border-radius: 8px;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.form-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.form-message[data-kind="success"] {
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  background: color-mix(in srgb, var(--green) 13%, transparent);
  color: color-mix(in srgb, var(--green) 72%, #111);
}

.app {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 176px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 20px;
  padding: 12px;
  background: rgba(8, 12, 16, 0.84);
  color: white;
  backdrop-filter: blur(12px);
}

.rail-logo {
  width: 150px;
  height: 58px;
  overflow: hidden;
  border-radius: 10px;
}

.rail-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

.rail-nav {
  display: grid;
  gap: 6px;
}

.rail-nav a,
.rail-premium {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
}

.rail-nav a.active,
.rail-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.rail-premium {
  margin-top: auto;
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  cursor: pointer;
}

.page {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 500px) auto;
  gap: 18px;
  align-items: center;
  justify-content: end;
  padding: 16px 28px;
}

.brand-hero {
  width: min(1180px, calc(100% - 48px));
  margin: 8px auto 22px;
  overflow: hidden;
  border-radius: 18px;
  background: #111820;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.brand-hero img {
  display: block;
  width: 100%;
  height: clamp(180px, 30vw, 330px);
  object-fit: cover;
  object-position: center;
}

.search-shell {
  position: relative;
}

.search-shell span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search-shell input {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding-left: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.content-grid {
  display: grid;
  width: min(1060px, calc(100% - 48px));
  gap: 22px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.main-column {
  display: grid;
  gap: 22px;
}

.location-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.location-heading h1 {
  margin: 4px 0 6px;
  font-size: 1.8rem;
}

.location-heading p {
  margin: 0;
  color: var(--muted);
}

.current-card {
  display: grid;
  min-height: 210px;
  grid-template-columns: 1fr;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(16, 24, 31, 0.95), rgba(31, 58, 45, 0.86));
  color: white;
  padding: 24px;
  box-shadow: var(--shadow);
}

.temp-value {
  display: block;
  font-size: clamp(5rem, 13vw, 8rem);
  font-weight: 900;
  line-height: 0.86;
}

.condition-row {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.quick-stats strong {
  color: white;
}

.station-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-tile {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.stat-tile span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.stat-tile strong {
  font-size: 1.4rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title h2,
.panel h2 {
  margin: 0;
  font-size: 1.35rem;
}

.outlook,
.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.reading-strip {
  display: grid;
  grid-auto-columns: minmax(96px, 1fr);
  grid-auto-flow: column;
  gap: 10px;
  min-height: 116px;
  overflow-x: auto;
}

.reading-point {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 96px;
  border-radius: 14px;
  background: var(--soft);
  padding: 12px;
  text-align: center;
}

.reading-point span,
.reading-point small,
.empty-reading {
  color: var(--muted);
}

.reading-point strong {
  font-size: 1.25rem;
}

.empty-reading {
  display: grid;
  min-width: 100%;
  place-items: center;
  text-align: center;
}

.empty-state {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  background: var(--soft);
}

.station-list {
  display: grid;
  gap: 10px;
}

.station-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

body.dark .station-card {
  background: rgba(255, 255, 255, 0.06);
}

.station-card.active {
  border-color: var(--green);
}

.station-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.station-main strong,
.station-main small {
  display: block;
}

.station-icon {
  display: none;
}

.station-temp {
  color: var(--blue);
  font-size: 1.28rem;
  font-weight: 900;
}

.station-details,
.station-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.status {
  color: var(--blue);
  font-weight: 900;
  text-transform: capitalize;
}

.status.waiting {
  color: var(--warning);
}

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

.setup-panel,
.upload-panel,
.admin-grid,
.upload-admin {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(300px, 1fr);
  gap: 24px;
}

.admin-panel {
  display: grid;
  gap: 24px;
}

.station-form h3,
.upload-admin h3,
.assignment-admin h3,
.data-admin h3 {
  margin: 0;
}

.assignment-box,
.assignment-admin,
.user-admin,
.data-admin,
.assignment-card {
  display: grid;
  gap: 12px;
}

.assignment-box {
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
}

.assignment-box > span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.assignment-list {
  display: grid;
  gap: 12px;
}

.assignment-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.assignment-card strong,
.assignment-card small {
  display: block;
}

.assignment-card small,
.assignment-checks small {
  color: var(--muted);
}

.assignment-checks {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
}

.check-row span {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.admin-user-list {
  display: grid;
  gap: 10px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.admin-user-main,
.admin-user-meta {
  display: grid;
  gap: 5px;
}

.admin-user-main strong {
  font-size: 1rem;
}

.admin-user-main span,
.admin-user-meta small {
  color: var(--muted);
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.role-pill,
.protected-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  padding: 0 10px;
}

.role-pill {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  color: color-mix(in srgb, var(--blue) 74%, white);
  text-transform: capitalize;
}

.protected-pill {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: color-mix(in srgb, var(--green) 78%, white);
}

.data-reset-list {
  display: grid;
  gap: 10px;
}

.data-reset-card {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.data-reset-main,
.data-reset-values {
  display: grid;
  gap: 6px;
}

.data-reset-main small {
  color: var(--muted);
}

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

.data-reset-values span {
  color: var(--muted);
  font-size: 0.86rem;
}

.data-reset-values strong {
  color: var(--ink);
}

.data-reset-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--soft);
}

.endpoint span {
  color: var(--green);
  font-weight: 900;
}

.upload-code {
  overflow: hidden;
  border-radius: 12px;
  background: var(--soft);
}

.code-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

pre {
  margin: 0;
  overflow-x: auto;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.utility-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.primary-button,
.ghost-button,
.signin-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 900;
  padding: 0 14px;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: #111;
}

.signin-button {
  border: 0;
  background: rgba(10, 12, 14, 0.9);
  color: white;
}

.danger-button {
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  background: transparent;
  color: var(--danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

body.dark .ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.bottom-nav {
  display: none;
}

.muted-message {
  color: var(--muted);
}

.error-page {
  width: min(720px, calc(100% - 32px));
  margin: 80px auto;
}

.forecast-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 16px;
}

.forecast-form label {
  display: grid;
  gap: 7px;
}

.forecast-form span {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.forecast-card {
  display: grid;
  gap: 7px;
  min-width: 120px;
  padding: 12px;
  border-radius: 14px;
  background: var(--soft);
}

.forecast-card b {
  font-size: 0.96rem;
}

.forecast-card span,
.forecast-card small {
  color: var(--muted);
}

.location-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.location-result {
  display: grid;
  gap: 4px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: inherit;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.location-result:hover {
  border-color: var(--green);
}

.location-result span {
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .content-grid {
    margin-top: 0;
  }

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

  .bottom-nav {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }

  .bottom-nav a {
    padding: 12px 6px;
    color: #555;
    font-size: 0.86rem;
    font-weight: 900;
    text-align: center;
  }
}

@media (max-width: 760px) {
  body {
    background-position: 50% top;
  }

  .signin-card,
  .topbar,
  .location-heading,
  .setup-panel,
  .upload-panel,
  .admin-grid,
  .upload-admin,
  .admin-user-card,
  .data-reset-card,
  .forecast-form {
    grid-template-columns: 1fr;
  }

  .content-grid {
    width: min(100% - 24px, 1060px);
    margin-top: 0;
  }

  .page {
    padding-bottom: 74px;
  }

  .brand-hero {
    width: min(100% - 24px, 1180px);
    margin-top: 0;
  }

  .topbar {
    justify-content: stretch;
    padding: 14px 12px;
  }

  .top-actions,
  .station-actions,
  .admin-user-actions,
  .data-reset-actions {
    width: 100%;
  }

  .top-actions > *,
  .station-actions > *,
  .admin-user-actions > *,
  .data-reset-actions > *,
  .primary-button {
    width: 100%;
  }

  .data-reset-values {
    grid-template-columns: 1fr;
  }

  .station-stat-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, minmax(132px, 1fr));
  }
}
