/* MS Track — "Hype hub" design system (Dom's target, 2026-08-01).
   Deep violet-black, glass bento tiles, purple-blue gradient accents, glow,
   game-hub motion. Single-page app: views swap without reload. */

:root {
  --bg: #0A0714;
  --glass: rgba(24, 18, 38, 0.55);
  --glass-2: rgba(38, 30, 60, 0.5);
  --glass-3: rgba(52, 42, 82, 0.45);
  --stroke: rgba(196, 181, 253, 0.10);
  --stroke-2: rgba(196, 181, 253, 0.2);
  --text: #F5F3FF;
  --muted: #A8A3BD;
  --faint: #6E6A85;
  --v1: #8B5CF6;   /* violet */
  --v2: #4F8CFF;   /* blue   */
  --v3: #EC4899;   /* pink support */
  --good: #3DDC97;
  --warn: #E8B24A;
  --bad: #FF7A7A;
  --grad: linear-gradient(120deg, var(--v1), var(--v2));
  --r-lg: 22px;
  --r-md: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: #A78BFA; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- aurora backdrop ---------------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.aurora i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); opacity: 0.5; will-change: transform;
}
.aurora i:nth-child(1) { width: 720px; height: 720px; left: -220px; top: -260px; background: radial-gradient(circle, rgba(124, 58, 237, 0.5), transparent 65%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 640px; height: 640px; right: -200px; top: 8%; background: radial-gradient(circle, rgba(79, 70, 229, 0.42), transparent 65%); animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 560px; height: 560px; left: 32%; bottom: -300px; background: radial-gradient(circle, rgba(236, 72, 153, 0.2), transparent 65%); animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(120px, 90px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-140px, 110px) scale(0.94); } }
@keyframes drift3 { to { transform: translate(-90px, -120px) scale(1.08); } }

/* ---------------- app frame ---------------- */
#app { display: none; }
#app.on { display: flex; min-height: 100vh; }

aside.side {
  width: 232px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  background: rgba(13, 9, 24, 0.6);
  border-right: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 4px 14px rgba(139, 92, 246, 0.5)); }
.brand .name {
  font-size: 16.5px; font-weight: 800; letter-spacing: 3px;
  background: linear-gradient(100deg, var(--v2), var(--v1) 55%, var(--v3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.sect { font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.sidenav { display: flex; flex-direction: column; gap: 3px; }
.sidenav a {
  display: flex; align-items: center; gap: 11px;
  color: var(--muted); font-weight: 570; font-size: 13.5px;
  padding: 10px 12px; border-radius: 13px; border: 1px solid transparent;
  transition: background 0.18s, color 0.18s, transform 0.18s;
  position: relative; overflow: hidden;
}
.sidenav a svg { width: 17px; height: 17px; opacity: 0.9; }
.sidenav a:hover { color: var(--text); background: var(--glass-2); text-decoration: none; transform: translateX(2px); }
.sidenav a.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.28), rgba(79, 140, 255, 0.2));
  border-color: rgba(139, 92, 246, 0.42);
  box-shadow: 0 0 26px rgba(139, 92, 246, 0.22), inset 0 0 18px rgba(139, 92, 246, 0.08);
}
.sidenav a.active::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.09) 50%, transparent 70%);
  transform: translateX(-100%); animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen { 0%, 55% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }

