:root {
  --background: #fbfcff;
  --bg-2: #f5f7fa;
  --foreground: #0e1116;
  --ink: #0e1116;
  --card: #ffffff;
  --card-foreground: #0e1116;
  --muted: #f1f4f9;
  --muted-foreground: #6b717c;
  --primary: #0e1116;
  --primary-foreground: #ffffff;
  --secondary: #f6f8fb;
  --secondary-foreground: #0e1116;
  --border: rgba(12, 16, 22, .10);
  --border-strong: rgba(12, 16, 22, .16);
  --input: rgba(12, 16, 22, .14);
  --ring: #7b5cf0;
  --success: #1f9d63;
  --warning: #ca8a04;
  --accent: #2f6df0;
  --accent-2: #7b5cf0;
  --serif-accent: #ec6a45;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --brand-grad: linear-gradient(135deg, #6d28d9 0%, #c026d3 58%, #ec4899 100%);
  --accent-grad: linear-gradient(100deg, var(--accent), var(--accent-2));
  --shadow-sm: 0 1px 2px rgba(12, 16, 22, .05);
  --shadow-card: 0 1px 2px rgba(12, 16, 22, .04), 0 18px 40px -28px rgba(20, 30, 60, .42);
  --shadow-lift: 0 1px 2px rgba(12, 16, 22, .05), 0 30px 60px -36px rgba(20, 30, 60, .55);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(46% 38% at 84% 2%, rgba(123, 92, 240, .10), transparent 60%),
    radial-gradient(40% 34% at 6% 6%, rgba(47, 109, 240, .09), transparent 58%),
    radial-gradient(60% 50% at 50% 120%, rgba(192, 38, 211, .05), transparent 60%),
    var(--background);
  color: var(--foreground);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .03) 1px, transparent 1px),
    radial-gradient(circle, rgba(47, 109, 240, .16) 1px, transparent 1.5px);
  background-size: 72px 72px, 72px 72px, 24px 24px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .34) 52%, transparent);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .34) 52%, transparent);
}

body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  min-width: 0;
  margin: 0 auto;
}

/* ============ EYEBROW ============ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--accent);
  font-size: 11.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 18px;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 1px var(--accent);
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: 14px;
  background: linear-gradient(180deg, rgba(251, 252, 255, .92), rgba(251, 252, 255, 0));
}

.topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 14px 0 20px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 18px;
  background: rgba(255, 255, 255, .56);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  backdrop-filter: blur(22px) saturate(185%);
  box-shadow: 0 10px 34px -18px rgba(22, 32, 60, .4), inset 0 1px 0 rgba(255, 255, 255, .7);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.01em;
  transition: opacity .2s;
}

.brand:hover { opacity: .8; }

.brand b {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .02em;
}

.brand > span {
  color: var(--muted-foreground);
  font-weight: 400;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
  animation: vortexGlow 3.5s ease-in-out infinite;
}

.brand-mark svg { display: block; width: 100%; height: 100%; }

.brand-mark .vortex-spin {
  animation: vortexSpin 14s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--foreground);
  background: rgba(255, 255, 255, .7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), var(--shadow-sm);
  transition: transform .16s var(--ease), box-shadow .2s, border-color .2s, color .2s;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 92, 240, .34);
  color: var(--accent-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .96), 0 16px 30px -22px rgba(109, 40, 217, .7);
}

.icon-button svg { width: 18px; height: 18px; }

@keyframes vortexSpin { to { transform: rotate(360deg); } }

@keyframes vortexGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(139, 92, 246, .45)); }
  50% { filter: drop-shadow(0 0 10px rgba(192, 38, 211, .7)) drop-shadow(0 0 16px rgba(139, 92, 246, .3)); }
}

/* ============ LOGIN HERO ============ */
.hero-grid {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 1.04fr .96fr;
  gap: 48px;
  align-items: center;
  padding: 46px 0;
}

