:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #15202b;
  --muted: #667085;
  --line: #d8dee6;
  --primary: #155eef;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
.topbar { min-height: 60px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #102a43; color: #fff; }
.brand { color: #fff; font-weight: 750; font-size: 1.1rem; }
nav { display: flex; align-items: center; gap: 16px; }
nav a, .link-button { color: #fff; }
nav form { margin: 0; }
.link-button, .danger-link { border: 0; background: transparent; padding: 0; cursor: pointer; }
.danger-link { color: var(--danger); }
.container { width: min(1180px, 92vw); margin: 32px auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 8px 24px rgba(16, 42, 67, .05); }
.narrow { width: min(440px, 100%); margin: 10vh auto 0; }
.heading-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
h1, h2 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metrics article { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.metrics strong { display: block; font-size: 2rem; }
.metrics span { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: 12px; align-items: center; }
.actions form { margin: 0; }
.stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #aeb8c4; border-radius: 8px; padding: 10px 12px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.form-actions { display: flex; gap: 10px; align-items: center; grid-column: 1 / -1; }
.button, button.primary { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; background: #fff; color: var(--text); cursor: pointer; }
.button.primary, button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.flash { margin-bottom: 16px; border-radius: 8px; padding: 12px 14px; }
.flash-error { background: #fee4e2; color: #912018; }
.flash-success { background: #dcfae6; color: #05603a; }
.badge, .status { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: .82rem; font-weight: 700; }
.badge { background: #e0eaff; color: #194185; }
.status-ready { background: #dcfae6; color: #05603a; }
.status-not_configured { background: #f2f4f7; color: #475467; }
.status-success { background: #dcfae6; color: #05603a; }
.status-failed { background: #fee4e2; color: #912018; }
.status-partial, .status-pending { background: #fef0c7; color: #93370d; }
.channel-row { display: flex; flex-wrap: wrap; gap: 18px; }
.choice-grid { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.choice { padding: 8px; border-bottom: 1px solid var(--line); }
.summary-list { display: grid; grid-template-columns: 120px 1fr; gap: 10px 18px; }
.summary-list dt { color: var(--muted); font-weight: 700; }
.summary-list dd { margin: 0; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.history-card { margin-bottom: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
legend { padding: 0 6px; font-weight: 750; }
code { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; padding-block: 14px; flex-direction: column; }
  nav { width: 100%; gap: 12px; flex-wrap: wrap; }
  .container { margin-top: 20px; }
  .heading-row { align-items: flex-start; flex-direction: column; }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
