

:root {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --background: 0 0% 100%;
  --foreground: 240 10% 9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 9%;

  --primary: 240 10% 9%;
  --primary-foreground: 0 0% 100%;

  --brand: 243 75% 59%;
  --brand-foreground: 0 0% 100%;
  --brand-2: 271 76% 53%;
  --brand-soft: 243 100% 97%;

  --secondary: 240 5% 96%;
  --secondary-foreground: 240 10% 9%;
  --muted: 240 5% 96%;
  --muted-foreground: 240 5% 45%;
  --accent: 240 5% 96%;
  --accent-foreground: 240 10% 9%;

  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;

  --border: 240 6% 90%;
  --input: 240 6% 90%;
  --ring: 240 10% 9%;

  --chart-1: 240 10% 20%;
  --chart-2: 173 58% 39%;
  --chart-3: 27 87% 67%;
  --chart-4: 200 70% 50%;
  --chart-5: 340 60% 50%;

  --radius: 0.625rem;

  --sidebar-background: 240 6% 98%;
  --sidebar-foreground: 240 8% 28%;
  --sidebar-primary: 240 10% 9%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 240 5% 94%;
  --sidebar-accent-foreground: 240 10% 9%;
  --sidebar-border: 240 6% 90%;
  --sidebar-ring: 240 10% 9%;

  --sidebar: var(--sidebar-background);
}

.dark {
  --background: 240 8% 6%;
  --foreground: 0 0% 96%;
  --card: 240 7% 9%;
  --card-foreground: 0 0% 96%;
  --popover: 240 7% 9%;
  --popover-foreground: 0 0% 96%;

  --primary: 0 0% 96%;
  --primary-foreground: 240 10% 9%;

  --brand: 245 80% 68%;
  --brand-foreground: 240 10% 9%;
  --brand-2: 271 80% 68%;
  --brand-soft: 243 40% 16%;

  --secondary: 240 6% 13%;
  --secondary-foreground: 0 0% 96%;
  --muted: 240 6% 13%;
  --muted-foreground: 240 5% 64%;
  --accent: 240 6% 15%;
  --accent-foreground: 0 0% 96%;

  --destructive: 0 63% 50%;
  --destructive-foreground: 0 0% 96%;

  --border: 240 6% 16%;
  --input: 240 6% 16%;
  --ring: 0 0% 96%;

  --chart-1: 0 0% 92%;
  --chart-2: 160 60% 50%;
  --chart-3: 30 80% 60%;
  --chart-4: 200 70% 60%;
  --chart-5: 340 60% 55%;

  --sidebar-background: 240 8% 7%;
  --sidebar-foreground: 240 5% 78%;
  --sidebar-primary: 0 0% 96%;
  --sidebar-primary-foreground: 240 10% 9%;
  --sidebar-accent: 240 6% 12%;
  --sidebar-accent-foreground: 0 0% 96%;
  --sidebar-border: 240 6% 16%;
  --sidebar-ring: 0 0% 96%;
  --sidebar: var(--sidebar-background);
}

