/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== THEME VARIABLES ===== */
:root, [data-theme="light"] {
  --bg: #f0f4f8; --surface: #ffffff; --surface-hover: #f7f9fc;
  --surface-alt: #f8fafc;
  --border: #e2e8f0; --border-light: #edf2f7;
  --text: #0f172a; --text-secondary: #475569; --text-muted: #94a3b8;
  --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --sidebar-bg: #0f172a; --sidebar-border: rgba(255,255,255,.06);
  --sidebar-text: rgba(255,255,255,.6); --sidebar-text-hover: rgba(255,255,255,.9);
  --sidebar-active-bg: rgba(37,99,235,.85);
  --sidebar-section: rgba(255,255,255,.3);
  --topbar-bg: rgba(255,255,255,.85); --topbar-border: #e2e8f0;
  --kpi-glow: .04;
  --metric-card-bg: white; --metric-card-border: #e2e8f0;
  --overview-card-bg: white; --overview-card-border: #e2e8f0;
  --bar-track: #f1f5f9;
  --table-header-bg: #f0f4f8;
  --donut-hole: white;
  --avatar-shadow: 0 1px 3px rgba(0,0,0,.1);
}

[data-theme="dark"] {
  --bg: #0a0f1a; --surface: rgba(255,255,255,.03); --surface-hover: rgba(255,255,255,.05);
  --surface-alt: rgba(255,255,255,.02);
  --border: rgba(255,255,255,.06); --border-light: rgba(255,255,255,.04);
  --text: #e2e8f0; --text-secondary: #94a3b8; --text-muted: #64748b;
  --card-shadow: 0 1px 3px rgba(0,0,0,.2);
  --card-shadow-hover: 0 4px 16px rgba(0,0,0,.3);
  --sidebar-bg: #070b14; --sidebar-border: rgba(255,255,255,.04);
  --topbar-bg: rgba(10,15,26,.85); --topbar-border: rgba(255,255,255,.06);
  --kpi-glow: .06;
  --metric-card-bg: linear-gradient(135deg,#1e293b,#0f1d32);
  --metric-card-border: rgba(255,255,255,.06);
  --overview-card-bg: rgba(255,255,255,.02);
  --overview-card-border: rgba(255,255,255,.06);
  --bar-track: rgba(255,255,255,.04);
  --table-header-bg: rgba(255,255,255,.03);
  --donut-hole: #0a0f1a;
  --avatar-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* Shared semantic colors */
:root {
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-light: #eff6ff;
  --primary-subtle: #dbeafe;
  --success: #059669; --success-bg: #ecfdf5; --success-text: #065f46;
  --warning: #d97706; --warning-bg: #fffbeb; --warning-text: #92400e;
  --danger: #dc2626; --danger-bg: #fef2f2; --danger-text: #991b1b;
  --purple: #7c3aed; --purple-bg: #f5f3ff;
  --radius: 14px; --radius-sm: 10px; --radius-xs: 6px;
  --transition: 150ms ease;
}
[data-theme="dark"] {
  --success-bg: rgba(5,150,105,.08); --success-text: #6ee7b7;
  --warning-bg: rgba(217,119,6,.08); --warning-text: #fde68a;
  --danger-bg: rgba(220,38,38,.08); --danger-text: #fca5a5;
  --purple-bg: rgba(124,58,237,.08);
  --primary-light: rgba(37,99,235,.08); --primary-subtle: rgba(37,99,235,.15);
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased; transition: background .3s ease, color .3s ease;
}

/* ===== FOCUS ===== */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px; background: var(--sidebar-bg); color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 20;
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--sidebar-border);
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed { width: 64px; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }

.sidebar-brand {
  padding: 16px 14px; border-bottom: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px; min-height: 60px;
}
.sidebar-brand-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand-icon svg { width: 16px; height: 16px; color: #fff; }
.sidebar-brand-text h1 { font-size: 14px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.sidebar-brand-text p { font-size: 10px; color: rgba(255,255,255,.35); margin-top: 1px; }

.sidebar-collapse-btn {
  margin-left: auto; width: 24px; height: 24px; border-radius: 6px;
  background: rgba(255,255,255,.05); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.1); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; color: var(--text-muted); transition: transform .25s ease; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* Collapsed state */
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer .nav-label { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 16px 0; gap: 0; }
.sidebar.collapsed .sidebar-collapse-btn { position: absolute; right: -12px; top: 20px; width: 24px; height: 24px; background: var(--sidebar-bg); border: 1px solid var(--sidebar-border); border-radius: 50%; z-index: 1; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item .nav-badge { position: absolute; top: 2px; right: 2px; font-size: 8px; padding: 1px 4px; min-width: 16px; }
.sidebar.collapsed .sidebar-footer { padding: 10px 8px; }
.sidebar.collapsed .btn-logout { padding: 8px; justify-content: center; }
.sidebar.collapsed .refresh-indicator { justify-content: center; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 0 8px; margin-bottom: 2px; }
.nav-section-label {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--sidebar-section);
  padding: 14px 10px 5px; white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--sidebar-text);
  cursor: pointer; transition: all var(--transition);
  margin-bottom: 1px; position: relative; white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--sidebar-text-hover); }
.nav-item.active { background: var(--sidebar-active-bg); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.25); }
.nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: .7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon svg { width: 17px; height: 17px; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; padding: 1px 6px;
  border-radius: 99px; min-width: 18px; text-align: center; line-height: 1.5;
}