.hero-grid > *,
.app-layout > *,
.grid > *,
.content > *,
.content,
.page-head,
.page-head > * { min-width: 0; }

.page-title {
  margin: 0;
  font-size: clamp(40px, 5.6vw, 70px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 600;
}

.page-title em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--serif-accent);
}

.page-title .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  max-width: 560px;
  color: #4b515c;
  font-size: 16.5px;
  line-height: 1.66;
  margin: 26px 0 0;
}

.hero-points {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
  max-width: 460px;
}

.hero-points li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: start;
  font-size: 14.5px;
  line-height: 1.5;
  color: #4b515c;
}

.hero-points .hp-ic {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(47, 109, 240, .08);
  box-shadow: inset 0 0 0 1px rgba(47, 109, 240, .14);
}

.hero-points .hp-ic svg { width: 15px; height: 15px; }
.hero-points b { color: var(--ink); font-weight: 600; }

/* ============ APP LAYOUT (dashboard) ============ */
.app-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 30px;
  padding: 28px 0 64px;
}

.sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(246, 248, 251, .82));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
}

.sidebar-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 6px 12px 8px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 500;
  transition: color .18s, background .18s;
}

.nav-item svg { width: 17px; height: 17px; }

.nav-item:hover {
  color: var(--foreground);
  background: rgba(12, 16, 22, .04);
}

.nav-item.active {
  color: var(--foreground);
  background: linear-gradient(100deg, rgba(47, 109, 240, .12), rgba(123, 92, 240, .08));
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-grad);
}

.nav-item.active svg { color: var(--accent); }

.sidebar-foot {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.content {
  display: grid;
  gap: 26px;
}

.content > section { display: grid; gap: 18px; scroll-margin-top: 96px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(27px, 3.4vw, 40px);
  letter-spacing: -.04em;
  line-height: 1.02;
  font-weight: 600;
}

.page-head h1 em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--serif-accent);
}

.page-head p {
  margin: 9px 0 0;
  color: var(--muted-foreground);
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.page-head p strong { color: var(--foreground); font-weight: 600; }

[data-user-email] { overflow-wrap: anywhere; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(21px, 2.4vw, 27px);
  letter-spacing: -.03em;
  font-weight: 600;
}

.section-head p { margin: 7px 0 0; color: var(--muted-foreground); font-size: 14px; }
.section-eyebrow { margin-bottom: 12px; }

/* ============ GRID ============ */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

/* ============ KPI STAT CARDS ============ */
.kpi {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f6f8fb);
  box-shadow: var(--shadow-card);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}

.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: rgba(47, 109, 240, .2); }

.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.kpi-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.kpi-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(47, 109, 240, .08);
  box-shadow: inset 0 0 0 1px rgba(47, 109, 240, .14);
}

.kpi-ic svg { width: 16px; height: 16px; }

.kpi-value {
  margin-top: 16px;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-value .unit { font-size: 14px; color: var(--muted-foreground); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.kpi-sub { margin-top: 8px; font-size: 12.5px; color: var(--muted-foreground); }

/* ============ CARD ============ */
.card {
  position: relative;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color .22s, box-shadow .22s, transform .22s var(--ease);
}

.card:hover {
  border-color: rgba(47, 109, 240, .2);
  box-shadow: var(--shadow-lift);
}

.card-header { padding: 22px 24px 0; }

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 600;
}

.card-description {
  margin: 8px 0 0;
  color: var(--muted-foreground);
  line-height: 1.56;
  font-size: 14px;
}

.card-content { padding: 22px 24px; }
.card-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px 22px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ============ BUTTON ============ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 20px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: transform .18s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s, opacity .2s;
}

