:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #657385;
  --line: #d8dee8;
  --accent: #1d6fb8;
  --accent-dark: #12548e;
  --danger: #b42318;
  --success: #157347;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

a {
  color: var(--accent);
}

.topbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 1;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

nav a.active,
nav a:hover {
  color: var(--text);
}

.logout {
  margin: 0;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto;
}

h1 {
  font-size: 28px;
  margin: 0 0 20px;
}

h2 {
  font-size: 18px;
  margin: 0;
}

.panel,
.email-preview,
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.auth-panel {
  width: min(440px, 100%);
  margin: 80px auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.metric-grid strong {
  display: block;
  font-size: 30px;
}

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

.section-head,
.inline-form {
  display: flex;
  gap: 14px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

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

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

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

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

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #8f1d14;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.table-note {
  color: var(--muted);
  font-size: 12px;
}

.secondary {
  background: #e8eef5;
  color: var(--text);
}

.secondary:hover {
  background: #dbe5ef;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
  background: #f8fafc;
}

.actions {
  margin-top: 16px;
}

.alert {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid;
}

.error {
  color: var(--danger);
  background: #fff1f0;
  border-color: #f4c7c3;
}

.success {
  color: var(--success);
  background: #eef8f1;
  border-color: #b9e3c7;
}

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

.email-preview h2 span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
  font-size: 12px;
}

.status.sent {
  background: #e8f6ed;
  color: var(--success);
}

.status.failed {
  background: #fff1f0;
  color: var(--danger);
}

.status.skipped {
  background: #eef2f7;
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

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