:root{
  --bg: #f9fafb;
  --panel: #ffffff;
  --panel2: #f3f4f6;
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(15,23,42,.08);
  --brand: #ff0000;
  --brand2: #cc0000;
  --radius: 16px;
  --shadow: 0 18px 55px rgba(15,23,42,.12);
  --w: 1140px;

  /* ── Z-index scale ─────────────────────────────────────────────
     Use these variables everywhere — never raw numbers.
     100  sticky header
     200  dropdowns (user menu, language picker)
     300  popovers  (workspace dropdown, chat export)
     400  modal overlays
     500  editor floats (table toolbar, slash command palette)
     600  skip link (above everything)
  ───────────────────────────────────────────────────────────── */
  --z-sticky   : 100;
  --z-dropdown : 200;
  --z-popover  : 300;
  --z-modal    : 400;
  --z-editor   : 500;
  --z-skip     : 600;
}

*{ box-sizing: border-box; }
html{ height:100%; }
body{
  margin:0;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 560px at 12% 8%, rgba(255,0,0,.06), transparent 55%),
    radial-gradient(1100px 640px at 88% 12%, rgba(255,87,51,.05), transparent 58%),
    var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
}
main{ flex:1; }
a{ color: inherit; text-decoration: none; }
a:hover{ opacity: .92; }

.container{ width: min(var(--w), calc(100% - 40px)); margin: 0 auto; }

.muted{ color: var(--muted); }
.w-full{ width: 100%; }

.no-scroll{ overflow: hidden; }

/* Header */
.header{
  position: sticky;
  top:0;
  z-index: var(--z-sticky);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 35px rgba(15,23,42,.06);
}
.header__inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.brand{
  display:flex; align-items:center; gap: 10px;
  font-weight: 700;
  letter-spacing: .2px;
}
.brand__mark{
  width: 36px; height: 36px;
  display:grid; place-items:center;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff0000, #cc0000);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(255,0,0,.18);
}
.nav{
  display:flex; gap: 18px;
  color: var(--muted);
}
.nav a{ padding: 10px 10px; border-radius: 12px; transition: background .2s ease, color .2s ease; }
.nav a:hover{ background: rgba(255,0,0,.08); color: var(--text); }

/* Language dropdown */
.lang-dropdown { position: relative; }
.lang-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  height: 36px;
  transition: background .15s, border-color .15s, color .15s;
}
.lang-dropdown.is-open .lang-dropdown__trigger,
.lang-dropdown__trigger:hover {
  background: rgba(255,0,0,.06);
  border-color: rgba(255,0,0,.16);
  color: var(--text);
}
.lang-dropdown__globe { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.lang-dropdown__chevron {
  width: 12px; height: 12px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .2s ease;
}
.lang-dropdown.is-open .lang-dropdown__chevron { transform: rotate(180deg); }
.lang-dropdown__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 120px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(15,23,42,.12);
  padding: 4px;
  z-index: var(--z-dropdown);
  animation: menu-in .15s ease;
}
.lang-dropdown__panel[hidden] { display: none; }
.lang-dropdown__option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}
.lang-dropdown__option:hover { background: rgba(255,0,0,.06); color: var(--brand); }
.lang-dropdown__option.is-active { color: var(--brand); }
/* Mobile drawer support row (support link + lang dropdown inline) */
.drawer__support-row { display: flex; align-items: center; gap: 12px; }

.header__cta{ display:flex; gap: 10px; }

.burger{
  display:none;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor:pointer;
}
.burger span{
  display:block;
  width: 18px; height: 2px;
  margin: 5px auto;
  background: var(--text);
  border-radius: 2px;
}

