/* ═══════════════════════════════════════════════════
   Aegis — Clean White / Light Mode Design System
   apple.css  ·  v2.0  (Minimax-inspired sidebar layout)
   ═══════════════════════════════════════════════════ */

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

/* ─── Design Tokens ───────────────────────────────── */
:root {
  /* Surfaces */
  --bg:            #f5f5f7;
  --surface:       #ffffff;
  --surface-2:     #f2f2f7;
  --surface-3:     #e8e8ed;
  --sidebar-bg:    #ffffff;
  --sidebar-width: 220px;

  /* Borders */
  --border:        #e5e5ea;
  --border-strong: #c7c7cc;

  /* Text */
  --text-primary:  #1c1c1e;
  --text-secondary:#3a3a3c;
  --text-tertiary: #8e8e93;
  --text-disabled: #c7c7cc;

  /* Accent */
  --accent:        #0071e3;
  --accent-hover:  #0066cc;
  --accent-light:  #e8f0fd;
  --accent-subtle: rgba(0,113,227,0.08);

  /* Semantic */
  --green:         #34c759;
  --green-subtle:  #e8f8ec;
  --yellow:        #ff9f0a;
  --yellow-subtle: #fff4e0;
  --red:           #ff3b30;
  --red-subtle:    #ffebea;
  --orange:        #ff6b00;
  --purple:        #5856d6;
  --purple-subtle: #eeeefd;

  /* Shape */
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  /* Shadows */
  --shadow-xs:     0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:     0 12px 48px rgba(0,0,0,0.14);

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
}

/* ─── Reset ───────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  overflow-x: hidden;
}

/* ─── Sidebar Layout ──────────────────────────────── */
#cl-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

#cl-sidebar::-webkit-scrollbar { width: 0; }

/* Sidebar brand */
.cl-sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.cl-sidebar-logo {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.cl-sidebar-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Sidebar nav groups */
.cl-nav-group {
  padding: 16px 12px 6px;
}
.cl-nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 8px;
  margin-bottom: 4px;
}
.cl-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
  margin-bottom: 1px;
  white-space: nowrap;
}
.cl-nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.cl-nav-item.active {
  background: var(--surface-2);
  color: var(--text-primary);
  font-weight: 600;
}
.cl-nav-item .cl-nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: 0.65;
}
.cl-nav-item.active .cl-nav-icon { opacity: 1; }
.cl-nav-icon svg { width: 16px; height: 16px; }

/* Sidebar footer */
.cl-sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ─── Main Content Area ───────────────────────────── */
.cl-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }
  
  body {
    flex-direction: column;
  }
  
  #cl-sidebar {
    left: calc(var(--sidebar-width) * -1);
    transition: left 0.3s ease;
    box-shadow: none;
  }
  
  #cl-sidebar.show {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  
  .cl-main {
    margin-left: 0;
    padding-top: 60px; /* Space for mobile header */
  }
  
  .cl-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    backdrop-filter: blur(4px);
  }
  
  .cl-sidebar-overlay.show {
    display: block;
  }
}

/* Top header bar inside main */
.cl-topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Mobile Header */
.cl-mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 20px;
  z-index: 2500;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
  .cl-mobile-header { display: flex; }
  .cl-topbar { display: none; }
  .cl-content { padding: 20px 16px !important; }
  .page-header { margin-bottom: 24px; }
  .page-header h1 { font-size: 22px; }
  
  /* Table RWD */
  .table-responsive {
    margin: 0 -16px;
    width: calc(100% + 32px);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  table { min-width: 600px; }
  
  /* Grid wrap */
  .grid-stack.cols-2, .grid-stack.cols-3, .grid-stack.cols-1-2, .grid-stack.cols-2-1 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Meta Grid Wrap (Document style) */
  .meta-grid { 
    grid-template-columns: 1fr !important; 
    gap: 16px !important; 
  }
}

