/* ═══════════════════════════════════════
   CSSignal Design Enhancements v160
   Additive overrides only — safe to apply
   ═══════════════════════════════════════ */

/* Premium font stack */
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Hard fallback — page is never black even if CSS vars fail */
  background: #111827;
}
html { background: #111827; }
[data-theme="light"] body, [data-theme="light"] html { background: #f7f5ff; }

/* ── SIDEBAR POLISH ── */
[data-theme="dark"] .sidebar {
  background: #161b22;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: none;
}
.sidebar-logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo svg {
  filter: drop-shadow(0 4px 10px rgba(124,92,255,0.3));
  border-radius: 8px;
}
.sidebar-nav { scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

/* Nav items — gradient active state */
.nav-item {
  border-radius: 8px;
  margin-bottom: 2px;
  padding: 9px 10px;
  gap: 10px;
  border-left: none !important;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
/* light nav active — canonical rule lives at bottom of file */
.nav-section-label {
  margin: 16px 0 6px 6px;
  padding: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── CARDS / SECTIONS ── */
.section {
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s;
}
.section:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
}
[data-theme="light"] .section {
  background: #ffffff;
  border: 1px solid #e9ecf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="light"] .section:hover {
  border-color: #c4b8f0;
  box-shadow: 0 4px 16px rgba(124,92,255,0.07), 0 2px 4px rgba(0,0,0,0.04);
}
[data-theme="light"] .rpt-card {
  background: #ffffff;
  border: 1px solid #e9ecf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="light"] .rpt-card:hover {
  border-color: #c4bef0;
  box-shadow: 0 4px 12px rgba(124,106,255,0.12), 0 2px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .rpt-card.active {
  background: #ede9ff;
  border-color: #7c6aff;
  box-shadow: 0 0 0 2px rgba(124,106,255,0.2);
}
[data-theme="light"] .rpt-card.active::after {
  background: #7c6aff;
}

/* ── KPI / STAT CARDS ── */
.stat-card {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border-default, rgba(255,255,255,0.1));
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.4); }
.stat-card:hover::after { opacity: 1; }

/* Bigger, crisper stat numbers */
.stat-value {
  font-size: 2.6rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  line-height: 1.05 !important;
  font-family: 'DM Sans', sans-serif !important;
}
.stat-label {
  font-size: 0.7rem !important;
  letter-spacing: 0.09em !important;
  font-weight: 700 !important;
  margin-bottom: 0.55rem !important;
}

/* ── BUTTONS ── */
.btn {
  border-radius: 8px !important;
  letter-spacing: 0.01em;
  font-weight: 600;
}
.btn-primary {
  box-shadow: 0 2px 8px rgba(124,106,255,0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(124,106,255,0.45) !important;
  transform: translateY(-1px);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── INPUTS FOCUS GLOW ── */
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(124,106,255,0.18) !important;
}
.filter-bar input:focus,
.filter-bar select:focus {
  box-shadow: 0 0 0 3px rgba(124,106,255,0.18) !important;
  border-color: var(--accent) !important;
}

/* ── TASK CARDS ── */
.task-card {
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.18s;
}
.task-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

/* ── REPORT CARDS ── */
.rpt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.15rem;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.rpt-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(124,106,255,0.2);
  transform: translateY(-2px);
}
.rpt-card.active {
  border-color: var(--accent);
  background: rgba(124,106,255,0.1);
  box-shadow: 0 0 0 2px rgba(124,106,255,0.3);
}
.rpt-card.active::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

/* ── ACCOUNT CARDS ── */
.account-card {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.2s;
}
.account-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}

/* ── ALERT CARDS ── */
.alert-card {
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: all 0.18s;
}
.alert-card:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* ── MODALS ── */
.modal-overlay { backdrop-filter: blur(4px); }
.modal-box { border-radius: 16px !important; box-shadow: 0 20px 60px rgba(0,0,0,0.6) !important; }

/* ── TABLE HEADERS ── */
thead th {
  font-size: 0.72rem !important;
  letter-spacing: 0.08em !important;
  font-weight: 700 !important;
}

/* ── BADGES — tighter radius ── */
.badge, .task-badge, .health-badge, .tier-badge {
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
}

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── SECTION HEADERS ── */
.section-header h3 {
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

/* ── PAGE HEADER CONSISTENCY ── */
.container > h2, .container > h1 {
  font-weight: 800;
  letter-spacing: -0.025em;
}

/* ── Nav polish — both themes get gradient active state ── */
.nav-item.active {
  background: linear-gradient(90deg, #7c5cff, #9b87ff) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  border-left: none !important;
  box-shadow: 0 6px 16px rgba(124,92,255,0.3) !important;
  padding: 9px 10px !important;
}
.nav-item:hover:not(.active) {
  background: rgba(124,92,255,0.08);
  color: var(--text);
}

/* ── Light sidebar ── */
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right: 1px solid #eae5ff;
  box-shadow: 2px 0 12px rgba(124,92,255,0.06);
}
[data-theme="light"] .nav-item {
  color: #6b5fa0;
  font-weight: 500;
}
[data-theme="light"] .nav-item:hover:not(.active) {
  background: #f2eeff !important;
  color: #5038d0 !important;
}
[data-theme="light"] .nav-section-label {
  color: #c4b8f0 !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
}

/* ── Dark nav (canonical) ── */
[data-theme="dark"] .nav-item {
  color: #8b949e;
  font-weight: 500;
}
[data-theme="dark"] .nav-item:hover:not(.active) {
  background: rgba(255,255,255,0.04) !important;
  color: #e6edf3 !important;
}
[data-theme="dark"] .nav-section-label {
  color: #484f58 !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
}