.side .spacer { flex: 1; }
.side .ws select {
  width: 100%; background: var(--glass-2); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 13px; padding: 9px 10px;
  font: inherit; font-size: 13px; margin-bottom: 10px;
}
.side .user {
  border: 1px solid var(--stroke); background: var(--glass);
  border-radius: 14px; padding: 10px 12px;
  font-size: 12px; color: var(--muted); word-break: break-all;
}
.side .user button { background: none; border: none; color: #A78BFA; cursor: pointer; font: inherit; font-size: 12px; padding: 3px 0 0; }

main { flex: 1; min-width: 0; }
.wrap { max-width: 1220px; margin: 0 auto; padding: 30px 32px 90px; }

/* ---------------- views ---------------- */
.view { display: none; }
.view.on { display: block; animation: viewIn 0.34s cubic-bezier(0.22, 0.8, 0.3, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(0.992); } to { opacity: 1; transform: none; } }

.pagehead { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.pagehead h1 { font-size: 25px; font-weight: 760; letter-spacing: -0.4px; }
.pagehead .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* staggered card entrances */
.view.on .anim { opacity: 0; animation: fadeUp 0.5s cubic-bezier(0.22, 0.8, 0.3, 1) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.card.hoverable:hover { border-color: var(--stroke-2); transform: translateY(-2px); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35), 0 0 30px rgba(139, 92, 246, 0.08); }
.card h2 { font-size: 15px; font-weight: 680; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card .hint { color: var(--muted); font-size: 13px; }

/* ---------------- stat tiles ---------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  padding: 18px 20px 14px; backdrop-filter: blur(14px); position: relative; overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
}
.stat:hover { border-color: rgba(139, 92, 246, 0.4); transform: translateY(-2px); }
.stat::before {
  content: ""; position: absolute; inset: -1px;
  background: radial-gradient(300px 120px at 20% 0%, rgba(139, 92, 246, 0.14), transparent 70%);
  pointer-events: none;
}
.stats .stat:nth-child(2)::before { background: radial-gradient(300px 120px at 20% 0%, rgba(79, 140, 255, 0.15), transparent 70%); }
.stats .stat:nth-child(3)::before { background: radial-gradient(300px 120px at 20% 0%, rgba(236, 72, 153, 0.13), transparent 70%); }
.stat .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); }
.stat .v { font-size: 34px; font-weight: 770; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.stat .d { font-size: 12.5px; color: var(--muted); position: relative; z-index: 1; }
.stat svg.area { position: absolute; right: 0; bottom: 0; width: 58%; height: 48px; opacity: 0.95; }

/* ---------------- charts ---------------- */
.grid2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
.bars { width: 100%; height: 190px; display: block; }
.bars rect { transform-origin: bottom; }
.view.on .bars rect { animation: barGrow 0.7s cubic-bezier(0.22, 0.8, 0.3, 1) backwards; }
@keyframes barGrow { from { transform: scaleY(0); } }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.donutwrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut circle.seg { fill: none; stroke-width: 14; stroke-linecap: butt; transition: stroke-dashoffset 1s cubic-bezier(0.22, 0.8, 0.3, 1); }
.donut text { fill: var(--text); font-weight: 770; font-size: 22px; }
.donut text.sub { fill: var(--faint); font-weight: 600; font-size: 8.5px; letter-spacing: 1px; text-transform: uppercase; }

/* ---------------- live feed ---------------- */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.feed .row {
  display: flex; align-items: center; gap: 11px;
  background: var(--glass-2); border: 1px solid var(--stroke);
  border-radius: 13px; padding: 9px 13px; font-size: 13px;
}
.feed .row.pop { animation: popIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes popIn { from { opacity: 0; transform: translateY(-10px) scale(0.96); } to { opacity: 1; transform: none; } }
.feed .flag { font-size: 16px; }
.feed .what { flex: 1; color: var(--text); }
.feed .what b { font-weight: 640; }
.feed .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.livedot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.5); } 50% { box-shadow: 0 0 0 6px rgba(61, 220, 151, 0); } }

/* ---------------- buttons, inputs ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; border: none; cursor: pointer;
  font: inherit; font-weight: 650; font-size: 13.5px;
  padding: 10px 18px; border-radius: 99px;
  box-shadow: 0 6px 26px rgba(139, 92, 246, 0.35);
  transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
  position: relative; overflow: hidden;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 10px 34px rgba(139, 92, 246, 0.45); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; transform: none; }
.btn.ghost { background: var(--glass-2); color: var(--text); border: 1px solid var(--stroke-2); box-shadow: none; }
.btn.ghost:hover { background: var(--glass-3); filter: none; }
.btn.small { padding: 6px 13px; font-size: 12.5px; }
.btn.danger { background: rgba(255, 122, 122, 0.1); color: var(--bad); border: 1px solid rgba(255, 122, 122, 0.3); box-shadow: none; }

input[type="text"], input[type="email"], input[type="url"] {
  width: 100%; background: rgba(8, 5, 16, 0.65); color: var(--text);
  border: 1px solid var(--stroke-2); border-radius: 13px; padding: 11px 13px; font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { outline: none; border-color: var(--v1); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18), 0 0 20px rgba(139, 92, 246, 0.1); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; font-weight: 590; }
label:first-child { margin-top: 0; }
.fieldnote { font-size: 12px; color: var(--faint); margin-top: 6px; }

/* ---------------- table ---------------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--stroke);
}
td { padding: 13px 14px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.rowlink { cursor: pointer; transition: background 0.15s; }
tr.rowlink:hover td { background: rgba(139, 92, 246, 0.07); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
td.num { font-weight: 660; font-size: 14.5px; }

.linkcell { display: flex; align-items: center; gap: 8px; }
.linkcell .url {
  color: var(--muted); background: rgba(8, 5, 16, 0.55);
  border: 1px solid var(--stroke); border-radius: 9px; padding: 3px 9px;
}
.copy {
  background: transparent; border: 1px solid var(--stroke-2); color: var(--muted);
  border-radius: 99px; padding: 4px 11px; font-size: 11.5px; font-weight: 650; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.copy:hover { color: #fff; border-color: var(--v1); box-shadow: 0 0 14px rgba(139, 92, 246, 0.35); }

/* ---------------- pills ---------------- */
.pill { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: 11px; font-weight: 680; letter-spacing: 0.3px; }
.pill.active { background: rgba(61, 220, 151, 0.12); color: var(--good); border: 1px solid rgba(61, 220, 151, 0.28); }
.pill.pending { background: rgba(232, 178, 74, 0.11); color: var(--warn); border: 1px solid rgba(232, 178, 74, 0.26); }
.pill.unprovisioned, .pill.unconfigured { background: var(--glass-2); color: var(--muted); border: 1px solid var(--stroke); }
.pill.error { background: rgba(255, 122, 122, 0.11); color: var(--bad); border: 1px solid rgba(255, 122, 122, 0.26); }
.pill.up { background: rgba(61, 220, 151, 0.12); color: var(--good); }
.pill.down { background: var(--glass-2); color: var(--muted); }

/* ---------------- sparkline ---------------- */
.spark { display: flex; align-items: flex-end; gap: 2.5px; height: 26px; min-width: 92px; }
.spark i { display: block; width: 5px; min-height: 2px; background: linear-gradient(180deg, var(--v3), var(--v1)); border-radius: 3px; opacity: 0.42; transform-origin: bottom; }
.view.on .spark i { animation: barGrow 0.6s cubic-bezier(0.22, 0.8, 0.3, 1) backwards; animation-delay: calc(var(--i, 0) * 22ms); }
.spark i.hot { opacity: 1; box-shadow: 0 0 10px rgba(139, 92, 246, 0.6); }

/* ---------------- tracking layout ---------------- */
.tracklayout { display: grid; grid-template-columns: 1fr 350px; gap: 14px; align-items: start; }
.createpanel { position: sticky; top: 24px; }
.createpanel .preview {
  margin-top: 12px; padding: 10px 13px; border-radius: 12px;
  background: rgba(8, 5, 16, 0.55); border: 1px dashed var(--stroke-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: #A78BFA;
  word-break: break-all;
}

/* ---------------- modal ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5, 3, 10, 0.75); z-index: 40;
  display: none; align-items: flex-start; justify-content: center; padding: 7vh 16px;
  backdrop-filter: blur(6px);
}
.overlay.open { display: flex; }
.overlay.open .modal { animation: popIn 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.25); }
.modal {
  background: rgba(26, 20, 42, 0.94);
  border: 1px solid var(--stroke-2); border-radius: 24px;
  width: 100%; max-width: 480px; padding: 26px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(139, 92, 246, 0.1);
  backdrop-filter: blur(20px);
}
.modal h3 { font-size: 17.5px; font-weight: 720; margin-bottom: 4px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------------- login ---------------- */
#login { display: none; }
#login.on { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.loginbox { width: 100%; max-width: 408px; animation: fadeUp 0.6s cubic-bezier(0.22, 0.8, 0.3, 1); }
.loginbox .card { padding: 34px; border-radius: 26px; }
.loginlogo { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.loginlogo img { width: 44px; height: 44px; filter: drop-shadow(0 6px 20px rgba(139, 92, 246, 0.55)); }
.loginlogo .t {
  font-size: 24px; font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(100deg, var(--v2), var(--v1) 55%, var(--v3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.loginsub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.gbtn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #16121f; border: none; border-radius: 99px;
  padding: 12px; font: inherit; font-weight: 660; cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s;
}
.gbtn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(255, 255, 255, 0.12); }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 11.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--stroke-2); }

/* ---------------- guides ---------------- */
.tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button {
  background: var(--glass-2); border: 1px solid var(--stroke); color: var(--muted);
  padding: 7px 15px; border-radius: 99px; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer;
  transition: all 0.18s;
}
.tabs button:hover { color: var(--text); border-color: var(--stroke-2); }
.tabs button.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 2px 20px rgba(139, 92, 246, 0.4); }
.guide { display: none; }
.guide.open { display: block; animation: viewIn 0.28s ease; }
.guide h4 { font-size: 14.5px; margin: 16px 0 6px; }
.guide p, .guide li { color: #C9C4DA; font-size: 13.5px; }
.guide ol, .guide ul { padding-left: 22px; margin: 8px 0; }
.guide li { margin: 6px 0; }
.guide code, .record code {
  background: rgba(8, 5, 16, 0.65); border: 1px solid var(--stroke); border-radius: 7px;
  padding: 1px 7px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
}
.callout {
  border: 1px solid rgba(139, 92, 246, 0.32);
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.1), rgba(79, 140, 255, 0.06));
  padding: 12px 16px; border-radius: 15px; margin: 14px 0; font-size: 13px; color: #C9C4DA;
}

.record { display: grid; grid-template-columns: 104px 1fr; gap: 9px 16px; margin: 14px 0; font-size: 13.5px; }
.record .k { color: var(--faint); }

/* ---------------- toast / empty ---------------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(26, 20, 42, 0.96); border: 1px solid var(--stroke-2); color: var(--text);
  padding: 11px 20px; border-radius: 99px; font-size: 13.5px; z-index: 60; opacity: 0;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55), 0 0 30px rgba(139, 92, 246, 0.15);
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty b { color: var(--text); display: block; margin-bottom: 6px; font-size: 15.5px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1020px) { .tracklayout { grid-template-columns: 1fr; } .createpanel { position: static; } }
@media (max-width: 880px) {
  #app.on { flex-direction: column; }
  aside.side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px; padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--stroke); }
  .brand { padding: 0 8px 0 0; }
  .sect { display: none; }
  .sidenav { flex-direction: row; flex-wrap: wrap; }
  .side .spacer, .side .user { display: none; }
  .side .ws { margin-left: auto; }
  .side .ws select { margin: 0; width: auto; }
  .wrap { padding: 20px 14px 70px; }
  .stats, .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
