/* BrandLift Growth Automation — Admin UI
   Design system: #0B1512 bg, #132620 surface, #00E59B mint, Figtree font. */

:root {
  --bg: #0B1512;
  --surface: #132620;
  --surface-hover: #1a2f29;
  --border: #1f362f;
  --mint: #00E59B;
  --mint-dim: #00B37B;
  --text: #e6e8e7;
  --muted: #8a9a96;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #16a34a;
  --info: #3b82f6;
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Figtree", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
}

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

code, pre { font-family: "SF Mono", "Monaco", "Menlo", monospace; font-size: 0.92em; }

a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; color: var(--text); }
h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

/* ── Layout ── */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 56px;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-right: 1rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  overflow-x: auto;
}

.tab {
  padding: 0.5rem 0.85rem;
  color: var(--muted);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.tab:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.tab.active { color: var(--mint); background: var(--surface-hover); }

.topbar-right { display: flex; gap: 0.75rem; align-items: center; }

.bell {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  position: relative;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}
.bell:hover { background: var(--surface-hover); }

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
}

.bell-dropdown {
  position: absolute;
  top: 100%;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 380px;
  max-width: calc(100vw - 2rem);
  max-height: 500px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 20;
}

.notif-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-hover); }
.notif-item.unread { background: rgba(0, 229, 155, 0.04); }
.notif-item-title { font-weight: 600; color: var(--text); font-size: 0.9rem; margin-bottom: 0.15rem; }
.notif-item-body { color: var(--muted); font-size: 0.85rem; }
.notif-item-time { color: var(--muted); font-size: 0.75rem; margin-top: 0.25rem; }
.notif-empty { padding: 2rem; text-align: center; color: var(--muted); }
.notif-actions { padding: 0.5rem; text-align: right; border-bottom: 1px solid var(--border); }

.logout {
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 1.1rem;
}
.logout:hover { background: var(--surface-hover); text-decoration: none; }

.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-header h1, .card-header h2 { margin: 0; }

/* ── KPI grid ── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.kpi-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
.kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.kpi-alert { border-color: var(--warning); }
.kpi-alert .kpi-value { color: var(--warning); }
.kpi-action { border-color: var(--mint); }
.kpi-action .kpi-value { color: var(--mint); }

/* ── Lists ── */

.list { display: flex; flex-direction: column; gap: 0.5rem; }

.list-item {
  display: flex;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
}
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; margin-bottom: 0.25rem; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.list-item-subtitle { font-weight: 500; color: var(--muted); font-size: 0.88rem; margin-bottom: 0.2rem; }
.list-item-body { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }
.list-item-meta { margin-top: 0.35rem; color: var(--muted); font-size: 0.8rem; }
.list-item-action { flex-shrink: 0; }

/* ── Badges ── */

.badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
  background: var(--surface-hover);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-zakeke { background: #3b0764; color: #e9d5ff; border-color: #6b21a8; }
.badge-customily { background: #14532d; color: #bbf7d0; border-color: #15803d; }
.badge-teeinblue { background: #172554; color: #bfdbfe; border-color: #1e40af; }
.badge-ordermygear { background: #431407; color: #fed7aa; border-color: #9a3412; }
.badge-score { background: rgba(0, 229, 155, 0.1); color: var(--mint); border-color: rgba(0, 229, 155, 0.2); }
.badge-category { background: #1e293b; color: #cbd5e1; border-color: #334155; }
.badge-status-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.badge-status-approved { background: rgba(0, 229, 155, 0.1); color: var(--mint); }
.badge-status-queued { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-status-sent { background: rgba(0, 229, 155, 0.1); color: var(--mint); }
.badge-status-rejected { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
.badge-status-bounced, .badge-status-bounced_out { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-status-paused_reply { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-status-active { background: rgba(0, 229, 155, 0.08); color: var(--mint); }
.badge-interested { background: rgba(22, 163, 74, 0.15); color: #86efac; border-color: rgba(22, 163, 74, 0.3); }
.badge-not_interested { background: rgba(107, 114, 128, 0.15); color: #d1d5db; }
.badge-ooo { background: rgba(59, 130, 246, 0.1); color: #93c5fd; }
.badge-bounce { background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.badge-human_fwd { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.badge-other { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.btn-primary { background: var(--mint); color: var(--bg); }
.btn-primary:hover { background: var(--mint-dim); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); text-decoration: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */

input[type="text"], input[type="password"], textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
input:focus, textarea:focus { outline: none; border-color: var(--mint); }
textarea { resize: vertical; min-height: 200px; line-height: 1.5; }
label { display: block; font-weight: 600; margin-bottom: 0.35rem; margin-top: 0.5rem; font-size: 0.88rem; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

.filters { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-chip {
  padding: 0.35rem 0.75rem;
  background: var(--surface-hover);
  color: var(--muted);
  border-radius: 16px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
}
.filter-chip:hover { text-decoration: none; background: var(--border); }
.filter-chip.active { background: var(--mint); color: var(--bg); border-color: var(--mint); }

/* ── Details pages ── */

.back-link { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; display: inline-block; }

.review-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.review-box .stars { font-size: 1rem; margin-bottom: 0.5rem; }
.review-box p { color: var(--text); margin-bottom: 0.75rem; line-height: 1.6; }
.review-box .meta { color: var(--muted); font-size: 0.82rem; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.message-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.reply-box { border-left: 3px solid var(--mint); }
.message-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.message-subject { font-weight: 600; margin-bottom: 0.5rem; }
.message-body {
  background: transparent;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

/* ── Data tables ── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover { background: var(--surface-hover); }

/* ── Account progress ── */

.account-row { display: flex; align-items: center; gap: 1rem; padding: 0.4rem 0; }
.account-id { flex-shrink: 0; font-weight: 600; min-width: 100px; font-size: 0.88rem; }
.progress-bar { flex: 1; background: var(--border); border-radius: 8px; overflow: hidden; height: 6px; }
.progress-fill { background: var(--mint); height: 100%; transition: width 0.3s; }
.account-count { flex-shrink: 0; color: var(--muted); font-size: 0.85rem; min-width: 60px; text-align: right; }

/* ── Login ── */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 360px;
}
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }
.login-card input { margin-bottom: 1rem; }
.login-card button { width: 100%; padding: 0.7rem; background: var(--mint); color: var(--bg); border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.login-card .error { background: rgba(239, 68, 68, 0.1); color: var(--danger); padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.88rem; }

/* ── Utility ── */

.muted { color: var(--muted); font-size: 0.88rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Mobile ── */

@media (max-width: 640px) {
  .tabs { font-size: 0.85rem; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .list-item { flex-direction: column; align-items: stretch; }
  .list-item-action { width: 100%; }
  .list-item-action .btn { width: 100%; justify-content: center; }
  .content { padding: 1rem 0.75rem 3rem; }
  .card { padding: 1rem; }
  .bell-dropdown { width: calc(100vw - 2rem); right: 0.5rem; }
}
