:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --panel: #ffffff;
  --panel-2: #eef3ef;
  --line: #cbd6ce;
  --text: #1e2721;
  --muted: #657169;
  --teal: #147d73;
  --green: #3f7b36;
  --amber: #ad7518;
  --red: #b84438;
  --ink: #26322c;
  --shadow: 0 10px 30px rgba(34, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--ink);
}

button.warn {
  border-color: var(--red);
  background: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 6px 8px;
}

select[multiple] {
  min-height: 92px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

label span {
  color: var(--muted);
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

label.checkbox input {
  width: 16px;
  min-height: 16px;
}

.shell {
  width: min(1480px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.title h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0;
}

.title p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.metric {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

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

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tab {
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--teal);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

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

.band-header h2,
.band-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.band-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.band-body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.planet-picks,
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-content: start;
}

.planet-picks {
  max-height: 132px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

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

.row {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.row strong {
  overflow-wrap: anywhere;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.pill.good {
  border-color: rgba(63, 123, 54, 0.35);
  background: rgba(63, 123, 54, 0.12);
  color: var(--green);
}

.pill.warn {
  border-color: rgba(173, 117, 24, 0.35);
  background: rgba(173, 117, 24, 0.12);
  color: var(--amber);
}

.pill.bad {
  border-color: rgba(184, 68, 56, 0.35);
  background: rgba(184, 68, 56, 0.12);
  color: var(--red);
}

.notice {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(20, 125, 115, 0.35);
  background: rgba(20, 125, 115, 0.1);
  color: #0f5c55;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.notice.error {
  border-color: rgba(184, 68, 56, 0.35);
  background: rgba(184, 68, 56, 0.1);
  color: var(--red);
}

.queue-tools {
  display: grid;
  grid-template-columns: 1.4fr 120px auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.empty {
  min-height: 58px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
}

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

.log-line {
  display: grid;
  grid-template-columns: 170px 72px 1fr;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.log-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.loading-panel {
  min-height: 50vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.pulse {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1040px) {
  .status-strip,
  .grid.cols-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 16px, 720px);
    padding-top: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 120px;
  }

  .status-strip,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .form-grid,
  .queue-tools {
    grid-template-columns: 1fr;
  }

  .row,
  .log-line {
    grid-template-columns: 1fr;
  }
}