html, body { height: 100%; }
html, body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  letter-spacing: -0.005em;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.35);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.bg-stripe-mesh {
  background-image:
    radial-gradient(at 12% -6%, hsl(var(--primary) / 0.06) 0px, transparent 50%),
    radial-gradient(at 88% 8%, hsl(var(--accent) / 0.6) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsl(var(--primary) / 0.03) 0px, transparent 50%);
}
.bg-stripe-lines {
  background-image: repeating-linear-gradient(135deg,
    hsl(var(--primary) / 0.03) 0px, hsl(var(--primary) / 0.03) 1px,
    transparent 1px, transparent 16px);
}
.hairline { box-shadow: inset 0 0 0 1px hsl(var(--border)); }
.elev-1 {
  box-shadow:
    0 1px 2px hsl(var(--foreground) / 0.04),
    0 0 0 1px hsl(var(--border) / 0.6);
}
.elev-2 {
  box-shadow:
    0 8px 24px -6px hsl(var(--foreground) / 0.08),
    0 2px 6px -2px hsl(var(--foreground) / 0.04);
}
.glow-ring {
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.35), 0 8px 30px -6px hsl(var(--primary) / 0.25);
}
.text-gradient-brand {
  background: linear-gradient(135deg, hsl(var(--foreground)) 0%, hsl(var(--muted-foreground)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-gradient-color {
  background: linear-gradient(115deg, hsl(var(--brand)) 0%, hsl(var(--brand-2)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bg-brand-mesh {
  background-image:
    radial-gradient(at 8% -10%, hsl(var(--brand) / 0.18) 0px, transparent 50%),
    radial-gradient(at 92% 0%, hsl(var(--brand-2) / 0.16) 0px, transparent 45%),
    radial-gradient(at 50% 110%, hsl(var(--brand) / 0.08) 0px, transparent 55%);
}
.bg-brand-gradient {
  background-image: linear-gradient(115deg, hsl(var(--brand)) 0%, hsl(var(--brand-2)) 100%);
}
.glow-brand { box-shadow: 0 10px 40px -8px hsl(var(--brand) / 0.45); }

@keyframes orbit-spin     { from { transform: rotate(0deg); }   to { transform: rotate(360deg); } }
@keyframes orbit-spin-rev { from { transform: rotate(0deg); }   to { transform: rotate(-360deg); } }
@keyframes orbit-glow     { 0%,100% { opacity: 0.45; } 50% { opacity: 0.7; } }
.orbit-ring-inner { animation: orbit-spin 44s linear infinite; }
.orbit-ring-outer { animation: orbit-spin-rev 64s linear infinite; }
.orbit-chip-inner { animation: orbit-spin-rev 44s linear infinite; }
.orbit-chip-outer { animation: orbit-spin 64s linear infinite; }
.orbit-glow { animation: orbit-glow 6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .orbit-ring-inner, .orbit-ring-outer, .orbit-chip-inner, .orbit-chip-outer, .orbit-glow { animation: none; }
}

.typing-caret::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 4px;
  margin-bottom: 1px;
  border-radius: 9999px;
  background: hsl(var(--primary));
  vertical-align: baseline;
  animation: caretPulse 1.05s ease-in-out infinite;
}
@keyframes caretPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.72); }
}
@media (prefers-reduced-motion: reduce) {
  .typing-caret::after { animation: none; }
}
@keyframes indeterminate-slide { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.shimmer {
  background: linear-gradient(90deg,
    hsl(var(--muted)) 0%, hsl(var(--accent)) 50%, hsl(var(--muted)) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.6s linear infinite;
}
.msg-enter { animation: msg-in 0.25s ease both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

.px-typing { display: inline-flex; align-items: center; gap: 3px; }

.px-typing.hidden { display: none; }
.px-typing i { width: 4px; height: 4px; border-radius: 9999px; background: currentColor;
               opacity: .35; animation: pxTyping 1.2s ease-in-out infinite; }
.px-typing i:nth-child(2) { animation-delay: .18s; }
.px-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes pxTyping { 0%, 70%, 100% { opacity: .3; transform: translateY(0); }
                      35% { opacity: 1; transform: translateY(-3px); } }

.ag-pop { animation: agPop .42s cubic-bezier(.2,.9,.3,1.15) both; animation-delay: calc(var(--i,0) * 70ms); }
@keyframes agPop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.ag-pop .ag-stage-dot { animation: agBadge .42s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: inherit; }
@keyframes agBadge { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ag-pop .ag-port { animation: agPing .6s ease-out both; animation-delay: calc(var(--i,0) * 70ms + 120ms); }
@keyframes agPing { 0% { box-shadow: 0 0 0 0 var(--ag-accent); } 100% { box-shadow: 0 0 0 9px transparent; } }

.ag-canvas {
  position: relative;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;

  background:
    radial-gradient(at 12% -6%, hsl(var(--primary) / 0.06) 0px, transparent 50%),
    radial-gradient(at 88% 8%, hsl(var(--accent) / 0.6) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsl(var(--primary) / 0.03) 0px, transparent 50%),
    hsl(var(--background));
}
.ag-canvas.ag-grabbing { cursor: grabbing; }

body.ag-panning, body.ag-panning * {
  -webkit-user-select: none !important;
          user-select: none !important;
  cursor: grabbing !important;
}
.ag-canvas::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;

  background-image:
    radial-gradient(hsl(var(--foreground) / 0.045) 1px, transparent 1.4px);

  background-size:
    calc(22px * var(--ag-bg-s, 1)) calc(22px * var(--ag-bg-s, 1));
  background-position: var(--ag-bg-x, 0px) var(--ag-bg-y, 0px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 6%, black 94%, transparent);
          mask-image: linear-gradient(to bottom, transparent, black 6%, black 94%, transparent);
}

.ag-controls {
  position: absolute; left: 14px; bottom: 14px; z-index: 6;
  display: flex; flex-direction: column;
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  background: hsl(var(--card) / 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px hsl(var(--foreground) / 0.05);
  overflow: hidden;
}
.ag-ctl-btn {
  width: 34px; height: 32px; display: grid; place-items: center;
  color: hsl(var(--foreground) / 0.6); background: transparent;
  border: 0; border-bottom: 1px solid hsl(var(--border) / 0.6);
  cursor: pointer; transition: background .14s ease, color .14s ease;
}
.ag-ctl-btn:hover { background: hsl(var(--brand) / 0.10); color: hsl(var(--brand)); }
.ag-ctl-btn:active { background: hsl(var(--brand) / 0.18); }
.ag-ctl-zoom {
  padding: 5px 0 6px; text-align: center; min-width: 34px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  color: hsl(var(--foreground) / 0.55); font-variant-numeric: tabular-nums;
}
.dark .ag-canvas::before {
  background-image:
    radial-gradient(hsl(var(--foreground) / 0.07) 1px, transparent 1.4px);
}

.ag-blueprint-shell { position: relative; width: min(100%, 760px); margin-inline: 0; transform-origin: 0 0; will-change: transform; }

.ag-blueprint-hero {
  position: relative; overflow: hidden;
  border-radius: 1rem;
  border: 1px solid hsl(var(--border));
  background:
    linear-gradient(135deg, hsl(var(--card) / 0.96), hsl(var(--muted) / 0.34)),
    radial-gradient(circle at 95% 0%, hsl(var(--brand) / 0.14), transparent 22rem);
  box-shadow: 0 1px 3px hsl(var(--foreground) / 0.05);
}
.ag-blueprint-hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; z-index: 1;
  background: linear-gradient(115deg, hsl(var(--brand)), hsl(var(--brand-2)));
  opacity: .9;
}
.ag-blueprint-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, hsl(var(--background) / 0.46), transparent);
  transform: translateX(-100%);
  animation: agBlueprintSheen 5.5s ease-in-out infinite;
}
@keyframes agBlueprintSheen {
  0%, 54% { transform: translateX(-115%); opacity: 0; }
  68% { opacity: .7; }
  100% { transform: translateX(115%); opacity: 0; }
}

.ag-stage-list {
  position: relative;
  --ag-spine-top: 18px;
  --ag-drawn: 100%;
}

.ag-spine {
  position: absolute; left: 27px;
  top: var(--ag-spine-top, 18px);
  height: calc(var(--ag-drawn, 100%) - var(--ag-spine-top, 18px));
  width: 2px; z-index: 0; pointer-events: none;
}
.ag-spine::before {
  content: ""; position: absolute; inset: 0; border-radius: 9999px;
  background: repeating-linear-gradient(180deg,
    hsl(var(--foreground) / 0.18) 0 6px, transparent 6px 12px);
  opacity: .5;
}
.ag-spine::after {
  content: ""; position: absolute; left: 0; top: 0; width: 2px; height: 100%;
  border-radius: 9999px;
  background: linear-gradient(180deg,
    hsl(var(--brand)), hsl(var(--brand-2)) 52%, hsl(var(--chart-2)) 100%);
  opacity: .55;
}
.dark .ag-spine::before { opacity: .6; }
.dark .ag-spine::after { opacity: .72; }

.ag-flow-dot {
  position: absolute; left: 25.5px;
  top: var(--ag-spine-top, 18px);
  width: 5px; height: 5px; z-index: 1;
  border-radius: 9999px;
  background: var(--ag-accent, hsl(var(--brand)));
  box-shadow: 0 0 8px 2px hsl(var(--brand) / 0.8); opacity: 0; pointer-events: none;
}
.ag-building .ag-flow-dot { animation: agFlowDot 2.4s ease-in-out infinite; }
@keyframes agFlowDot {
  0%   { top: var(--ag-spine-top, 18px); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: var(--ag-drawn, 100%); opacity: 0; }
}

.ag-stage {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: .75rem;
  padding-bottom: 28px;
}
.ag-stage:last-child { padding-bottom: 4px; }
.ag-stage-rail { display: flex; flex-direction: column; align-items: center; }

.ag-stage-dot {
  position: relative; z-index: 2;
  width: 36px; height: 36px; border-radius: .9rem;
  display: grid; place-items: center;
  background: hsl(var(--card));
  border: 1.5px solid var(--ag-accent, hsl(var(--brand)));
  color: var(--ag-accent, hsl(var(--brand)));
  box-shadow: 0 0 0 5px hsl(var(--background));
}

.ag-stage:not(:last-child) .ag-stage-dot::after {
  content: ""; position: absolute; z-index: -1;
  top: 50%; left: 100%; width: 22px; height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--ag-accent), transparent);
  opacity: .5;
}

.ag-building .ag-stage:last-of-type .ag-stage-dot {
  box-shadow:
    0 0 0 5px hsl(var(--background)),
    0 0 0 7px var(--ag-accent);
  animation: agDotPulse 1.8s ease-in-out infinite;
}
@keyframes agDotPulse { 50% { box-shadow: 0 0 0 5px hsl(var(--background)), 0 0 0 9px transparent; } }

.ag-stage-dot.ag-cap {
  background: var(--ag-accent); color: var(--ag-cap-ink, #1a1205);
  border-color: var(--ag-accent);
}
.dark .ag-stage-dot.ag-cap { color: hsl(var(--background)); }

.ag-rail-spacer { flex: 1 1 auto; min-height: 6px; }
.ag-chev {
  display: grid; place-items: center;
  width: 36px; height: 22px; margin: 0;
  color: var(--ag-next, var(--ag-accent)); opacity: .5;
}
.ag-stage:last-child .ag-chev,
.ag-stage:last-child .ag-rail-spacer { display: none; }

.ag-stage-title {
  display: block; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: .12em; text-transform: uppercase;
  font-size: 10.5px; font-weight: 750; line-height: 1;
  color: var(--ag-accent, hsl(var(--brand)));
}
.ag-term {
  flex: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px; font-weight: 700; letter-spacing: .14em;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 6px;
  padding: 1px 5px; margin-left: 6px;
}

.ag-node {
  position: relative; isolation: isolate;
  transition: border-color .15s ease, background .15s ease;
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.035);
}

.ag-node::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 9999px;
  background: linear-gradient(180deg, var(--ag-accent), transparent);
  transition: opacity .15s ease; opacity: .85;
}

