/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #2D3748;
  background: #EDF1F7;
}

a { color: #3B6FE8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-body {
  display: flex;
  min-height: 100vh;
  background: #EDF1F7;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #1A2035;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 100;
  overflow: hidden;
}

.sidebar-top {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 16px;
}

.sidebar-wordmark {
  font-family: 'DM Serif Display', serif;
  font-size: 1.375rem;
  color: #fff;
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-dot {
  color: #3B6FE8;
  font-size: 1.8rem;
  line-height: 1;
  margin-top: -4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.7);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}

.sidebar-link.active {
  color: #fff;
  border-left-color: #3B6FE8;
  background: rgba(255,255,255,0.06);
}

.sidebar-link--external {
  gap: 10px;
}

.external-icon {
  margin-left: auto;
  opacity: 0.5;
}

.sidebar-bottom {
  padding: 0 0 20px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 0 16px 16px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.sidebar-user-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
}

.sidebar-logout {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); text-decoration: none; }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  padding: 32px;
  overflow-y: auto;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 400;
  color: #1A2035;
  line-height: 1.2;
  margin-bottom: 6px;
}

.page-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: #718096;
}

.back-link {
  display: inline-block;
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 10px;
  text-decoration: none;
}
.back-link:hover { color: #3B6FE8; text-decoration: none; }

/* ── Section Labels ──────────────────────────────────────────────────────── */
.section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3B6FE8;
  margin-bottom: 12px;
  margin-top: 28px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 24px;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}

.stat-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 22px 24px 20px;
  border-top: 3px solid #3B6FE8;
}

.stat-number {
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  font-weight: 400;
  color: #1A2035;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #718096;
  font-weight: 500;
  line-height: 1.4;
}

/* ── Quick Actions ───────────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 12px;
  margin: 24px 0 4px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-pill {
  display: inline-block;
  padding: 12px 28px;
  background: #3B6FE8;
  color: #fff;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-pill:hover { background: #2D5ED4; color: #fff; text-decoration: none; }

.btn-pill--sm {
  padding: 9px 20px;
  font-size: 0.875rem;
}

.btn-pill--lg {
  padding: 16px 40px;
  font-size: 1.0625rem;
}

/* ── Feature Cards (clients overview) ───────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 720px;
}

.feature-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.feature-icon {
  width: 44px;
  height: 44px;
  background: rgba(59,111,232,0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1A2035;
  margin-bottom: 4px;
}

.feature-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #718096;
  line-height: 1.5;
}

/* ── Pipeline Card ───────────────────────────────────────────────────────── */
.pipeline-card {
  background: #1A2035;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.15);
  padding: 24px;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.pipeline-stage {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  border-top: 3px solid #3B6FE8;
  padding: 18px 16px 16px;
  text-align: center;
}

.pipeline-count {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 400;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}

.pipeline-stage-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.pipeline-value {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
}

/* ── Dashboard Grid ──────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 4px;
}

/* ── Item Lists ──────────────────────────────────────────────────────────── */
.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #EDF1F7;
}
.item-row:last-child { border-bottom: none; }

.item-primary {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #2D3748;
  margin-bottom: 2px;
}

.item-secondary {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #718096;
}

.item-timestamp {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #718096;
  white-space: nowrap;
  margin-left: 16px;
  margin-top: 2px;
}

/* ── Empty States ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 24px 0 8px;
}

.empty-icon {
  font-size: 1.75rem;
  margin-bottom: 10px;
  opacity: 0.5;
}

.empty-state-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #718096;
}

/* ── Coming Soon ─────────────────────────────────────────────────────────── */
.coming-soon-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 56px 40px;
  text-align: center;
  max-width: 480px;
}

.coming-soon-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(59,111,232,0.08);
  border-radius: 18px;
  margin: 0 auto 20px;
}

.coming-soon-heading {
  font-family: 'DM Serif Display', serif;
  font-size: 1.625rem;
  font-weight: 400;
  color: #1A2035;
  margin-bottom: 10px;
}

.coming-soon-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: #718096;
  line-height: 1.6;
}

/* ── Tools Grid ──────────────────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
}

.tool-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 28px 24px;
}

.tool-card--disabled {
  opacity: 0.7;
}

.tool-card-icon {
  margin-bottom: 16px;
}

.tool-card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: #1A2035;
  margin-bottom: 8px;
}

.tool-card-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 20px;
  line-height: 1.5;
}

.badge-coming-soon {
  display: inline-block;
  padding: 6px 14px;
  background: #EDF1F7;
  color: #718096;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { width: 200px; min-width: 200px; }
  .main-content { margin-left: 200px; padding: 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
}

/* ── Client Management — Secondary Nav ──────────────────────────────────── */
.clients-subnav {
  display: flex;
  border-bottom: 2px solid #DDE3EE;
  margin-bottom: 24px;
  gap: 0;
}

.subnav-link {
  padding: 10px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #718096;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.subnav-link:hover { color: #2D3748; text-decoration: none; }
.subnav-link.active { color: #3B6FE8; border-bottom-color: #3B6FE8; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-green      { background: #E6FBF5; color: #0E9F6E; }
.badge-red        { background: #FEF2F2; color: #DC2626; }
.badge-blue       { background: #EBF0FD; color: #3B6FE8; }
.badge-blue-light { background: #EBF5FF; color: #2563EB; }
.badge-grey       { background: #F3F4F6; color: #6B7280; }
.badge-amber      { background: #FFFBEB; color: #D97706; }

/* ── Action / Filter Bar ─────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  max-width: 320px;
  padding: 9px 14px;
  border: 1.5px solid #DDE3EE;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #2D3748;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: #3B6FE8; }

.filter-select {
  padding: 9px 14px;
  border: 1.5px solid #DDE3EE;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #2D3748;
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: #3B6FE8; }

/* ── Data Table ──────────────────────────────────────────────────────────── */
.table-wrapper {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  overflow: hidden;
}

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

.data-table th {
  padding: 11px 16px;
  background: #EDF1F7;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: #2D3748;
  border-bottom: 1px solid #F0F2F8;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: #F7F9FC; }

.data-table tbody tr.clickable { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr.clickable:hover td { background: #EEF2FD !important; }

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: #718096;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,32,53,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(26,32,53,0.18);
  margin: 20px;
}

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

.modal-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.375rem;
  font-weight: 400;
  color: #1A2035;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #EDF1F7;
  cursor: pointer;
  font-size: 1rem;
  color: #718096;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.modal-close:hover { background: #DDE3EE; }

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #2D3748;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #DDE3EE;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #2D3748;
  background: #F7F9FC;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #3B6FE8; background: #fff; }
.form-textarea { resize: vertical; min-height: 80px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.btn-ghost {
  padding: 10px 20px;
  background: transparent;
  color: #718096;
  border: 1.5px solid #DDE3EE;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
  display: inline-block;
}
.btn-ghost:hover { border-color: #3B6FE8; color: #3B6FE8; text-decoration: none; }
.btn-ghost--sm { padding: 7px 14px; font-size: 0.8125rem; }

/* ── Company Detail ──────────────────────────────────────────────────────── */
.detail-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(26,32,53,0.07);
  padding: 28px;
  margin-bottom: 8px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.detail-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: #1A2035;
  line-height: 1.2;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 24px;
}

.detail-field label {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #718096;
  display: block;
  margin-bottom: 4px;
}

.detail-field span {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: #2D3748;
}

.breadcrumb {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #718096;
  margin-bottom: 16px;
}
.breadcrumb a { color: #718096; text-decoration: none; }
.breadcrumb a:hover { color: #3B6FE8; }
.breadcrumb span { margin: 0 6px; }
