:root {
  --bg: #f9fafb;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --muted: #6b7280;
  --text: #1f2937;
  --brand: #3b82f6;      /* Primary accent */
  --brand-2: #8b5cf6;    /* Secondary accent */
  --good: #16a34a;
  --warn: #f59e0b;
  --bad:  #ef4444;
  --glass: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box }
html, body { height: 100% }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 10% -10%, rgba(59,130,246,0.12), transparent 40%),
              radial-gradient(1000px 700px at 110% 10%, rgba(139,92,246,0.10), transparent 35%),
              var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
}

/* Shell */
.app-shell { display:flex; min-height:100dvh }

/* Sidebar */
.sidebar {
  width: 260px; flex: 0 0 260px;
  background: linear-gradient(180deg, #fdfdfd, #f5f5f5);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display:flex; align-items:center; gap:12px; padding:8px 6px 18px 6px; border-bottom:1px dashed var(--border); margin-bottom:16px }
.brand-logo {
  width:42px; height:42px; border-radius:12px;
  display:grid; place-items:center; font-weight:800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color:white; box-shadow: var(--shadow);
}
.brand-title { font-weight:800; letter-spacing:.2px }

.side-nav { display:flex; flex-direction:column; gap:6px; margin-top:10px }
.nav-link {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:12px;
  color:var(--text); text-decoration:none;
  border:1px solid transparent;
  transition: background 0.2s ease;
}
.nav-link:hover { background: var(--glass); border-color: var(--border) }
.nav-link.active {
  background:linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.10));
  border-color: transparent;
}

.sidebar-footer { position:absolute; bottom:14px; left:16px; right:16px; color:var(--muted); display:flex; align-items:center; gap:10px }
.mini-badge {
  background:linear-gradient(135deg, var(--brand), var(--brand-2));
  padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; color:white;
}

/* Main */
.main { flex:1; display:flex; flex-direction:column; min-width:0 }

/* Topbar */
.topbar {
  position:sticky; top:0; z-index:9;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 20px; background:rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
}
.page-title { margin:0; font-size:20px; font-weight:800 }
.page-emoji { font-size:22px; margin-right:8px }
.topbar-left { display:flex; align-items:center; gap:10px }
.topbar-right { display:flex; align-items:center; gap:14px }
.search input {
  background:var(--bg-elev); border:1px solid var(--border);
  color:var(--text); padding:10px 12px; border-radius:12px; min-width:260px;
  outline:none;
}
.user-chip {
  display:flex; align-items:center; gap:10px;
  background:var(--bg-elev); border:1px solid var(--border);
  padding:6px 10px; border-radius:999px;
}
.avatar {
  width:26px; height:26px; border-radius:50%;
  background:linear-gradient(135deg, var(--brand), var(--brand-2));
  display:grid; place-items:center; font-weight:800; color:white;
}
.user-name { font-size:13px }

/* Content */
.content { padding:22px 22px 28px; display:flex; flex-direction:column; gap:22px }

/* Hero */
.hero {
  display:grid; grid-template-columns: 1.2fr .8fr; gap:18px; align-items:stretch;
}
.hero-text {
  background:linear-gradient(180deg, rgba(59,130,246,0.08), rgba(139,92,246,0.06));
  border:1px solid var(--border); border-radius:var(--radius); padding:24px;
  box-shadow: var(--shadow);
}
.hero-text h2 { margin:0 0 8px 0; font-size:32px; letter-spacing:.2px }
.muted { color:var(--muted) }
.cta-row { display:flex; gap:10px; margin-top:14px }

/* Glass stats */
.glass {
  background:linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.4));
  border:1px solid var(--border); border-radius:var(--radius); box-shadow: var(--shadow);
}
.hero-stats { display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; padding:12px }
.stat { padding:16px }
.stat-value { font-size:26px; font-weight:800 }
.stat-label { color:var(--muted); font-size:13px }