.ag-node::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--ag-accent-soft), transparent 55%);
  opacity: .5;
}
.ag-node > * { position: relative; z-index: 1; }

.ag-fan-multi .ag-node::after { opacity: .28; }

.ag-port {
  position: absolute; left: -4px; top: 19px; width: 8px; height: 8px; z-index: 2;
  border-radius: 9999px; background: hsl(var(--card));
  border: 1.5px solid var(--ag-accent);
}

.ag-ico {
  height: 40px; width: 40px; border-radius: .75rem;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--ag-accent-12, hsl(var(--muted)));
  border: 1px solid var(--ag-accent-35, hsl(var(--border)));
  color: var(--ag-accent);
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.18);
}
button.ag-node { cursor: pointer; }
button.ag-node:hover {
  border-color: hsl(var(--foreground) / 0.22);
}
button.ag-node:hover::before { opacity: 1; }
button.ag-node:hover .ag-chevron { transform: translateX(2px); color: var(--ag-accent); }
.ag-chevron { transition: transform .15s ease, color .15s ease; }

.ag-cap { transition: border-color .15s ease, background .15s ease; }
.ag-cap:hover {
  border-color: var(--ag-accent-35, hsl(var(--border)));
}

.ag-fan { position: relative; }
.ag-fan > * + * { margin-top: 12px; }

