/* ==========================================================================
   Profile Portal — design system
   Dark, glass-surfaced, aurora-lit. No framework, no build step.
   1. Tokens      2. Base      3. Background      4. Header
   5. Buttons     6. Cards     7. Profile view    8. Chat
   9. Analyzer   10. Markdown  11. Footer/Toast  12. Motion & responsive
   ========================================================================== */

/* -------------------------------------------------------------- 1. Tokens */
:root {
  /* surfaces */
  --bg:        #070b18;
  --bg-soft:   #0b1122;
  --surface:   rgba(20, 28, 54, 0.72);
  --surface-2: rgba(28, 38, 70, 0.72);
  --surface-3: #141c36;
  --border:    rgba(124, 156, 255, 0.16);
  --border-2:  rgba(124, 156, 255, 0.34);

  /* ink */
  --text:  #eaeefb;
  --text-2:#c2cbe6;
  --muted: #8e9bc0;

  /* brand */
  --brand:   #7c9cff;
  --brand-2: #4fd1c5;
  --brand-3: #b88bff;
  --ink-on-brand: #060a16;
  --grad: linear-gradient(120deg, var(--brand) 0%, var(--brand-3) 45%, var(--brand-2) 100%);

  /* state */
  --ok: #3ddc97;
  --danger: #ff6b81;

  /* shape */
  --r-xs: 10px;
  --r-sm: 14px;
  --r:    20px;
  --r-lg: 28px;
  --ring: 0 0 0 1px var(--border);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, .8);
  --shadow:    0 24px 60px -28px rgba(0, 0, 0, .9);
  --shadow-brand: 0 20px 44px -22px rgba(124, 156, 255, .75);

  /* type */
  --font:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", var(--font);
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 1180px;
  --gap: 22px;
}

/* ---------------------------------------------------------------- 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--display); color: var(--text); line-height: 1.18; letter-spacing: -0.025em; margin: 0; }
p { margin: 0 0 14px; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
::selection { background: rgba(124, 156, 255, .35); color: #fff; }

.muted { color: var(--muted); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow {
  margin: 0 0 6px; font-family: var(--display); font-size: 12px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; color: var(--brand-2);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 10px; z-index: 100; background: var(--brand); color: var(--ink-on-brand); padding: 10px 16px; border-radius: var(--r-xs); font-weight: 600; }
.skip-link:focus { left: 10px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

/* custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(124,156,255,.35) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(124,156,255,.28); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(124,156,255,.5); background-clip: content-box; }

/* ---------------------------------------------------------- 3. Background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 120% at 50% 0%, #0d1530 0%, var(--bg) 55%); }
.bg__orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.bg__orb--1 { width: 620px; height: 620px; top: -220px; right: -140px; background: radial-gradient(circle, rgba(124,156,255,.55), transparent 65%); animation: drift 26s ease-in-out infinite; }
.bg__orb--2 { width: 540px; height: 540px; top: 36%; left: -200px; background: radial-gradient(circle, rgba(79,209,197,.38), transparent 65%); animation: drift 32s ease-in-out infinite reverse; }
.bg__orb--3 { width: 460px; height: 460px; bottom: -180px; right: 12%; background: radial-gradient(circle, rgba(184,139,255,.34), transparent 65%); animation: drift 38s ease-in-out infinite; }
.bg__grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(124,156,255,.055) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(124,156,255,.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, #000 20%, transparent 75%);
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-40px, 50px) scale(1.12); }
}

/* -------------------------------------------------------------- 4. Header */
.banner {
  position: relative; z-index: 30; text-align: center; font-size: 14px;
  padding: 10px 18px; color: #ffe9a8;
  background: linear-gradient(90deg, rgba(255,196,0,.14), rgba(255,196,0,.06));
  border-bottom: 1px solid rgba(255,196,0,.28);
}
.banner code { font-family: var(--mono); font-size: 12.5px; background: rgba(0,0,0,.35); padding: 2px 7px; border-radius: 6px; }

