/* ================================================================
   DRIPPY AI — Design System
   Red / Black / White · Light & Dark · Premium & Minimal
   ================================================================ */

/* ---------- Tokens ---------- */
:root {
  --red: #FF1F3D;
  --red-deep: #E5092F;
  --red-soft: rgba(255, 31, 61, 0.08);

  --bg: #FFFFFF;
  --bg-soft: #F5F5F5;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --border: #EAEAEA;
  --border-strong: #D8D8D8;

  --text: #0A0A0A;
  --text-soft: #3a3a3a;
  --muted: #6b6b6b;

  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.05);
  --shadow-md: 0 8px 30px rgba(10, 10, 10, 0.08);
  --shadow-lg: 0 24px 80px rgba(10, 10, 10, 0.14);
  --shadow-red: 0 10px 40px rgba(255, 31, 61, 0.28);

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 10px;

  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --topbar-h: 64px;
  --sidebar-w: 248px;

  --ease: cubic-bezier(.22, .8, .26, .99);
}

[data-theme="dark"] {
  --bg: #050505;
  --bg-soft: #0B0B0B;
  --surface: #111111;
  --surface-2: #161616;
  --border: #1f1f1f;
  --border-strong: #2c2c2c;

  --text: #F5F5F5;
  --text-soft: #d4d4d4;
  --muted: #9a9a9a;

  --red-soft: rgba(255, 31, 61, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color .35s var(--ease), color .35s var(--ease);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 .5em; }
code, pre, .mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--red); color: #fff; padding: .5rem 1rem; z-index: 300; }
.skip-link:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.link { color: var(--red-deep); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Logo ---------- */
.logo-wrap { display: inline-flex; align-items: center; gap: .6rem; }
.logo-word { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; color: var(--text); }
.logo-ai { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 600 .92rem var(--font-body); text-decoration: none; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  padding: .68rem 1.3rem; position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, border-color .2s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff; box-shadow: 0 6px 20px rgba(255, 31, 61, .25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-red); }
.btn-primary:disabled:hover { transform: none; box-shadow: 0 6px 20px rgba(255,31,61,.25); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--red); color: var(--red-deep); background: var(--red-soft); transform: translateY(-2px); }
.btn-danger { background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: var(--shadow-red); }
.btn-sm { padding: .45rem .95rem; font-size: .85rem; }
.btn-lg { padding: .9rem 1.9rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-text { background: none; border: none; font: 600 .92rem var(--font-body); color: var(--muted); cursor: pointer; padding: .4rem .6rem; border-radius: 8px; text-decoration: none; }
.btn-text:hover { color: var(--red-deep); background: var(--red-soft); }
.btn.glow { box-shadow: var(--shadow-red); animation: glowPulse 3.2s ease-in-out infinite; }
@keyframes glowPulse { 0%,100% { box-shadow: 0 8px 30px rgba(255,31,61,.3); } 50% { box-shadow: 0 8px 46px rgba(255,31,61,.5); } }

/* Ripple effect */
.btn.ripple::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255,255,255,.35) 0%, transparent 55%);
  opacity: 0; transition: opacity .5s;
}
.btn.ripple:active::after { opacity: 1; transition: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font: 600 .82rem var(--font-body); margin-bottom: .4rem; color: var(--text); letter-spacing: .01em; }
.label-hint { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="url"], input[type="number"], textarea, select {
  width: 100%; font: 400 .95rem var(--font-body); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .68rem .9rem;
  transition: border-color .2s, box-shadow .2s, background .3s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); outline: none; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.05rem; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox { display: flex; gap: .55rem; align-items: center; font-size: .9rem; cursor: pointer; margin: .6rem 0; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }
.pw-meter { height: 4px; background: var(--bg-soft); border-radius: 4px; margin-top: .45rem; overflow: hidden; }
.pw-meter-bar { height: 100%; width: 0; border-radius: 4px; transition: width .3s, background .3s; }