.ag-ghost { border-style: dashed !important; background: hsl(var(--card) / 0.4) !important; box-shadow: none !important; }
.ag-ghost .ag-ico { background: hsl(var(--muted) / 0.5); border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); box-shadow: none; }
.ag-ghost::before, .ag-ghost::after { opacity: .25; }
.ag-stage-dot.ag-ghost-dot {
  background: hsl(var(--card)); border: 1.5px dashed hsl(var(--muted-foreground) / 0.5);
  color: hsl(var(--muted-foreground)); box-shadow: 0 0 0 5px hsl(var(--background));
  animation: none;
}
.ag-stage-dot.ag-ghost-dot::after { background: linear-gradient(90deg, hsl(var(--muted-foreground) / 0.4), transparent); }
.ag-ghost-shimmer { position: relative; overflow: hidden; }
.ag-ghost-shimmer::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, transparent, hsl(var(--foreground) / 0.05), transparent);
  transform: translateX(-100%); animation: agGhostSheen 1.8s ease-in-out infinite;
}
@keyframes agGhostSheen { 100% { transform: translateX(100%); } }
.ag-building-note { display: flex; align-items: center; gap: 8px; justify-content: center; color: hsl(var(--muted-foreground)); font-size: 12px; }

.ag-notes { margin-top: 1rem; padding-left: 68px; display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 767px) {
  .ag-node { padding: .75rem .875rem; }

  .ag-blueprint-shell .ag-stage-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-pop, .ag-pop .ag-stage-dot, .ag-pop .ag-port,
  .ag-blueprint-hero::after, .ag-ghost-shimmer::after,
  .ag-building .ag-flow-dot, .ag-building .ag-stage:last-of-type .ag-stage-dot {
    animation: none !important;
  }
}

