/* =====================================================================
   AI Portal — landing page stylesheet
   Fully self-contained: no frameworks, no external fonts, no build step.
   ===================================================================== */

:root {
  --bg: #07070d;
  --bg-2: #0b0b16;
  --panel: #10101d;
  --panel-2: #151526;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eceef7;
  --muted: #9aa0ba;
  --faint: #6a7090;
  --violet: #8b5cf6;
  --violet-deep: #6d28d9;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(135deg, var(--violet) 0%, var(--cyan) 100%);
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(139, 92, 246, 0.10), transparent 60%),
    radial-gradient(40% 30% at 90% 10%, rgba(34, 211, 238, 0.06), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--violet); color: #fff; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 96px 0; }
.section-head { max-width: 640px; margin: 0 auto 56px; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-head h2 {
  margin: 20px 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.section-head p { margin: 0; color: var(--muted); font-size: 1.05rem; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}
.btn-sm { padding: 10px 18px; font-size: 14px; }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(139, 92, 246, 0.5);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: rgba(139, 92, 246, 0.6); color: #fff; }

/* ---------------------------------------------------------------- Navbar */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}
.nav.scrolled {
  background: rgba(7, 7, 13, 0.82);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45);
}
.brand-text { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
}
.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--line);
  background: rgba(7, 7, 13, 0.97);
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
}
.nav-mobile a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-burger { display: block; }
  .nav-cta .btn { display: none; }
}

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 168px 0 96px;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 100%);
  mask-image: radial-gradient(70% 60% at 50% 30%, #000 30%, transparent 100%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.orb-violet { width: 480px; height: 480px; top: -140px; left: 8%; background: rgba(139, 92, 246, 0.22); }
.orb-cyan { width: 420px; height: 420px; top: 60px; right: 2%; background: rgba(34, 211, 238, 0.14); animation: float 9s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-22px); }
}

.hero-inner { position: relative; text-align: center; }
.hero .eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.hero h1 {
  margin: 26px auto 20px;
  max-width: 820px;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.hero h1 .grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero-sub {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
  font-size: 1.1rem;
}
.hero-cta { margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 18px; color: var(--faint); font-size: 13px; }

/* ---------------------------------------------------------------- Stats */
.stats {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0;
}
.stat { text-align: center; }
.stat-num {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.stat-label { margin-top: 4px; color: var(--faint); font-size: 13px; font-weight: 600; }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 16, 29, 0.4) 100%);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.feature:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 21px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  margin-bottom: 18px;
}
.feature h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }
@media (max-width: 900px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .features-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  counter-reset: step;
}
.step {
  position: relative;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.step-num {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}
.step h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Dashboard mockup */
.mockup-wrap { position: relative; margin-top: 88px; }
.mockup-glow {
  position: absolute;
  inset: -10% -5%;
  background: radial-gradient(50% 50% at 50% 30%, rgba(139, 92, 246, 0.28), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}
.mockup {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mockup-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.mockup-dot { width: 11px; height: 11px; border-radius: 50%; }
.mockup-url {
  margin-left: 10px;
  flex: 1;
  max-width: 340px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mockup-body { display: grid; grid-template-columns: 180px 1fr; min-height: 430px; }
.mockup-side { border-right: 1px solid var(--line); padding: 20px 14px; }
.mockup-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 4px;
}
.mockup-side-item.active { background: rgba(139, 92, 246, 0.14); color: #ddd6fe; }
.mockup-side-item .ico { font-size: 15px; }
.mockup-main { padding: 22px; overflow: hidden; }
.mockup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.mockup-head h4 { margin: 0; font-size: 16px; font-weight: 800; }
.mockup-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--muted);
}
.mockup-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.mock-stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.mock-stat-label { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.mock-stat-value { margin-top: 6px; font-size: 20px; font-weight: 900; letter-spacing: -0.01em; }
.mock-stat-delta { font-size: 11px; font-weight: 700; }
.delta-up { color: var(--green); }
.delta-warn { color: var(--amber); }

.mock-cards { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.mock-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px;
}
.mock-card h5 { margin: 0 0 14px; font-size: 13px; font-weight: 700; color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bar {
  flex: 1;
  height: var(--h);
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--violet), rgba(139, 92, 246, 0.25));
  transform-origin: bottom;
  animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d);
  transform: scaleY(0);
}
.bar.hot { background: linear-gradient(180deg, var(--cyan), rgba(34, 211, 238, 0.25)); }
@keyframes grow { to { transform: scaleY(1); } }

.quota-ring {
  --p: 78%;
  position: relative;
  width: 108px;
  height: 108px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: conic-gradient(var(--violet) var(--p), rgba(255, 255, 255, 0.08) 0);
  display: grid;
  place-items: center;
}
.quota-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--panel);
}
.quota-ring span {
  position: relative;
  font-size: 18px;
  font-weight: 900;
}
.quota-label { text-align: center; font-size: 12px; color: var(--faint); }

