:root {
  --bg: #F7F7F5;
  --white: #FFFFFF;
  --black: #0A0A0A;
  --gray-1: #F0EFED;
  --gray-2: #E5E4E1;
  --gray-3: #C8C7C4;
  --gray-4: #8A8986;
  --green: #22C55E;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--black);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
.login-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.login-card {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 12px;
  width: 420px;
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.login-logo {
  width: 48px;
  height: 48px;
  background: var(--black);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 4px;
}

.login-title {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--black);
}

.login-sub {
  font-size: 12px;
  color: var(--gray-4);
  margin-bottom: 20px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--black);
}

.form-group input {
  border: 1.5px solid var(--gray-2);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus { border-color: var(--black); }
.form-group input::placeholder { color: var(--gray-3); }

.login-error {
  font-size: 13px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 12px;
}

.btn-login {
  width: 100%;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.btn-login:hover { opacity: 0.85; }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; }

.login-footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-4);
}

/* ── DASHBOARD LAYOUT ── */
.dashboard-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--white);
  border-right: 1.5px solid var(--gray-2);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1.5px solid var(--gray-2);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--black);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--white);
  font-weight: 500;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-4);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  user-select: none;
}

.nav-item:hover { color: var(--black); background: var(--gray-1); }
.nav-item.active { color: var(--black); border-left-color: var(--black); background: var(--gray-1); }

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

.sidebar-user {
  padding: 16px 20px;
  border-top: 1.5px solid var(--gray-2);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--gray-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--black);
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; truncate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-company { font-size: 11px; color: var(--gray-4); }

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── MAIN AREA ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── TOP BAR ── */
.topbar {
  height: 56px;
  min-height: 56px;
  background: var(--white);
  border-bottom: 1.5px solid var(--gray-2);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--black);
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-4);
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: 4px;
  padding: 2px 7px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-4);
}

.topbar-updated {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-4);
}

.btn-run {
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-run:hover { opacity: 0.8; }

.btn-logout {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--gray-4);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-logout:hover { color: var(--black); }

/* ── CONTENT AREA ── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  padding: 16px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-4);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--black);
  line-height: 1;
}

.stat-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-4);
  margin-top: 4px;
}

/* ── SKELETON ── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-1) 25%, var(--gray-2) 50%, var(--gray-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-value { height: 32px; width: 60px; margin-bottom: 6px; }
.skeleton-label { height: 10px; width: 80%; }

/* ── TWO-COL GRID ── */
.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-bottom: 24px; }
.two-col-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

/* ── PANEL CARD ── */
.panel {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 16px 12px;
  border-bottom: 1.5px solid var(--gray-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
}

.panel-body { padding: 16px; }

/* ── TABLE ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-4);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1.5px solid var(--gray-2);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-1);
  color: var(--black);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-1); }

.data-table .mono { font-family: var(--font-mono); font-size: 12px; }
.data-table .muted { color: var(--gray-4); font-size: 12px; }

/* ── PILL BADGES ── */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-done { background: var(--black); color: var(--white); }
.pill-running { background: #374151; color: var(--white); }
.pill-scheduled { border: 1.5px solid var(--gray-2); color: var(--gray-4); }
.pill-active { background: #dcfce7; color: #166534; }
.pill-product { background: var(--gray-1); color: var(--black); border: 1px solid var(--gray-2); }

/* ── SCORE BOX ── */
.score-box {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.score-5 { background: var(--black); color: var(--white); }
.score-4 { border: 1.5px solid var(--black); color: var(--black); }
.score-3 { border: 1.5px solid var(--gray-3); color: var(--gray-4); }
.score-2 { border: 1.5px solid var(--gray-2); color: var(--gray-3); }
.score-1 { border: 1.5px solid var(--gray-2); color: var(--gray-3); }

/* ── PIPELINE SIDEBAR ── */
.pipeline-section { display: flex; flex-direction: column; gap: 16px; }

.progress-item { display: flex; flex-direction: column; gap: 6px; }

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label { font-size: 12.5px; font-weight: 500; }
.progress-val { font-family: var(--font-mono); font-size: 12px; color: var(--gray-4); }

.progress-bar {
  height: 6px;
  background: var(--gray-1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--black);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.pipeline-products {
  margin-top: 8px;
  border-top: 1.5px solid var(--gray-2);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.pipeline-product-name { color: var(--black); }
.pipeline-product-count { font-family: var(--font-mono); font-size: 12px; color: var(--gray-4); }

/* ── ACTIVITY FEED ── */
.activity-list { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-1);
  align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 28px;
  height: 28px;
  background: var(--gray-1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-body { flex: 1; min-width: 0; }
.activity-action { font-size: 13px; font-weight: 600; }
.activity-meta { font-size: 12px; color: var(--gray-4); margin-top: 1px; }

/* ── SCHEDULE ── */
.schedule-list { display: flex; flex-direction: column; gap: 0; }

.schedule-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-1);
  align-items: flex-start;
}

.schedule-item:last-child { border-bottom: none; }

.schedule-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-4);
  width: 52px;
  flex-shrink: 0;
  padding-top: 1px;
}

.schedule-body { flex: 1; min-width: 0; }
.schedule-task { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.schedule-detail { font-size: 12px; color: var(--gray-4); }

/* ── LEAD TRACKER ── */
.lead-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.lead-search {
  flex: 1;
  min-width: 200px;
  border: 1.5px solid var(--gray-2);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13.5px;
  background: var(--white);
  color: var(--black);
  outline: none;
  transition: border-color 0.15s;
}

.lead-search:focus { border-color: var(--black); }
.lead-search::placeholder { color: var(--gray-3); }

.filter-btns { display: flex; gap: 6px; }

.filter-btn {
  border: 1.5px solid var(--gray-2);
  background: var(--white);
  border-radius: 5px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-4);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--black); color: var(--black); }
.filter-btn.active { background: var(--black); color: var(--white); border-color: var(--black); }

/* ── CONTEXT & ICP ── */
.context-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  height: calc(100vh - 56px - 48px);
  min-height: 400px;
}

.context-nav {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  overflow: hidden;
  height: fit-content;
}

.context-nav-section {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-4);
  padding: 12px 14px 6px;
}