.input {
  width: 100%;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}
/* Defined well + readable placeholder so empty fields never read as faint outlines
   floating on white (and stay legible on dark cards). */
.input { box-shadow: inset 0 1px 2px hsl(var(--foreground) / 0.045); }
.input::placeholder { color: hsl(var(--muted-foreground) / 0.7); }
.input:hover { border-color: hsl(var(--foreground) / 0.22); }
.input:focus { border-color: hsl(var(--brand)); box-shadow: 0 0 0 3px hsl(var(--brand) / 0.15), inset 0 1px 2px hsl(var(--foreground) / 0.04); }
/* Make room for a leading icon / trailing button inside an .input (no build step,
   so Tailwind's !pl-10 isn't compiled — these real classes always apply). */
.input-lead { padding-left: 2.5rem !important; }
.input-trail { padding-right: 2.75rem !important; }

.ts-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.375rem;
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-weight: 600; font-size: 0.875rem;
  border-radius: var(--radius); padding: 0.625rem 1.25rem;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: hsl(var(--brand)); color: hsl(var(--brand-foreground));
  font-weight: 600; font-size: 0.875rem;
  border-radius: var(--radius); padding: 0.625rem 1.25rem;
  transition: filter 0.15s;
}
.btn-brand:hover { filter: brightness(1.08); }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  font-weight: 600; font-size: 0.875rem;
  border-radius: var(--radius); padding: 0.625rem 1.25rem;
  transition: background 0.15s;
}
.btn-secondary:hover { background: hsl(var(--muted)); }

/* Marketing primary CTA — white on a brand→violet gradient (AA-safe + premium),
   pill-shaped with a soft brand glow. Never depends on --brand-foreground (which
   flips in dark mode), so it can't render dark text on the indigo pill. */
