:root {
  --ink: #26323d;
  --muted: #66727d;
  --line: #dfe3e7;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --accent: #f0522a;
  --accent-dark: #c73f1e;
  --ok: #147a48;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.public .shell {
  width: min(920px, calc(100% - 24px));
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.topnav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.secondary {
  background: white;
  color: var(--accent);
}

.compact-button {
  min-height: 42px;
  width: auto;
  min-width: 76px;
  padding-inline: 12px;
}

.topnav a {
  background: white;
  color: var(--accent);
}

.topnav a.primary-nav {
  background: var(--accent);
  color: white;
}

.topnav a.primary-nav:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:hover,
.button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: .65;
  background: #7b858f;
  border-color: #7b858f;
}

.page-head {
  margin-bottom: 18px;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  margin-bottom: 10px;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.05rem;
}

.lead,
.page-head p {
  color: var(--muted);
  font-size: 1.05rem;
}

.panel,
.subpanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 18px;
}

.narrow {
  width: min(520px, 100%);
  margin: 48px auto;
}

.form-panel {
  margin-top: 18px;
}

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

.metrics div {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metrics strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.metrics span {
  color: var(--muted);
}

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

.stack {
  display: grid;
  gap: 16px;
}

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

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

.field {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b9c0c7;
  border-radius: 4px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

legend {
  font-weight: 800;
}

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 18px;
}

fieldset input,
.consent input {
  width: auto;
  min-height: 0;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
}

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

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

th {
  color: var(--accent);
  font-weight: 800;
}

.status {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-ready {
  border-color: #bfdbfe;
  background: #eef6ff;
  color: #24496f;
}

.status-success {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.status-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.status-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.status-busy {
  border-color: #fde68a;
  background: #fffbeb;
  color: #854d0e;
}

.details {
  display: grid;
  gap: 12px;
  margin: 0;
}

.details > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 980px);
}

.copy-row input {
  flex: 1 1 620px;
  min-width: min(620px, 100%);
}

.copy-row .compact-button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 36px;
  padding: 0 10px;
  font-size: .9rem;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
}

.alert {
  background: #fff0eb;
  border: 1px solid #ffc8b8;
  color: #8f2c10;
  padding: 12px;
  border-radius: 6px;
}

.notice {
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  color: #24496f;
  padding: 12px;
  border-radius: 6px;
  margin: 0;
}

.success-note {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: #166534;
}

.run-log {
  margin-top: 18px;
}

.sweet-options {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.choice-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 16px;
  padding: 12px;
}

.choice-group legend {
  padding: 0 6px;
  font-weight: 700;
}

.choice-group label {
  display: block;
  margin: 8px 0;
}

.danger-zone {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.danger-button {
  background: #991b1b;
  border-color: #991b1b;
}

.danger-button:hover {
  background: #7f1d1d;
  border-color: #7f1d1d;
}

.success h1 {
  color: var(--ok);
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .grid.two,
  .metrics,
  .details > div {
    grid-template-columns: 1fr;
  }

  .panel,
  .subpanel {
    padding: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  .copy-row {
    flex-wrap: wrap;
  }

  .copy-row input {
    min-width: 100%;
  }
}