.topbar {
  position: sticky; top: 0; z-index: 25;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(7, 11, 24, .72);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand__mark {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; background: var(--grad); color: var(--ink-on-brand);
  font-family: var(--display); font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow-brand);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-family: var(--display); font-weight: 700; font-size: 15px; }
.brand__role { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.tabs {
  position: relative; display: flex; gap: 2px; padding: 5px;
  border-radius: 999px; border: 1px solid var(--border); background: rgba(14, 20, 40, .8);
}
.tab {
  position: relative; z-index: 1; padding: 8px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: color .25s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tabs__glider {
  position: absolute; top: 5px; left: 5px; height: calc(100% - 10px);
  border-radius: 999px; background: linear-gradient(135deg, rgba(124,156,255,.28), rgba(79,209,197,.2));
  box-shadow: inset 0 0 0 1px var(--border-2);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1), width .32s cubic-bezier(.4, 0, .2, 1);
  width: 0;
}

main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 40px 24px 72px; }

/* ----------------------------------------------------------- 5. Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: inherit; font-weight: 650; font-size: 15px; cursor: pointer; white-space: nowrap;
  padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--grad); color: var(--ink-on-brand); box-shadow: var(--shadow-brand); }
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 26px 50px -20px rgba(124,156,255,.9); }
.btn--ghost { background: rgba(255,255,255,.03); color: var(--text); border-color: var(--border-2); }
.btn--ghost:hover { background: rgba(124,156,255,.12); border-color: var(--brand); }
.btn--danger { background: rgba(255,107,129,.14); color: var(--danger); border-color: rgba(255,107,129,.4); }
.btn--sm { padding: 8px 16px; font-size: 13.5px; }
.btn--xl { padding: 17px 42px; font-size: 17px; letter-spacing: .01em; }
.btn--xl .btn__arrow { width: 19px; height: 19px; transition: transform .25s ease; }
.btn--xl:hover:not(:disabled) .btn__arrow { transform: translateX(4px); }
.topbar__cta svg { width: 15px; height: 15px; }

.spinner {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  border: 2px solid rgba(6,10,22,.25); border-top-color: var(--ink-on-brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- 6. Cards */
.card {
  position: relative; min-width: 0; padding: 28px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.card--glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(124,156,255,.55), transparent 42%, rgba(79,209,197,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card__icon {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 11px; background: rgba(124,156,255,.14); border: 1px solid var(--border);
}
.card__icon svg { width: 19px; height: 19px; fill: var(--brand); }
.card__title { font-size: 18px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.card__head .card__title { margin: 0; }
.num {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--grad); color: var(--ink-on-brand); font-size: 13px; font-weight: 800;
}
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.layout-7-5 { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--gap); margin-top: var(--gap); align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }

.section { margin-top: 64px; }
.section__head { margin-bottom: 22px; }
.section__head h2 { font-size: clamp(22px, 3vw, 30px); }

/* -------------------------------------------------------- 7. Profile view */
.hero {
  display: grid; grid-template-columns: 1.25fr .85fr; align-items: center; gap: 48px;
  padding: 52px 48px;
  border-radius: var(--r-lg); border: 1px solid var(--border);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(124,156,255,.16), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(79,209,197,.12), transparent 55%),
    var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 800; margin: 14px 0 18px; }
.lede { font-size: 17.5px; color: var(--text-2); max-width: 56ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.pill {
  display: inline-flex; align-items: center; gap: 9px; margin: 0;
  padding: 6px 14px 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(61,220,151,.1); color: var(--ok); border: 1px solid rgba(61,220,151,.3);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61,220,151,.6); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(61,220,151,0); } 100% { box-shadow: 0 0 0 0 rgba(61,220,151,0); } }