/* Buttons */
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 14px; border-radius:12px; text-decoration:none; font-weight:700;
  border:1px solid var(--border); color:var(--text);
}
.btn:hover { transform:translateY(-1px) }
.btn-primary { background:linear-gradient(135deg, var(--brand), var(--brand-2)); border-color:transparent; color:white; }
.btn-ghost { background:transparent }

/* Grid / Cards */
.grid-3 { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px }
.card {
  background:var(--panel); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; box-shadow: var(--shadow);
}
.card h3 { margin:0 0 6px 0 }

/* KPI */
.kpi-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap:12px }
.kpi {
  padding:16px; border-radius:var(--radius);
  background:linear-gradient(180deg, rgba(59,130,246,0.10), rgba(139,92,246,0.05));
  border:1px solid var(--border); box-shadow: var(--shadow);
}
.kpi-label { color:var(--muted); font-size:12px }
.kpi-value { font-size:24px; font-weight:800 }

/* Panels */
.panel {
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow: var(--shadow);
}
.panel-header {
  padding:14px 16px; display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--border)
}
.panel-body { padding:16px }
.chart-area { min-height:280px }
.chip {
  background:var(--bg-elev); border:1px solid var(--border); color:var(--text);
  padding:6px 10px; border-radius:999px; font-weight:600; cursor:pointer;
}
.chip-active {
  background:linear-gradient(135deg, rgba(59,130,246,0.10), rgba(139,92,246,0.15));
  border-color:transparent;
}

/* Table */
.table-wrap { overflow:auto; border-radius:12px; border:1px solid var(--border) }
.table { width:100%; border-collapse:separate; border-spacing:0 }
.table thead th {
  text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted);
  padding:12px 12px; background:rgba(0,0,0,0.02);
  position:sticky; top:0;
}
.table tbody td { padding:12px; border-top:1px solid var(--border); vertical-align:top }
.col-text { max-width:560px; white-space:wrap; overflow:hidden }
.badge {
  padding:4px 8px; border-radius:999px; font-size:12px; font-weight:700; display:inline-block;
  background:var(--glass); border:1px solid var(--border);
}
.badge-green { background:rgba(34,197,94,0.15); border-color:rgba(34,197,94,0.35) }
.badge-red { background:rgba(239,68,68,0.15); border-color:rgba(239,68,68,0.35) }
.badge-amber { background:rgba(245,158,11,0.15); border-color:rgba(245,158,11,0.35) }
.score { font-weight:800 }
.table-search {
  background:var(--bg-elev); border:1px solid var(--border); color:var(--text);
  padding:8px 10px; border-radius:10px; min-width:220px;
}

/* Footer */
.footer {
  padding:16px 22px; color:var(--muted); border-top:1px solid var(--border);
  display:flex; gap:8px; align-items:center; justify-content:flex-end;
}
.dot { opacity:.6 }

/* Responsiveness */
@media (max-width: 1100px){
  .grid-3{grid-template-columns:1fr 1fr}
  .kpi-grid{grid-template-columns:1fr 1fr}
  .hero{grid-template-columns:1fr}
  .sidebar{width:220px; flex-basis:220px}
}
@media (max-width: 720px){
  .sidebar{display:none}
  .topbar{position:static}
  .grid-3{grid-template-columns:1fr}
  .kpi-grid{grid-template-columns:1fr 1fr}
  .search input{min-width:unset; width:160px}
}

.nav-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  color: var(--text);
}
.nav-link.active i {
  color: var(--brand);
}

/* WHY Button */
.btn-why {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}
.btn-why:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.btn-why:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Modal styling consistent with dashboard */
#whyModal {
    display: none;
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    max-width: 500px;
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.25s ease-out;
}
#whyModal button {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    margin-top: 12px;
}
#whyModal button:hover {
    background: var(--brand-2);
}

/* Fade-in animation for modal */
@keyframes fadeIn {
    from {opacity: 0; transform: translate(-50%, 15%);}
    to {opacity: 1; transform: translate(-50%, 0);}
}
