/* DiSEG CRM v2 — Custom Styles (Bootstrap 5 base) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sidebar-w: 220px;
  --brand-dark: #1a2332;
  --brand-blue: #0077cc;
  --brand-blue-hover: #005fa3;
}

* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f0f2f5; margin: 0; }

/* ── Sidebar ── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--brand-dark); display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .brand {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: rgba(255,255,255,.5);
}
.sidebar-logo .title {
  font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.2; margin-top: 2px;
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: rgba(255,255,255,.65);
  font-size: .84rem; font-weight: 500; text-decoration: none;
  border-left: 3px solid transparent; transition: all .15s;
}
.nav-link:hover   { color: #fff; background: rgba(255,255,255,.06); }
.nav-link.active  { color: #fff; border-left-color: var(--brand-blue); background: rgba(0,119,204,.15); }
.nav-link .bi     { font-size: 1rem; flex-shrink: 0; }
.nav-section {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: rgba(255,255,255,.3);
  padding: 14px 18px 4px;
}
.badge-nav {
  margin-left: auto; background: #dc3545; color: #fff;
  font-size: .65rem; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.sidebar-footer {
  padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.45); font-size: .78rem;
}
.sidebar-footer a { color: rgba(255,255,255,.55); text-decoration: none; }
.sidebar-footer a:hover { color: #fff; }

/* ── Main ── */
#main { margin-left: var(--sidebar-w); min-height: 100vh; }
.page-header {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  padding: 14px 24px; display: flex; align-items: center; gap: 12px;
}
.page-header h1 { font-size: 1.1rem; font-weight: 700; color: #1a2332; margin: 0; }
.page-body { padding: 20px 24px; }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 14px; margin-bottom: 20px;
}
.kpi-card {
  background: #fff; border-radius: 10px; padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07); border-top: 3px solid #e2e8f0;
}
.kpi-card .kpi-val { font-size: 1.7rem; font-weight: 700; line-height: 1; color: #1a2332; }
.kpi-card .kpi-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-top: 4px; }
.kpi-card.blue  { border-top-color: #0077cc; }
.kpi-card.green { border-top-color: #10b981; }
.kpi-card.orange{ border-top-color: #f59e0b; }
.kpi-card.red   { border-top-color: #ef4444; }
.kpi-card.purple{ border-top-color: #8b5cf6; }

/* ── Cards ── */
.crm-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07); margin-bottom: 16px; overflow: hidden;
}
.crm-card-header {
  padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #475569; display: flex; align-items: center; gap: 8px;
}
.crm-card-body { padding: 16px; }

/* ── Pipeline Stages ── */
.stage-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.stage-tab {
  padding: 5px 14px; border-radius: 20px; font-size: .78rem; font-weight: 600;
  border: 2px solid #e2e8f0; color: #64748b; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.stage-tab:hover, .stage-tab.active { border-color: var(--brand-blue); color: var(--brand-blue); background: #eff6ff; }

/* ── Timeline ── */
.timeline { position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 16px; top: 8px; bottom: 0;
  width: 2px; background: #e2e8f0;
}
.timeline-item { position: relative; padding-left: 40px; padding-bottom: 20px; }
.timeline-dot {
  position: absolute; left: 8px; top: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand-blue); border: 3px solid #fff;
  box-shadow: 0 0 0 2px #e2e8f0;
}
.timeline-dot.system { background: #94a3b8; }
.timeline-content {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px;
}
.timeline-meta { font-size: .72rem; color: #94a3b8; margin-bottom: 4px; }
.timeline-text { font-size: .84rem; color: #374151; white-space: pre-wrap; }

/* ── Unit Economics ── */
.eco-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px;
}
.eco-card {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px 14px; text-align: center;
}
.eco-val  { font-size: 1.4rem; font-weight: 700; color: #1a2332; }
.eco-lbl  { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-top: 3px; }
.eco-sub  { font-size: .75rem; color: #64748b; margin-top: 2px; }
.trend-up   { color: #10b981; }
.trend-down { color: #ef4444; }

/* ── Auto-Action Cards ── */
.auto-action-card {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 14px;
  margin-bottom: 12px;
}
.auto-action-trigger { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: #92400e; }
.auto-action-name { font-size: .9rem; font-weight: 600; color: #1a2332; margin: 2px 0 10px; }
.action-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
  font-size: .82rem; color: #374151; border-bottom: 1px dashed #fde68a;
}
.action-item:last-child { border-bottom: none; }
.action-dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex-shrink: 0; }

/* ── Alert Rows ── */
.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.alert-row:last-child { border-bottom: none; }
.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.alert-body  { flex: 1; }
.alert-title { font-size: .85rem; font-weight: 600; color: #1a2332; }
.alert-msg   { font-size: .78rem; color: #64748b; margin-top: 2px; }
.alert-time  { font-size: .7rem; color: #94a3b8; margin-top: 3px; }

/* ── Tables ── */
.crm-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.crm-table th { background: #f8fafc; font-weight: 600; color: #475569; padding: 9px 12px; border-bottom: 2px solid #e2e8f0; text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.crm-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #374151; }
.crm-table tr:hover td { background: #fafbfc; }

/* ── Forms ── */
.form-label { font-size: .78rem; font-weight: 600; color: #475569; margin-bottom: 4px; }
.form-control, .form-select { font-size: .84rem; border-color: #e2e8f0; }
.form-control:focus, .form-select:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(0,119,204,.1); }

/* ── Funnel Bar ── */
.funnel { display: flex; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.funnel-step {
  flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 10px 12px; text-align: center;
}
.funnel-step .f-count { font-size: 1.4rem; font-weight: 700; color: #1a2332; }
.funnel-step .f-label { font-size: .68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.funnel-step.active { border-color: #10b981; background: #f0fdf4; }
.funnel-step.lost   { border-color: #fca5a5; background: #fff1f2; }

/* ── Misc ── */
.badge { font-weight: 600; }
.text-eur::before { content: '€ '; }
.copy-btn { cursor: pointer; font-size: .75rem; color: #94a3b8; border: none; background: none; padding: 0 4px; }
.copy-btn:hover { color: var(--brand-blue); }
.msg-toast {
  position: fixed; bottom: 20px; right: 20px; background: #1a2332; color: #fff;
  border-radius: 8px; padding: 10px 18px; font-size: .84rem; z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: slideup .3s ease;
}
@keyframes slideup { from { transform: translateY(20px); opacity:0; } to { transform:translateY(0); opacity:1; } }

@media (max-width: 768px) {
  #sidebar { position: static; width: 100%; }
  #main { margin-left: 0; }
}
