/* Kivo app styles — matches landing page design tokens */
:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: #1a1a25;
  --fg: #e8e8ed;
  --fg-muted: #8a8a9a;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.12);
  --accent-glow: rgba(74, 222, 128, 0.25);
  --red-muted: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --border: rgba(255, 255, 255, 0.06);
  --radius: 12px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

/* ─── Layout ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-logo a {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}

.sidebar-logo a span { color: var(--accent); }

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.nav-item:hover { color: var(--fg); background: var(--accent-dim); text-decoration: none; }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-dim); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-size: 1.6rem;
  font-family: var(--font-display);
}

.page-sub {
  color: var(--fg-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--accent); color: #0a0f0a; }
.btn-secondary { background: var(--bg-card); color: var(--fg); border: 1px solid var(--border); }
.btn-danger { background: rgba(248,113,113,0.15); color: var(--red-muted); border: 1px solid rgba(248,113,113,0.3); }
.btn-ghost { background: transparent; color: var(--fg-muted); border: 1px solid var(--border); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
}

.stat-value.green { color: var(--accent); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.blue { color: var(--blue); }
.stat-value.red { color: var(--red-muted); }

/* ─── Table ─── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 600;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: var(--font-display);
}

.badge-draft { background: rgba(138,138,154,0.15); color: var(--fg-muted); }
.badge-ready { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-sent { background: rgba(96,165,250,0.15); color: var(--blue); }
.badge-opened { background: rgba(74,222,128,0.15); color: var(--accent); }
.badge-replied { background: rgba(74,222,128,0.25); color: var(--accent); border: 1px solid var(--accent-glow); }

/* ─── Forms ─── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
}

.form-textarea { resize: vertical; min-height: 120px; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.modal-sub {
  color: var(--fg-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
}

.empty-icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--fg); margin-bottom: 8px; }
.empty-sub { font-size: 14px; max-width: 360px; margin: 0 auto 24px; }

/* ─── Loading ─── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,15,0.8);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 2000;
  gap: 16px;
  font-family: var(--font-display);
  color: var(--fg-muted);
  backdrop-filter: blur(4px);
}

.loading-overlay .spinner { width: 36px; height: 36px; border-width: 3px; }

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); color: var(--red-muted); }
.alert-success { background: var(--accent-dim); border: 1px solid var(--accent-glow); color: var(--accent); }

/* ─── Email Preview ─── */
.email-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--fg);
  max-height: 300px;
  overflow-y: auto;
}

/* ─── Prospect list ─── */
.prospect-row td:first-child { font-weight: 600; }
.prospect-actions { display: flex; gap: 8px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
