:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --sent: #3b82f6;
  --delivered: #14b8a6;
  --soft: #8b5cf6;
  --hard: #f97316;
  --failed: #ef4444;
  --opens: #60a5fa;
  --clicks: #86efac;
  --ok: #16a34a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar nav { display: flex; gap: 16px; align-items: center; }

.page { padding: 20px 24px 40px; max-width: 1280px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
}

.metrics { list-style: none; margin: 0; padding: 0; }
.metrics li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.metrics li:last-child { border-bottom: 0; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 8px;
}
.pct { color: var(--hard); font-weight: 600; margin-left: 6px; }

.bounce-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: center;
}
@media (max-width: 700px) {
  .bounce-grid { grid-template-columns: 1fr; }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
select, input[type="text"], input[type="date"], input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
button, .btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
}

table.logs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.logs th, table.logs td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.logs tbody tr { cursor: pointer; }
table.logs tbody tr:hover { background: #f8fafc; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.status.delivered { color: var(--ok); }
.status.softbounce { color: var(--soft); }
.status.hardbounce { color: var(--hard); }
.status.process_failed { color: var(--failed); }
.status.submitted { color: var(--muted); }
.status-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: currentColor;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  display: grid;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; }
.login-card button {
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 10px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
}
.meta-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.meta-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.meta-list strong { display: block; color: var(--muted); font-weight: 500; margin-bottom: 4px; }

.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tabs a {
  padding: 10px 0;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.preview-frame {
  width: 100%;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.actions-row {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin: 8px 0 16px;
}
.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { width: 100%; height: 260px; display: block; }
.donut-wrap { width: 180px; height: 180px; margin: 0 auto; position: relative; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}
.donut-center strong { font-size: 22px; display: block; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
