:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #171b25;
  --line: #232936;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #4ade80;
  --accent-dim: #1f6b3f;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-dim);
}

.tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 12px
  ;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-tight {
  margin-top: 14px;
  gap: 10px;
}

.input {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.input:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

.input-num {
  max-width: 90px;
  flex: 0 0 auto;
  text-align: center;
}

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

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

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 14px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  border-color: #2f3949;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #2f9e5f, #227a48);
  border-color: #2f9e5f;
  color: #04140b;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 16px;
}

.btn-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
}

.btn-ghost {
  background: transparent;
}

.chip {
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.chip-muted {
  color: var(--muted);
}

.banner {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--panel-2);
  font-size: 14px;
}

.banner[data-kind="standby"] {
  border-color: #6b5320;
  background: #1d1809;
}

.banner[data-kind="armed"] {
  border-color: var(--accent-dim);
  background: #0e1a13;
}

.banner[data-kind="error"] {
  border-color: #6b2626;
  background: #1c0f0f;
  color: #ffd9d9;
}

.banner[data-kind="result"] {
  border-color: var(--accent-dim);
  background: #0e1a13;
}

.banner strong {
  display: block;
  margin-bottom: 2px;
}

.slug {
  margin: 0;
  font-size: 18px;
}

.meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.supply {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.phases {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.phase {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--panel-2);
  cursor: pointer;
}

.phase[data-selectable="false"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.phase[data-selected="true"] {
  border-color: var(--accent-dim);
  background: #0f1712;
}

.phase-mark {
  font-size: 15px;
}

.phase-body {
  flex: 1;
  min-width: 0;
}

.phase-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
}

.phase-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
}

.phase-kind[data-kind="allowlist"] {
  border-color: #6b5320;
  color: var(--warn);
}

.panel-log {
  padding-bottom: 10px;
}

.events {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px
  ;
  overflow-y: auto;
  font-size: 13px;
}

.events li {
  display: flex;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--panel-2);
  word-break: break-word;
}

.events time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.events li[data-kind="error"] {
  background: #1c0f0f;
  color: #ffd9d9;
}

.events li[data-kind="warning"] {
  background: #1d1809;
  color: #ffe9b8;
}

.events li[data-kind="result"] {
  background: #0e1a13;
}

.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(460px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(4, 6, 10, 0.72);
}

.modal form {
  padding: 18px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.modal-body {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-wide {
  width: min(620px, calc(100vw - 32px));
}

.modal-body code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  font-size: 12px;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  max-height: min(60vh, 460px);
  overflow-y: auto;
  padding-right: 4px;
}

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

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
}

.field-key {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.field-help {
  font-size: 12px;
  color: var(--muted);
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row .input {
  flex: 1;
}

.field-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.field-badge[data-required="true"] {
  border-color: #6b2626;
  color: #ffb4b4;
}

.field-badge[data-set="true"] {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.form-errors {
  margin-top: 12px;
  border: 1px solid #6b2626;
  background: #1c0f0f;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  color: #ffd9d9;
  white-space: pre-wrap;
}

@media (max-width: 620px) {
  .bar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    flex: 1;
    justify-content: center;
  }
}
