:root {
  --bg: #f4f8fc;
  --surface: #ffffff;
  --surface-alt: #f7fbff;
  --surface-soft: #eef5fb;
  --line: #d7e3ef;
  --line-strong: #bdd0e4;
  --text: #14263a;
  --muted: #63788f;
  --accent: #0071ff;
  --accent-hover: #0885ff;
  --accent-soft: #edf5ff;
  --accent-soft-strong: #dff0ff;
  --danger: #c2574c;
  --danger-soft: #fff1ef;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f7fbff 0%, #f4f8fc 48%, #eef4fa 100%);
  color: var(--text);
  font-family: "Roboto", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #fbfdff;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  font-family: "Lexend", sans-serif;
  font-size: 1.08rem;
  font-weight: 600;
  color: #10263d;
}

.brand-lockup {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.brand-logo {
  display: block;
  max-width: 168px;
  width: 100%;
  height: auto;
}

.earthscope-logo {
  max-width: 182px;
}

.brand {
  text-align: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  border: 1px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #cfe3ff;
  outline: none;
}

.sidebar-status {
  display: grid;
  gap: 6px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.sidebar-status span,
.sidebar-note {
  color: var(--muted);
}

.sidebar-status strong {
  font-weight: 600;
  color: var(--text);
}

.sidebar-note {
  margin: 0;
  font-size: 0.92rem;
}

.workspace {
  min-width: 0;
  padding: 24px 28px 36px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.toolbar h1 {
  margin: 0 0 6px;
  font-family: "Lexend", sans-serif;
  font-size: 1.72rem;
  font-weight: 600;
  color: #10263d;
}

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

.toolbar-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 18px;
  scroll-margin-top: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-family: "Lexend", sans-serif;
  font-size: 1.03rem;
  font-weight: 600;
  color: #173352;
}

.section-grid {
  display: grid;
  gap: 18px;
}

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

.station-grid {
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.05fr);
  margin-top: 18px;
}

.stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.control {
  border-color: var(--line-strong) !important;
  border-radius: 8px !important;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  background: #fff !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.control::placeholder {
  color: #8da0b3;
}

.control:focus {
  border-color: #6baeff !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 255, 0.12) !important;
}

.token-control {
  min-height: 136px;
  resize: vertical;
}

.form-select {
  background-image:
    linear-gradient(45deg, transparent 50%, #7a93af 50%),
    linear-gradient(135deg, #7a93af 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.btn {
  border-radius: 8px;
  font-weight: 500;
  box-shadow: none !important;
}

.btn-sm {
  padding: 0.48rem 0.85rem;
}

.btn-lg {
  padding: 0.8rem 1rem;
}

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-hover);
  --bs-btn-active-border-color: var(--accent-hover);
}

.btn-outline-primary {
  --bs-btn-color: var(--accent);
  --bs-btn-border-color: #b6d5ff;
  --bs-btn-hover-bg: var(--accent-soft);
  --bs-btn-hover-color: var(--accent);
  --bs-btn-hover-border-color: #97c3ff;
}

.btn-outline-secondary {
  --bs-btn-color: #45617f;
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--surface-soft);
  --bs-btn-hover-color: #20476f;
  --bs-btn-hover-border-color: #a9c2db;
}

.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: #e0b6b0;
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-color: #b2443a;
  --bs-btn-hover-border-color: #d79a92;
}

.selected-block {
  padding-top: 6px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
}

.chip {
  border: 1px solid #c7ddfb;
  background: var(--accent-soft);
  color: #1851a0;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.chip:hover,
.chip:focus-visible {
  background: var(--accent-soft-strong);
  border-color: #a7cbff;
  outline: none;
}

.list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  min-height: 164px;
  max-height: 340px;
  overflow: auto;
}

.list.tall {
  max-height: 430px;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-bottom: 1px solid #e6eef7;
}

.item:last-child {
  border-bottom: none;
}

.item small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.result {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: #173352;
  min-height: 280px;
  max-height: 430px;
  overflow: auto;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}

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

  .sidebar {
    position: static;
    top: auto;
    height: auto;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 16px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px;
  }

  .toolbar,
  .section-header,
  .station-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .two-up,
  .station-grid,
  .streams-grid {
    grid-template-columns: 1fr;
  }
}
