/* App layout — sidebar + main content area */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  padding: 0 12px;
  margin-bottom: 32px;
  display: block;
}

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

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--fg);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 16px;
  margin-top: 16px;
}

.back-link { font-size: 0.85rem; }

/* MAIN CONTENT */
.app-main {
  flex: 1;
  margin-left: 240px;
  padding: 40px 48px;
  min-height: 100vh;
}

/* PAGE HEADER */
.page-header {
  margin-bottom: 36px;
}

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-box .stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-bar.green { background: var(--green); }
.stat-bar.orange { background: var(--accent); }
.stat-bar.blue { background: #60a5fa; }
.stat-bar.yellow { background: var(--accent-secondary); }

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 24px;
}

.card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

/* DASHBOARD GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* PIPELINE */
.pipeline-stage {
  margin-bottom: 16px;
}

.pipeline-stage:last-child { margin-bottom: 0; }

.stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stage-dot.new { background: #60a5fa; }
.stage-dot.contacted { background: var(--accent); }
.stage-dot.proposal { background: var(--accent-secondary); }
.stage-dot.negotiating { background: #c084fc; }
.stage-dot.won { background: var(--green); }

.stage-count {
  margin-left: auto;
  font-weight: 600;
  color: var(--fg-muted);
}

.stage-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}

.stage-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.stage-bar.new { background: #60a5fa; }
.stage-bar.contacted { background: var(--accent); }
.stage-bar.proposal { background: var(--accent-secondary); }
.stage-bar.negotiating { background: #c084fc; }
.stage-bar.won { background: var(--green); }

/* RECENT LEADS LIST */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
}

.recent-item-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.recent-item-info span {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* STATUS BADGES */
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.new { background: rgba(96,165,250,0.15); color: #60a5fa; }
.status-badge.contacted { background: var(--accent-glow); color: var(--accent); }
.status-badge.proposal_sent { background: rgba(255,210,63,0.15); color: var(--accent-secondary); }
.status-badge.negotiating { background: rgba(192,132,252,0.15); color: #c084fc; }
.status-badge.won { background: rgba(74,222,128,0.15); color: var(--green); }
.status-badge.lost { background: rgba(255,255,255,0.06); color: var(--fg-muted); }

/* QUICK ACTIONS */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.action-icon { font-size: 1.5rem; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.empty-state a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #e55a2b;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.1);
}

/* INPUTS */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--fg);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.input:focus {
  border-color: var(--accent);
}

.input::placeholder { color: rgba(255,255,255,0.2); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.input { resize: vertical; }

.field-row {
  margin-bottom: 16px;
}

.field-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* PACKAGES GRID */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.package-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 32px 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.package-card:hover {
  border-color: rgba(255,255,255,0.12);
}

.package-card.pro {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

.package-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.package-badge.basic { background: rgba(96,165,250,0.15); color: #60a5fa; }
.package-badge.pro { background: var(--accent-glow); color: var(--accent); }
.package-badge.premium { background: rgba(255,210,63,0.15); color: var(--accent-secondary); }

.package-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
  cursor: text;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.package-name:hover,
.package-name:focus {
  border-color: rgba(255,255,255,0.1);
  outline: none;
}

.package-desc {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.package-price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.package-price .dollar { font-size: 1.2rem; vertical-align: top; margin-right: 2px; }
.package-price .period { font-size: 0.85rem; color: var(--fg-muted); font-weight: 400; }

.package-price-input {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent);
  color: var(--fg);
  width: 120px;
  outline: none;
  padding: 0;
}

.package-meta {
  display: flex;
  gap: 16px;
  margin: 16px 0 20px;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.package-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.package-features {
  list-style: none;
  padding: 0;
}

.package-features li {
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.package-features li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
}

.packages-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

/* TIP CARD */
.tip-card { border-left: 3px solid var(--accent-secondary); }

.tip-list {
  list-style: none;
  padding: 0;
}

.tip-list li {
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.tip-list li:last-child { border-bottom: none; }

/* OUTREACH */
.outreach-controls {
  margin-bottom: 28px;
}

.sender-form {
  max-width: 320px;
}

.sender-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.template-industry {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.template-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.template-subject {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--fg); }

.modal-body { padding: 24px 28px; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.modal-footer .btn { flex-shrink: 0; }

/* EMAIL PREVIEW */
.email-preview {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

.email-subject {
  font-size: 0.85rem;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.email-body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.template-tips {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255,210,63,0.06);
  border: 1px solid rgba(255,210,63,0.1);
  border-radius: 10px;
}

.template-tips h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 8px;
}

.template-tips ul {
  list-style: none;
  padding: 0;
}

.template-tips li {
  font-size: 0.8rem;
  color: var(--fg-muted);
  padding: 3px 0;
  line-height: 1.4;
}

.template-tips li::before {
  content: '→ ';
  color: var(--accent-secondary);
}

.copy-feedback {
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 600;
}

.copy-feedback.hidden { display: none; }

/* LEADS TABLE */
.leads-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--fg);
}

.filter-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.leads-table-wrap {
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.leads-table td {
  padding: 14px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.leads-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.lead-actions {
  display: flex;
  gap: 6px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .packages-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    transition: left 0.3s ease;
  }

  .sidebar.open { left: 0; }

  .app-main {
    margin-left: 0;
    padding: 24px 16px;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .actions-grid { grid-template-columns: 1fr; }
  .templates-grid { grid-template-columns: 1fr; }

  .page-header-row {
    flex-direction: column;
  }
}
