:root {
  --primary: #4361ee;
  --primary-dark: #3651d4;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e5e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(67, 97, 238, 0.12);
  border: 1px solid var(--border);
}

.login-icon { font-size: 42px; margin-bottom: 10px; }

.login-card h1 { font-size: 20px; margin-bottom: 6px; }

.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.login-form { text-align: right; }

.field { margin-bottom: 16px; }

.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.field input:focus { border-color: var(--primary); }

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.error-box {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { font-size: 18px; font-weight: 700; }

.btn-logout {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background 0.15s;
}

.btn-logout:hover { background: #f3f4f6; }

.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-head h2 { font-size: 16px; }

.groups-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.groups-badge button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary);
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus { border-color: var(--primary); }

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.compose-actions .btn-primary { width: auto; padding: 12px 26px; }

.status-text { font-size: 13px; color: var(--muted); }

.status-text.ok { color: var(--success); }
.status-text.err { color: var(--danger); }

.history-list { display: flex; flex-direction: column; gap: 12px; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 30px 0;
  font-size: 14px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.history-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
  flex: 1;
}

.history-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.history-meta .stat-ok { color: var(--success); font-weight: 600; }
.history-meta .stat-err { color: var(--danger); font-weight: 600; }

.btn-resend {
  background: #eef2ff;
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-resend:hover { background: #e0e7ff; }
.btn-resend:disabled { opacity: 0.6; cursor: not-allowed; }

.send-log {
  border-top: 1px dashed var(--border);
  margin-top: 10px;
  padding-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 560px) {
  .topbar { padding: 14px 16px; }
  .card { padding: 16px; }
  .compose-actions { flex-direction: column; align-items: stretch; }
  .compose-actions .btn-primary { width: 100%; }
  .history-item-head { flex-direction: column; }
  .btn-resend { align-self: flex-start; }
}