.hero__media { position: relative; margin: 0; justify-self: center; }
.photo { position: relative; width: 300px; height: 300px; }
.photo__ring {
  position: absolute; inset: -14px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--brand), var(--brand-3), var(--brand-2), var(--brand));
  filter: blur(2px); opacity: .85; animation: spin 14s linear infinite;
}
.photo img, .photo__initials {
  position: relative; width: 300px; height: 300px; border-radius: 50%; object-fit: cover;
  border: 6px solid var(--bg-soft); box-shadow: var(--shadow);
}
.photo__initials {
  display: grid; place-items: center; font-family: var(--display); font-size: 92px;
  font-weight: 800; color: var(--ink-on-brand); background: var(--grad);
}
.float-card {
  position: absolute; display: flex; align-items: baseline; gap: 7px; padding: 10px 16px;
  border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: rgba(12, 18, 38, .9); backdrop-filter: blur(10px);
  box-shadow: var(--shadow); animation: float 6s ease-in-out infinite;
}
.float-card--a { top: 14px; left: -34px; }
.float-card--b { bottom: 22px; right: -40px; animation-delay: -3s; }
.float-card__k { font-family: var(--display); font-size: 20px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.float-card__v { font-size: 12.5px; color: var(--muted); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.statband {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: var(--gap);
  border-radius: var(--r); overflow: hidden; border: 1px solid var(--border);
  background: var(--border);
}
.stat { padding: 22px 24px; text-align: center; background: rgba(13, 19, 40, .85); transition: background .25s; }
.stat:hover { background: rgba(22, 31, 62, .9); }
.stat__n { display: block; font-family: var(--display); font-size: clamp(28px, 4vw, 38px); font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat__l { font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 9px; list-style: none; padding: 0; margin: 18px 0 0; }
.chip {
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; padding: 6px 14px; border-radius: 999px;
  color: var(--brand); background: rgba(124,156,255,.1); border: 1px solid rgba(124,156,255,.28);
}

.meters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 15px; }
.meters li { display: grid; gap: 7px; font-size: 14px; color: var(--text-2); }
.meters li > span { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.meters em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--brand-2); }
.meters i { display: block; height: 7px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.meters b {
  display: block; height: 100%; border-radius: 99px; background: var(--grad);
  transform-origin: left; animation: grow 1.1s cubic-bezier(.22,.9,.3,1) both;
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.card--contact { padding: 22px; }
.contact-row {
  display: flex; align-items: center; gap: 14px; padding: 13px; border-radius: var(--r-sm);
  color: var(--text); border: 1px solid transparent; transition: background .2s, border-color .2s, transform .2s;
}
.contact-row:hover { background: rgba(124,156,255,.08); border-color: var(--border); transform: translateX(3px); }
.contact-row__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: rgba(124,156,255,.14); border: 1px solid var(--border); }
.contact-row__icon svg { width: 18px; height: 18px; fill: var(--brand); }
.contact-row span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.contact-row em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.contact-row strong { font-size: 15px; }
.contact-row__go { color: var(--brand); font-size: 18px; }

.tile {
  padding: 24px; border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.tile:hover { transform: translateY(-4px); border-color: var(--border-2); box-shadow: var(--shadow); }
.tile__icon {
  display: grid; place-items: center; width: 46px; height: 46px; font-size: 22px; margin-bottom: 14px;
  border-radius: 14px; background: rgba(124,156,255,.1); border: 1px solid var(--border);
}
.tile h3 { font-size: 16.5px; margin-bottom: 8px; }
.tile p { font-size: 14.5px; margin: 0; color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 30px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(180deg, var(--brand), var(--brand-3), transparent); }
.timeline li { position: relative; padding: 0 0 30px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute; left: -30px; top: 7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--brand); box-shadow: 0 0 0 4px rgba(124,156,255,.14);
}
.timeline__when { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-2); margin: 0 0 4px; }
.timeline h3 { font-size: 17px; margin-bottom: 5px; }
.timeline li > p:last-child { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 72ch; }

.promo {
  display: flex; flex-direction: column; padding: 28px; border-radius: var(--r);
  border: 1px solid var(--border); color: var(--text); overflow: hidden; position: relative;
  background: radial-gradient(110% 120% at 0% 0%, rgba(124,156,255,.2), transparent 60%), var(--surface);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.promo--alt { background: radial-gradient(110% 120% at 100% 0%, rgba(79,209,197,.2), transparent 60%), var(--surface); }
.promo:hover { transform: translateY(-4px); border-color: var(--border-2); box-shadow: var(--shadow); }
.promo__icon { font-size: 30px; margin-bottom: 12px; }
.promo h3 { font-size: 20px; margin-bottom: 8px; }
.promo p { color: var(--muted); font-size: 14.5px; }
.promo__link { margin-top: auto; font-weight: 700; color: var(--brand); font-size: 14.5px; }

/* --------------------------------------------------------------- 8. Chat */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.view-head h1 { font-size: clamp(26px, 3.6vw, 36px); margin-bottom: 6px; }
.view-head p { margin: 0; }

.chat { display: flex; flex-direction: column; height: calc(100vh - 280px); min-height: 480px; padding: 0; overflow: hidden; }
.chat__log { flex: 1; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; gap: 20px; scroll-behavior: smooth; }
.chat__empty { margin: auto; text-align: center; max-width: 640px; }
.chat__empty-icon { font-size: 34px; }
.chat__empty-title { font-family: var(--display); font-size: 23px; font-weight: 700; color: var(--text); margin: 10px 0 4px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.suggestion {
  font: inherit; font-size: 13.5px; color: var(--text-2); cursor: pointer; text-align: left;
  padding: 11px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(255,255,255,.03); transition: border-color .2s, color .2s, transform .2s;
}
.suggestion:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); }

.msg { display: flex; gap: 13px; animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg__avatar {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; font-family: var(--display);
}
.msg--user { flex-direction: row-reverse; }
.msg--user .msg__avatar { background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--muted); }
.msg--assistant .msg__avatar { background: var(--grad); color: var(--ink-on-brand); }
.msg__bubble { padding: 13px 17px; border-radius: 16px; min-width: 0; max-width: min(760px, 86%); overflow-wrap: anywhere; }
.msg--user .msg__bubble { background: linear-gradient(135deg, rgba(124,156,255,.2), rgba(184,139,255,.14)); border: 1px solid var(--border-2); border-top-right-radius: 5px; white-space: pre-wrap; color: var(--text); }
.msg--assistant .msg__bubble { background: rgba(255,255,255,.04); border: 1px solid var(--border); border-top-left-radius: 5px; }
.msg--error .msg__bubble { border-color: rgba(255,107,129,.5); background: rgba(255,107,129,.08); color: var(--danger); }

.typing { display: inline-flex; gap: 5px; padding: 5px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat__composer {
  display: flex; gap: 10px; align-items: flex-end; padding: 16px;
  border-top: 1px solid var(--border); background: rgba(9, 14, 30, .75);
}
.chat__composer textarea { flex: 1; resize: none; max-height: 200px; border-radius: 16px; }
.chat__send { width: 48px; height: 48px; padding: 0; border-radius: 15px; }
.chat__send svg { width: 19px; height: 19px; }
.chat__composer .btn--danger { height: 48px; border-radius: 15px; }

/* ----------------------------------------------------------- 9. Analyzer */
textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: rgba(7, 11, 24, .72); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 14px 16px; line-height: 1.6;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea:focus { outline: none; border-color: var(--brand); background: rgba(7,11,24,.9); box-shadow: 0 0 0 4px rgba(124,156,255,.16); }
textarea::placeholder { color: #65719a; }
fieldset { margin: 0; border: 1px solid var(--border); }
.input-panel legend { float: left; width: 100%; padding: 0; }
.input-panel legend + * { clear: both; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin: 8px 2px 0; font-family: var(--mono); }

.segmented { display: inline-flex; padding: 4px; margin-bottom: 16px; border-radius: 999px; border: 1px solid var(--border); background: rgba(7,11,24,.6); }
.seg { font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); background: transparent; border: 0; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: color .2s, background .2s; }
.seg:hover { color: var(--text); }
.seg.is-active { background: linear-gradient(135deg, rgba(124,156,255,.3), rgba(79,209,197,.22)); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 322px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-2); border-radius: var(--r-sm);
  background: rgba(7,11,24,.4); transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--brand); background: rgba(124,156,255,.08); }