.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  color: #fff !important;
  background-image: linear-gradient(118deg, hsl(243 72% 56%) 0%, hsl(271 76% 53%) 100%);
  font-weight: 600; font-size: 0.9rem; line-height: 1; white-space: nowrap;
  border-radius: 9999px; padding: 0.8rem 1.45rem;
  box-shadow: 0 1px 2px hsl(var(--brand) / 0.35), 0 10px 26px -12px hsl(var(--brand) / 0.6);
  transition: transform .15s ease, box-shadow .2s ease, filter .15s ease;
}
.btn-cta:hover { filter: brightness(1.06); transform: translateY(-1px);
  box-shadow: 0 2px 6px hsl(var(--brand) / 0.4), 0 16px 36px -12px hsl(var(--brand-2) / 0.65); }
.btn-cta:active { transform: translateY(0); }
.btn-cta:disabled { opacity: 0.5; cursor: not-allowed; filter: none; transform: none;
  box-shadow: 0 1px 2px hsl(var(--brand) / 0.2); }
.btn-cta svg { stroke: #fff; }
.btn-cta-sm { height: 2.25rem; padding: 0 1.1rem; font-size: 0.875rem; }
.btn-cta-lg { font-size: 1rem; padding: 0.95rem 1.8rem; }

/* Password reveal toggle (auth forms): swap eye / eye-off glyphs. */
.pw-eye .eye-off { display: none; }
.pw-eye.is-revealed .eye-on { display: none; }
.pw-eye.is-revealed .eye-off { display: inline; }

.opt-prose {
  font-size: 16px;
  line-height: 1.75;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum", "lnum", "ss01", "cv11";
}

.kit-card {
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04),
              0 1px 3px hsl(var(--foreground) / 0.03);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}

@keyframes pxWidgetDone {
  0%, 100% { box-shadow: 0 0 0 0 hsl(var(--foreground) / 0.04); }
  50% { box-shadow: 0 0 0 4px hsl(346 90% 60% / 0.18); }
}
.px-widget-done { animation: pxWidgetDone 1s ease-in-out 3; }

.kit-xlsx table { border-collapse: collapse; font-size: 12px; }
.kit-xlsx td, .kit-xlsx th {
  border: 1px solid hsl(var(--border)); padding: 4px 9px;
  white-space: nowrap; color: hsl(var(--foreground)); max-width: 360px;
  overflow: hidden; text-overflow: ellipsis;
}
.kit-xlsx tr:first-child td { background: hsl(var(--muted)); font-weight: 600; }
.kit-xlsx td[data-t="n"] { text-align: right; font-variant-numeric: tabular-nums; }

.kit-docx { color: #1a1a1a; background: #fff; border-radius: 8px; }
.kit-docx * { max-width: 100%; }

.kit-hscroll { scrollbar-width: thin; scrollbar-color: hsl(var(--border)) transparent; }
.kit-hscroll::-webkit-scrollbar { height: 7px; }
.kit-hscroll::-webkit-scrollbar-track { background: transparent; }
.kit-hscroll::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 9999px; }
.kit-hscroll::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.4); }