.button svg { width: 16px; height: 16px; }
.button:hover { transform: translateY(-1px); background: #1b2230; }

.button.secondary {
  background: rgba(255, 255, 255, .8);
  color: var(--secondary-foreground);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
  background: #fff;
  border-color: rgba(47, 109, 240, .32);
  color: var(--accent);
}

.button.ghost { background: transparent; color: var(--muted-foreground); }
.button.ghost:hover { background: rgba(12, 16, 22, .05); color: var(--foreground); }

.button.link {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
}

.button.link:hover { transform: none; text-decoration: underline; }

.button[disabled], .button.disabled { opacity: .55; pointer-events: none; }
.button.disabled:not([disabled]) { cursor: not-allowed; pointer-events: auto; }

.button:focus-visible,
.input:focus-visible,
.tab-trigger:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(47, 109, 240, .2);
}

/* ============ BADGE ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0 11px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .03em;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted-foreground);
  background: rgba(255, 255, 255, .82);
}

.badge svg { width: 13px; height: 13px; }

.badge.success {
  border-color: rgba(31, 157, 99, .26);
  color: #15803d;
  background: rgba(31, 157, 99, .09);
}

.badge.warning {
  border-color: rgba(202, 138, 4, .26);
  color: #a16207;
  background: rgba(202, 138, 4, .09);
}

.badge.grad {
  border-color: transparent;
  color: #fff;
  background: var(--brand-grad);
}

/* ============ FORM ============ */
.form { display: grid; gap: 16px; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field { display: grid; gap: 8px; }
.label { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }

.input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .94);
  padding: 0 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.input::placeholder { color: #9aa0aa; }

.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(123, 92, 240, .16);
}

select.input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #7b8494 50%),
    linear-gradient(135deg, #7b8494 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.checkbox-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.55;
}

.checkbox-row input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

/* ============ TABS ============ */
.tabs { display: grid; gap: 18px; }

.tabs-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border-radius: 999px;
  background: var(--muted);
  padding: 5px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.tab-trigger {
  border: 0;
  border-radius: 999px;
  background: transparent;
  min-height: 38px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color .18s, background .18s, box-shadow .18s;
}

.tab-trigger.active {
  background: #fff;
  color: var(--foreground);
  box-shadow: 0 6px 16px -12px rgba(15, 23, 42, .6), inset 0 0 0 1px rgba(226, 232, 240, .8);
}

.tab-panel[hidden] { display: none; }

/* ============ TRIAL RING + PROGRESS ============ */
.trial-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 26px;
  align-items: center;
}

.ring {
  --value: 0%;
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    conic-gradient(var(--accent) 0, var(--accent-2) var(--value), rgba(12, 16, 22, .07) var(--value));
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(12, 16, 22, .04);
}

.ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #f6f8fb);
  box-shadow: 0 6px 16px -12px rgba(20, 30, 60, .5);
}

.ring-inner { position: relative; z-index: 1; text-align: center; }
.ring-inner b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.ring-inner span {
  display: block;
  margin-top: 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(12, 16, 22, .07);
  box-shadow: inset 0 0 0 1px var(--border);
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  border-radius: inherit;
  background: var(--accent-grad);
  transition: width .6s var(--ease);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, #f6f8fb);
  padding: 14px 15px;
}

.metric b { display: block; font-size: 24px; letter-spacing: -.04em; font-weight: 600; line-height: 1; }
.metric span { display: block; margin-top: 6px; color: var(--muted-foreground); font-size: 12px; }

/* ============ DOWNLOAD CARDS ============ */
.download-card, .plan-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 196px;
}

.download-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-2);
  background: linear-gradient(160deg, rgba(47, 109, 240, .1), rgba(123, 92, 240, .12));
  box-shadow: inset 0 0 0 1px rgba(123, 92, 240, .18);
}

.download-icon svg { width: 22px; height: 22px; }

.download-card.recommended {
  border-color: rgba(47, 109, 240, .4);
  box-shadow: 0 1px 2px rgba(12, 16, 22, .04), 0 26px 56px -36px rgba(47, 109, 240, .8);
}

.download-card.recommended::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: var(--accent-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .5;
  pointer-events: none;
}