.context-nav-item {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-4);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  user-select: none;
}

.context-nav-item:hover { color: var(--black); background: var(--gray-1); }
.context-nav-item.active { color: var(--black); border-left-color: var(--black); background: var(--gray-1); }

.context-content {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  padding: 24px 28px;
  overflow-y: auto;
}

.context-rendered h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.context-rendered .context-mono-meta { font-family: var(--font-mono); font-size: 11px; color: var(--gray-4); margin-bottom: 20px; }
.context-rendered h2 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-4);
  margin-top: 20px;
  margin-bottom: 8px;
}
.context-rendered p { font-size: 13.5px; color: var(--black); line-height: 1.65; margin-bottom: 8px; }
.context-rendered .bullet {
  font-size: 13.5px;
  color: var(--black);
  line-height: 1.65;
  padding-left: 4px;
  margin-bottom: 5px;
}
.context-rendered .bullet span { color: var(--gray-4); margin-right: 6px; }

/* ── SEQUENCES ── */
.seq-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.btn-seq-refresh {
  background: none;
  border: 1.5px solid var(--gray-2);
  border-radius: 5px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-4);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-seq-refresh:hover { border-color: var(--black); color: var(--black); }

.seq-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.seq-summary-card {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.seq-summary-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-4);
}

.seq-summary-count {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--black);
  line-height: 1;
}

.seq-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.seq-col {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  overflow: hidden;
  min-height: 160px;
}

.seq-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1.5px solid var(--gray-2);
  background: var(--gray-1);
}

.seq-col-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--black);
}

.seq-col-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--white);
  background: var(--black);
  border-radius: 4px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
}

.seq-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seq-card {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 6px;
  padding: 12px 13px;
  transition: border-color 0.15s;
}

.seq-card:hover { border-color: var(--black); }

.seq-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seq-card-company {
  font-size: 12px;
  color: var(--gray-4);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seq-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.seq-card-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-4);
}

/* ── PLACEHOLDER ── */
.placeholder-card {
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: 8px;
  padding: 60px 40px;
  text-align: center;
  max-width: 480px;
  margin: 60px auto 0;
}

.placeholder-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-4);
  margin-bottom: 12px;
}

.placeholder-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.placeholder-desc { font-size: 13.5px; color: var(--gray-4); line-height: 1.6; }

/* ── EMPTY STATE ── */
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--gray-4);
  font-size: 13px;
}

/* ── NOTION BADGE ── */
.notion-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-4);
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: 4px;
  padding: 3px 8px;
}

.notion-badge.connected { color: #166534; background: #dcfce7; border-color: #bbf7d0; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col-even { grid-template-columns: 1fr; }
  .context-layout { grid-template-columns: 1fr; height: auto; }
}