.kit-card-i { cursor: pointer; }
.kit-card-i:hover {
  box-shadow: 0 12px 28px -10px hsl(var(--foreground) / 0.14),
              0 2px 6px -2px hsl(var(--foreground) / 0.05);
  transform: translateY(-1px);
  border-color: hsl(var(--border));
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .kit-chevron { transform: rotate(180deg); }

.ag-md { font-size: 13.5px; line-height: 1.65; }
.ag-md > :first-child { margin-top: 0 !important; }
.ag-md > :last-child { margin-bottom: 0 !important; }

.ag-md > * + * { margin-top: 0.7rem; }
.ag-md p { margin: 0; }

.ag-md h1, .ag-md h2, .ag-md h3, .ag-md h4, .ag-md h5, .ag-md h6 {
  font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; margin: 0.2rem 0 0; }
.ag-md > * + :is(h1, h2, h3, h4, h5, h6) { margin-top: 1.05rem; }
.ag-md :is(h1, h2, h3, h4, h5, h6) + * { margin-top: 0.35rem; }
.ag-md h1 { font-size: 1.15rem; }
.ag-md h2 { font-size: 1.05rem; }
.ag-md h3 { font-size: 0.98rem; }
.ag-md h4, .ag-md h5, .ag-md h6 { font-size: 0.92rem; }

.ag-md ul, .ag-md ol { margin: 0; padding-left: 1.35rem; }
.ag-md ul { list-style: disc; }
.ag-md ol { list-style: decimal; }
.ag-md li { margin: 0.3rem 0; }
.ag-md li::marker { color: hsl(var(--muted-foreground)); }
.ag-md li > p { margin: 0; }
.ag-md li > ul, .ag-md li > ol { margin: 0.3rem 0 0.15rem; }

.ag-md code {
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  font-size: 0.86em; background: hsl(var(--muted) / 0.7);
  border: 1px solid hsl(var(--border) / 0.5); padding: 0.12em 0.38em; border-radius: 5px; }

.ag-md pre {
  background: hsl(var(--muted) / 0.5); border: 1px solid hsl(var(--border));
  border-radius: 10px; padding: 0.75rem 0.85rem; overflow-x: auto; line-height: 1.5; }
.ag-md pre code { background: none; border: 0; padding: 0; font-size: 0.85em; }

.ag-md a {
  color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2.5px;
  text-decoration-thickness: 1px; text-decoration-color: hsl(var(--primary) / 0.4);
  transition: text-decoration-color .15s ease; }
.ag-md a:hover { text-decoration-color: hsl(var(--primary)); }
.ag-md strong { font-weight: 700; }
.ag-md em { font-style: italic; }
.ag-md s, .ag-md del { color: hsl(var(--muted-foreground)); }

.ag-md blockquote {
  border-left: 3px solid hsl(var(--primary) / 0.35); background: hsl(var(--muted) / 0.3);
  padding: 0.4rem 0.85rem; border-radius: 0 8px 8px 0; color: hsl(var(--muted-foreground)); }
.ag-md blockquote > * { margin: 0; }

.ag-md table {
  border-collapse: collapse; font-size: 0.92em; display: block; overflow-x: auto;
  border: 1px solid hsl(var(--border) / 0.6); border-radius: 8px; }
.ag-md thead { background: hsl(var(--muted) / 0.45); }
.ag-md th, .ag-md td { border: 1px solid hsl(var(--border) / 0.5); padding: 0.42rem 0.6rem; text-align: left; }
.ag-md th { font-weight: 650; }
.ag-md tbody tr:nth-child(even) { background: hsl(var(--muted) / 0.18); }

.ag-md hr { border: 0; border-top: 1px solid hsl(var(--border) / 0.6); margin: 0.9rem 0; height: 0; }
.opt-prose > * + * { margin-top: 1rem; }

.opt-prose h1 {
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}
.opt-prose h2 {
  font-size: 1.3rem; font-weight: 600; letter-spacing: -0.014em;
  margin: 1.75rem 0 0.625rem; padding-bottom: 0.375rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}
.opt-prose h3 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.01em; margin: 1.5rem 0 0.375rem; }
.opt-prose h4 { font-size: 0.95rem; font-weight: 600; margin: 1rem 0 0.25rem; }
.opt-prose h3::before {
  content: ""; display: inline-block;
  width: 3px; height: 0.85em; margin-right: 0.5rem;
  border-radius: 9999px; background: hsl(var(--primary) / 0.5);
  vertical-align: -1px;
}
.opt-prose > h1:first-child, .opt-prose > h2:first-child,
.opt-prose > h3:first-child, .opt-prose > h4:first-child { margin-top: 0; }

.opt-prose p { margin: 0; }
.opt-prose strong { font-weight: 600; color: hsl(var(--foreground)); }
.opt-prose em { font-style: italic; }
.opt-prose a {
  color: hsl(var(--primary));
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: hsl(var(--primary) / 0.4);
  transition: text-decoration-color 0.15s;
}
.opt-prose a:hover { text-decoration-color: hsl(var(--primary)); }
.opt-prose > p:first-child { font-size: 16.5px; }

