:root {
  --bg: #0f1419;
  --surface: #1a222c;
  --text: #e8eef4;
  --muted: #9aa8b5;
  --accent: #2f9e74;
  --accent-text: #062217;
  --danger: #e07a6a;
  --ok: #6bcf8e;
  --border: #2c3845;
  --focus: #7eb6ff;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1c3344 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243028 0%, transparent 50%),
    var(--bg);
  line-height: 1.5;
}

.shell {
  width: min(440px, calc(100% - 2rem));
  margin: 4rem auto;
}

.shell.wide {
  width: min(720px, calc(100% - 2rem));
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.lede,
.status {
  color: var(--muted);
  margin-top: 0;
}

section {
  background: color-mix(in srgb, var(--surface) 92%, black);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.card-form {
  display: grid;
  gap: 0.65rem;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #10161d;
  color: var(--text);
  font: inherit;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button {
  margin-top: 0.35rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  margin-top: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

button:hover {
  filter: brightness(1.05);
}

.kv {
  margin: 0;
}

.kv > div {
  margin-bottom: 0.85rem;
}

.kv dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.kv dd {
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

code {
  font-family: var(--mono);
  font-size: 0.92rem;
  word-break: break-all;
  background: #10161d;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}

.flash {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash li {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.4rem;
}

.flash .ok {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent);
}

.flash .error {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent);
}

ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ghost-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ghost-link:hover {
  color: #ffffff;
}

.ghost-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.live-status {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.dest-toggles {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.dest-toggles fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
  padding: 0.75rem 1rem;
}

.dest-toggles legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.45rem 0;
  color: var(--text);
  cursor: pointer;
}

.toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.dest-toggles button {
  width: fit-content;
}

.hint {
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

table.history {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

table.history th,
table.history td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-weight: 400;
}

table.history thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.history tbody th[scope="row"] {
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: color-mix(in srgb, var(--ok) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 55%, transparent);
  color: #cdf3da;
}

.badge-bad {
  background: color-mix(in srgb, var(--danger) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  color: #f8d5cd;
}

details {
  margin-top: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.logbox {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  background: #10161d;
  border-radius: 6px;
  padding: 0.6rem;
  margin: 0.5rem 0 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 560px) {
  .shell {
    margin: 1.5rem auto;
  }

  .top {
    flex-direction: column;
  }

  table.history th,
  table.history td {
    padding: 0.45rem 0.35rem;
    font-size: 0.9rem;
  }
}
