:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #202528;
  --muted: #667075;
  --line: #d8dfdc;
  --green: #2f6b57;
  --blue: #315f9d;
  --gold: #b9822b;
  --red: #a34842;
  --sidebar: #17201d;
  --shadow: 0 12px 28px rgba(31, 39, 36, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .68;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px;
  background: var(--sidebar);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f4cf72;
  color: #17201d;
  font-weight: 850;
}

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

.brand strong {
  line-height: 1.1;
}

.brand span {
  margin-top: 4px;
  color: rgba(255, 255, 255, .62);
  font-size: 13px;
}

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

.nav-btn,
.icon-btn,
.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
}

.nav-btn {
  justify-content: flex-start;
  padding: 0 12px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.nav-btn svg,
.icon-btn svg,
.primary svg,
.secondary svg {
  width: 18px;
  height: 18px;
}

.token-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.token-box label {
  color: rgba(255, 255, 255, .62);
  font-size: 12px;
}

.token-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 6px;
}

.token-row input,
.token-row button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.token-row input {
  width: 100%;
  padding: 0 10px;
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

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

.top-actions select {
  min-width: 220px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select,
input {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  min-height: 76px;
  resize: vertical;
  padding: 10px;
}

.icon-btn {
  width: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 12px;
}

.panel {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel.wide {
  grid-column: span 1;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

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

.role-step {
  min-height: 108px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.role-step strong {
  display: block;
  margin-bottom: 12px;
  font-size: 24px;
}

.role-step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.stack,
.cards,
.table-like,
.season-summary {
  display: grid;
  gap: 8px;
}

.queue-item,
.table-row,
.card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.queue-item strong {
  font-size: 22px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.table-row span,
.card p,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  align-items: start;
}

.left-stack {
  display: grid;
  gap: 12px;
}

.form-panel {
  display: grid;
  gap: 9px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.primary {
  padding: 0 14px;
  background: var(--green);
  color: #fff;
  font-weight: 760;
}

.secondary {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.card {
  display: grid;
  gap: 8px;
}

.environment-card.is-selected {
  border-color: rgba(47, 107, 87, .45);
  background: #f8fbf9;
}

.environment-meta {
  display: grid;
  gap: 6px;
}

.environment-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.environment-meta svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.card-actions {
  display: flex;
  justify-content: flex-end;
}

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

.badge-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: #fff;
}

.pill.green { color: var(--green); border-color: rgba(47, 107, 87, .32); }
.pill.blue { color: var(--blue); border-color: rgba(49, 95, 157, .32); }
.pill.gold { color: var(--gold); border-color: rgba(185, 130, 43, .32); }
.pill.red { color: var(--red); border-color: rgba(163, 72, 66, .32); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: .18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav-btn {
    justify-content: center;
  }

  .nav-btn span {
    display: none;
  }

  .content-grid,
  .split,
  .metrics,
  .ladder {
    grid-template-columns: 1fr;
  }
}
