:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #181d20;
  --panel-2: #20262a;
  --line: #344047;
  --text: #eef3ed;
  --muted: #b8c3bd;
  --accent: #70c4b0;
  --accent-strong: #9be0ca;
  --amber: #f2bb5b;
  --red: #e66c62;
  --green: #91c66a;
  --blue: #79a8d8;
  --shadow: rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 10%, rgba(112, 196, 176, 0.12), transparent 30rem),
    linear-gradient(160deg, #101316 0%, #171714 42%, #141b20 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #222b2e;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  border-color: var(--accent);
  background: #273438;
  transform: translateY(-1px);
  outline: none;
}

button:disabled {
  color: #6f797a;
  cursor: not-allowed;
  opacity: 0.66;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 0.98rem;
  letter-spacing: 0;
}

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

.top-actions button {
  padding: 0 18px;
}

#commitButton {
  background: #276352;
  border-color: #57ad98;
}

.objective {
  border: 1px solid #3c494a;
  border-radius: 8px;
  background: rgba(24, 29, 32, 0.88);
  box-shadow: 0 18px 45px var(--shadow);
  color: var(--muted);
  line-height: 1.45;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.objective strong {
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 14px;
  align-items: start;
}

.map-panel,
.side-panel {
  border: 1px solid #334046;
  border-radius: 8px;
  background: rgba(20, 24, 27, 0.9);
  box-shadow: 0 18px 45px var(--shadow);
}

.map-panel {
  overflow: hidden;
  min-height: 420px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 420px;
}

.side-panel {
  padding: 12px;
}

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

.stat {
  min-height: 66px;
  border: 1px solid #303b3f;
  border-radius: 7px;
  background: var(--panel-2);
  padding: 10px;
}

.stat span,
.meter-row span,
.ticks,
.plan-list,
.log p,
.action-card small {
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 1.28rem;
  line-height: 1;
}

.balances,
.policy,
.plan,
.actions,
.log {
  margin-top: 12px;
  border: 1px solid #303b3f;
  border-radius: 8px;
  background: #171d20;
  padding: 12px;
}

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

.section-heading strong,
#taxLabel {
  color: var(--accent-strong);
  font-size: 0.94rem;
}

.meter-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

meter {
  width: 100%;
  height: 14px;
}

.policy input {
  width: 100%;
  accent-color: var(--accent);
}

.ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.plan-list {
  min-height: 74px;
  margin: 0;
  padding-left: 22px;
  line-height: 1.55;
}

.plan-list:empty::before {
  content: "No crew assigned yet.";
  color: #839093;
}

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

.action-card {
  display: grid;
  gap: 5px;
  min-height: 118px;
  padding: 10px;
  text-align: left;
}

.action-card strong {
  color: var(--text);
  line-height: 1.1;
}

.action-card em {
  color: var(--amber);
  font-style: normal;
  font-size: 0.82rem;
}

.log p {
  margin-bottom: 0;
  line-height: 1.5;
}

.is-good {
  color: var(--green) !important;
}

.is-warn {
  color: var(--amber) !important;
}

.is-danger {
  color: var(--red) !important;
}

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

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

  .stats,
  .balances,
  .policy,
  .plan,
  .actions,
  .log {
    margin-top: 0;
  }

  .stats,
  .actions,
  .log {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 18px, 1480px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1 1 120px;
    padding: 0 10px;
  }

  .objective {
    font-size: 0.94rem;
  }

  .side-panel {
    display: block;
  }

  .stats,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .balances,
  .policy,
  .plan,
  .actions,
  .log {
    margin-top: 10px;
  }

  canvas {
    min-height: 300px;
  }
}