.opt-prose ul { list-style: disc; padding-left: 1.25rem; margin: 0.5rem 0; }
.opt-prose ul ::marker { color: hsl(var(--muted-foreground)); }
.opt-prose ul > li + li, .opt-prose ol > li + li { margin-top: 0.375rem; }
.opt-prose ol { padding-left: 0; margin: 0.5rem 0; list-style: none; counter-reset: opt-ol; }
.opt-prose ol > li { position: relative; padding-left: 2.1rem; counter-increment: opt-ol; }
.opt-prose ol > li::before {
  content: counter(opt-ol) ".";
  position: absolute; left: 0; top: 0;
  width: 1.7rem; text-align: right; padding-right: 0.4rem;
  font-weight: 600; color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums lining-nums;
  line-height: inherit;
}
.opt-prose ol ol { counter-reset: opt-ol-2; }
.opt-prose ol ol > li { counter-increment: opt-ol-2; padding-left: 2rem; }
.opt-prose ol ol > li::before { content: counter(opt-ol-2, lower-alpha) "."; }
.opt-prose ol ol ol { counter-reset: opt-ol-3; }
.opt-prose ol ol ol > li { counter-increment: opt-ol-3; }
.opt-prose ol ol ol > li::before { content: counter(opt-ol-3, lower-roman) "."; }
.opt-prose li { line-height: 1.7; }
.opt-prose li > p { margin: 0; }
.opt-prose li > p + p { margin-top: 0.5rem; }
.opt-prose li > ul, .opt-prose li > ol { margin: 0.5rem 0 0; }

.opt-prose blockquote {
  padding: 0.75rem 1rem; margin: 1rem 0;
  border-radius: 0 0.75rem 0.75rem 0;
  font-size: 15.5px; font-style: normal;
  color: hsl(var(--foreground) / 0.9);
  border-left: 3px solid hsl(var(--primary) / 0.55);
  background: hsl(var(--muted) / 0.5);
}
.opt-prose blockquote p { margin: 0.375rem 0; }
.opt-prose blockquote > :first-child { margin-top: 0; }
.opt-prose blockquote > :last-child { margin-bottom: 0; }

.opt-prose hr {
  margin: 1.75rem 0; border: 0; height: 1px;
  background: linear-gradient(to right, transparent, hsl(var(--border)), transparent);
}

.opt-table-wrap {
  margin: 1rem 0; width: 100%; overflow-x: auto;
  border-radius: 0.75rem; border: 1px solid hsl(var(--border));
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.04);
}
.opt-prose table {
  width: 100%; font-size: 14.5px; border-collapse: collapse; margin: 0;
  font-variant-numeric: tabular-nums lining-nums;
}
.opt-prose thead { background: hsl(var(--muted) / 0.7); }
.opt-prose th {
  text-align: left; font-weight: 600; padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); white-space: nowrap;
  letter-spacing: -0.005em;
}
.opt-prose td { padding: 0.75rem 1rem; border-bottom: 1px solid hsl(var(--border) / 0.5); vertical-align: top; }
.opt-prose tbody tr:nth-child(even) { background: hsl(var(--muted) / 0.35); }
.opt-prose tbody tr:hover { background: hsl(var(--accent) / 0.6); }
.opt-prose tr:last-child td { border-bottom: 0; }

.opt-prose code {
  font-family: var(--font-mono); font-size: 0.88em;
  border-radius: 0.375rem; padding: 0.125rem 0.375rem;
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.8);
  border: 1px solid hsl(var(--border) / 0.7);
  font-feature-settings: "calt" 0;
}
.opt-prose h1 code, .opt-prose h2 code, .opt-prose h3 code { font-size: 0.9em; }

.opt-prose pre {
  margin: 0.85rem 0; overflow-x: auto;
  background: #2b303b; border-radius: 0.85rem;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.95rem 1.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  color: #c7cdd9;
}
.opt-prose pre code {
  background: transparent; border: 0; padding: 0;
  font-size: 13px; line-height: 1.65; color: #c7cdd9;
  font-feature-settings: "calt" 0;
}

.opt-prose input[type="checkbox"] { vertical-align: middle; margin-right: 0.375rem; }
.opt-prose ul.contains-task-list { list-style: none; padding-left: 0.25rem; }
