/* ── Global ─────────────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: rgba(99,102,241,0.18);
  --sidebar-active-bg: rgba(99,102,241,0.3);
  --card-shadow: 0 2px 12px rgba(0,0,0,0.07);
  --border-radius: 12px;
  --body-bg: #f5f6fa;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--body-bg);
  color: #1e293b;
  margin: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  overflow-y: auto;
  z-index: 1040;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand {
  min-height: 64px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  font-size: 1.4rem;
  color: var(--primary-light);
}

.brand-text {
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.3px;
}

.brand-accent {
  color: var(--accent);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}

.sidebar-link {
  color: rgba(255,255,255,0.72);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  font-weight: 600;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.text-secondary-muted { color: rgba(255,255,255,0.45); }

/* ── Mobile topbar ──────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--sidebar-bg);
  z-index: 1039;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1039;
}

/* ── Main content ───────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding-bottom: 3rem;
}

@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
    padding-top: var(--topbar-height);
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1.5rem 1.75rem 1.25rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.page-subtitle {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
  padding: 1rem 1.25rem;
}

.card-header-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #0f172a;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

.stat-card .stat-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* ── Health badges ──────────────────────────────────────────────────────── */
.badge-health-green  { background: #dcfce7; color: #166534; }
.badge-health-amber  { background: #fef9c3; color: #854d0e; }
.badge-health-red    { background: #fee2e2; color: #991b1b; }
.badge-health-unknown { background: #f1f5f9; color: #64748b; }

/* ── Status badges ──────────────────────────────────────────────────────── */
.badge-status-live     { background: #dcfce7; color: #166534; }
.badge-status-planned  { background: #ede9fe; color: #4c1d95; }
.badge-status-progress { background: #dbeafe; color: #1e40af; }
.badge-status-draft    { background: #f1f5f9; color: #475569; }
.badge-status-published { background: #dcfce7; color: #166534; }
.badge-status-approved { background: #d1fae5; color: #065f46; }
.badge-status-review   { background: #fef3c7; color: #92400e; }

/* ── Priority badges ────────────────────────────────────────────────────── */
.badge-priority-high   { background: #fee2e2; color: #991b1b; }
.badge-priority-medium { background: #fef9c3; color: #854d0e; }
.badge-priority-low    { background: #f1f5f9; color: #475569; }

/* ── Customer card ──────────────────────────────────────────────────────── */
.customer-card {
  border-radius: var(--border-radius);
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.18s, transform 0.18s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.customer-card:hover {
  box-shadow: 0 8px 28px rgba(79,70,229,0.14);
  transform: translateY(-2px);
  color: inherit;
}

.customer-card .customer-card-header {
  padding: 1.1rem 1.25rem 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.customer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.customer-card .customer-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  margin-bottom: 2px;
}

.customer-card .customer-meta {
  font-size: 0.78rem;
  color: #64748b;
}

/* ── Section tab navigation ─────────────────────────────────────────────── */
.section-tabs {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1.75rem;
  overflow-x: auto;
  white-space: nowrap;
}

.section-tabs .nav-link {
  color: #64748b;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.85rem 0.1rem;
  margin-right: 1.5rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.section-tabs .nav-link:hover { color: var(--primary); }
.section-tabs .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: none;
}

/* ── Data entry sections ────────────────────────────────────────────────── */
.section-panel { padding: 1.75rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #94a3b8;
}

.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ── Use case / AI story cards ──────────────────────────────────────────── */
.data-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s;
}

.data-card:hover {
  box-shadow: 0 4px 16px rgba(79,70,229,0.1);
}

.data-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  margin-right: 0.4rem;
  margin-top: 0.3rem;
}

.metric-pill .metric-val { color: var(--primary); font-weight: 700; }

/* ── Case study preview card ────────────────────────────────────────────── */
.cs-stat-box {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  padding: 1.25rem;
  color: #fff;
  text-align: center;
}

.cs-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.cs-stat-label {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 0.25rem;
}

.blockquote-box {
  border-left: 4px solid var(--primary);
  background: #f5f3ff;
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  font-style: italic;
  color: #3730a3;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--card-shadow);
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.form-label {
  font-weight: 500;
  font-size: 0.825rem;
  color: #374151;
  margin-bottom: 0.3rem;
}

.form-control, .form-select {
  border-radius: 8px;
  border-color: #d1d5db;
  font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  border-radius: 8px;
}

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

.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
  border-radius: 8px;
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ── Timeline ───────────────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.15rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item.highlight::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-date {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

/* ── Dashboard chart area ───────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 240px;
}

/* ── AI capability tag cloud ────────────────────────────────────────────── */
.capability-tag {
  display: inline-flex;
  align-items: center;
  background: #ede9fe;
  color: #4c1d95;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0.2rem;
}

/* ── Responsive table wrapper ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  background: #f8fafc;
  border-bottom-width: 1px;
}

.table td {
  font-size: 0.875rem;
  vertical-align: middle;
}

/* ── Auth pages ─────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #0e7490 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}

.auth-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

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

/* ── Data card (used in trigger list fallback) ──────────────────────────── */
.data-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* ── Small action buttons in tables ────────────────────────────────────── */
.btn-xs { padding: 0.15rem 0.45rem; font-size: 0.72rem; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
a { text-decoration: none; }
a:hover { text-decoration: none; }

.text-primary-custom { color: var(--primary) !important; }

.chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
  margin: 1px;
}

.section-heading {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading i { color: var(--primary); }

.star-icon { color: #f59e0b; }

/* ── Customer header banner ─────────────────────────────────────────────── */
.customer-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  padding: 1.75rem;
}

.customer-banner .customer-logo {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.2);
}

.customer-banner h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
