@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&display=swap');

:root {
  --brand: #6e00d4;
  --accent: #6e00d4;
  --accent-teal: #6bdbcc;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --border: #dfdfdf;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
}

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

body {
  font-family: 'Onest', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 40px;
}

.site-header {
  width: 100%;
  max-width: 680px;
  padding: 24px 0 20px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-logo .logo-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent-teal);
  border-radius: 50%;
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.site-logo-puls {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  padding: 2px 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.container {
  width: 100%;
  max-width: 560px;
}

.container.center { text-align: center; padding-top: 80px; }

h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 6px; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--muted); }

.subtitle { color: var(--muted); margin-bottom: 32px; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 24px;
}

.field { margin-bottom: 20px; }
.field.row { display: flex; gap: 16px; }
.field.row > div { flex: 1; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: 'Onest', sans-serif;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { resize: vertical; }

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.label-row label { margin-bottom: 0; }
.edit-hint {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}

textarea {
  border: 2px solid var(--accent) !important;
  background: #faf6ff !important;
  font-size: 1rem;
  line-height: 1.5;
}

button, .btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Onest', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s;
}
button, .btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  text-align: center;
}
button:hover, .btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  background: #ebebeb;
  color: var(--text);
}
.btn-secondary:hover { opacity: 0.8; }

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.button-row .btn-secondary { flex: 0 0 auto; }
.button-row button { flex: 1; }

.activity-list { list-style: none; padding: 0; }
.activity-list li {
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.activity-list li:last-child { border-bottom: none; }

.status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  background: #e8e8e8;
  color: var(--muted);
  white-space: nowrap;
}
.status.complete, .status.done { background: #d5f5f1; color: #0a6b5e; }
.status.in\ progress { background: #ede0ff; color: #5400a0; }
.status.review { background: #fef3c7; color: #92400e; }

.error-icon {
  width: 64px; height: 64px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-icon {
  width: 64px; height: 64px;
  background: #d5f5f1;
  color: #0a6b5e;
  border-radius: 50%;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.sms-preview {
  font-style: italic;
  color: var(--muted);
  margin: 16px 0;
}

/* Batch approval */
.batch-container { max-width: 680px; }

.batch-summary {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  margin-bottom: 24px;
}

.batch-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }

.batch-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  padding: 20px;
  transition: border-color 0.2s;
}
.batch-card.approved { border-color: var(--accent-teal); }
.batch-card.sent { opacity: 0.7; }

.batch-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.batch-customer-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.recipient-info { font-size: 0.85rem; color: var(--muted); }

.approval-badge {
  background: #d5f5f1;
  color: #0a6b5e;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.batch-char-info {
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 12px;
}

.batch-card-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-sm { padding: 8px 18px; font-size: 0.9rem; width: auto; }

.batch-result {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius);
}
.result-success { background: #d5f5f1; color: #0a6b5e; }
.result-error { background: #fee2e2; color: #991b1b; }

.recipient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.recipient-display { font-size: 0.85rem; color: var(--muted); }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Onest', sans-serif;
  cursor: pointer;
  padding: 0;
  width: auto;
  text-decoration: underline;
}
.btn-link:hover { opacity: 0.75; }

.recipient-editor {
  background: #faf6ff;
  border: 1.5px solid #e0ccff;
  border-radius: var(--radius);
  padding: 12px;
  margin: 10px 0;
}
.recipient-editor-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.recipient-editor-fields input {
  flex: 1;
  min-width: 120px;
  font-size: 0.9rem;
  padding: 8px 10px;
}
.recipient-editor-hint {
  font-size: 0.78rem;
  color: #d97706;
  margin-top: 6px;
  margin-bottom: 0;
}

.batch-error-card {
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: #92400e;
  margin-bottom: 12px;
}

.batch-footer {
  display: flex;
  gap: 12px;
  padding: 20px 0;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.batch-footer .btn-secondary { flex: 0 0 auto; }
.batch-footer .btn-primary { flex: 1; }

.send-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.send-overlay-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px 48px;
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.error-box {
  background: #fee2e2;
  color: #991b1b;
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Loading overlay */
#loadingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
#loadingOverlay.active { display: flex; }

.loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  min-width: 220px;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.loading-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; background: var(--accent-teal); }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}

.loading-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.nav-logout {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-logout:hover { color: var(--accent); }
