/* Swayantra console — self-branded design system.
   Two skins: Nebula (dark, default) and Aurora (light). All colour is tokenised. */
:root {
  /* Nebula (dark) — default */
  --bg:        #070711;
  --bg-2:      #0d0d1e;
  --surface:   rgba(22, 22, 44, 0.66);
  --surface-2: rgba(30, 30, 58, 0.72);
  --stroke:    rgba(130, 130, 220, 0.16);
  --stroke-2:  rgba(150, 150, 240, 0.30);
  --fg:        #eef0ff;
  --fg-dim:    #a7a9c8;
  --fg-mute:   #6d6f91;
  --brand:     #7c5cff;   /* swa-violet */
  --brand-2:   #26d6c9;   /* yantra-teal */
  --accent:    #ff8a4c;
  --good:      #3ad29f;
  --avg:       #ffce54;
  --poor:      #ff6b7a;
  --glow:      0 0 30px rgba(124, 92, 255, 0.35);
  --radius:    16px;
  --radius-sm: 10px;
  --font:      "Space Grotesk", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono:      "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
:root[data-skin="aurora"] {
  /* Aurora (light) */
  --bg:        #f4f5fb;
  --bg-2:      #e9ebf6;
  --surface:   rgba(255, 255, 255, 0.78);
  --surface-2: rgba(255, 255, 255, 0.92);
  --stroke:    rgba(90, 80, 180, 0.14);
  --stroke-2:  rgba(90, 80, 180, 0.28);
  --fg:        #15162b;
  --fg-dim:    #4a4c6b;
  --fg-mute:   #8688a6;
  --brand:     #6a44ff;
  --brand-2:   #0fb5aa;
  --accent:    #f1681f;
  --good:      #15a97e;
  --avg:       #cf9a12;
  --poor:      #e0485a;
  --glow:      0 0 24px rgba(106, 68, 255, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
#nebula, #particles {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
#particles { opacity: 0.6; }
.app { position: relative; z-index: 2; display: grid; grid-template-columns: 264px 1fr;
       min-height: 100vh; }

/* ---- sidebar ---- */
.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; padding: 20px 14px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-right: 1px solid var(--stroke); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 18px; }
.brand .mark { width: 38px; height: 38px; filter: drop-shadow(var(--glow)); }
.brand .name { font-size: 20px; font-weight: 700; letter-spacing: 0.4px; }
.brand .name small { display: block; font-size: 10.5px; font-weight: 500;
  letter-spacing: 2px; color: var(--brand-2); text-transform: uppercase; }
.nav-group { font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--fg-mute); margin: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: var(--fg-dim); cursor: pointer;
  font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s; }
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item.active { background: linear-gradient(90deg, rgba(124,92,255,.22), rgba(38,214,201,.10));
  color: var(--fg); border-color: var(--stroke-2); box-shadow: var(--glow); }
.nav-item .ic { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item .en { font-size: 10.5px; color: var(--fg-mute); font-weight: 500; }
.nav-item .lab { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.nav-item .lab b { font-weight: 600; }

/* ---- main ---- */
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.topbar .sub { color: var(--fg-dim); font-size: 13px; margin-top: 3px; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.chip { font-size: 11.5px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--stroke-2); color: var(--fg-dim); background: var(--surface);
  display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 8px var(--good); }
.skin-toggle { cursor: pointer; width: 40px; height: 24px; border-radius: 999px;
  border: 1px solid var(--stroke-2); background: var(--surface-2); position: relative; }
.skin-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px;
  height: 18px; border-radius: 50%; background: var(--brand); transition: left .2s; box-shadow: var(--glow); }
:root[data-skin="aurora"] .skin-toggle::after { left: 18px; background: var(--accent); }

/* ---- cards & grid ---- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 18px 20px; backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); min-width: 0; }
.card.pad-lg { padding: 22px 24px; }
.stat .k { font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--fg-mute); display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums;
  margin-top: 8px; letter-spacing: -.5px; }
.stat .v small { font-size: 15px; color: var(--fg-dim); font-weight: 500; }
.stat .d { font-size: 12px; color: var(--fg-dim); margin-top: 4px; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; letter-spacing: .2px; }
.card h3 .en { color: var(--fg-mute); font-weight: 500; font-size: 12px; }

.badge { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  letter-spacing: .3px; }
.b-good { background: rgba(58,210,159,.16); color: var(--good); }
.b-avg  { background: rgba(255,206,84,.16); color: var(--avg); }
.b-poor { background: rgba(255,107,122,.16); color: var(--poor); }
.b-kev  { background: rgba(255,107,122,.2); color: var(--poor); }

/* bars */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 7px 0; }
.meter-row .lab { font-size: 13px; color: var(--fg-dim); }
.meter-row .val { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--fg-mute); font-weight: 500; font-size: 11px;
  letter-spacing: .5px; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--stroke); }
td { padding: 10px; border-bottom: 1px solid var(--stroke); color: var(--fg); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }

/* ring */
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; position: relative; }
.ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--bg-2); }
.ring .inner { position: relative; text-align: center; }
.ring .inner b { font-size: 30px; font-variant-numeric: tabular-nums; }
.ring .inner span { display: block; font-size: 10.5px; color: var(--fg-mute);
  letter-spacing: 1px; text-transform: uppercase; }

/* pipeline svg */
.pipeline { width: 100%; height: auto; }
.pipeline .node rect { fill: var(--surface-2); stroke: var(--stroke-2); }
.pipeline .node text { fill: var(--fg); font-size: 11px; font-family: var(--font); }
.pipeline .flow { stroke: var(--brand); stroke-width: 2; fill: none;
  stroke-dasharray: 7 7; animation: dash 1.1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -14; } }

/* settings */
.set-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--stroke); align-items: start; }
.set-row:last-child { border-bottom: none; }
.set-row .key { font-family: var(--mono); font-size: 12px; color: var(--brand-2); }
.set-row .key small { display: block; color: var(--fg-mute); font-family: var(--font); font-size: 11px; margin-top: 3px; }
.set-row pre { margin: 0; font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim);
  white-space: pre-wrap; word-break: break-word; background: var(--bg-2);
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--stroke); }

.pill-tier { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--stroke); }

.muted { color: var(--fg-mute); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.btn { cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--stroke-2);
  background: linear-gradient(90deg, rgba(124,92,255,.9), rgba(38,214,201,.8)); color: #fff; }
.btn.ghost { background: var(--surface); color: var(--fg-dim); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--stroke-2);
  border-top-color: var(--brand); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.section-title { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--fg-mute); margin: 26px 2px 12px; }
.loading { display: grid; place-items: center; height: 60vh; color: var(--fg-dim); gap: 14px; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 264px; transform: translateX(-110%);
    transition: transform .22s; }
  .side.open { transform: none; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }
