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

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

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-h: #1d4ed8;
  --danger: #ef4444;
  --danger-h: #dc2626;
  --tier-a: #16a34a;
  --tier-b: #d97706;
  --tier-c: #94a3b8;
  --s-new: #6b7280;
  --s-reached: #3b82f6;
  --s-responded: #8b5cf6;
  --s-met: #f59e0b;
  --s-converted: #10b981;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #0f172a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand { display: flex; align-items: baseline; gap: 10px; }
.header-brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.header-subtitle { font-size: 12px; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Main ── */
main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-h); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-toggle { background: rgba(255,255,255,.12); color: #fff; }
.btn-toggle.active { background: var(--primary); }
.btn-toggle:hover:not(.active) { background: rgba(255,255,255,.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
  min-width: 90px;
}
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.tier-a { color: var(--tier-a); }
.tier-b { color: var(--tier-b); }
.tier-c { color: var(--tier-c); }
.overdue { color: var(--danger); }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: #0f172a;
  padding: 10px 16px;
  border-radius: var(--radius);
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }

.select, .input {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: rgba(255,255,255,.08);
  color: #fff;
  outline: none;
  transition: border-color .15s;
}
.select option { background: #1e293b; color: #fff; }
.select:focus, .input:focus { border-color: var(--primary); }
.input::placeholder { color: #64748b; }
.input { min-width: 180px; }

.view-toggle { display: flex; gap: 4px; }

/* ── Table ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #f8fafc;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; cursor: pointer; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
td { padding: 11px 14px; vertical-align: middle; }
.td-name { font-weight: 600; color: var(--text); }
.td-sub { font-size: 12px; color: var(--muted); }
.td-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-tier-A { background: #dcfce7; color: var(--tier-a); }
.badge-tier-B { background: #fef3c7; color: var(--tier-b); }
.badge-tier-C { background: #f1f5f9; color: var(--tier-c); }
.badge-new { background: #f1f5f9; color: var(--s-new); }
.badge-reached_out { background: #dbeafe; color: var(--s-reached); }
.badge-responded { background: #ede9fe; color: var(--s-responded); }
.badge-met { background: #fef3c7; color: var(--s-met); }
.badge-converted { background: #d1fae5; color: var(--s-converted); }

/* ── Kanban ── */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: start;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kanban-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.kanban-card-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.kanban-card-sub { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.due-date { font-size: 11px; color: var(--muted); }
.due-date.overdue { color: var(--danger); font-weight: 600; }

/* ── Empty State ── */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty p { font-size: 15px; font-weight: 500; }
.empty small { font-size: 13px; }

/* ── Login Page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}
.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; min-height: 20px; }

/* ── Form Styles (shared) ── */
.form-page { max-width: 760px; margin: 0 auto; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 16px;
}
.form-card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span2 { grid-column: span 2; }
label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.form-input, .form-select, .form-textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions-right { margin-left: auto; }
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  user-select: none;
}
.radio-option input { display: none; }
.radio-option.tier-A:has(input:checked) { border-color: var(--tier-a); background: #dcfce7; color: var(--tier-a); }
.radio-option.tier-B:has(input:checked) { border-color: var(--tier-b); background: #fef3c7; color: var(--tier-b); }
.radio-option.tier-C:has(input:checked) { border-color: var(--tier-c); background: #f1f5f9; color: var(--tier-c); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--tier-a); }
.toast.error { background: var(--danger); }

/* ── Utility ── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }

@media (max-width: 900px) {
  .kanban { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  main { padding: 16px; }
  .kanban { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .stats-bar { gap: 8px; }
}