.user-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}
.avatar-a { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-b { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.avatar-c { background: linear-gradient(135deg, #34d399, #059669); }
.avatar-d { background: linear-gradient(135deg, #fbbf24, #d97706); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 700; }
.user-track { margin-top: 5px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.user-fill { height: 100%; border-radius: 999px; background: var(--grad); }
.user-fill.warn { background: var(--amber); }
.user-fill.low { background: var(--violet); }
.user-pct { flex: none; font-size: 11px; font-weight: 700; color: var(--faint); }

@media (max-width: 980px) {
  .mockup-body { grid-template-columns: 1fr; }
  .mockup-side { display: none; }
  .mockup-stats { grid-template-columns: repeat(2, 1fr); }
  .mock-cards { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- Testimonials */
.quotes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.quote {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.quote-stars { color: var(--amber); letter-spacing: 2px; font-size: 14px; }
.quote-text { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.quote-person { display: flex; align-items: center; gap: 12px; }
.quote-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex: none;
}
.quote-name { font-size: 14px; font-weight: 700; }
.quote-role { font-size: 12px; color: var(--faint); }
@media (max-width: 900px) { .quotes { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}
.price-card {
  position: relative;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 16, 29, 0.3) 100%);
  display: flex;
  flex-direction: column;
}
.price-card.featured {
  border-color: rgba(139, 92, 246, 0.55);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.10) 0%, rgba(16, 16, 29, 0.4) 100%);
  box-shadow: 0 20px 60px rgba(139, 92, 246, 0.18);
}
.price-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.price-name { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.price-amount { margin-top: 10px; font-size: 40px; font-weight: 900; letter-spacing: -0.02em; }
.price-amount small { font-size: 15px; font-weight: 600; color: var(--faint); }
.price-desc { margin: 8px 0 20px; color: var(--muted); font-size: 14px; }
.price-list { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.price-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.price-list li::before { content: "✓"; color: var(--green); font-weight: 800; }
.price-card .btn { margin-top: auto; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; } }

/* ---------------------------------------------------------------- FAQ */
.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.faq-item[open] { border-color: rgba(139, 92, 246, 0.45); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15.5px;
  list-style: none;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 16px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}
.faq-answer { padding: 0 22px 18px; color: var(--muted); font-size: 14.5px; }

/* ---------------------------------------------------------------- CTA band */
.cta-band {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 72px 0;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(60% 120% at 50% 0%, rgba(139, 92, 246, 0.18), transparent 60%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
}
.cta-band h2 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.02em;
}
.cta-band p { margin: 0 auto 30px; max-width: 480px; color: var(--muted); }
.cta-band .btn { font-size: 16px; padding: 16px 34px; }

/* ---------------------------------------------------------------- Footer */
.footer {
  margin-top: 96px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  padding: 56px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 44px;
}
.footer-tag { margin: 14px 0 0; max-width: 300px; color: var(--faint); font-size: 14px; }
.footer-col h4 { margin: 0 0 16px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.footer-col a { display: block; padding: 5px 0; color: var(--faint); font-size: 14px; transition: color 0.15s ease; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--rd, 0s);
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar { animation: none; transform: none; }
  .orb-cyan { animation: none; }
  .hero .eyebrow .dot { animation: none; }
}

/* =====================================================================
   App pages — login, user dashboard, admin console
   ===================================================================== */

.nav-active { color: #fff !important; background: rgba(139, 92, 246, 0.14) !important; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.nav-user-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.nav-user-name { font-size: 13px; font-weight: 700; }
@media (max-width: 980px) { .nav-user-name { display: none; } }
@media (max-width: 860px) { .nav-user { display: none; } }

.app-page main { padding-top: 108px; padding-bottom: 90px; }
.app-container { max-width: 1060px; }
.app-wide { max-width: 1280px; }

.app-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.app-head h1 { margin: 14px 0 6px; font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 900; letter-spacing: -0.02em; }
.app-sub { margin: 0; color: var(--muted); font-size: 14px; }

.app-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.app-stats .mock-stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.app-stats .mock-stat-value { margin-top: 8px; font-size: 22px; }
@media (max-width: 900px) { .app-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .app-stats { grid-template-columns: 1fr; } }

.app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .app-grid { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 24px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.card-note { margin: 12px 0 0; color: var(--faint); font-size: 13px; }

.alert {
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}
.alert p { margin: 0; }
.alert p + p { margin-top: 6px; }
.alert-ok { border: 1px solid rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); color: #a7f3d0; }
.alert-error { border: 1px solid rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); color: #fecaca; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress-sm { height: 6px; margin: 8px 0 4px; }
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width 0.4s ease;
}
.fill-amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.fill-red { background: linear-gradient(90deg, #ef4444, #f87171); }

.text-red { color: var(--red); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-green { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-amber { background: rgba(251, 191, 36, 0.15); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-red { background: rgba(248, 113, 113, 0.15); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-violet { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }

.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 16px;
}
.form-field-wide { grid-column: 1 / -1; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: rgba(139, 92, 246, 0.7); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.input-sm { padding: 7px 10px; font-size: 13px; }
select.input { appearance: auto; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.checkbox-item:hover { border-color: rgba(139, 92, 246, 0.5); }
.checkbox-item input { accent-color: var(--violet); }

.btn-block { width: 100%; }
.btn-danger { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); border-color: var(--red); color: #fff; }

.model-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.model-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.08);
  color: #c4b5fd;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.model-chip-more { border-color: var(--line-strong); background: rgba(255,255,255,0.04); color: var(--muted); }
.model-cost { font-size: 12px; color: var(--faint); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.table-muted { color: var(--faint); white-space: nowrap; }
.row-suspended td { opacity: 0.55; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.user-cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.avatar-0 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar-1 { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.avatar-2 { background: linear-gradient(135deg, #34d399, #059669); }
.avatar-3 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.user-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.spend-cell { min-width: 120px; }
.spend-value { font-weight: 800; }
.spend-sub { font-size: 11px; color: var(--faint); }
.table-actions { text-align: right; }

.row-edit summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  user-select: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.row-edit summary::-webkit-details-marker { display: none; }
.row-edit summary:hover { border-color: rgba(139, 92, 246, 0.5); color: #fff; }
.row-edit-panel {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 14px;
  background: var(--bg-2);
}
.edit-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.edit-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.edit-inline-label { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Login page ---- */
.auth-page { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding-top: 108px; padding-bottom: 60px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(16, 16, 29, 0.5) 100%);
  padding: 36px;
  box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 22px; }
.auth-title { margin: 0 0 6px; font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.auth-foot { margin: 18px 0 0; text-align: center; font-size: 13px; }
.auth-foot a { color: var(--muted); transition: color 0.15s ease; }
.auth-foot a:hover { color: #fff; }

.test-result {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}
.test-result.is-error { border-color: rgba(248, 113, 113, 0.35); color: #fca5a5; }
textarea.input { resize: vertical; font-family: inherit; }

/* =====================================================================
   Chat page — AI agent conversation UI
   ===================================================================== */
.chat-shell {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  height: min(72vh, 780px);
  min-height: 480px;
}
.chat-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.chat-model-field { margin: 0; min-width: 220px; }
.chat-model-field label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chat-toolbar-meta { display: flex; align-items: center; gap: 10px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-2);
  justify-content: flex-end;
}
.chat-log.chat-log-empty { justify-content: center; }

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  max-width: 440px;
  margin: 0 auto;
  padding: 12px;
}
.chat-empty-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.25);
}
.chat-empty h3 { margin: 0; font-size: 18px; font-weight: 800; }
.chat-empty p { margin: 4px 0 4px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.chat-chip {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.chat-chip:hover { border-color: rgba(139, 92, 246, 0.6); background: rgba(139, 92, 246, 0.1); transform: translateY(-1px); }

.chat-row { display: flex; align-items: flex-end; max-width: 82%; }
.chat-row-user { align-self: flex-end; justify-content: flex-end; }
.chat-row-assistant { align-self: flex-start; }
.chat-row-system { align-self: center; max-width: 92%; justify-content: center; }

.chat-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}
.chat-avatar-assistant { background: var(--grad); margin-right: 10px; }
.chat-avatar-user { background: linear-gradient(135deg, var(--violet-deep) 0%, var(--violet) 100%); margin-left: 10px; order: 2; }
.chat-row-user .chat-msg-user { order: 1; }

.chat-msg { display: flex; flex-direction: column; min-width: 0; }
.chat-msg-user { align-items: flex-end; }
.chat-msg-assistant { align-items: flex-start; }
.chat-msg-system { align-items: center; width: 100%; }

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}
.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, var(--violet) 0%, var(--violet-deep) 100%);
  border-color: transparent;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg-system .chat-bubble {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
  font-size: 13.5px;
  text-align: center;
}
.chat-bubble code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.chat-bubble .chat-code {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}
.chat-meta { margin-top: 4px; font-size: 11.5px; color: var(--faint); padding: 0 4px; }

.chat-typing .chat-bubble { display: flex; gap: 5px; padding: 14px 16px; }
.chat-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: chat-bounce 1.2s infinite ease-in-out;
}
.chat-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.chat-textarea {
  flex: 1;
  resize: none;
  max-height: 180px;
  min-height: 44px;
  line-height: 1.5;
}
.chat-send-btn { flex-shrink: 0; }
.chat-footnote { padding: 0 22px 18px; margin: 0; }

@media (max-width: 720px) {
  .chat-shell { height: min(78vh, 680px); }
  .chat-msg { max-width: 92%; }
}