.dropzone.is-drag { transform: scale(1.01); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(124,156,255,.12); border: 1px solid var(--border); }
.dropzone__icon svg { width: 24px; height: 24px; fill: var(--brand); }
.dropzone__text { color: var(--text-2); font-size: 15px; }
.dropzone__hint { font-size: 13px; color: var(--muted); }
.dropzone__name { font-family: var(--mono); font-size: 12.5px; color: var(--ok); margin-top: 6px; word-break: break-all; }

.analyze-bar { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 0 4px; }
.analyze-bar__hint { font-size: 13px; margin: 0; }
.alert { margin: 0; padding: 11px 18px; border-radius: var(--r-xs); font-size: 14px; background: rgba(255,107,129,.12); color: var(--danger); border: 1px solid rgba(255,107,129,.35); }

.analysis { margin-top: 28px; animation: rise .35s ease both; }
.analysis__head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.analysis__head .card__title { margin: 0; }
.analysis__actions { display: flex; gap: 8px; }

/* ----------------------------------------------------------- 10. Markdown */
.markdown { color: var(--text-2); overflow-wrap: anywhere; font-size: 15px; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3 { font-family: var(--display); }
.markdown h2 { font-size: 19px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.markdown h3 { font-size: 16px; margin: 22px 0 8px; }
.markdown ul, .markdown ol { padding-left: 22px; margin: 0 0 14px; }
.markdown li { margin: 5px 0; }
.markdown strong { color: var(--text); }
.markdown code { font-family: var(--mono); font-size: .88em; background: rgba(7,11,24,.8); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); }
.markdown pre { background: rgba(7,11,24,.85); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; overflow-x: auto; }
.markdown pre code { border: 0; padding: 0; background: none; }
.markdown blockquote { margin: 0 0 14px; padding: 6px 16px; border-left: 3px solid var(--brand); color: var(--muted); background: rgba(124,156,255,.05); border-radius: 0 8px 8px 0; }
.markdown table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0 18px; font-size: 14px; display: block; overflow-x: auto; }
.markdown th, .markdown td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.markdown thead th { background: rgba(124,156,255,.1); color: var(--text); font-family: var(--display); font-size: 13px; letter-spacing: .02em; white-space: nowrap; }
.markdown tbody tr:hover td { background: rgba(255,255,255,.025); }
.cursor::after { content: "▋"; margin-left: 2px; color: var(--brand); animation: blink 1s steps(1) infinite; }