/* Alerts */
.alert { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1rem; border: 1px solid; animation: fadeUp .3s var(--ease); }
.alert-error { background: var(--red-soft); border-color: rgba(255,31,61,.35); color: var(--red-deep); }
[data-theme="dark"] .alert-error { color: #ff8296; }
.alert-success { background: rgba(34, 170, 96, .08); border-color: rgba(34,170,96,.35); color: #177f4b; }
[data-theme="dark"] .alert-success { color: #7cd6a3; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: .3rem; font: 600 .72rem var(--font-body); padding: .2rem .6rem; border-radius: 99px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.chip.ok { background: rgba(34,170,96,.1); border-color: rgba(34,170,96,.3); color: #177f4b; }
[data-theme="dark"] .chip.ok { color: #7cd6a3; }
.chip.warn { background: rgba(234,156,27,.1); border-color: rgba(234,156,27,.3); color: #96700f; }
[data-theme="dark"] .chip.warn { color: #e3bb63; }
.chip.danger, .chip.err { background: var(--red-soft); border-color: rgba(255,31,61,.3); color: var(--red-deep); }
[data-theme="dark"] .chip.danger, [data-theme="dark"] .chip.err { color: #ff8296; }

/* ================================================================
   LANDING PAGE
   ================================================================ */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 100; transition: background .3s, box-shadow .3s, border-color .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: .85rem 1.5rem; display: flex; align-items: center; gap: 2rem; }
.nav-brand { text-decoration: none; display: inline-flex; }
.nav-links { display: flex; gap: 1.6rem; margin: 0 auto; }
.nav-links a { text-decoration: none; font: 500 .92rem var(--font-body); color: var(--muted); transition: color .2s; position: relative; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; background: var(--red); border-radius: 2px; }
.nav-actions { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.nav-burger { display: none; }
.nav-mobile { display: none; flex-direction: column; gap: .3rem; padding: 1rem 1.5rem 1.4rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.nav-mobile.open { display: flex; animation: fadeUp .25s var(--ease); }
.nav-mobile a { text-decoration: none; font: 600 1rem var(--font-body); padding: .6rem .4rem; color: var(--text); }
.nav-mobile-cta { display: grid; gap: .6rem; margin-top: .8rem; }

/* Hero */
.hero { position: relative; padding: 10.5rem 1.5rem 6rem; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hero-glow {
  position: absolute; top: -30%; left: 50%; transform: translateX(-50%);
  width: 900px; height: 620px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,31,61,.16), transparent 70%);
  filter: blur(40px); animation: glowDrift 14s ease-in-out infinite alternate;
}
[data-theme="dark"] .hero-glow { background: radial-gradient(closest-side, rgba(255,31,61,.22), transparent 70%); }
@keyframes glowDrift { from { transform: translateX(-58%) scale(1); } to { transform: translateX(-42%) scale(1.12); } }
.hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 35%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 35%, #000 20%, transparent 75%);
  opacity: .5;
}
.hero-inner { position: relative; max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr .95fr; gap: 4rem; align-items: center; }
.hero-pill { display: inline-flex; align-items: center; gap: .5rem; font: 600 .8rem var(--font-body); color: var(--muted); border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: .4rem .95rem; margin-bottom: 1.4rem; }
.hero-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,31,61,.5); } 50% { box-shadow: 0 0 0 6px rgba(255,31,61,0); } }
.hero-title { font-size: clamp(2.6rem, 5vw, 4.1rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 1.2rem; }
.accent-text { background: linear-gradient(120deg, var(--red), var(--red-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 1.13rem; color: var(--muted); max-width: 34rem; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 2rem; }
.hero-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.hero-meta span { display: inline-flex; gap: .4rem; align-items: center; }
.hero-meta svg { width: 15px; height: 15px; color: var(--red); }

/* Chat preview */
.hero-visual { position: relative; }
.chat-preview {
  position: relative; z-index: 2; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: floatIn .9s var(--ease) both .25s;
}
.cp-head { display: flex; align-items: center; gap: .45rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.cp-dot:nth-child(1) { background: #FF5F57; } .cp-dot:nth-child(2) { background: #FEBC2E; } .cp-dot:nth-child(3) { background: #28C840; }
.cp-title { font: 700 .85rem var(--font-display); margin-left: .5rem; }
.cp-status { margin-left: auto; font: 600 .72rem var(--font-body); color: #177f4b; display: inline-flex; align-items: center; gap: .35rem; }
.cp-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #28C840; animation: pulse 2s infinite; }
.cp-body { padding: 1.2rem; display: flex; flex-direction: column; gap: .9rem; min-height: 250px; }
.cp-msg { max-width: 85%; padding: .7rem .95rem; border-radius: 14px; font-size: .86rem; line-height: 1.55; }
.cp-msg p { margin: 0 0 .45rem; } .cp-msg p:last-child { margin-bottom: 0; }
.cp-msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; border-bottom-right-radius: 4px; animation: msgIn .5s var(--ease) both; }
.cp-msg.ai { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--border); border-bottom-left-radius: 4px; animation: msgIn .5s var(--ease) both .3s; }
.cp-msg.typing { padding: .95rem 1.1rem; }
.cp-code { font-family: var(--font-mono); font-size: .78rem; background: #0A0A0A; color: #f5f5f5; border-radius: 8px; padding: .55rem .7rem; margin: .45rem 0; }
.cp-input { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.cp-send { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; display: grid; place-items: center; }
.cp-send svg { width: 14px; height: 14px; }
.cp-msg.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin-right: 4px; animation: bounceDot 1.2s infinite; }
.cp-msg.typing span:nth-child(2) { animation-delay: .15s; } .cp-msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounceDot { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes floatIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

.float-card {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: .45rem;
  font: 600 .8rem var(--font-body); background: var(--surface); border: 1px solid var(--border);
  padding: .5rem .85rem; border-radius: 99px; box-shadow: var(--shadow-md);
  animation: floatCard 6s ease-in-out infinite;
}
.float-card .fc-icon { filter: saturate(1.4); }
.fc-1 { top: -18px; left: -14px; animation-delay: 0s; }
.fc-2 { top: 36%; right: -26px; animation-delay: 1.4s; }
.fc-3 { bottom: 82px; left: -30px; animation-delay: 2.6s; }
.fc-4 { bottom: -16px; right: 8%; animation-delay: 3.8s; }
@keyframes floatCard { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* Sections */
.section { padding: 5.5rem 1.5rem; max-width: 1200px; margin: 0 auto; }
.section-alt { max-width: none; background: var(--bg-soft); }
.section-alt > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.section-head { text-align: center; margin-bottom: 3.2rem; }
.section-title { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; }
.section-sub { color: var(--muted); font-size: 1.05rem; margin-top: -.8rem; }

/* Feature cards */
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.4rem; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.feature-card:hover { transform: translateY(-5px); border-color: var(--red); box-shadow: 0 14px 40px rgba(255,31,61,.13); }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--red-soft); color: var(--red-deep); display: grid; place-items: center; margin-bottom: 1rem; }
.feature-icon svg { width: 21px; height: 21px; }
.feature-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.feature-card p { color: var(--muted); font-size: .88rem; margin: 0; }

/* Capability grid */
.cap-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .9rem; }
.cap-card {
  display: flex; align-items: center; gap: .7rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; font: 600 .92rem var(--font-body);
  transition: transform .22s var(--ease), border-color .22s, box-shadow .22s;
}
.cap-card:hover { transform: translateY(-3px) scale(1.02); border-color: var(--red); box-shadow: var(--shadow-md); }
.cap-emoji { font-size: 1.25rem; }

/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; counter-reset: step; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.7rem 1.5rem; position: relative; transition: transform .25s var(--ease); }
.step-card:hover { transform: translateY(-5px); }
.step-num { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; background: linear-gradient(135deg, var(--red), var(--red-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: .9; margin-bottom: .6rem; }
.step-card h3 { font-size: 1.02rem; }
.step-card p { color: var(--muted); font-size: .88rem; margin: 0; }

/* Pricing */
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; align-items: stretch; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem 1.7rem; display: flex; flex-direction: column; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.plan-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.plan-card.highlight { border-color: var(--red); box-shadow: var(--shadow-red); }
.plan-badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; font: 700 .72rem var(--font-display); padding: .3rem .95rem; border-radius: 99px; letter-spacing: .04em; }
.plan-card h3 { font-size: 1.15rem; }
.plan-price { display: flex; align-items: baseline; gap: .2rem; margin: .4rem 0 1.3rem; font-family: var(--font-display); font-weight: 800; font-size: 2.5rem; letter-spacing: -0.03em; }
.price-cur { font-size: 1.3rem; font-weight: 700; }
.price-per { font: 500 .85rem var(--font-body); color: var(--muted); letter-spacing: 0; }
.price-free { font-size: 2.2rem; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .55rem; flex: 1; }
.plan-features li { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; color: var(--text-soft); }
.plan-features svg { width: 15px; height: 15px; color: var(--red); flex: none; margin-top: .28rem; }
.pricing-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 2rem; }

/* Use cases */
.usecase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.usecase-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; transition: transform .25s var(--ease), border-color .25s; }
.usecase-card:hover { transform: translateY(-5px); border-color: var(--red); }
.usecase-card h3 { font-size: 1.05rem; }
.usecase-card p { color: var(--muted); font-size: .9rem; margin: 0; }

/* FAQ */
.faq-list { max-width: 760px; margin: 0 auto; display: grid; gap: .8rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .2s; }
.faq-item[open] { border-color: var(--red); }
.faq-item summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.05rem 1.25rem; font: 600 .98rem var(--font-body); cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg { width: 18px; height: 18px; color: var(--red); transition: transform .25s var(--ease); flex: none; }
.faq-item[open] summary svg { transform: rotate(180deg); }
.faq-body { padding: 0 1.25rem 1.15rem; color: var(--muted); font-size: .93rem; animation: fadeUp .25s var(--ease); }
.faq-body p { margin: 0; }

/* CTA */
.cta-section { padding: 7rem 1.5rem; background: var(--bg-soft); }
.cta-inner { position: relative; max-width: 880px; margin: 0 auto; text-align: center; background: #0A0A0A; color: #fff; border-radius: 26px; padding: 4.5rem 2.5rem; overflow: hidden; }
.cta-inner::before { content: ""; position: absolute; top: -60%; left: 50%; transform: translateX(-50%); width: 640px; height: 480px; background: radial-gradient(closest-side, rgba(255,31,61,.35), transparent 70%); filter: blur(30px); animation: glowDrift 12s ease-in-out infinite alternate; pointer-events: none; }
.cta-title { position: relative; font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
.cta-title .accent-text { background: none; color: var(--red); -webkit-text-fill-color: var(--red); }
.cta-sub { position: relative; color: #b5b5b5; margin-bottom: 2rem; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 3rem 1.5rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: space-between; }
.footer-brand p { color: var(--muted); font-size: .85rem; margin: .6rem 0 0; }
.footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer-links a { font: 500 .88rem var(--font-body); color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--red-deep); }
.footer-copy { color: var(--muted); font-size: .82rem; width: 100%; text-align: center; margin-top: 1rem; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ================================================================
   AUTH PAGES
   ================================================================ */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; position: relative; overflow-x: hidden; }
.auth-glow { position: fixed; top: -25%; left: 50%; transform: translateX(-50%); width: 720px; height: 540px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,31,61,.14), transparent 70%); filter: blur(46px); pointer-events: none; animation: glowDrift 16s ease-in-out infinite alternate; }
.auth-card { position: relative; width: 100%; max-width: 428px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2.4rem 2.2rem 1.8rem; animation: floatIn .5s var(--ease); }
.auth-card.center { text-align: center; max-width: 520px; }
.auth-brand { display: flex; justify-content: center; text-decoration: none; margin-bottom: 1.6rem; }
.auth-title { font-size: 1.55rem; font-weight: 800; text-align: center; }
.auth-sub { color: var(--muted); text-align: center; font-size: .92rem; margin: -.3rem 0 1.4rem; }
.auth-form { margin-top: .4rem; }
.auth-foot { margin-top: 1.3rem; text-align: center; font-size: .82rem; color: var(--muted); }
.auth-foot a { color: var(--red-deep); text-decoration: none; }
.auth-alt { text-align: center; margin-top: 1.2rem; font-size: .9rem; color: var(--muted); }
.auth-alt a { color: var(--red-deep); text-decoration: none; font-weight: 600; }
.divider { display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.link-quiet { font-size: .85rem; color: var(--muted); text-decoration: none; }
.link-quiet:hover { color: var(--red-deep); }
.verify-icon { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1.2rem; }
.verify-icon svg { width: 30px; height: 30px; }
.verify-icon.ok { background: rgba(34,170,96,.12); color: #177f4b; }
.verify-icon.err { background: var(--red-soft); color: var(--red-deep); }
.display-xl { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; }
.typing-dots { display: flex; gap: 6px; justify-content: center; margin: 1.4rem 0; }
.typing-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: bounceDot 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; } .typing-dots span:nth-child(3) { animation-delay: .3s; }

/* ================================================================
   APP LAYOUT (dashboard / chat / admin)
   ================================================================ */
.app-body { min-height: 100vh; background: var(--bg); }
.app-topbar {
  position: sticky; top: 0; z-index: 90; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.4rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.app-brand { text-decoration: none; display: inline-flex; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, border-color .2s; position: relative; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.topbar-search { position: relative; flex: 1; max-width: 460px; margin: 0 auto; }
.topbar-search > svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topbar-search input { padding-left: 2.4rem; border-radius: 99px; background: var(--bg-soft); border-color: transparent; font-size: .88rem; }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 380px; overflow: auto; z-index: 50; animation: fadeUp .2s var(--ease); }
.search-results .sr-item { display: block; padding: .7rem 1rem; text-decoration: none; border-bottom: 1px solid var(--border); }
.search-results .sr-item:last-child { border-bottom: none; }
.search-results .sr-item:hover { background: var(--bg-soft); }
.sr-title { font: 600 .88rem var(--font-body); display: block; }
.sr-snippet { font-size: .8rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: .9rem 1rem; color: var(--muted); font-size: .88rem; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.notif-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font: 700 10px/16px var(--font-body); text-align: center; }
.topbar-user { text-decoration: none; }
.avatar-img, .avatar-txt { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; }
.avatar-txt { background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; font: 700 .8rem var(--font-display); }
.avatar-xl { width: 84px; height: 84px; font-size: 1.6rem; }

.app-shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.app-sidebar { width: var(--sidebar-w); flex: none; border-right: 1px solid var(--border); padding: 1.2rem .9rem; display: flex; flex-direction: column; gap: .2rem; background: var(--bg); }
.app-sidebar nav { display: flex; flex-direction: column; gap: .15rem; }
.app-sidebar nav a, .sidebar-foot a {
  display: flex; align-items: center; gap: .8rem; padding: .62rem .8rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font: 500 .92rem var(--font-body);
  transition: background .18s, color .18s;
}
.app-sidebar nav a:hover, .sidebar-foot a:hover { background: var(--bg-soft); color: var(--text); }
.app-sidebar nav a.active { background: var(--red-soft); color: var(--red-deep); font-weight: 600; }
[data-theme="dark"] .app-sidebar nav a.active { color: #ff8296; }
.app-sidebar svg, .sidebar-foot svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .15rem; border-top: 1px solid var(--border); padding-top: .8rem; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 0 .5rem .8rem; }
.admin-chip { background: var(--red-soft); color: var(--red-deep) !important; border-color: rgba(255,31,61,.3); }
.app-main { flex: 1; min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.6rem) 4rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.page-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.page-sub { color: var(--muted); margin: .25rem 0 0; font-size: .92rem; }

/* Banner */
.banner { border-radius: var(--radius-sm); padding: .85rem 1.1rem; margin-bottom: 1.3rem; font-size: .9rem; border: 1px solid; animation: fadeUp .3s var(--ease); }
.banner a { color: var(--red-deep); font-weight: 600; }
.banner-warning { background: rgba(234,156,27,.08); border-color: rgba(234,156,27,.35); }
.banner-info { background: var(--red-soft); border-color: rgba(255,31,61,.25); }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.8rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.35rem; display: flex; flex-direction: column; transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-label { font: 600 .74rem var(--font-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; letter-spacing: -0.03em; margin: .35rem 0 .15rem; }
.stat-foot { font-size: .8rem; color: var(--muted); }
.stat-foot a { color: var(--red-deep); text-decoration: none; }
.stat-bar { height: 5px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; margin-top: .8rem; }
.stat-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--red-deep)); border-radius: 4px; transition: width .8s var(--ease); }
.stat-bar-fill.warn { background: linear-gradient(90deg, #EAA018, #d18b0f); }
.stat-bar-fill.danger { background: linear-gradient(90deg, var(--red), var(--red-deep)); }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.8rem; }
.qa-card { display: flex; flex-direction: column; gap: .2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; text-decoration: none; transition: transform .22s var(--ease), border-color .22s; }
.qa-card:hover { transform: translateY(-4px); border-color: var(--red); }
.qa-icon { font-size: 1.4rem; }
.qa-card span:not(.qa-icon) { font: 600 .95rem var(--font-body); color: var(--text); }
.qa-card small { color: var(--muted); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.5rem; margin-bottom: 1.3rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { font-size: 1.05rem; margin: 0; }

/* Conversation lists */
.convo-list { list-style: none; padding: 0; margin: 0; }
.convo-list li + li { border-top: 1px solid var(--border); }
.convo-list a { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem .4rem; text-decoration: none; }
.convo-list a:hover .convo-title { color: var(--red-deep); }
.convo-title { font: 600 .93rem var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-time { color: var(--muted); font-size: .8rem; flex: none; }

/* History table */
.history-toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.3rem; }
.history-search { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 99px; padding: .2rem .5rem .2rem 1rem; flex: 1; max-width: 460px; }
.history-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.history-search input { border: none; background: none; box-shadow: none; padding: .5rem 0; }
.history-search input:focus { box-shadow: none; }
.segmented { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented a { text-decoration: none; font: 600 .84rem var(--font-body); color: var(--muted); padding: .4rem 1rem; border-radius: 99px; transition: background .2s, color .2s; }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.convo-table { list-style: none; padding: 0; margin: 0; }
.convo-row { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--border); }
.convo-row:last-child { border-bottom: none; }
.convo-row-link { flex: 1; display: flex; justify-content: space-between; gap: 1rem; padding: .85rem .4rem; text-decoration: none; min-width: 0; }
.convo-row-actions { display: flex; gap: .2rem; opacity: 0; transition: opacity .2s; }
.convo-row:hover .convo-row-actions { opacity: 1; }
@media (hover: none) { .convo-row-actions { opacity: 1; } }

/* Discover */
.discover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.discover-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; }
.discover-card header { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.discover-emoji { font-size: 1.4rem; }
.discover-card h3 { font-size: 1rem; margin: 0; }
.discover-prompt { display: block; width: 100%; text-align: left; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-soft); border-radius: var(--radius-sm); padding: .7rem .9rem; font: 400 .86rem var(--font-body); margin-bottom: .6rem; cursor: pointer; transition: border-color .2s, transform .2s var(--ease); }
.discover-prompt:hover { border-color: var(--red); transform: translateY(-2px); }

/* Chart */
.chart-days { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; height: 180px; padding-top: .5rem; }
.chart-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; }
.chart-col { flex: 1; width: 100%; max-width: 42px; display: flex; align-items: flex-end; background: var(--bg-soft); border-radius: 8px; overflow: hidden; }
.chart-bar { width: 100%; background: linear-gradient(180deg, var(--red), var(--red-deep)); border-radius: 8px; transition: height .8s var(--ease); }
.chart-num { font: 700 .78rem var(--font-display); }
.chart-label { font-size: .72rem; color: var(--muted); }

/* Settings */
.settings-tabs { margin-bottom: 1.4rem; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: start; }
.settings-form .btn { margin-top: .4rem; }
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.theme-picker { display: flex; gap: .8rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.theme-option { position: relative; }
.theme-option input { position: absolute; opacity: 0; }
.theme-option span { display: inline-flex; padding: .7rem 1.3rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font: 600 .88rem var(--font-body); transition: border-color .2s, background .2s; }
.theme-option input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red-deep); }
.profile-avatar-row { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.2rem; }
.profile-avatar-actions { display: flex; flex-direction: column; gap: .4rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; margin: 0 0 1rem; }
.kv dt { font: 600 .86rem var(--font-body); color: var(--muted); }
.kv dd { margin: 0; font-size: .92rem; }
.tips-list { padding-left: 1.1rem; color: var(--muted); font-size: .88rem; margin: 0; display: grid; gap: .5rem; }

/* Notifications */
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-item { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem .4rem; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--red-soft); border-radius: var(--radius-sm); }
.notif-type { font-size: 1.2rem; flex: none; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font: 600 .93rem var(--font-body); margin: 0 0 .15rem; }
.notif-text { color: var(--muted); font-size: .87rem; margin: 0 0 .3rem; }
.notif-time { color: var(--muted); font-size: .78rem; }
.notif-mark { flex: none; }

/* Empty states */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-emoji { font-size: 2.4rem; display: block; margin-bottom: .8rem; }
.empty-state h3 { font-size: 1.1rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.2rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font: 600 .78rem var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .6rem .8rem; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.table td { padding: .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table-actions { white-space: nowrap; display: flex; gap: .4rem; }
.row-menu { position: relative; }
.row-menu summary { list-style: none; cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu .dropdown { left: 0; right: auto; min-width: 220px; display: flex; flex-direction: column; gap: .2rem; }
.row-menu .dropdown form { display: contents; }
.row-menu select { margin: .3rem 0; }
.row-menu-danger input { margin: .3rem 0; }
.health-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.health-list li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: .7rem; }
.health-list li:last-child { border-bottom: none; padding-bottom: 0; }
.health-name { font: 600 .92rem var(--font-body); }

/* Pagination */
.pagination { display: flex; gap: .4rem; justify-content: center; margin: 1.6rem 0; flex-wrap: wrap; }
.pagination a { min-width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; text-decoration: none; font: 600 .85rem var(--font-body); color: var(--muted); padding: 0 .5rem; transition: border-color .2s, color .2s; }
.pagination a:hover { border-color: var(--red); color: var(--red-deep); }
.pagination a.active { background: var(--red); border-color: var(--red); color: #fff; }

/* Dropdowns */
.dropdown { position: absolute; top: calc(100% + 10px); right: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem; z-index: 60; animation: fadeUp .18s var(--ease); }
.dropdown button { display: block; width: 100%; text-align: left; background: none; border: none; font: 500 .9rem var(--font-body); color: var(--text); padding: .55rem .8rem; border-radius: 8px; cursor: pointer; }
.dropdown button:hover { background: var(--bg-soft); }
.dropdown button.danger { color: var(--red-deep); }
.dropdown.show { display: flex; }
.dropdown select, .dropdown input[type="text"] { width: 100%; margin: .2rem 0; }
.notif-wrap { position: relative; }
.notif-panel { min-width: 340px; max-height: 420px; overflow: auto; }
.notif-panel .np-head { display: flex; justify-content: space-between; align-items: center; padding: .4rem .6rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.notif-panel .np-head strong { font-size: .92rem; }
.np-item { display: flex; gap: .7rem; padding: .6rem; border-radius: 8px; }
.np-item:hover { background: var(--bg-soft); }
.np-item.unread { background: var(--red-soft); }
.np-item .notif-title { font-size: .87rem; }
.np-item .notif-text { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-item .notif-time { font-size: .74rem; }
.np-empty { text-align: center; color: var(--muted); padding: 1.6rem .8rem; font-size: .9rem; }

/* ================================================================
   CHAT INTERFACE
   ================================================================ */
.chat-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 300px; gap: 0; height: calc(100vh - var(--topbar-h)); margin: -2rem calc(-1 * clamp(1rem, 3vw, 2.6rem)) - 4rem; }
.chat-sidebar { border-right: 1px solid var(--border); padding: 1rem .8rem; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.chat-sidebar-head { margin-bottom: .9rem; }
.chat-convo-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; padding-right: .2rem; }
.chat-convo-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: var(--radius-sm); text-decoration: none; color: var(--text-soft); font: 500 .88rem var(--font-body); cursor: pointer; transition: background .15s; }
.chat-convo-item:hover { background: var(--bg-soft); }
.chat-convo-item.active { background: var(--red-soft); color: var(--red-deep); font-weight: 600; }
[data-theme="dark"] .chat-convo-item.active { color: #ff8296; }
.chat-convo-item .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-convo-item .pin { font-size: .75rem; opacity: .8; }
.chat-sidebar-foot { border-top: 1px solid var(--border); padding-top: .8rem; text-align: center; }
.chat-sidebar-toggle { display: none; }

.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.6rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-title-block { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.chat-title { font-size: 1.05rem; margin: 0; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-model { font-size: .8rem; color: var(--muted); }
.chat-model strong { color: var(--text); font-weight: 600; }
.chat-status { font: 600 .78rem var(--font-body); padding: .22rem .7rem; border-radius: 99px; }
.chat-status.ok { background: rgba(34,170,96,.1); color: #177f4b; }
.chat-status.err { background: var(--red-soft); color: var(--red-deep); }
.chat-actions { display: flex; gap: .5rem; position: relative; }

.chat-messages { flex: 1; overflow-y: auto; padding: 1.8rem clamp(1rem, 4vw, 3.2rem); scroll-behavior: smooth; }
.chat-welcome { max-width: 640px; margin: 4vh auto 0; text-align: center; animation: floatIn .5s var(--ease); }
.welcome-logo { display: flex; justify-content: center; margin-bottom: 1.2rem; }
.chat-welcome h2 { font-size: 1.7rem; font-weight: 800; }
.suggestion-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1.6rem; text-align: left; }
.suggestion-card { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .95rem 1.1rem; font: 600 .88rem var(--font-body); color: var(--text); cursor: pointer; transition: transform .18s var(--ease), border-color .18s; }
.suggestion-card:hover { transform: translateY(-3px); border-color: var(--red); }

.msg { max-width: 760px; margin: 0 auto 1.6rem; display: flex; gap: .9rem; animation: msgIn .3s var(--ease); }
.msg-user { justify-content: flex-end; }
.msg-bubble { max-width: 86%; padding: .9rem 1.15rem; border-radius: 16px; font-size: .95rem; line-height: 1.7; overflow-wrap: break-word; }
.msg-user .msg-bubble { background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; border-bottom-right-radius: 5px; white-space: pre-wrap; }
.msg-ai .msg-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 .72rem var(--font-display); }
.msg-ai .msg-avatar { background: #0A0A0A; color: #fff; border: 1px solid var(--border); }
.msg-user .msg-avatar { background: var(--bg-soft); color: var(--muted); order: 2; }

/* Markdown inside AI messages */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 { margin: .9rem 0 .5rem; font-size: 1.05rem; }
.msg-bubble h1 { font-size: 1.2rem; } .msg-bubble h2 { font-size: 1.12rem; }
.msg-bubble p { margin: 0 0 .6rem; } .msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: .4rem 0 .7rem; padding-left: 1.35rem; }
.msg-bubble li { margin-bottom: .25rem; }
.msg-bubble a { color: var(--red-deep); }
.msg-bubble blockquote { margin: .6rem 0; padding: .3rem 1rem; border-left: 3px solid var(--red); background: var(--bg-soft); border-radius: 0 8px 8px 0; color: var(--muted); }
.msg-bubble code:not(pre code) { background: var(--bg-soft); border: 1px solid var(--border); padding: .1rem .38rem; border-radius: 6px; font-size: .84em; }
.msg-bubble table { border-collapse: collapse; margin: .7rem 0; width: 100%; font-size: .87em; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--border-strong); padding: .42rem .65rem; text-align: left; }
.msg-bubble th { background: var(--bg-soft); font-weight: 600; }
.code-block { position: relative; margin: .7rem 0; }
.code-block pre { background: #0A0A0A; color: #f0f0f0; border-radius: 10px; padding: 1rem 1.1rem; overflow-x: auto; margin: 0; font-size: .84rem; line-height: 1.6; }
.code-lang { position: absolute; top: .45rem; right: 3.6rem; font: 600 .68rem var(--font-mono); color: #8a8a8a; text-transform: lowercase; }
.code-copy, .code-download { position: absolute; top: .35rem; width: 28px; height: 28px; border-radius: 7px; border: none; background: rgba(255,255,255,.09); color: #d9d9d9; cursor: pointer; display: grid; place-items: center; font-size: .75rem; transition: background .2s; }
.code-copy:hover, .code-download:hover { background: rgba(255,255,255,.2); }
.code-copy { right: .4rem; } .code-download { right: 2.4rem; }

.msg-actions { display: flex; gap: .2rem; margin-top: .5rem; opacity: 0; transition: opacity .2s; }
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
.msg-action { border: none; background: none; color: var(--muted); font-size: 1rem; width: 30px; height: 30px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; }
.msg-action:hover { background: var(--bg-soft); color: var(--text); }
.msg-action.active-good { color: #177f4b; }
.msg-action.active-bad { color: var(--red-deep); }

/* Thinking indicator */
.thinking { display: inline-flex; gap: 5px; padding: .4rem 0; }
.thinking span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: bounceDot 1.2s infinite; }
.thinking span:nth-child(2) { animation-delay: .15s; } .thinking span:nth-child(3) { animation-delay: .3s; }

/* Composer */
.chat-composer-wrap { padding: 1rem clamp(1rem, 4vw, 3.2rem) 1.3rem; }
.chat-composer { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: .4rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; padding: .5rem .55rem; box-shadow: var(--shadow-md); transition: border-color .2s, box-shadow .2s; }
.chat-composer:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.chat-composer textarea { flex: 1; border: none; background: none; resize: none; max-height: 180px; padding: .6rem .5rem; font-size: .95rem; box-shadow: none; }
.chat-composer textarea:focus { box-shadow: none; }
.composer-btn { width: 38px; height: 38px; border-radius: 11px; border: none; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s; }
.composer-btn:hover:not(:disabled) { background: var(--bg-soft); color: var(--text); }
.composer-btn:disabled { opacity: .4; cursor: not-allowed; }
.composer-btn svg { width: 18px; height: 18px; }
.composer-send { width: 42px; height: 42px; border-radius: 13px; border: none; background: linear-gradient(135deg, var(--red), var(--red-deep)); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 5px 16px rgba(255,31,61,.3); transition: transform .18s var(--ease), box-shadow .2s; }
.composer-send:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-red); }
.composer-send:disabled { opacity: .5; cursor: not-allowed; }
.composer-send svg { width: 18px; height: 18px; margin: 1px 0 0 1px; }
.composer-hint { text-align: center; font-size: .74rem; color: var(--muted); margin: .55rem 0 0; }

/* Right context panel */
.chat-context { border-left: 1px solid var(--border); padding: 1.4rem 1.2rem; overflow-y: auto; background: var(--bg); }
.chat-context .panel { padding: 1.1rem 1.2rem; }

/* Legal pages */
.legal-body { background: var(--bg); }
.legal-main { max-width: 820px; margin: 0 auto; padding: 7rem 1.5rem 4rem; }
.legal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.6rem clamp(1.4rem, 4vw, 3.2rem); }
.legal-card h1 { font-size: 1.9rem; }
.legal-card h2 { font-size: 1.15rem; margin-top: 2rem; }
.legal-card p { color: var(--text-soft); }
.legal-updated { color: var(--muted); font-size: .86rem; }

/* Toasts */
.toasts { position: fixed; bottom: 1.4rem; right: 1.4rem; display: flex; flex-direction: column; gap: .6rem; z-index: 200; max-width: min(380px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: flex-start; gap: .7rem; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: var(--radius-sm); padding: .85rem 1.05rem; box-shadow: var(--shadow-lg); font-size: .9rem; animation: toastIn .3s var(--ease); }
.toast.toast-success { border-left-color: #22AA60; }
.toast.toast-info { border-left-color: var(--red); }
.toast.toast-error { border-left-color: var(--red-deep); background: var(--red-soft); }
.toast.hide { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* Skeletons */
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 50%, var(--bg-soft) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1280px) {
  .chat-context { display: none; }
  .chat-shell { grid-template-columns: 264px minmax(0, 1fr); }
  .cap-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: 1fr; gap: 3.5rem; }
  .hero-visual { max-width: 560px; margin: 0 auto; }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .discover-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-burger { display: grid; }
  .plans-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .usecase-grid { grid-template-columns: 1fr 1fr; }
  .cap-grid { grid-template-columns: repeat(3, 1fr); }
  .app-sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 95; transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  .app-sidebar.open { transform: none; }
  .sidebar-toggle { display: grid !important; }
  .sidebar-backdrop { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 94; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .topbar-search { display: none; }
  .app-main { padding: 1.4rem 1rem 5rem; }
  .chat-shell { grid-template-columns: minmax(0, 1fr); margin: -1.4rem -1rem -5rem; height: calc(100vh - var(--topbar-h)); }
  .chat-sidebar { position: fixed; top: var(--topbar-h); bottom: 0; z-index: 95; transform: translateX(-100%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); }
  .chat-sidebar.open { transform: none; }
  .chat-sidebar-toggle { display: grid; position: fixed; left: 1rem; bottom: 1rem; z-index: 92; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; place-items: center; box-shadow: var(--shadow-md); }
  .chat-sidebar-toggle svg { width: 20px; height: 20px; }
  .chat-composer-wrap { position: sticky; bottom: 0; background: var(--bg); }
}
@media (max-width: 640px) {
  .features-grid, .steps-grid, .usecase-grid, .discover-grid, .stat-grid, .quick-actions { grid-template-columns: 1fr; }
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding-top: 8rem; }
  .float-card { display: none; }
  .field-row-2 { grid-template-columns: 1fr; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .msg-bubble { max-width: 94%; }
  .page-head { flex-direction: column; }
  .section { padding: 3.5rem 1.1rem; }
  .history-toolbar { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
