:root {
  --bg: #0b0e14;
  --surface: #121722;
  --surface-2: #192030;
  --border: #263044;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --emerald: #10b981;
  --indigo: #6366f1;
  --pink: #ec4899;
  --danger: #ef4444;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #0b0e14;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-title { font-weight: 700; font-size: 14px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.target-card-mini {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.row-between { display: flex; justify-content: space-between; align-items: center; }
.mini-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mini-pct { font-size: 12px; font-weight: 700; color: var(--primary); }
.mini-amount { font-size: 14px; font-weight: 700; margin: 6px 0 8px; }

.progress-track {
  height: 7px;
  background: #0b0e14;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--primary);
  font-weight: 600;
}

.badge {
  margin-left: auto;
  background: var(--primary);
  color: #0b0e14;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sync-pill {
  font-size: 12px;
  color: var(--emerald);
  font-weight: 500;
}

.backup-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.main-area {
  padding: 24px 28px 48px;
  max-width: 1440px;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.topbar h1 { margin: 0; font-size: 24px; font-weight: 800; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tab-panel { display: none; flex-direction: column; gap: 18px; }
.tab-panel.active { display: flex; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.kpi-card.highlight {
  background: linear-gradient(145deg, rgba(245,158,11,0.14), rgba(18,23,34,1));
  border-color: rgba(245,158,11,0.4);
}

.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 800; margin: 6px 0 4px; }
.kpi-meta { font-size: 12px; color: var(--muted); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--primary); }
.text-danger { color: var(--danger); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.two-col-tight { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.three-col-tight { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.muted { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }

/* Buttons */
button, .btn-outline {
  font-family: inherit;
  cursor: pointer;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: #0b0e14;
  border: none;
  padding: 9px 15px;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 14px;
}
.btn-secondary:hover { border-color: var(--primary); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 8px 13px;
}

.btn-wa {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 5px 10px;
  font-size: 12px;
}
.btn-wa:hover { background: rgba(16, 185, 129, 0.28); }

.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; }
.full-width { width: 100%; }

/* Pillars */
.pillars-list { display: flex; flex-direction: column; gap: 14px; }
.pillar-item { background: var(--surface-2); padding: 12px; border-radius: 10px; border: 1px solid var(--border); }
.pillar-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pillar-nums { color: var(--muted); font-weight: 500; }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.check-item input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--emerald); cursor: pointer; }
.check-item.done .check-text { text-decoration: line-through; color: var(--muted); }
.check-impact { font-size: 11px; color: var(--primary); margin-top: 2px; }

/* Queue */
.queue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.queue-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
}
.pill.justdial { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.pill.paid { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.pill.pending { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }

/* Leads Pipeline */
.alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: rgba(245, 158, 11, 0.09);
  border-color: rgba(245, 158, 11, 0.35);
  font-size: 13px;
}

.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.filters-bar input { flex: 1; min-width: 200px; }

.view-toggle { display: flex; gap: 4px; background: var(--surface); padding: 3px; border-radius: 9px; border: 1px solid var(--border); }
.view-toggle button { background: transparent; color: var(--muted); border: none; }
.view-toggle button.active { background: var(--surface-2); color: var(--text); }

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(230px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.stage-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.lead-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.lead-card:hover { border-color: rgba(245,158,11,0.5); }
.lead-title { font-weight: 700; font-size: 13.5px; }
.lead-sub { font-size: 12px; color: var(--muted); }
.lead-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Retainers & Packages */
.retainers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.retainer-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.retainer-tip {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: #c7d2fe;
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pkg-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.pkg-card.featured { border-color: var(--primary); background: rgba(245,158,11,0.06); }
.pkg-tag { font-size: 11px; color: var(--primary); font-weight: 700; text-transform: uppercase; }
.pkg-card h3 { margin: 6px 0; font-size: 16px; }
.pkg-price { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.pkg-price span { font-size: 12px; color: var(--muted); font-weight: 500; }
.pkg-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 5px; }

/* Team & Prompts */
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.team-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.sop-list { display: flex; flex-direction: column; gap: 12px; }
.sop-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 13px; }
.sop-item h4 { margin: 0 0 8px; font-size: 14px; color: var(--primary); }
.sop-item ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.sop-item strong { color: var(--text); }

.prompts-list { display: flex; flex-direction: column; gap: 10px; }
.prompt-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.prompt-text { font-size: 12px; color: #cbd5e1; background: #0b0e14; padding: 9px; border-radius: 8px; margin: 8px 0 0; white-space: pre-wrap; font-family: inherit; }

/* Forms & Modals */
.form-stack { display: flex; flex-direction: column; gap: 11px; }
.form-stack label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.total-bar { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 15px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  padding: 20px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal.modal-lg { max-width: 680px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-size: 17px; }
.close-btn { background: transparent; border: none; color: var(--muted); font-size: 18px; }
.modal-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.spacer { flex: 1; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--emerald);
  color: #06281e;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.hidden { display: none !important; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .kpi-grid, .two-col, .packages-grid, .team-grid { grid-template-columns: 1fr; }
}