/* ============ ONBOARDING ============ */
.onboarding-card {
  border-color: rgba(47, 109, 240, .22);
  background:
    linear-gradient(180deg, rgba(47, 109, 240, .04), transparent 34%),
    var(--card);
}

.onboarding-card.is-complete {
  border-color: rgba(22, 163, 74, .22);
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ============ PLAN CARDS ============ */
.plan-card .price { margin-top: 8px; }
.plan-card .plan-note { margin: 9px 0 18px; min-height: 18px; }

.price {
  font-size: 34px;
  letter-spacing: -.04em;
  font-weight: 600;
  line-height: 1;
}

.price span {
  white-space: nowrap;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.price .plan-amount {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

.billing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  box-shadow: var(--shadow-soft);
  justify-self: end;
}

.billing-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  transition: color .2s;
}

.billing-label.on { color: var(--foreground); }

.billing-switch {
  position: relative;
  width: 48px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: #e7ebf2;
  box-shadow: inset 0 0 0 1px rgba(12, 16, 22, .08);
  transition: background .25s;
}

.billing-switch::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 7px 16px -8px rgba(12, 16, 22, .55);
  transition: transform .25s var(--ease);
}

.billing-switch.on,
.billing-switch[aria-checked="true"] {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
}

.billing-switch.on::after,
.billing-switch[aria-checked="true"]::after { transform: translateX(20px); }

.billing-switch:focus-visible {
  outline: 3px solid rgba(47, 109, 240, .22);
  outline-offset: 3px;
}

.billing-save {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(47, 109, 240, .08);
}

.plan-card.featured {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 26%),
    linear-gradient(180deg, #0e1116, #1b2230);
  border-color: transparent;
  box-shadow: 0 30px 60px -34px rgba(20, 30, 60, .7);
}

.plan-card.featured .card-title,
.plan-card.featured .price { color: #fff; }
.plan-card.featured .price span,
.plan-card.featured .card-description,
.plan-card.featured .muted { color: #cbd5e1; }
.plan-card.featured .list { color: #cfd6e6; }
.plan-card.featured .list svg { color: #7fd8ff; }
.plan-card.featured .badge { background: var(--brand-grad); color: #fff; border-color: transparent; }
.plan-card.featured .download-icon { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.plan-card.featured .billing-save,
.plan-card.featured .plan-note { color: #cbd5e1; }

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--muted-foreground);
  font-size: 13.5px;
}

.list li { display: flex; gap: 9px; align-items: flex-start; line-height: 1.45; }
.list svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }

/* ============ TABLE ============ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th, .table td {
  padding: 13px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table tr:last-child th, .table tr:last-child td { border-bottom: 0; }

.table th {
  color: var(--muted-foreground);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 500;
}

.table td { font-weight: 500; }

.muted { color: var(--muted-foreground); }
.small { font-size: 13px; line-height: 1.5; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lift);
  padding: 14px 16px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}

.toast.show { opacity: 1; transform: none; }

/* ============ DIVIDER / OAUTH ============ */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-foreground);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.divider::before, .divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-providers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* ============ GREETING HERO ============ */
.hero-greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 180% at 100% 0%, rgba(123, 92, 240, .07), transparent 60%),
    linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: var(--shadow-card);
}

.greet-left { display: flex; align-items: center; gap: 18px; min-width: 0; }

.date-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
  flex-shrink: 0;
}