.cl-menu-toggle {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text-primary);
  background: var(--surface-2);
  cursor: pointer;
  margin-right: 12px;
}
.cl-topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.cl-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Page content wrapper */
.cl-content {
  padding: 24px 32px 40px;
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Responsive Grid Utilities */
.grid-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1024px) {
  .grid-stack.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-stack.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-stack.cols-1-2 { grid-template-columns: 1fr 2fr; }
  .grid-stack.cols-2-1 { grid-template-columns: 2fr 1fr; }
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* legacy container/page compatibility */
.container, .page {
  padding: 24px 32px;
  width: 100%;
  margin: 0;
}

/* ─── Page Header ───────────────────────────────────── */
.page-header {
  margin-bottom: 40px;
  padding-top: 8px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.page-header p {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

/* ─── Page Section ─────────────────────────────────── */
.section {
  margin-bottom: 40px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle, #f0f0f5);
}
.section-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.section-link:hover {
  gap: 7px;
  color: var(--accent-hover);
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Cards ───────────────────────────────────────── */
.card, .section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover, .section-card:hover { box-shadow: var(--shadow-sm); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.overline {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 3px;
  font-weight: 600;
}

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.stat-card .num, .stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-weight: 500;
}

/* ─── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary:disabled { background: var(--surface-3); color: var(--text-disabled); border-color: var(--border); cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--accent-light); }

.btn-danger {
  background: var(--surface);
  color: var(--red);
  border-color: var(--border);
}
.btn-danger:hover { background: var(--red-subtle); border-color: var(--red); }

.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-dark {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}
.btn-dark:hover { background: #000; }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 8px; }
.btn-group .btn { flex: 1; }

/* AI action buttons */
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font);
}
.ai-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.ai-btn.primary, .ai-btn.badge-blue {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ai-btn.primary:hover, .ai-btn.badge-blue:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.ai-btn.danger, .ai-btn.badge-red {
  color: var(--red);
  border-color: var(--border);
}
.ai-btn.danger:hover, .ai-btn.badge-red:hover {
  background: var(--red-subtle);
  border-color: var(--red);
  color: var(--red);
}

/* ─── Typography ──────────────────────────────────── */
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* ─── Forms & Inputs ──────────────────────────────── */
.cl-input, .cl-select, .cl-textarea,
input[type="text"], input[type="number"], input[type="email"], input[type="date"],
select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font);
  transition: all 0.15s ease;
  outline: none;
  appearance: none; /* Reset for selects */
  background-image: none;
}

/* Custom arrow for select */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

textarea {
  min-height: 80px;
  line-height: 1.5;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--surface);
}

input::placeholder, textarea::placeholder {
  color: var(--text-tertiary);
  opacity: 0.8;
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ─── Status Badges ───────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.01em;
}
.badge-blue   { background: var(--accent-light);   color: var(--accent); }
.badge-green  { background: var(--green-subtle);   color: #1d7a39; }
.badge-yellow { background: var(--yellow-subtle);  color: #b36b00; }
.badge-red    { background: var(--red-subtle);     color: #c0392b; }
.badge-gray   { background: var(--surface-2);      color: var(--text-tertiary); }
.badge-purple { background: var(--purple-subtle);  color: var(--purple); }

.status { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-tertiary); font-weight: 600; }
.status.active { background: var(--green-subtle); color: #1d7a39; }

/* ─── Tables ──────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--surface);
}
tbody td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
  background: var(--surface);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ─── Note / Document Cards ───────────────────────── */
.note-card, .opp-card, .company-card, .contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.note-card:hover, .opp-card:hover, .company-card:hover, .contact-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* Card Typography Refinements */
.company-card h3, .opp-card h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

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

.opp-amount {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0;
  letter-spacing: -0.02em;
}

.opp-card .company-name {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.opp-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-2);
}

.company-card .industry {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: -4px;
}

.company-card .contacts-count {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
}

/* ─── Modals ──────────────────────────────────────── */
.modal-overlay, .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal-backdrop { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
}
.modal h2, .modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: var(--text-primary);
}

/* ─── Dividers ────────────────────────────────────── */
hr, .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ─── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── Spinner ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ───────────────────────────────────────── */
.cl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 8px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
}
.cl-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.cl-toast.error {
  border-left: 3px solid var(--red);
}
.cl-toast.success {
  border-left: 3px solid var(--green);
}