/* ------------------------------------------------------ 11. Footer/Toast */
.footer { border-top: 1px solid var(--border); background: rgba(7, 11, 24, .6); }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 13.5px; }
.footer p { margin: 0; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 12px 22px; border-radius: 999px; font-size: 14px; color: var(--text);
  background: rgba(20, 28, 54, .96); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  animation: rise .25s ease both;
}

/* -------------------------------------------- 12. Motion & responsive */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.22,.9,.3,1), transform .7s cubic-bezier(.22,.9,.3,1); }
.reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 42px 28px; gap: 36px; }
  .hero .lede { margin-inline: auto; }
  .hero__cta, .pill { justify-content: center; }
  .hero__media { order: -1; }
  .float-card--a { left: -10px; }
  .float-card--b { right: -14px; }
  .layout-7-5 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .topbar__cta { display: none; }
  .brand__role { display: none; }
}
@media (max-width: 860px) {
  .topbar__inner { flex-wrap: wrap; justify-content: center; }
  .statband { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chat { height: calc(100vh - 300px); }
}
@media (max-width: 560px) {
  main { padding: 26px 16px 48px; }
  .hero { padding: 32px 20px; border-radius: var(--r); }
  .photo, .photo img, .photo__initials { width: 200px; height: 200px; }
  .photo__initials { font-size: 62px; }
  .float-card { padding: 8px 12px; }
  .float-card--a { top: 0; left: -6px; }
  .float-card--b { bottom: 6px; right: -6px; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }
  .card, .tile, .promo { padding: 20px; }
  .section { margin-top: 44px; }
  .btn--xl { width: 100%; }
  .view-head { flex-direction: column; align-items: flex-start; }
  .msg__bubble { max-width: 100%; }
  .chat__log { padding: 18px; }
  .dropzone { min-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