.sidebar-footer {
  padding: 12px 14px; border-top: 1px solid var(--sidebar-border);
  font-size: 11px; color: rgba(255,255,255,.3);
}
.btn-logout {
  margin-top: 8px; width: 100%; padding: 7px 10px;
  background: rgba(255,255,255,.04); color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
  font-size: 12px; font-family: inherit; cursor: pointer;
  transition: all var(--transition); display: flex; align-items: center;
  justify-content: center; gap: 6px; white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); }
.btn-logout svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ===== MAIN ===== */
.main {
  flex: 1; margin-left: 240px; min-height: 100vh;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .main { margin-left: 64px; }

.topbar {
  background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-border);
  padding: 10px 28px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(16px); transition: background .3s ease;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.sidebar-expand-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all var(--transition);
}
.sidebar-expand-btn:hover { background: var(--surface-hover); }
.sidebar-expand-btn svg { width: 16px; height: 16px; color: var(--text-muted); }

.content-area { padding: 20px 28px; max-width: 1400px; }

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  width: 56px; height: 28px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; position: relative;
  display: flex; align-items: center; padding: 2px;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle-icon {
  width: 22px; height: 22px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; transition: all .25s ease;
}
.theme-toggle-icon svg { width: 13px; height: 13px; }
.theme-icon-dark { color: var(--text-muted); }
.theme-icon-light { color: var(--text-muted); }
[data-theme="dark"] .theme-icon-dark { background: var(--primary); color: white; }
[data-theme="light"] .theme-icon-light { background: var(--primary); color: white; }

/* ===== CARDS ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  margin-bottom: 14px; overflow: hidden; transition: all .2s ease;
}
.card:hover { box-shadow: var(--card-shadow-hover); }
.card-header {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 13px; font-weight: 650; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
.card-header .subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ===== OVERVIEW GRID ===== */
.overview-grid { display: grid; gap: 12px; }
.overview-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.overview-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.overview-row-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.overview-card {
  background: var(--overview-card-bg); border: 1px solid var(--overview-card-border);
  border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden;
  transition: all .2s ease; box-shadow: var(--card-shadow);
}
.overview-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.overview-card-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px;
}
.overview-card-link {
  font-size: 10px; color: var(--primary); font-weight: 500; cursor: pointer;
  text-decoration: none; transition: opacity var(--transition);
}
.overview-card-link:hover { opacity: .8; }