.date-pill .d-num {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.date-pill .d-rest { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.32; }
.date-pill .d-rest b { display: block; color: var(--foreground); font-weight: 600; font-size: 14px; }

.greet-h { font-size: clamp(21px, 2.5vw, 29px); font-weight: 600; letter-spacing: -.03em; margin: 0; line-height: 1.05; }
.greet-h em { font-family: "Instrument Serif", Georgia, serif; font-style: italic; color: var(--serif-accent); font-weight: 400; }
.greet-sub { margin: 6px 0 0; color: var(--muted-foreground); font-size: 14px; overflow-wrap: anywhere; }
.greet-sub strong { color: var(--foreground); font-weight: 600; }
.greet-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ BENTO ============ */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.bento > * { min-width: 0; }
.b-trial { grid-column: span 3; grid-row: span 2; display: flex; flex-direction: column; }
.b-4 { grid-column: span 3; }
.b-3 { grid-column: span 3; }
.b-12 { grid-column: span 6; }
.b-trial .card-content { flex: 1; }

.tile-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tile-k {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* shipped sparkline tile */
.spark-num { margin-top: 14px; display: flex; align-items: baseline; gap: 10px; }
.spark-num b { font-size: 38px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.delta {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: #15803d;
  background: rgba(31, 157, 99, .1);
  padding: 3px 9px;
  border-radius: 999px;
}
.delta.down { color: #b91c1c; background: rgba(185, 28, 28, .08); }
.spark-svg { width: 100%; height: 54px; display: block; margin-top: 14px; overflow: visible; }

/* aether tile */
.aether { display: flex; align-items: center; gap: 15px; margin-top: 14px; }
.aether-av {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 15px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -.02em;
  box-shadow: 0 12px 26px -12px rgba(192, 38, 211, .6);
}
.aether-name { font-size: 18px; font-weight: 600; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }
.aether-role { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: var(--muted-foreground); margin-top: 3px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(31, 157, 99, .5); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(31, 157, 99, .5); } 70% { box-shadow: 0 0 0 7px rgba(31, 157, 99, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 157, 99, 0); } }
.aether-state { margin-top: 14px; font-size: 13.5px; color: #4b515c; line-height: 1.5; }
.aether-state .mono { color: var(--accent); }

/* crew tile */
.crew { margin-top: 12px; display: flex; flex-direction: column; }
.crew-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.crew-row:last-child { border-bottom: 0; }
.crew-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.crew-role { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); min-width: 64px; }
.crew-name { font-weight: 500; letter-spacing: -.01em; }
.crew-name em { font-style: normal; color: var(--serif-accent); }

/* activity manager */
.act-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.act-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  transition: color .18s, background .18s;
}
.chip.on { background: #fff; color: var(--foreground); box-shadow: inset 0 0 0 1px var(--border-strong); }
.act-list { display: flex; flex-direction: column; margin-top: 6px; }

.act-empty {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  color: var(--muted-foreground);
  background: rgba(255, 255, 255, .58);
}

.act-empty b {
  color: var(--foreground);
}

.act-empty span {
  font-size: 13px;
  line-height: 1.5;
}
.act-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 15px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.act-item:last-child { border-bottom: 0; }
.act-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.act-ic svg { width: 17px; height: 17px; }
.act-ic.plan { color: var(--accent); background: rgba(47, 109, 240, .1); }
.act-ic.build { color: var(--accent-2); background: rgba(123, 92, 240, .12); }
.act-ic.test { color: var(--success); background: rgba(31, 157, 99, .1); }
.act-ic.ship { color: #c026d3; background: rgba(192, 38, 211, .1); }
.act-text { font-size: 14px; letter-spacing: -.01em; line-height: 1.35; }
.act-text .ic { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .86em; background: rgba(12, 16, 22, .06); padding: 1px 7px; border-radius: 6px; }
.act-text .act-sub { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted-foreground); }
.act-phase {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.act-phase.plan { color: var(--accent); background: rgba(47, 109, 240, .1); }
.act-phase.build { color: var(--accent-2); background: rgba(123, 92, 240, .12); }
.act-phase.test { color: #15803d; background: rgba(31, 157, 99, .1); }
.act-phase.ship { color: #a21caf; background: rgba(192, 38, 211, .1); }
.act-time { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; }

@media (max-width: 1080px) {
  .bento { grid-template-columns: repeat(4, 1fr); }
  .b-trial { grid-column: span 2; }
  .b-4 { grid-column: span 2; }
  .b-3 { grid-column: span 2; }
  .b-12 { grid-column: span 4; }
}

@media (max-width: 760px) {
  .section-head { align-items: flex-start; flex-direction: column; }
  .billing-toggle { justify-self: start; flex-wrap: wrap; border-radius: 18px; }
}

/* setup checklist */
.check-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.check-list li { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--foreground); font-weight: 500; }
.check-list li:last-child { border-bottom: 0; }
.check-list li a { display: flex; align-items: center; gap: 11px; color: var(--accent); }
.check-list li a:hover { text-decoration: underline; }
.cl-ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; background: rgba(12, 16, 22, .05); color: var(--muted-foreground); }
.cl-ic svg { width: 13px; height: 13px; }
.check-list li.done { color: var(--muted-foreground); }
.check-list li.done .cl-ic { background: rgba(31, 157, 99, .12); color: var(--success); }

/* privacy / local-first panel */
.privacy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 22px; }
.pv-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--accent-2); background: linear-gradient(160deg, rgba(47, 109, 240, .1), rgba(123, 92, 240, .12)); box-shadow: inset 0 0 0 1px rgba(123, 92, 240, .18); }
.pv-ic svg { width: 18px; height: 18px; }
.pv b { display: block; margin: 13px 0 6px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.pv p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted-foreground); }
@media (max-width: 760px) { .privacy-grid { grid-template-columns: 1fr; } }

