* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
  line-height: 1.5;
}
a { color: #4CDA64; }

/* ---- Логотип ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  background: #4CDA64; color: #fff; font-weight: 700; font-size: 18px;
  width: 36px; height: 36px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 18px; font-weight: 700; color: #4CDA64; }
.brand-name span { color: #333; }

/* ---- Логін ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08);
  width: 100%; max-width: 380px; padding: 36px;
}
.login-card .brand { justify-content: center; margin-bottom: 8px; }
.login-card h1 { font-size: 18px; text-align: center; margin-bottom: 4px; }
.login-card .muted { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }

/* ---- Хедер дашборду ---- */
.topbar {
  background: #fff; border-bottom: 1px solid #e8e8e8;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; position: sticky; top: 0; z-index: 10;
}
.topbar .right { display: flex; align-items: center; gap: 16px; }
.btn-ghost {
  background: none; border: 1px solid #ddd; color: #555; padding: 7px 14px;
  border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #f5f5f5; }

.container { max-width: 920px; margin: 0 auto; padding: 28px; }

/* ---- Вкладки ---- */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid #eee; }
.tab {
  background: none; border: none; padding: 12px 20px; font-size: 15px; font-weight: 600;
  color: #888; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab.active { color: #4CDA64; border-bottom-color: #4CDA64; }

/* ---- Картки ---- */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 28px; }

/* ---- Форми ---- */
label { display: block; font-size: 14px; font-weight: 600; color: #333; margin: 16px 0 6px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid #dcdcdc; border-radius: 7px;
  font-size: 14px; color: #222; outline: none; font-family: inherit; transition: border .15s;
}
input:focus, textarea:focus, select:focus { border-color: #4CDA64; }
textarea { resize: vertical; min-height: 120px; }
.btn-primary {
  width: 100%; margin-top: 22px; padding: 13px; background: #4CDA64; color: #fff;
  border: none; border-radius: 7px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #2bb14e; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.result { margin-top: 16px; padding: 12px 16px; border-radius: 7px; font-size: 14px; display: none; }
.result.ok { background: #e7f6ec; color: #1b7a3d; display: block; }
.result.err { background: #fdecea; color: #c0392b; display: block; }

/* ---- Статистика ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat .num { font-size: 26px; font-weight: 700; color: #1a1a1a; }
.stat .lbl { font-size: 13px; color: #999; margin-top: 2px; }

/* ---- Таблиця історії ---- */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #999; padding: 13px 16px; border-bottom: 1px solid #eee; }
.table td { padding: 13px 16px; border-bottom: 1px solid #f3f3f3; font-size: 14px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background: #fafafa; cursor: pointer; }
.empty { text-align: center; color: #aaa; padding: 50px; }

/* ---- Бейджі статусів ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.sent { background: #eef2ff; color: #4f5bd5; }
.badge.delivered { background: #e7f6ec; color: #1b7a3d; }
.badge.opened { background: #e6f4fb; color: #1c7ca8; }
.badge.clicked { background: #e6f4fb; color: #1c7ca8; }
.badge.bounced { background: #fdecea; color: #c0392b; }
.badge.complained { background: #fdecea; color: #c0392b; }
.badge.delayed { background: #fff4e0; color: #b8860b; }

/* ---- Модалка ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 12px; max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 28px; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #f3f3f3; font-size: 14px; }
.modal .row .k { color: #999; }
.modal .row .v { color: #222; font-weight: 500; text-align: right; max-width: 60%; }
.modal .close { float: right; background: none; border: none; font-size: 22px; color: #aaa; cursor: pointer; }
.modal .vtext { background: #fafafa; border-radius: 7px; padding: 12px; margin-top: 6px; font-size: 14px; white-space: pre-line; }

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