/* ===== METRIC CARDS (KPI) ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card {
  background: var(--metric-card-bg); border: 1px solid var(--metric-card-border);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
  transition: all .2s ease; box-shadow: var(--card-shadow);
}
.kpi-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.kpi-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.kpi-card::after {
  content: ''; position: absolute; top: -10px; right: -10px;
  width: 50px; height: 50px; border-radius: 50%; opacity: var(--kpi-glow);
  pointer-events: none;
}
.kpi-card.kpi-danger { border-left: 3px solid var(--danger); }
.kpi-card.kpi-danger .kpi-value { color: var(--danger); }
.kpi-card.kpi-danger::after { background: var(--danger); }
.kpi-card.kpi-success { border-left: 3px solid var(--success); }
.kpi-card.kpi-success .kpi-value { color: var(--success); }
.kpi-card.kpi-success::after { background: var(--success); }
.kpi-card.kpi-warning { border-left: 3px solid var(--warning); }
.kpi-card.kpi-warning .kpi-value { color: var(--warning); }
.kpi-card.kpi-warning::after { background: var(--warning); }
.kpi-card.kpi-primary { border-left: 3px solid var(--primary); }
.kpi-card.kpi-primary .kpi-value { color: var(--primary); }
.kpi-card.kpi-primary::after { background: var(--primary); }
.kpi-card.kpi-purple { border-left: 3px solid var(--purple); }
.kpi-card.kpi-purple .kpi-value { color: var(--purple); }
.kpi-card.kpi-purple::after { background: var(--purple); }

/* ===== BUTTONS ===== */
select, .btn {
  padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
select:hover, .btn:hover { border-color: var(--primary); }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
  font-weight: 600; box-shadow: 0 1px 2px rgba(37,99,235,.2);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { display: inline-flex; align-items: center; gap: 5px; }
.btn-icon svg { width: 14px; height: 14px; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 9px 14px; font-size: 10px; font-weight: 650;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  background: var(--table-header-bg); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-hover); }
.data-table a, .data-table a:visited { color: var(--primary); text-decoration: none; font-weight: 500; }
.data-table .text-center { text-align: center; }
.data-table .text-right { text-align: right; }
.data-table .font-bold { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Excel-style filter dropdowns */
.conv-filter-header { position: relative; cursor: pointer; user-select: none; white-space: nowrap; }
.conv-filter-header:hover { color: var(--primary); }
.conv-filter-icon { font-size: 9px; margin-left: 4px; opacity: 0.6; }
.conv-filter-header:hover .conv-filter-icon { opacity: 1; }
.conv-dropdown { display: none; position: absolute; top: 100%; left: 0; z-index: 100; min-width: 200px; max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); margin-top: 4px; }
[data-theme="dark"] .conv-dropdown { background: #1e293b; }
.conv-dropdown-open { display: block; }
.conv-dropdown-content { padding: 8px 0; }
.conv-dropdown-actions { display: flex; gap: 12px; padding: 6px 14px 8px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; }
.conv-dropdown-actions a { font-size: 11px; color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 600; }
.conv-dropdown-actions a:hover { text-decoration: underline; }
.conv-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 5px 14px; font-size: 13px; cursor: pointer; color: var(--text); transition: background 0.1s; }
.conv-dropdown-item:hover { background: var(--surface-hover); }
.conv-dropdown-item input[type=checkbox] { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; }
.conv-dropdown-item span { flex: 1; }
.data-table .font-medium { font-weight: 500; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge-red { background: var(--danger); color: #fff; }
.badge-amber { background: var(--warning); color: #fff; }
.badge-green { background: var(--success); color: #fff; }
.badge-blue { background: var(--primary); color: #fff; }
.badge-purple { background: var(--purple); color: #fff; }
.badge-outline-red { background: var(--danger-bg); color: var(--danger-text); border: 1px solid rgba(220,38,38,.2); }
.badge-outline-amber { background: var(--warning-bg); color: var(--warning-text); border: 1px solid rgba(217,119,6,.2); }
.badge-outline-green { background: var(--success-bg); color: var(--success-text); border: 1px solid rgba(5,150,105,.2); }

/* ===== DONUT CHART ===== */
.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut { border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.donut-hole { border-radius: 50%; background: var(--donut-hole); display: flex; align-items: center; justify-content: center; flex-direction: column; }
.donut-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.donut-label { font-size: 9px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ===== LEADERBOARD ===== */
.leaderboard { display: flex; flex-direction: column; gap: 10px; }
.leaderboard-item { display: flex; align-items: center; gap: 10px; }
.leaderboard-rank { font-size: 13px; font-weight: 800; width: 18px; text-align: center; }
.leaderboard-rank.gold { color: #f59e0b; }
.leaderboard-rank.silver { color: #94a3b8; }
.leaderboard-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: white; font-weight: 700; flex-shrink: 0;
  box-shadow: var(--avatar-shadow);
}
.leaderboard-name { flex: 1; font-size: 13px; font-weight: 500; }
.leaderboard-bar { width: 90px; height: 6px; background: var(--bar-track); border-radius: 99px; overflow: hidden; }
.leaderboard-bar-fill { height: 100%; border-radius: 99px; }
.leaderboard-value { font-size: 13px; font-weight: 700; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== TEAM GRID ===== */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.team-card {
  background: var(--surface-alt); border-radius: 12px; padding: 14px 10px;
  text-align: center; transition: all .2s ease;
}
.team-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.team-avatar {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  box-shadow: var(--avatar-shadow);
}
.team-name { font-size: 12px; font-weight: 600; }
.team-metric { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.team-label { font-size: 9px; color: var(--text-muted); }

/* ===== PIPELINE BARS ===== */
.pipeline-bars { display: flex; align-items: end; gap: 6px; }
.pipeline-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pipeline-bar-value { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-bar {
  width: 100%; border-radius: 6px 6px 0 0; min-height: 4px;
  transition: height .6s cubic-bezier(.4,0,.2,1);
}
.pipeline-bar-label { font-size: 8px; color: var(--text-muted); white-space: nowrap; text-align: center; font-weight: 500; }

/* ===== SLA STAGE CARDS ===== */
.stage-card { margin-bottom: 10px; }
.stage-header { padding: 12px 18px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: background var(--transition); }
.stage-header:hover { background: var(--surface-hover); }
.stage-name { font-weight: 650; font-size: 14px; letter-spacing: -.005em; }
.stage-sla { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stage-stats { display: flex; align-items: center; gap: 8px; }
.stage-count { font-size: 22px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stage-count small { font-size: 11px; color: var(--text-muted); font-weight: 400; display: block; letter-spacing: 0; }

.deal-section { padding: 8px 14px 12px; }
.deal-section h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.deal-section .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.section-overdue { border-top: 2px solid rgba(220,38,38,.4); }
.section-overdue h4 { color: var(--danger-text); }
.section-overdue .dot { background: var(--danger); }
.section-warning { border-top: 2px solid rgba(217,119,6,.4); background: var(--warning-bg); }
.section-warning h4 { color: var(--warning-text); }
.section-warning .dot { background: var(--warning); }
.section-ok { border-top: 2px solid rgba(5,150,105,.4); background: var(--success-bg); }
.section-ok h4 { color: var(--success-text); }
.section-ok .dot { background: var(--success); }

.deal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 8px; margin-bottom: 4px; transition: all var(--transition);
}
.deal-row:hover { border-color: var(--border); box-shadow: var(--card-shadow); }
.deal-name a { font-weight: 500; color: var(--primary); text-decoration: none; font-size: 13px; }
.deal-name a:hover { text-decoration: underline; }
.deal-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.deal-meta .owner { color: var(--text-secondary); font-weight: 500; }
.sla-badge { font-size: 11px; padding: 3px 10px; border-radius: 99px; font-weight: 500; white-space: nowrap; }
.sla-ok { background: var(--success-bg); color: var(--success-text); }
.sla-warning { background: var(--warning-bg); color: var(--warning-text); }
.sla-overdue { background: var(--danger-bg); color: var(--danger-text); }

/* ===== BAR CHARTS ===== */
.bar-chart { margin-top: 8px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.bar-label { width: 140px; text-align: right; font-size: 12px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--bar-track); border-radius: 99px; height: 26px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; transition: width .6s cubic-bezier(.4,0,.2,1); min-width: 28px; }
.bar-fill span { font-size: 11px; color: #fff; font-weight: 700; }

.stacked-bar { display: flex; height: 26px; border-radius: 99px; overflow: hidden; }
.stacked-bar .segment { display: flex; align-items: center; justify-content: center; min-width: 2px; transition: width .6s ease; }
.stacked-bar .segment span { font-size: 10px; color: #fff; font-weight: 700; }

/* ===== FUNNEL ===== */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-step { display: flex; align-items: center; gap: 14px; padding: 9px 14px; background: var(--surface-hover); border-radius: var(--radius-sm); transition: background var(--transition); }
.funnel-step:hover { background: var(--surface-alt); }
.funnel-step-name { width: 160px; font-size: 13px; font-weight: 500; }
.funnel-step-bar { flex: 1; height: 26px; border-radius: var(--radius-xs); overflow: hidden; background: var(--bar-track); }
.funnel-step-fill { height: 100%; border-radius: var(--radius-xs); display: flex; align-items: center; padding-left: 10px; transition: width .6s ease; }
.funnel-step-fill span { font-size: 12px; font-weight: 700; color: #fff; }
.funnel-step-count { width: 45px; text-align: right; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ===== ALERTS ===== */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 6px; transition: all var(--transition);
}
.alert-item:hover { transform: translateX(2px); }
.alert-critical { background: var(--danger-bg); border: 1px solid rgba(220,38,38,.2); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(217,119,6,.2); }
.alert-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.alert-critical .alert-icon { background: var(--danger); color: #fff; }
.alert-warning .alert-icon { background: var(--warning); color: #fff; }
.alert-icon svg { width: 14px; height: 14px; }
.alert-content { flex: 1; min-width: 0; }
.alert-content .alert-title { font-size: 13px; font-weight: 600; }
.alert-content .alert-title a { color: inherit; text-decoration: none; }
.alert-content .alert-title a:hover { text-decoration: underline; }
.alert-content .alert-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.alert-badge { flex-shrink: 0; }

/* ===== PROGRESS RING ===== */
.progress-ring { width: 48px; height: 48px; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.progress-ring svg { position: absolute; transform: rotate(-90deg); }
.progress-ring .ring-label { font-size: 11px; font-weight: 700; z-index: 1; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.arrow { display: flex; align-items: center; color: var(--text-muted); transition: transform var(--transition); }
.arrow svg { width: 16px; height: 16px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== LOADING ===== */
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 20px; color: var(--text-muted); font-size: 13px; }

/* ===== REFRESH ===== */
.refresh-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: rgba(255,255,255,.35); }
.refresh-dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; animation: pulse 2s infinite; flex-shrink: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.refresh-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--primary); font-weight: 500; }
.refresh-progress.hidden { display: none; }
.refresh-progress-spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.refresh-progress.refresh-warning { color: var(--warning); }
.refresh-progress.refresh-warning .refresh-progress-spinner { border-top-color: var(--warning); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.empty-state svg { width: 36px; height: 36px; color: var(--border); margin-bottom: 10px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { width: 64px; }
  .sidebar .sidebar-brand-text, .sidebar .nav-section-label,
  .sidebar .nav-label, .sidebar .sidebar-footer .nav-label { display: none; }
  .sidebar .sidebar-brand { justify-content: center; padding: 16px 0; gap: 0; }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
  .sidebar .nav-item .nav-badge { position: absolute; top: 2px; right: 2px; font-size: 8px; padding: 1px 4px; min-width: 16px; }
  .sidebar .sidebar-footer { padding: 10px 8px; }
  .sidebar .btn-logout { padding: 8px; justify-content: center; }
  .sidebar .btn-logout span { display: none; }
  .sidebar .refresh-indicator { justify-content: center; }
  .sidebar .sidebar-collapse-btn { display: none; }
  .main { margin-left: 64px !important; }
  .overview-metrics { grid-template-columns: repeat(2, 1fr); }
  .overview-row, .overview-row-equal { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0 !important; }
  #sidebarExpandBtn { display: none !important; }
  .topbar { padding: 10px 16px; }
  .content-area { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-metrics { grid-template-columns: repeat(2, 1fr); }
  .bar-label { width: 90px; font-size: 11px; }
  .funnel-step-name { width: 100px; font-size: 12px; }
  .btn-label { display: none; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .kpi-grid, .overview-metrics { grid-template-columns: 1fr; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