/* plan-aware views (body.is-paid set by portal.js for active paid subscriptions) */
body:not(.is-paid) [data-plan-view="paid"] { display: none !important; }
body.is-paid [data-plan-view="trial"] { display: none !important; }

/* sync note */
.sync-note { display: inline-flex; align-items: center; gap: 7px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10.5px; letter-spacing: .02em; color: var(--muted-foreground); }
.sync-note .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.kpi-value.pos { color: var(--success); }

/* subscription / payment card */
.paycard { position: relative; overflow: hidden; border-radius: 16px; padding: 20px; color: #fff; background: radial-gradient(130% 150% at 100% 0%, rgba(192, 38, 211, .42), transparent 52%), linear-gradient(135deg, #2a2350, #11151d); box-shadow: 0 20px 40px -22px rgba(20, 30, 60, .65); }
.paycard::after { content: ""; position: absolute; right: -28px; top: -28px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(123, 92, 240, .5), transparent 70%); pointer-events: none; }
.paycard-top { display: flex; align-items: center; justify-content: space-between; position: relative; }
.pc-plan { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.pc-brand { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .22em; color: rgba(255, 255, 255, .55); }
.pc-price { margin-top: 16px; font-size: 30px; font-weight: 600; letter-spacing: -.04em; line-height: 1; position: relative; }
.pc-price .pc-per { font-size: 13px; color: rgba(255, 255, 255, .55); font-weight: 500; letter-spacing: 0; margin-left: 5px; }
.pc-dots { display: block; margin-top: 18px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; letter-spacing: .16em; color: rgba(255, 255, 255, .9); position: relative; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .04em; color: rgba(255, 255, 255, .55); position: relative; }

/* ============ STATUS BANNER ============ */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-card);
}
.banner[hidden] { display: none; }
.banner > svg, .banner > [data-lucide] { width: 20px; height: 20px; flex-shrink: 0; }
.banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.banner b { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.banner span { font-size: 13px; color: var(--muted-foreground); line-height: 1.45; }
.banner .button { flex-shrink: 0; min-height: 40px; }
.banner.warn { border-color: rgba(202, 138, 4, .3); background: linear-gradient(180deg, rgba(202, 138, 4, .07), #fff); }
.banner.warn > svg, .banner.warn > [data-lucide], .banner.warn b { color: #a16207; }
.banner.danger { border-color: rgba(190, 40, 40, .3); background: linear-gradient(180deg, rgba(190, 40, 40, .07), #fff); }
.banner.danger > svg, .banner.danger > [data-lucide], .banner.danger b { color: #b91c1c; }
.banner.info { border-color: rgba(47, 109, 240, .3); background: linear-gradient(180deg, rgba(47, 109, 240, .06), #fff); }
.banner.info > svg, .banner.info > [data-lucide], .banner.info b { color: var(--accent); }

/* ============ ACTIVITY EMPTY STATE ============ */
[data-activity="empty"] { display: none; }
body.no-activity [data-activity="synced"] { display: none; }
body.no-activity [data-activity="empty"] { display: block; }
.empty-state .card-content { text-align: center; padding: 44px 24px; }
.empty-ic {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  background: linear-gradient(160deg, rgba(47, 109, 240, .1), rgba(123, 92, 240, .12));
  box-shadow: inset 0 0 0 1px rgba(123, 92, 240, .18);
}
.empty-ic svg { width: 24px; height: 24px; }
.empty-state h2 { margin-top: 16px; }

/* ============ TRIAL RING URGENCY ============ */
.ring.warn { background: conic-gradient(#f59e0b 0, #f97316 var(--value), rgba(12, 16, 22, .07) var(--value)); }
.ring.danger { background: conic-gradient(#ef4444 0, #dc2626 var(--value), rgba(12, 16, 22, .07) var(--value)); }

/* ============ LOADING SKELETON ============ */
@keyframes shimmer { 100% { background-position: -200% 0; } }
body.is-loading [data-skel] {
  color: transparent !important;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef1f6 25%, #e2e7ef 37%, #eef1f6 63%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  -webkit-text-fill-color: transparent;
}
body.is-loading [data-skel] * { visibility: hidden; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .hero-grid, .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .sidebar-label, .sidebar-foot { display: none; }
  .nav-item.active::before { display: none; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .metric-row, .span-2 { grid-template-columns: 1fr; grid-column: auto; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .bento > *, .b-trial, .b-4, .b-3, .b-12 { grid-column: auto; grid-row: auto; }
  .b-trial { grid-row: auto; }
  .hero-greet { flex-direction: column; align-items: flex-start; }
  .greet-actions { width: 100%; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trial-layout { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 18px; }
  .act-item { grid-template-columns: auto 1fr auto; }
  .act-item .act-phase { display: none; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); }
  .topbar { padding-top: 10px; }
  .topbar-inner { height: auto; padding: 14px; align-items: flex-start; flex-direction: column; border-radius: 16px; }
  .top-actions { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .topbar .top-actions { gap: 8px; }
  .topbar .top-actions .icon-button { width: 42px; flex-basis: 42px; }
  .topbar .top-actions .button { width: auto; flex: 1 1 calc(50% - 4px); min-width: 0; padding-inline: 14px; }
  .hero-grid { padding: 28px 0; gap: 28px; align-items: start; }
  .page-title { font-size: clamp(32px, 9.6vw, 42px); line-height: 1.04; letter-spacing: -.035em; }
  .lead { font-size: 16px; line-height: 1.6; }
  .grid.cols-4 { grid-template-columns: 1fr; }
  .card { width: 100%; min-width: 0; }
  .hero-grid > section { width: 100%; min-width: 0; }
  .field-row { grid-template-columns: 1fr; }
  .tabs-list, .tab-trigger { min-width: 0; }
  .card-header, .card-content { padding-left: 18px; padding-right: 18px; }
  .card-footer { padding-left: 18px; padding-right: 18px; flex-direction: column; align-items: stretch; }
  .button { width: 100%; }
  .button.link { width: auto; display: inline-flex; }
  .page-head .top-actions .button { width: 100%; flex: 1 1 100%; }
  .auth-providers { grid-template-columns: 1fr; }
  .banner { flex-wrap: wrap; }
  .banner .button { width: 100%; }
}

@media (max-width: 420px) {
  .page-title { font-size: 31px; }
  .lead { font-size: 15.5px; }
  .topbar .top-actions .button { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .brand-mark, .brand-mark .vortex-spin { animation: none; }
  .progress > span { transition: none; }
}