/* Drawer */
.drawer{
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
}
.drawer__inner{
  padding: 14px 0 20px;
  display: flex;
  flex-direction: column;
  color: var(--muted);
}
/* Unauthenticated nav links (direct children only) */
.drawer__inner > a{
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.drawer__inner > a:hover{ background: rgba(255,0,0,.08); color: var(--text); }
.drawer__cta{ display:flex; gap: 10px; padding-top: 6px; }

/* ── Authenticated drawer ── */
.drawer__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 16px;
}
.drawer__user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.drawer__user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer__user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.drawer__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}
.drawer__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}
.drawer__item:hover { background: rgba(255,0,0,.07); color: var(--brand); }
.drawer__item--danger:hover { background: rgba(220,38,38,.07); color: #dc2626; }
.drawer__item i {
  font-style: normal;
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.drawer__divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}
.drawer__nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  padding: 14px 12px 2px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.drawer__nav-row a {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.drawer__nav-row a:hover { color: var(--text); }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 0 14px;
  height: 36px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.input{
  width: 100%;
  max-width: 360px; /* overridden to none inside .card */
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus{
  border-color: rgba(255,0,0,.35);
  box-shadow: 0 10px 28px rgba(255,0,0,.12);
}
.input::placeholder{ color: var(--muted); }
.card .input{ max-width: none; }
.btn--lg{ height: auto; padding: 12px 16px; border-radius: 16px; }
.btn--primary{
  border-color: transparent;
  background: linear-gradient(135deg, #ff0000, #d60000);
  color:#fff;
  box-shadow: 0 14px 40px rgba(255,0,0,.18);
  cursor: pointer;
}
.btn--primary:hover{ filter: brightness(0.96); }
.btn--ghost{
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.btn--ghost:hover{
  background: rgba(255,0,0,.08);
  border-color: rgba(255,0,0,.16);
  color: var(--brand);
}
.btn--soft{
  background: rgba(255,0,0,.08);
  border-color: rgba(255,0,0,.16);
  color: var(--brand);
}
.btn--soft:hover{
  background: rgba(255,0,0,.14);
  border-color: rgba(255,0,0,.26);
  color: var(--brand2);
}
.btn--danger{
  border-color: transparent;
  background: #dc2626;
  color: #fff;
}
.btn--danger:hover{ background: #b91c1c;
}

/* Hero */
.hero{ padding: 52px 0 26px; }
.hero__grid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 28px;
  align-items: center;
}
h1{
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05;
  margin: 0 0 12px;
}
.lead{
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 18px;
}
.hero__badges{ display:flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.pill{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.pill--link{ color: var(--brand); border-color: rgba(255,0,0,.16); background: rgba(255,0,0,.08); }
.hero__actions{
  margin-bottom: 18px;
  max-width: 760px;
}
.hero__actions form{
  display:flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
}
.hero__actions .input{ flex:1 1 340px; min-height: 48px; }
.hero__actions .btn{
  min-height: 48px;
  flex: 0 0 auto;
}
.hero__actions .btn--primary{
  background: linear-gradient(135deg, #ff1f3d, #d60000);
  box-shadow: 0 14px 38px rgba(214,0,0,.18);
  padding-inline: 18px;
}
.trust{ display:flex; align-items:center; gap: 12px; color: var(--muted); }
.trust__dots{ display:flex; gap: 6px; }
.trust__dots span{
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.14);
}

/* Mock */
.mock{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.mock__topbar{
  height: 42px;
  display:flex; align-items:center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}
.dot{ width: 10px; height: 10px; border-radius: 50%; background: rgba(15,23,42,.12); }
.mock__topbar .dot:nth-child(1){ background: #ff5f57; }
.mock__topbar .dot:nth-child(2){ background: #febc2e; }
.mock__topbar .dot:nth-child(3){ background: #28c840; }
.mock__body{
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
}
.mock__video{
  background: radial-gradient(420px 260px at 30% 35%, rgba(255,0,0,.14), transparent 60%),
              radial-gradient(420px 260px at 80% 60%, rgba(255,87,51,.12), transparent 60%),
              rgba(15,23,42,.04);
}
.mock__chat{
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--line);
}
.msg{
  max-width: 75%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  align-self: flex-start;
  border-radius: 14px 14px 14px 4px;
}
.msg--user{
  align-self: flex-end;
  background: rgba(255,0,0,.10);
  border-color: rgba(255,0,0,.18);
  border-radius: 14px 14px 4px 14px;
}
.caption{ color: var(--muted); font-size: 12px; margin: 10px 6px 0; }

/* Sections */
.section{ padding: 56px 0; }
.section--alt{
  background: linear-gradient(180deg, transparent, rgba(255,0,0,.03), transparent);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section__head{ margin-bottom: 22px; }
.section__head h2{ margin:0 0 8px; font-size: 30px; }
.section__head p{ margin:0; color: var(--muted); line-height: 1.6; }

/* Feature split */
.feature--split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin: 22px 0 22px;
}
.feature__text{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}
.feature__text h3{ margin: 0 0 10px; }
.checklist{ margin: 0 0 14px; padding-left: 18px; color: var(--muted); }
.checklist li{ margin: 8px 0; }

.feature__media .card--media{
  min-height: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: radial-gradient(520px 260px at 18% 32%, rgba(255,0,0,.12), transparent 62%),
              radial-gradient(480px 240px at 82% 70%, rgba(255,87,51,.10), transparent 62%),
              #fff;
}

/* Research Workspace preview mock */
.workspace-preview {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}
.wp-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #7c3aed;
  margin-bottom: 6px;
}
.wp-videos { display: flex; flex-direction: column; gap: 4px; }
.wp-vid {
  background: #f8fafc;
  border: 1px solid rgba(15,23,42,.07);
  border-radius: 6px;
  padding: 5px 10px;
  color: #334155;
  font-size: 12.5px;
}
.wp-vid--more { color: #94a3b8; font-style: italic; }
.wp-query {
  background: #f3e8ff;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wp-q-label { font-size: 11px; color: #7c3aed; font-weight: 600; }
.wp-q-text  { font-size: 13px; color: #1e1b4b; font-weight: 600; }
.wp-answer {
  background: #fff;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 8px;
  padding: 8px 12px;
  color: #334155;
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.wp-a-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 4px;
}

/* Cards */
.card{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
}
.card h4{ margin: 0 0 8px; }
.card p{ margin: 0; color: var(--muted); line-height: 1.6; }

.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* How it works steps */
.how-step { position: relative; }
.how-step__num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* CTA */
.cta{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0;
}
.cta__actions{ display:flex; gap: 12px; flex-wrap: wrap; }

/* Toggle */
.toggle{
  display:inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  margin-bottom: 18px;
}
.toggle__btn{
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}
.toggle__btn.is-active{
  background: rgba(255,0,0,.10);
  color: var(--text);
}
.badge{
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,0,0,.25);
  background: rgba(255,0,0,.10);
  color: var(--brand);
  font-size: 12px;
}

/* Pricing */
.pricing{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.price{
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.price .btn,
.price form{ margin-top: auto; }
.price h3{ margin: 0 0 8px; }
.price__value{ margin: 0 0 8px; display:flex; align-items: baseline; gap: 8px; }
.money{ font-size: 34px; font-weight: 900; letter-spacing: -0.6px; }
.per{ color: var(--muted); font-weight: 700; }
.price ul{ margin: 12px 0 16px; padding-left: 18px; color: var(--muted); }
.price li{ margin: 8px 0; }
.price--featured{
  border-color: rgba(255,0,0,.35);
  background: linear-gradient(180deg, rgba(255,0,0,.10), #fff);
  box-shadow: 0 24px 80px rgba(255,0,0,.12);
}
.price--current{
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.current-plan-label{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 10px;
}
/* Header tier badge */
.tier-badge{
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 5px;
  line-height: 1.6;
}
.tier-badge--standard{
  background: rgba(255,0,0,.10);
  color: var(--brand);
  border: 1px solid rgba(255,0,0,.22);
}
.tier-badge--pro{
  background: #1e1b4b;
  color: #c7d2fe;
  border: 1px solid #4338ca;
}
.ribbon{
  position:absolute;
  top: 14px;
  right: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,0,0,.12);
  border: 1px solid rgba(255,0,0,.24);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

/* FAQ */
.faq{
  display:grid;
  gap: 10px;
}
details{
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
}
summary{
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}
details .faq__body{
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .4s ease;
}
details[open] .faq__body{
  grid-template-rows: 1fr;
}
details .faq__inner{
  overflow: hidden;
}
details p{
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Footer */
.footer{
  padding: 40px 0 26px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.footer__grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 18px;
}
.footer__col h5{ margin: 0 0 10px; }
.footer__col a{
  display:block;
  color: var(--muted);
  padding: 7px 0;
}
.footer__col a:hover{ color: var(--brand); }
.footer__bottom{
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Responsive */
@media (max-width: 920px){
  .nav, .header__cta{ display:none; }
  .burger{ display:block; }
  .hero__grid{ grid-template-columns: 1fr; }
  .mock__body{ grid-template-columns: 1fr; }
  .mock__chat{ border-left: 0; border-top: 1px solid rgba(255,255,255,.10); }
  .feature--split{ grid-template-columns: 1fr; }
  .grid3{ grid-template-columns: 1fr; }
  .pricing{ grid-template-columns: 1fr; }
  .footer__grid{ grid-template-columns: 1fr 1fr 1fr; }
  .footer__grid > div:first-child{ grid-column: 1 / -1; }
  .cta{ flex-direction: column; align-items: flex-start; }
  .hero__actions form{ flex-direction: column; align-items: stretch; }
  .hero__actions .input{ flex-basis: auto; }
  .hero__actions .btn{
    width: 100%;
    justify-content: center;
  }
  .input{ max-width: 100%; }
}

@media (max-width: 540px){
  .footer__grid{ grid-template-columns: 1fr; }
  .footer__grid > div:first-child{ grid-column: auto; }
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(15,23,42,.18);
  padding: 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modal-in .15s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal__title { margin: 0; font-size: 18px; font-weight: 800; }
.modal__input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 15px;
  font-family: inherit;
  color: #0f172a;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.modal__input:focus {
  border-color: rgba(255,0,0,.35);
  box-shadow: 0 0 0 3px rgba(255,0,0,.08);
}
.modal__body {
  margin: 0;
  color: #475569;
  line-height: 1.55;
}
.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Copy button ─────────────────────────────────────────── */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
  font-family: inherit;
}
.msg-bubble:hover .copy-btn,
.summary-content:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { background: #e2e8f0; color: var(--text); }
.copy-btn--copied { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; opacity: 1; }

/* ── User menu dropdown ──────────────────────────────────── */
.user-menu { position: relative; }
.user-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
  height: 36px;
}
.user-menu__trigger:hover {
  background: rgba(255,0,0,.06);
  border-color: rgba(255,0,0,.16);
}
.user-menu__avatar {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff0000, #d60000);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.user-menu__chevron {
  width: 14px; height: 14px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform .2s ease;
}
.user-menu.is-open .user-menu__chevron { transform: rotate(180deg); }

.user-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 55px rgba(15,23,42,.13);
  padding: 6px;
  z-index: var(--z-dropdown);
  animation: menu-in .15s ease;
}
.user-menu__panel[hidden] { display: none; }
@keyframes menu-in {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.user-menu__header { padding: 8px 10px 10px; }
.user-menu__name { font-weight: 700; font-size: 14px; color: var(--text); }
.user-menu__email { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-menu__sep { height: 1px; background: var(--line); margin: 4px 0; }
.user-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.user-menu__item:hover { background: rgba(255,0,0,.07); color: var(--brand); opacity: 1; }
.user-menu__item--danger:hover { background: rgba(220,38,38,.07); color: #dc2626; }
.user-menu__icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-style: normal;
  font-size: 17px;
}

/* Inline timestamp button rendered inside AI replies */
.stamp--inline {
  display: inline;
  padding: 1px 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand2);
  background: rgba(255,0,0,.06);
  border: 1px solid rgba(204,0,0,.18);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  transition: background .15s;
}
.stamp--inline:hover { background: rgba(255,0,0,.12); }

/* Timestamp ref in research chat (no seek, visual only) */
.stamp-ref {
  display: inline;
  padding: 1px 5px;
  font-size: .78rem;
  font-weight: 700;
  color: #6366f1;
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 5px;
  font-family: inherit;
}

/* ── History page ────────────────────────────────────────────────── */
.history-page {
  padding: 48px 0 80px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.history-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.history-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.history-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  overflow: hidden;
}
.history-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.history-card__thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.5rem;
  color: #334155;
}
.history-card__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: .02em;
}

.history-card__body {
  padding: 14px 16px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-card__title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-card__meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.history-card__meta--muted {
  color: #94a3b8;
}

.history-card__footer {
  padding: 10px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
}
.history-card__msgs {
  font-size: 12px;
  color: #94a3b8;
}

.history-empty {
  text-align: center;
  padding: 80px 24px;
  color: #64748b;
}
.history-empty__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

/* ── Skip navigation link ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 16px;
  z-index: var(--z-skip);
  padding: 8px 16px;
  background: var(--text);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: top 0s;
}
.skip-link:focus {
  top: 0;
}

/* ── CSS tooltip system (replaces native title= attribute) ─────── */
/* Usage: <button data-tooltip="Label"> */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: var(--z-popover);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}
/* Tooltip below (for elements near top of viewport) */
[data-tooltip-pos="below"]::after {
  bottom: auto;
  top: calc(100% + 6px);
}

/* ── Global toast notification ─────────────────────────────────── */
.tt-toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: var(--z-modal);
  pointer-events: none;
}
.tt-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15,23,42,.16);
  pointer-events: auto;
  animation: toast-in .2s ease;
  max-width: min(440px, calc(100vw - 32px));
}
.tt-toast--error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.tt-toast--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.tt-toast--info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.tt-toast--out     { animation: toast-out .25s ease forwards; }
@keyframes toast-in  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(6px); } }

/* ── Notes index page ──────────────────────────────────────────── */
.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.note-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.note-card__thumb {
  width: 80px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #f1f5f9;
}
.note-card__thumb--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 20px;
}
.note-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.note-card__title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card__excerpt {
  font-size: 13px;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card__meta {
  font-size: 12px;
  color: #94a3b8;
}
.note-card__open {
  flex-shrink: 0;
  font-size: 13px;
  padding: 7px 14px;
}

/* ── Pricing: subscribe-instead nudge ─────────────────────────── */
.subscribe-nudge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  color: #1e40af;
  text-align: center;
  margin-bottom: 28px;
}
.subscribe-nudge__link {
  white-space: nowrap;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
}
.subscribe-nudge__link:hover { text-decoration: underline; }

/* ── Dunning banner (past_due payment) ────────────────────────── */
.dunning-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fef3c7;
  border-bottom: 1px solid #fbbf24;
  padding: 10px 20px;
  font-size: 14px;
  color: #92400e;
  text-align: center;
}
.dunning-banner__btn {
  background: #d97706;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.dunning-banner__btn:hover { background: #b45309; }

/* ── Credits remaining notice (pricing page) ──────────────────── */
.credits-remaining-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: #166534;
  font-weight: 500;
  margin-bottom: 16px;
}

/* ── Checkout success banner ───────────────────────────────────── */
.checkout-success-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: #d1fae5;
  border-bottom: 1px solid #6ee7b7;
  color: #065f46;
  font-size: .9rem;
  text-align: center;
}

/* ── Copy button fade-out ──────────────────────────────────────── */
.copy-btn--fading {
  opacity: 0 !important;
  transition: opacity .3s ease !important;
}

/* ── Plan-change confirmation modal ───────────────────────────── */
.plan-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}
.plan-modal-overlay[hidden] { display: none; }
.plan-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(15,23,42,.18);
}
.plan-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 10px;
}
.plan-modal__intro {
  color: #475569;
  margin: 0 0 16px;
  font-size: .95rem;
}
.plan-modal__feature-label {
  font-weight: 600;
  font-size: .9rem;
  margin: 0 0 8px;
  color: #0f172a;
}
.plan-modal__features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-modal__features li::before {
  content: '✦ ';
  color: #6366f1;
  font-size: .75rem;
}
.plan-modal__billing {
  font-size: .85rem;
  color: #64748b;
  margin: 0 0 24px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  min-height: 0;
}
.plan-modal__billing:empty { display: none; }
.plan-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.btn--danger {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: .95rem;
}
.btn--danger:hover { background: #b91c1c; }

/* Social proof stats strip */
.stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: .9rem;
  color: #64748b;
}
.stats-strip__item strong {
  color: #1e293b;
  font-weight: 700;
}
.stats-strip__sep {
  color: #cbd5e1;
}
