:root {
  color-scheme: light;
  --ink: #21142f;
  --ink-soft: #51455f;
  --muted: #766b82;
  --purple-950: #160c24;
  --purple-900: #241036;
  --purple-800: #381653;
  --purple-700: #592486;
  --purple-600: #7539ad;
  --purple-500: #9254c8;
  --cyan: #51b9d2;
  --surface: rgba(255, 255, 255, .76);
  --line: rgba(93, 53, 123, .13);
  --line-light: rgba(255, 255, 255, .54);
  --shadow: 0 18px 50px rgba(54, 24, 76, .09);
  --shadow-soft: 0 8px 24px rgba(54, 24, 76, .065);
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% -4%, rgba(130, 75, 186, .22), transparent 30%),
    radial-gradient(circle at 42% 22%, rgba(77, 187, 211, .12), transparent 26%),
    linear-gradient(145deg, #f8f5fb 0%, #f1edf7 49%, #f8f6fb 100%);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .34;
  background-image: radial-gradient(rgba(73, 35, 101, .16) .55px, transparent .55px);
  background-size: 20px 20px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}
button, input, select { font: inherit; }
button, input, select { min-height: 44px; border-radius: 13px; padding: 0 13px; }
input, select {
  min-width: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, .76);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, select:focus {
  border-color: rgba(117, 57, 173, .44);
  background: rgba(255,255,255,.96);
  box-shadow: 0 0 0 4px rgba(117, 57, 173, .09);
  outline: 0;
}
button {
  border: 1px solid transparent;
  color: white;
  font-weight: 680;
  cursor: pointer;
  background: linear-gradient(135deg, var(--purple-700), var(--purple-600));
  box-shadow: 0 8px 18px rgba(89, 36, 134, .16), inset 0 1px 0 rgba(255,255,255,.15);
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 11px 25px rgba(89, 36, 134, .2), inset 0 1px 0 rgba(255,255,255,.17); }
button:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: default; transform: none; }
:focus-visible { outline: 3px solid rgba(61, 171, 199, .42); outline-offset: 3px; }
label { display: grid; gap: 6px; font-size: .76rem; font-weight: 680; color: var(--ink-soft); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 4vw, 3.65rem); line-height: 1; letter-spacing: -.065em; font-weight: 700; }
h2 { margin-bottom: 15px; font-size: 1.32rem; letter-spacing: -.035em; }
h3 { margin-bottom: 6px; font-size: 1rem; letter-spacing: -.022em; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.5);
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5);
}
.brand strong { display: block; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 3px; color: inherit; opacity: .6; font-size: .7rem; }

