:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #687486;
  --line: #dce4ed;
  --accent: #1769aa;
  --good: #16804b;
  --good-bg: #eaf8f1;
  --bad: #b42318;
  --bad-bg: #fff1f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px max(20px, calc((100% - 1180px) / 2));
  background: white;
  border-bottom: 1px solid var(--line);
}

.site-header h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}

.site-header nav {
  display: flex;
  gap: 14px;
}

.site-header a,
.back-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.page {
  max-width: 1180px;
  margin: auto;
  padding: 26px 20px 55px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.toolbar h2 {
  margin: 4px 0;
  font-size: 28px;
}

.toolbar p,
.help-text {
  color: var(--muted);
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 15px;
  border-radius: 10px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.danger-btn {
  border: 1px solid #f1b9b5;
  background: var(--bad-bg);
  color: var(--bad);
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
}

.flash.success {
  background: var(--good-bg);
  color: var(--good);
}

.flash.error {
  background: var(--bad-bg);
  color: var(--bad);
}

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

.station-card,
.form-card,
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3,
.form-card h3 {
  margin-top: 0;
}

.card-head code {
  color: var(--muted);
}

.status {
  height: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 750;
}

.status.active {
  background: var(--good-bg);
  color: var(--good);
}

.station-card dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 16px 0;
}

.station-card dl div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 3px 0 0;
  font-weight: 650;
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

input[readonly] {
  background: #f5f7fa;
  color: var(--muted);
}

textarea {
  min-height: 95px;
  resize: vertical;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.calc-grid div {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  padding: 13px;
}

.calc-grid span,
.calc-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.calc-grid strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.notes {
  display: block;
  margin-top: 16px;
}

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

.delete-zone {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.login-card {
  max-width: 480px;
  margin: 50px auto;
}

.login-card h2 {
  margin-top: 0;
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .station-grid,
  .form-grid,
  .calc-grid {
    grid-template-columns: 1fr;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn {
    width: 100%;
  }
}
