:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #162238;
  --line: #2b3a55;
  --ink: #edf2ff;
  --muted: #9aa8bd;
  --accent: #59e0d0;
  --warn: #9b5b19;
  --ok: #137a68;
  --danger: #b13b4d;
}
* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, sans-serif;
  margin: 0;
}
a { color: inherit; text-decoration: none; }
.topbar {
  align-items: stretch;
  background: #08101d;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  left: 0;
  padding: 24px 18px;
  position: fixed;
  top: 0;
  width: 260px;
}
.brand { color: var(--accent); font-weight: 900; }
nav { display: flex; flex: 1; flex-direction: column; gap: 8px; }
nav a {
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  padding: 9px 10px;
}
nav a:hover { color: var(--ink); }
.page { margin-left: 260px; max-width: 1480px; padding: 28px; }
.no-topbar-page {
  margin-left: auto;
  margin-right: auto;
}
.public-page {
  align-items: center;
  display: flex;
  justify-content: center;
  margin-left: 0;
  max-width: none;
  min-height: 100vh;
  padding: 32px 18px;
}
.auth-page {
  align-items: center;
}
.auth-page .narrow {
  margin: 0;
  width: min(520px, 100%);
}
.panel, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 24px;
  padding: 24px;
}
.narrow { max-width: 680px; }
.form-panel { max-width: 960px; }
.public-page .form-panel {
  margin: 0;
  width: min(960px, 100%);
}
.registration-heading {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lock-link {
  flex: 0 0 auto;
}
.subpanel {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}
h1, h2 { margin: 0 0 12px; }
.with-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 900; letter-spacing: .08em; margin: 0 0 8px; text-transform: uppercase; }
.lead { color: var(--muted); font-size: 20px; }
.muted { color: var(--muted); }
.field-hint {
  color: var(--muted);
  font-size: .92rem;
  margin: -8px 0 2px;
  min-height: 1.4em;
}
.field-hint.error {
  color: #ff9aa7;
}
.flash {
  background: #12372f;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--ink);
  padding: 12px 16px;
}
.stack, .grid-form { display: grid; gap: 16px; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { color: var(--ink); display: grid; font-weight: 800; gap: 8px; }
input, select, textarea {
  background: #0d1728;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
  width: 100%;
}
select {
  appearance: none;
  background-color: #0d1728;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 44px;
}
button, .secondary-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  justify-content: center;
  padding: 11px 16px;
}
button:hover,
button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  background: var(--panel-2);
  outline: 0;
}
button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06201d;
}
.primary:hover,
.primary:focus-visible {
  filter: brightness(.95);
}
.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
.small { padding: 7px 10px; }
.full { width: 100%; }
.button-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 20px 0;
}
.name-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}
.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  height: 38px;
  padding: 0;
  text-decoration: none;
  width: 38px;
}
.icon-button:hover,
.icon-button:focus-visible {
  background: var(--panel-2);
}
.danger-icon {
  border-color: color-mix(in srgb, var(--danger), var(--line));
  color: #ffb8c2;
}
.inline-action,
.actions-cell {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}
.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 24px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.metric span { color: var(--muted); display: block; font-size: 13px; font-weight: 800; }
.metric strong { display: block; font-size: 28px; margin-top: 6px; }
.table-wrap { overflow-x: auto; padding: 0; }
.tabs {
  display: grid;
  gap: 16px;
}
.tab-list {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tab-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  gap: 10px;
}
.tab-button span {
  align-items: center;
  background: var(--panel-2);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  min-width: 26px;
  padding: 2px 8px;
}
.tab-button.active {
  border-color: var(--accent);
  color: var(--ink);
}
.tab-button.active span {
  background: var(--accent);
  color: #06201d;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.table-toolbar {
  align-items: end;
  display: flex;
  justify-content: flex-start;
  margin: 0 0 12px;
}
.table-search {
  max-width: 420px;
  width: min(100%, 420px);
}
table { border-collapse: collapse; min-width: 920px; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 13px 16px; text-align: left; white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-size: 13px; text-transform: uppercase; }
.sortable-header {
  cursor: pointer;
  user-select: none;
}
.sortable-header::after {
  color: var(--accent);
  content: " ↕";
  font-size: 12px;
}
.sortable-header[aria-sort="ascending"]::after {
  content: " ↑";
}
.sortable-header[aria-sort="descending"]::after {
  content: " ↓";
}
.sortable-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.pill { border-radius: 999px; display: inline-flex; font-weight: 900; padding: 5px 10px; }
.pill.ok { background: var(--ok); color: #d9fff8; }
.pill.warn { background: var(--warn); color: #ffe7c2; }
.pill.pending { background: #c79a1f; color: #1f1600; }
.pill.danger { background: #8f1f31; color: #ffe1e7; }
.job-stats {
  margin-bottom: 16px;
}
.job-run-form {
  margin-top: 16px;
}
.job-run-form label {
  max-width: 140px;
}
.adobe-jobs-table table {
  min-width: 1180px;
}
.adobe-jobs-table th,
.adobe-jobs-table td {
  vertical-align: top;
}
.adobe-jobs-table .job-failed {
  background: rgb(143 31 49 / 8%);
}
.adobe-jobs-table .job-queued {
  background: rgb(199 154 31 / 6%);
}
.job-details-cell {
  min-width: 260px;
  white-space: normal;
}
.job-summary {
  display: grid;
  gap: 3px 10px;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 0 0 8px;
}
.job-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.job-summary dd {
  margin: 0;
}
.job-details {
  margin-top: 6px;
}
.job-details summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 800;
}
.job-details code {
  display: block;
  margin-top: 6px;
  max-height: 160px;
  overflow: auto;
}
.error-details summary {
  color: #ff9fb0;
}
.job-due {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 9px;
}
.job-due.ready {
  background: rgb(19 122 104 / 22%);
  color: #8ff5e6;
}
.job-due.waiting {
  background: rgb(199 154 31 / 22%);
  color: #ffe39b;
}
.inline-form { align-items: end; display: flex; gap: 12px; max-width: 760px; }
.inline-form input { flex: 1; }
.check-line {
  align-items: center;
  display: flex;
  flex-direction: row;
}
.check-line input {
  width: auto;
}
.empty { color: var(--muted); font-size: 18px; }
code { color: var(--accent); white-space: normal; }
.modal {
  background: transparent;
  border: 0;
  color: var(--ink);
  max-width: min(760px, calc(100vw - 32px));
  padding: 0;
  width: 100%;
}
.modal::backdrop {
  background: rgb(3 7 18 / 70%);
  backdrop-filter: blur(3px);
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 35%);
  display: grid;
  gap: 18px;
  padding: 24px;
}
.modal-head,
.modal-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.modal-actions {
  justify-content: flex-end;
}
.editor-preview {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, .9fr);
}
.email-editor,
.email-preview {
  margin-bottom: 0;
}
.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mail-frame {
  background: #f7f9fc;
  border-radius: 10px;
  color: #172033;
  overflow: hidden;
}
.mail-meta {
  border-bottom: 1px solid #dce4f0;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}
.mail-meta span {
  color: #66748a;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.mail-frame article {
  min-height: 280px;
  padding: 22px 16px;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    position: static;
    width: auto;
  }
  nav, .inline-form, .with-actions, .header-actions, .name-row { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .editor-preview { grid-template-columns: 1fr; }
  .page { margin-left: 0; padding: 16px; }
}