/* Dashboard shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 100dvh;
  padding: 23px 17px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 10% 5%, rgba(160, 84, 210, .34), transparent 28%),
    radial-gradient(circle at 90% 82%, rgba(73, 180, 204, .15), transparent 34%),
    linear-gradient(170deg, rgba(42, 18, 62, .97), rgba(21, 10, 33, .99));
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 15px 0 48px rgba(28, 10, 43, .1);
}
.sidebar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(120deg, rgba(255,255,255,.055), transparent 26%); }
.sidebar > * { position: relative; z-index: 1; }
.sidebar .brand { padding: 2px 7px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav::before { content: "WORKSPACE"; padding: 0 11px 7px; color: rgba(255,255,255,.35); font-size: .58rem; font-weight: 750; letter-spacing: .15em; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 0 12px;
  border-radius: 13px;
  color: rgba(255,255,255,.67);
  text-decoration: none;
  font-size: .79rem;
  font-weight: 570;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.sidebar nav a::before { content: ""; width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 2px; opacity: .72; }
.sidebar nav a:hover { color: white; background: rgba(255,255,255,.07); transform: translateX(2px); }
.sidebar nav a[aria-current] { color: var(--purple-950); background: rgba(255,255,255,.94); box-shadow: 0 8px 22px rgba(0,0,0,.12), inset 0 1px 0 white; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; }
.live-status { display: flex; align-items: center; gap: 8px; padding: 0 10px; color: rgba(255,255,255,.55); font-size: .65rem; }
.live-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #67e3b2; box-shadow: 0 0 0 4px rgba(103,227,178,.1); }
.sidebar form { margin: 0; }
.sidebar button { width: 100%; color: rgba(255,255,255,.72); background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.11); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.sidebar button:hover { color: white; background: rgba(255,255,255,.09); }
.dashboard { width: min(100%, 1580px); min-width: 0; padding: 31px clamp(18px, 3.5vw, 54px) 24px; margin: 0 auto; }
.heading {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 22px;
  margin-bottom: 16px;
  padding: 27px 29px;
  border: 1px solid var(--line-light);
  border-radius: 28px;
  background: linear-gradient(120deg, rgba(255,255,255,.78), rgba(255,255,255,.48));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
}
.heading::after { content: ""; position: absolute; width: 230px; height: 230px; right: -68px; top: -112px; border-radius: 50%; background: linear-gradient(140deg, rgba(145,75,199,.19), rgba(71,190,210,.13)); }
.heading > * { position: relative; z-index: 1; }
.eyebrow { color: var(--purple-600); font-size: .66rem; letter-spacing: .15em; font-weight: 780; margin-bottom: 10px; }
.subtitle { max-width: 650px; margin-top: 10px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
#status { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 23px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}
.filters label { max-width: 100%; }
#search { width: min(320px, 100%); }
.dashboard section { margin-bottom: 29px; scroll-margin: 22px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; }
.section-heading p { color: var(--muted); font-size: .75rem; }
.grid, .kpis { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
article {
  min-width: 0;
  padding: 19px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255,255,255,.88);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
article:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.96); box-shadow: var(--shadow), inset 0 1px 0 white; }
.kpis article { position: relative; min-height: 154px; overflow: hidden; padding: 20px; }
.kpis article::before { content: ""; position: absolute; width: 72px; height: 72px; right: -28px; top: -30px; border-radius: 50%; background: linear-gradient(145deg, rgba(143,80,195,.21), rgba(80,188,210,.12)); }
.kpis article::after { content: ""; position: absolute; left: 20px; top: 0; width: 38px; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--purple-500), var(--cyan)); }
.kpi-label { color: var(--muted); font-size: .7rem; font-weight: 720; text-transform: uppercase; letter-spacing: .075em; }
.kpis strong { display: block; margin-top: 19px; font-size: 2.25rem; line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--muted); font-size: .69rem; }
.kpi-foot .percent-pill { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; color: var(--purple-700); font-weight: 740; border: 1px solid rgba(117,57,173,.12); border-radius: 999px; background: rgba(140,76,194,.08); }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 15px; }
.card-head h3 { margin: 0; }
.card-head p, .note, .login p { color: var(--muted); font-size: .74rem; line-height: 1.5; }
.card-summary { text-align: right; color: var(--muted); font-size: .68rem; }
.card-summary strong { display: block; color: var(--ink); font-size: .9rem; }
.note { margin-top: 12px; }
.rank { display: grid; gap: 13px; }
.rank-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; overflow-wrap: anywhere; font-size: .79rem; }
.rank-heading > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.rank-value { display: inline-flex; align-items: baseline; gap: 7px; flex: 0 0 auto; }
.rank-value strong { font-variant-numeric: tabular-nums; }
.rank-percent { color: var(--purple-600); font-size: .68rem; font-weight: 720; }
meter { width: 100%; height: 8px; appearance: none; }
meter::-webkit-meter-bar { background: rgba(89,36,134,.08); border: 0; border-radius: 999px; }
meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, var(--purple-500), var(--cyan)); border-radius: 999px; }
meter::-moz-meter-bar { background: linear-gradient(90deg, var(--purple-500), var(--cyan)); border-radius: 999px; }
.chart-wrap { position: relative; min-height: 215px; }
svg.chart { display: block; width: 100%; min-height: 205px; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid-line { stroke: rgba(90,52,117,.1); stroke-dasharray: 3 5; }
.chart .chart-bar { cursor: crosshair; transform-origin: bottom; transition: opacity .14s ease, filter .14s ease; }
.chart .chart-bar:hover, .chart .chart-bar:focus { opacity: .84; filter: drop-shadow(0 7px 8px rgba(89,36,134,.2)); outline: none; }
.chart-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  min-width: 124px;
  padding: 10px 12px;
  color: white;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: rgba(27, 12, 41, .92);
  box-shadow: 0 18px 40px rgba(23,9,34,.25), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  opacity: 0;
  transform: translateY(5px) scale(.98);
  transition: opacity .1s ease, transform .1s ease;
  font-size: .7rem;
}
.chart-tooltip.show { opacity: 1; transform: translateY(0) scale(1); }
.chart-tooltip strong { display: block; margin-top: 3px; font-size: .85rem; }
.table-card { padding: 15px; }
.table-card .filters { margin-bottom: 12px; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .77rem; text-align: left; }
th, td { padding: 12px 11px; border-bottom: 1px solid rgba(93,53,123,.09); white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: rgba(248,245,251,.96); font-size: .67rem; text-transform: uppercase; letter-spacing: .055em; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: rgba(143,80,195,.045); }
.paging { display: flex; gap: 8px; margin-top: 12px; }
.secondary { color: var(--purple-700); background: rgba(255,255,255,.7); border-color: var(--line); box-shadow: inset 0 1px 0 white; }
.secondary:hover { background: rgba(255,255,255,.96); }
.dashboard-footer { padding: 9px 12px 2px; text-align: center; color: rgba(81,69,95,.58); font-size: .65rem; letter-spacing: .02em; }
.dashboard-footer strong { color: var(--purple-600); font-weight: 680; }

/* Login */
body.login-page {
  display: grid;
  place-items: center;
  padding: 28px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(174, 96, 220, .32), transparent 28%),
    radial-gradient(circle at 88% 86%, rgba(72, 190, 211, .22), transparent 30%),
    linear-gradient(145deg, #1e0d2f 0%, #34144f 47%, #170c25 100%);
}
body.login-page::after { content: ""; position: fixed; width: 520px; height: 520px; right: -230px; top: -260px; border-radius: 50%; border: 1px solid rgba(255,255,255,.07); box-shadow: 0 0 0 62px rgba(255,255,255,.018), 0 0 0 125px rgba(255,255,255,.012); pointer-events: none; }
.login-layout { position: relative; z-index: 1; width: min(1040px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); gap: clamp(38px, 8vw, 105px); align-items: center; }
.login-intro { color: white; padding: 24px 4px; }
.login-intro .brand { margin-bottom: 52px; }
.login-intro .brand img { width: 58px; height: 58px; border-radius: 18px; }
.login-intro .brand strong { font-size: 1.1rem; }
.login-intro .brand small { color: rgba(255,255,255,.62); opacity: 1; }
.login-kicker { margin-bottom: 14px; color: #bcdfea; font-size: .67rem; font-weight: 760; letter-spacing: .17em; }
.login-intro h1 { max-width: 560px; font-size: clamp(2.8rem, 6vw, 5.15rem); font-weight: 650; }
.login-intro h1 span { color: transparent; background: linear-gradient(90deg, #d7a9f3, #8fe0ed); background-clip: text; -webkit-background-clip: text; }
.login-intro > p { max-width: 500px; margin-top: 20px; color: rgba(255,255,255,.62); font-size: .91rem; line-height: 1.65; }
.login {
  position: relative;
  overflow: hidden;
  padding: 30px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(255,255,255,.18), rgba(255,255,255,.09));
  box-shadow: 0 30px 90px rgba(0,0,0,.27), inset 0 1px 0 rgba(255,255,255,.25);
  backdrop-filter: blur(32px) saturate(140%);
  -webkit-backdrop-filter: blur(32px) saturate(140%);
  color: white;
}
.login::before { content: ""; position: absolute; width: 160px; height: 160px; right: -85px; top: -90px; border-radius: 50%; background: rgba(119,202,220,.13); }
.login .mini-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 36px; color: rgba(255,255,255,.6); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; }
.login .mini-brand::before { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, #c894e8, #73cedf); }
.login h2 { margin-bottom: 10px; font-size: 2rem; letter-spacing: -.045em; }
.login p { color: rgba(255,255,255,.58); }
.login form { display: grid; gap: 15px; margin-top: 27px; }
.login label { color: rgba(255,255,255,.7); }
.login input { color: white; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.09); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.login input::placeholder { color: rgba(255,255,255,.32); }
.login input:focus { border-color: rgba(164,104,208,.7); background: rgba(255,255,255,.13); box-shadow: 0 0 0 4px rgba(171,104,219,.12); }
.login button { margin-top: 4px; background: linear-gradient(135deg, #8e4bc1, #5e2c92 62%, #3f8ba7); }
.login .error { margin-top: 13px; padding: 10px 12px; color: #ffe4e8; border: 1px solid rgba(255,163,177,.2); border-radius: 12px; background: rgba(123,34,55,.25); }
.login-credit { margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.38); font-size: .65rem; text-align: center; }
.login-credit strong { color: rgba(255,255,255,.65); font-weight: 650; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (max-width: 1120px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 840px) {
  .login-layout { grid-template-columns: 1fr; gap: 24px; width: min(500px, 100%); }
  .login-intro { padding: 0; }
  .login-intro .brand { margin-bottom: 30px; }
  .login-intro h1 { font-size: clamp(2.45rem, 11vw, 4rem); }
  .login-intro > p { display: none; }
  .shell { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 9px; }
  .sidebar .brand { padding: 0; border: 0; }
  .sidebar .brand img { width: 42px; height: 42px; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; overflow: auto; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav::before { display: none; }
  .sidebar nav a { flex: 0 0 auto; white-space: nowrap; }
  .sidebar-bottom { margin: auto 0; }
  .live-status { display: none; }
  .sidebar form { margin: 0; }
  .sidebar button { width: auto; }
  .dashboard { padding-top: 18px; }
}
@media (max-width: 620px) {
  body.login-page { align-items: start; padding: 21px 16px; }
  .login-intro .brand { margin-bottom: 22px; }
  .login-intro h1 { font-size: 2.75rem; }
  .login { padding: 24px 20px; border-radius: 25px; }
  .heading { display: block; padding: 23px 20px; }
  #status { margin-top: 14px; white-space: normal; }
  .grid, .kpis { grid-template-columns: 1fr; }
  .kpis article { min-height: 142px; }
  .filters { align-items: stretch; }
  .filters > * { width: 100%; }
  .filters button { width: 100%; }
  .table-card .filters { display: grid; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 4px; }
}