/* ─── Progress ────────────────────────────────────── */
.progress-track { width: 100%; background: var(--surface-3); height: 6px; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; background: var(--accent); }

/* ─── Tabs ────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  border-radius: 0;
  background: none;
  border-left: none; border-right: none; border-top: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ─── AI actions panel ────────────────────────────── */
.ai-actions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

/* ─── Avatar ──────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}

/* ─── Utility ─────────────────────────────────────── */
.text-muted    { color: var(--text-tertiary); }
.text-accent   { color: var(--accent); }
.text-green    { color: #1d7a39; }
.text-yellow   { color: #b36b00; }
.text-red      { color: #c0392b; }
.hidden        { display: none !important; }
.full-width    { width: 100%; }

/* ─── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  #cl-sidebar { transform: translateX(-220px); width: 220px; transition: transform 0.25s ease; }
  #cl-sidebar.open { transform: translateX(0); }
  .cl-main { margin-left: 0; padding-top: 52px; }
  .cl-content, .container, .page { padding: 14px 16px; }
  .page-header h1 { font-size: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  #month-revenue, #quarter-revenue { font-size: 18px !important; }
  .quick-actions { grid-template-columns: 1fr 1fr !important; }


}

/* ─── Print ───────────────────────────────────────── */
@media print {
  #cl-sidebar, .cl-topbar, .no-print { display: none !important; }
  .cl-main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* ─── Legacy nav compatibility (hidden by sidebar.js) */
.nav, nav.nav { display: none !important; }
.mobile-menu   { display: none !important; }

/* ─── White-mode override ─────────────────────────────
   These overrides ensure inline `body { background: #0a0a0a }` etc.
   from page-specific styles cannot override our design system.     */
body {
  background: var(--bg) !important;
  color: var(--text-primary) !important;
}
/* Dark cards → white cards */
.card, .stat-card, .section-card,
.quick-add, .opp-card, .company-card, .contact-card,
.opp-info-card, .modal {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
/* Dark inner panels → light surface */
.topic-card, .recent-item, .contact-item, .opp-item,
.voice-panel, .summary-block, .opp-note,
.scan-area, .scan-empty {
  background: var(--surface-2) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
}
/* Inputs in dark mode → white */
input, textarea, select {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}
/* Force text colours */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary) !important; }
p, span, div, label, td, th, li { color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* ─── Compact Timeline ────────────────────────────── */
.tl-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); 
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 2000; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.tl-overlay.show { display: flex; }

.tl-modal {
  background: var(--surface); width: 95%; max-width: 1200px; max-height: 85vh;
  border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.tl-header {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.tl-header h3 { font-size: 15px; margin: 0; }

.tl-content {
  flex: 1; overflow: auto; display: flex; font-size: 11.5px;
}

.tl-sidebar {
  width: 180px; border-right: 1px solid var(--border); flex-shrink: 0;
  background: var(--surface-2); position: sticky; left: 0; z-index: 10;
}
.tl-sidebar-header { height: 48px; border-bottom: 1px solid var(--border); }
.tl-project-label {
  height: 48px; padding: 0 12px; display: flex; align-items: center;
  border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 500; color: var(--text-secondary);
}

.tl-main { flex: 1; position: relative; }
.tl-grid { display: flex; }
.tl-day-col {
  width: 50px; flex-shrink: 0; border-right: 1px dashed var(--border);
  text-align: center; height: 100%; position: relative;
}
.tl-day-header {
  height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  line-height: 1.2; font-weight: 600; color: var(--text-tertiary);
}
.tl-day-header span { font-size: 9px; opacity: 0.7; }

.tl-lane {
  height: 48px; border-bottom: 1px solid var(--border); width: fit-content;
  display: flex; align-items: center; position: relative;
}
.tl-lane:nth-child(even) { background: rgba(0,0,0,0.015); }
.tl-lane:hover { background: rgba(59, 130, 246, 0.04); }

.tl-pill {
  position: absolute; height: 28px; padding: 0 10px;
  border-radius: 14px; font-size: 11.5px; display: flex; align-items: center;
  white-space: nowrap; cursor: pointer; transition: transform 0.1s, box-shadow 0.1s;
  border: 1px solid rgba(0,0,0,0.05); z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.tl-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 10; }
.tl-pill.todo    { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.tl-pill.done    { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; text-decoration: line-through; opacity: 0.7; }
.tl-pill.overdue { background: #fef2f2; color: #b91c1c; border-color: #fecaca; font-weight: 600; }

.tl-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--red); opacity: 0.4; pointer-events: none; z-index: 8;
}

.tl-tip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: var(--surface); border: 1px solid var(--border); padding: 8px 12px;
  border-radius: 8px; box-shadow: var(--shadow-md); width: 200px;
  visibility: hidden; opacity: 0; transition: 0.2s; pointer-events: none;
  font-size: 11px; line-height: 1.4; color: var(--text-primary); z-index: 100;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tl-pill:hover .tl-tip { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ─── AI Analysis Refinement ─────────────────────── */
.summary-block, .topic-card {
  padding: 18px 22px !important;
  margin-bottom: 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 8px;
  position: relative;
}
.summary-label, .topic-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.body-text, .topic-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ─── Premium Loading Experience ─────────────────── */
.premium-loader {
  position: fixed; inset: 0; 
  backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%);
  background: rgba(255,255,255,0.73);
  z-index: 5000; display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
}
.premium-loader.show { display: flex; animation: fadeIn 0.4s ease forwards; }

.loader-spinner {
  width: 48px; height: 48px; border: 3px solid rgba(0,0,0,0.05);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text-container { 
  display: flex; flex-direction: column; align-items: center; gap: 6px; 
  text-align: center;
}
.loader-text {
  font-size: 15px; font-weight: 500; color: var(--text-primary);
  letter-spacing: -0.01em; min-height: 1.5em;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ─── Premium Confirmation Modal ───────────────── */
.cl-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.15); 
  backdrop-filter: blur(28px) saturate(180%); -webkit-backdrop-filter: blur(28px) saturate(180%);
  z-index: 10000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease;
}
.cl-confirm-overlay.show { display: flex; opacity: 1; }

.cl-confirm-modal {
  background: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12); border-radius: 20px;
  width: 90%; max-width: 320px; padding: 24px; text-align: center;
  transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.17, 0.89, 0.32, 1.28);
}
.cl-confirm-overlay.show .cl-confirm-modal { transform: scale(1); }

.cl-confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.cl-confirm-message { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.cl-confirm-actions { display: flex; flex-direction: column; gap: 8px; }

.cl-confirm-btn { 
  border: none; border-radius: 12px; padding: 11px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  font-family: var(--font);
}
.cl-confirm-btn.primary { background: var(--accent); color: #fff; }
.cl-confirm-btn.danger  { background: #ff3b30; color: #fff; }
.cl-confirm-btn.secondary { background: rgba(0,0,0,0.05); color: var(--text-primary); }
.cl-confirm-btn:hover { filter: brightness(1.1); }
.cl-confirm-btn:active { transform: scale(0.98); }


/* ─── Global Amount & Currency Refinement ────── */
.amount-display {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.amount-display .currency {
  font-size: 0.8em;
  font-weight: 500;
  opacity: 0.55;
  margin-right: 1px;
}
.amount-display .value {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Reduced size for all secondary currency text */
.currency-text {
  font-size: 0.85em;
  opacity: 0.7;
  font-weight: 500;
}


/* Rebuild Marker: 2026-03-31 16:35 */
