/* FLUXODO · quiet-premium tokens (from design/tokens.json) as CSS variables.
   Preset switch (technical-mono) in future = override variables, no component rework. */

:root {
  /* colors: quiet-premium */
  --color-background: #08090B;
  --color-surface: #101114;
  --color-surface-raised: #16181C;
  --color-text: #F4F4F5;
  --color-muted: #A7A9B0;
  --color-subtle: #767982;
  --color-border: #292B31;
  --color-border-soft: #1E2025;
  --color-primary: #E7E7EA;
  --color-primary-text: #090A0C;
  --color-success: #A9EAC0;
  --color-danger: #FC9D9D;

  /* radiuses */
  --radius-button: 10px;
  --radius-card: 16px;
  --radius-panel: 24px;
  --radius-pill: 999px;

  /* motion */
  --motion-hover: 180ms;
  --motion-entry: 420ms;
  --motion-ease: cubic-bezier(.22, 1, .36, 1);

  /* layout */
  --container-max: 1200px;
  --reading-max: 720px;
  --gutter-mobile: 16px;
  --gutter-tablet: 20px;
  --gutter-desktop: 32px;

  /* typography */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --h1-mobile: clamp(35px, 9.5vw, 44px);
  --h1-desktop: clamp(44px, 4.4vw, 64px);
  --h2-mobile: clamp(28px, 7vw, 38px);
  --h2-desktop: clamp(42px, 4.5vw, 56px);
  --body-mobile: 16px;
  --body-desktop: 17px;
  --eyebrow-size: 11px;
  --tracking-heading: -0.055em;

  /* interaction */
  --tap-target-min: 44px;
  --primary-btn-min-height: 48px;
  --header-height: 60px;
  --dock-height: 72px;
}

/* base */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); }

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--body-mobile);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* mobile QA: no horizontal overflow on 320-430px */
  overflow-x: clip;
  /* reserve space so the sticky dock never covers content/footer */
  padding-bottom: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px));
}

::selection { background: #868993; color: #fff; }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--gutter-mobile);
  padding-right: var(--gutter-mobile);
}

.reading { max-width: calc(var(--reading-max) + 2 * var(--gutter-mobile)); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--color-primary);
  color: var(--color-primary-text);
  padding: 10px 16px;
  border-radius: var(--radius-button);
}

.skip-link:focus { left: 8px; }

a { color: inherit; }

button, input, textarea { font: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-height);
}

.brand {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.055em;
  font-size: 21px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark { flex-shrink: 0; }

.site-nav { display: none; gap: 24px; }

.site-nav a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 14px;
  min-height: var(--tap-target-min);
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover { color: var(--color-text); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.header-cta { display: none; }

/* burger: 44x44 touch target */
.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target-min);
  height: var(--tap-target-min);
  min-width: var(--tap-target-min);
  min-height: var(--tap-target-min);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text);
  cursor: pointer;
  padding: 0;
}

.burger-box { display: block; width: 18px; }

.burger-line {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  box-shadow: 0 -6px 0 var(--color-text), 0 6px 0 var(--color-text);
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--color-border-soft);
  padding: 8px var(--gutter-mobile) 16px;
}
/* JS toggles the `hidden` attribute — display:flex would override it. */
.mobile-nav[hidden] { display: none; }

.mobile-nav a {
  min-height: var(--tap-target-min);
  display: flex;
  align-items: center;
  color: var(--color-text);
  text-decoration: none;
  font-size: 15px;
  border-bottom: 1px solid var(--color-border-soft);
}

.mobile-nav a:last-child { border-bottom: none; }

.mobile-nav-cta {
  color: var(--color-success) !important;
  font-weight: 600;
}

.mobile-nav-ai { text-align: left; }

/* typography */
h1 {
  font-size: var(--h1-mobile);
  line-height: 1.06;
  letter-spacing: var(--tracking-heading);
  font-weight: 600;
  margin: 12px 0 16px;
  overflow-wrap: break-word;
  color: var(--color-text);
}

h2 {
  font-size: var(--h2-mobile);
  line-height: 1.14;
  letter-spacing: var(--tracking-heading);
  font-weight: 600;
  margin: 12px 0 16px;
  overflow-wrap: break-word;
}

h3 { font-size: 19px; letter-spacing: -0.02em; margin: 0 0 8px; line-height: 1.3; }

.lead {
  color: var(--color-muted);
  max-width: var(--reading-max);
  margin: 0 0 24px;
  line-height: 1.6;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--eyebrow-size);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-subtle);
  margin: 0;
}

.section-body {
  color: var(--color-muted);
  max-width: var(--reading-max);
  line-height: 1.65;
}

.note {
  color: var(--color-subtle);
  font-size: 14px;
  margin-top: 16px;
  line-height: 1.6;
}

/* sections */
.hero { padding: 40px 0 48px; }

.hero-title { margin-top: 16px; }

.hero-lead { font-size: 17px; }

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  color: var(--color-success);
  font-size: 14px;
  font-weight: 600;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 12px rgba(169, 234, 192, 0.4);
}

.hero-caption { color: var(--color-muted); font-size: 14px; margin: 12px 0 0; }

/* hero layout: single column on mobile, two columns on desktop */
.hero-inner { display: flex; flex-direction: column; gap: 40px; }

.hero-copy { max-width: var(--reading-max); }

/* decorative hero background (pure CSS, aria-hidden in markup) */
.hero-bg { position: absolute; inset: 0; overflow: hidden; z-index: -1; }

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(231, 231, 234, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 231, 234, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

.hero-glow {
  position: absolute;
  top: -120px;
  right: -160px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(169, 234, 192, 0.07), transparent 65%);
  pointer-events: none;
}

/* flow diagram: SVG nodes/edges with running pulse (animation only) */
.flow-diagram { width: 100%; max-width: 520px; height: auto; }

.flow-node circle {
  fill: #1a1c22;
  stroke: #4a4e59;
  stroke-width: 1.5;
}

.flow-node text {
  fill: var(--color-text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

.flow-edge {
  fill: none;
  stroke: url(#edge-g);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.flow-pulse {
  fill: none;
  stroke: var(--color-success);
  stroke-width: 1.5;
  stroke-dasharray: 12 200;
  stroke-dashoffset: 0;
  animation: flow-dash 4.5s var(--motion-ease) infinite;
}

.flow-pulse-2 { animation-delay: 1.5s; }
.flow-pulse-3 { animation-delay: 3s; }

@keyframes flow-dash {
  0% { stroke-dashoffset: 212; opacity: 0; }
  12% { opacity: 0.9; }
  60% { opacity: 0.9; }
  100% { stroke-dashoffset: -60; opacity: 0; }
}

.flow-caption { color: var(--color-subtle); font-size: 13px; margin: 12px 0 0; text-align: center; }

/* tech ticker: static wrap on mobile */
.ticker-section { border-top: 1px solid var(--color-border-soft); padding: 20px 0; }

.ticker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 0 var(--gutter-mobile);
}

.ticker-item {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-subtle);
  white-space: nowrap;
}

.ticker-dot { color: var(--color-border); }

/* scroll reveal: content visible by default (no-JS / reduced-motion safe),
   JS adds .reveal-ready to <html> only when IntersectionObserver runs */
.reveal { opacity: 1; transform: none; }

html.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--motion-entry) var(--motion-ease),
    transform var(--motion-entry) var(--motion-ease);
  transition-delay: var(--reveal-delay, 0ms);
}

html.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* spotlight hover effect (pointer devices only, no touch ghosting) */
@media (hover: hover) and (pointer: fine) {
  .spotlight { position: relative; overflow: hidden; }
  .spotlight::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(360px circle at var(--spot-x, 50%) var(--spot-y, 50%),
                rgba(231, 231, 234, 0.06), transparent 60%);
    opacity: 0;
    transition: opacity var(--motion-hover) var(--motion-ease);
    pointer-events: none;
  }
  .spotlight:hover::after { opacity: 1; }
}

.section { padding: 64px 0; border-top: 1px solid var(--color-border-soft); }

.page-head { padding: 40px 0 16px; }

.demo-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e0c99d;
  background: #17140f;
  border: 1px solid #2e2920;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  margin: 0 0 24px;
}

/* cards */
.cards-3, .cards-2 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: linear-gradient(160deg, var(--color-surface-raised), var(--color-surface));
  padding: 24px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: border-color var(--motion-hover) var(--motion-ease);
}

.card p { color: var(--color-muted); margin: 0; line-height: 1.6; font-size: 15px; }

.card-link { color: inherit; }

.card-link:hover { border-color: #4a4c54; }

.card-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-subtle);
  letter-spacing: 0.09em;
  margin-bottom: 28px;
}

.card-cta { margin-top: 20px; color: var(--color-text); font-weight: 600; font-size: 15px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }

.tag {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-muted);
  font-size: 12px;
  padding: 5px 8px;
}

.card-note { color: var(--color-subtle) !important; font-size: 14px !important; margin-top: 16px !important; }

.card-sub { color: var(--color-text); font-weight: 600; margin: 0 0 6px !important; font-size: 15px; }

/* bento grid: 1 col mobile -> 2/3 cols desktop with spanning feature tiles */
.bento { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }

.bento-item { min-width: 0; }

/* anti-middleman block */
.direct-grid { display: flex; flex-direction: column; gap: 24px; }

.direct-points { display: flex; flex-direction: column; gap: 16px; }

.direct-point { border-top: 1px solid var(--color-border); padding-top: 16px; }

.direct-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-subtle);
  display: block;
  margin-bottom: 6px;
}

.direct-point p { color: var(--color-muted); margin: 0; line-height: 1.6; font-size: 15px; }

/* risk relief block */
.risk-relief { margin-bottom: 40px; }

.process-eyebrow { margin-top: 8px; }

.faq-body { padding-bottom: 4px; }

/* contact page availability line */
.availability {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-success);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 8px;
}

.availability-note,
.availability-sep { color: var(--color-muted); font-weight: 400; }

/* direct contact aside (contact page / access page) */
.direct-contact {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  padding: 20px;
  margin-top: 28px;
}

.direct-contact-line { color: var(--color-muted); line-height: 1.6; margin: 8px 0 0; }

.direct-contact-note { color: var(--color-subtle); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }

.mono-handle { font-family: var(--font-mono); color: var(--color-text); }

.field-hint { color: var(--color-subtle); font-size: 13px; line-height: 1.5; margin: 4px 0 0; }

.contact-section { padding-top: 32px; }

.dev-note { color: var(--color-subtle); font-size: 13px; }

.steps { margin: 0; padding-left: 20px; color: var(--color-muted); line-height: 1.7; font-size: 15px; }

.steps li + li { margin-top: 4px; }

/* process */
.process-item { border-top: 1px solid #4a4b50; padding-top: 20px; }

.process-num { font-family: var(--font-mono); font-size: 11px; color: var(--color-subtle); }

.process-item h3 { margin-top: 16px; }

.process-item p { color: var(--color-muted); font-size: 15px; margin: 0; line-height: 1.6; }

.process-grid { gap: 20px; }

/* faq */
.faq-list { border-top: 1px solid var(--color-border); margin-top: 24px; }

.faq-item { border-bottom: 1px solid var(--color-border); }

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 2px;
  min-height: var(--tap-target-min);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  font-weight: 550;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after { content: "+"; font-size: 20px; color: var(--color-subtle); flex-shrink: 0; }

.faq-item[open] summary::after { content: "−"; }

.faq-item p { margin: 0 0 18px; color: var(--color-muted); line-height: 1.7; font-size: 15px; }

.service-section { margin-bottom: 40px; }

.service-section h2 { font-size: clamp(22px, 5vw, 30px); }

.service-section p { color: var(--color-muted); line-height: 1.7; margin: 0; }

/* buttons: touch targets >=44px, primary >=48px height on mobile */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target-min);
  padding: 12px 20px;
  border-radius: var(--radius-button);
  font-size: 16px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--motion-hover) var(--motion-ease),
              border-color var(--motion-hover) var(--motion-ease);
  cursor: pointer;
}

.btn-primary {
  min-height: var(--primary-btn-min-height);
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-weight: 600;
}

.btn-primary:hover { background: #f5f5f7; }

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover { background: var(--color-surface); border-color: var(--color-border); }

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* forms: input font >=16px (prevents iOS zoom), errors under the field */
.contact-form { display: flex; flex-direction: column; gap: 20px; margin-top: 32px; }

.form-field { display: flex; flex-direction: column; gap: 8px; }

.form-field label { font-size: 15px; font-weight: 600; }

.form-field .hint { color: var(--color-subtle); font-weight: 400; font-size: 13px; }

.contact-form input,
.contact-form textarea {
  font-size: 16px; /* >=16px: no iOS auto-zoom */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text);
  padding: 12px 14px;
  min-height: var(--tap-target-min);
  width: 100%;
  resize: vertical;
}

.contact-form input[aria-invalid="true"],
.contact-form textarea[aria-invalid="true"] { border-color: var(--color-danger); }

.contact-form input:focus-visible,
.contact-form textarea:focus-visible { border-color: var(--color-primary); outline: 2px solid var(--color-primary); outline-offset: 1px; }

.field-error { color: var(--color-danger); font-size: 14px; margin: 0; }

.form-error-banner {
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-card);
  background: rgba(252, 157, 157, 0.08);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.form-error-banner p { margin: 0; color: var(--color-danger); }

.form-success {
  border: 1px solid var(--color-success);
  border-radius: var(--radius-card);
  background: rgba(169, 234, 192, 0.08);
  padding: 20px;
  margin-bottom: 28px;
}

.form-success-title { color: var(--color-success); font-weight: 600; margin: 0 0 8px; font-size: 17px; }

.form-success .note { margin: 0; }

.form-consent { color: var(--color-subtle); font-size: 13px; line-height: 1.6; margin: 0; }

/* Consent checkbox (152-ФЗ): touch target >=44px, aligned on all widths */
.consent-field { gap: 4px; }

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px; /* mobile-first tap target */
  padding: 8px 0;
  cursor: pointer;
  font-weight: 400;
}

.consent-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 3px 0 0; /* optically aligns with the first text line */
  accent-color: var(--color-primary);
}

.consent-text { font-size: 13px; line-height: 1.6; color: var(--color-subtle); }

.consent-text a { color: var(--color-text); text-decoration: underline; }

/* /privacy document typography */
.privacy-doc h2 { font-size: 19px; margin: 32px 0 12px; }
.privacy-doc ul { margin: 0 0 16px; padding-left: 20px; }
.privacy-doc li { margin-bottom: 8px; }
.privacy-note {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-top: 32px;
}
.privacy-note p { color: var(--color-subtle); font-size: 13px; line-height: 1.6; margin: 0; }

.form-submit { width: 100%; }

/* honeypot: hidden from humans, still present for bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* P3: auth / workspace / admin */
.form-warning {
  border: 1px solid var(--color-warning, #e7c66b);
  border-radius: var(--radius-card);
  background: rgba(231, 198, 107, 0.08);
  padding: 16px 20px;
  margin-top: 20px;
}

.form-warning p { margin: 0; line-height: 1.6; }

.inline-form { margin-top: 16px; display: flex; gap: 12px; align-items: center; }

.workspace-actions { margin: 20px 0 8px; display: flex; flex-wrap: wrap; gap: 12px; }

.key-reveal {
  border: 1px solid var(--color-success);
  border-radius: var(--radius-card);
  background: rgba(169, 234, 192, 0.06);
  padding: 20px;
  margin-bottom: 28px;
}

.key-reveal .key-value { margin: 12px 0; }

.key-reveal code {
  display: block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 16px;
  word-break: break-all;
  padding: 14px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-button);
  background: var(--color-surface);
  user-select: all;
}

/* P4: workspace + admin panel */
.ws-section { padding-top: 24px; }

.ws-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 8px;
}

.ws-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-target-min);
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-subtle);
  font-size: 14px;
  text-decoration: none;
}

.ws-nav a.ws-nav-active {
  color: var(--color-text);
  border-color: var(--color-text);
}

.ws-h2 { font-size: 19px; margin: 28px 0 12px; }

.ws-empty { color: var(--color-subtle); }

.ws-empty-block {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-card);
  padding: 24px 20px;
}

.ws-card {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.ws-pre { white-space: pre-wrap; word-break: break-word; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 13px; }
.cell-wrap { max-width: 320px; }

/* badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-subtle);
  white-space: nowrap;
}

.badge-planned { border-color: #8b90a0; color: #c8ccd9; }
.badge-in_progress { border-color: #7fb2ff; color: #a9caff; }
.badge-review { border-color: #e7c66b; color: #ecd79a; }
.badge-done { border-color: #7dd3a2; color: #a9e8c4; }
.badge-paused { border-color: #d38f8f; color: #e7b1b1; }

/* project list */
.project-list, .conv-list, .msg-briefs, .event-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-item, .conv-item, .msg-brief { list-style: none; }

.msg-brief-text { color: var(--color-text); font-size: 14px; line-height: 1.5; }

.msg-time { white-space: nowrap; }

.admin-project { border-color: var(--color-border); }

.project-link, .conv-link, .msg-brief-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap-target-min);
  padding: 12px 16px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-card);
  color: var(--color-text);
  text-decoration: none;
  flex-wrap: wrap;
}

.project-title, .conv-title { font-weight: 600; }

.conv-link, .msg-brief-link { flex-direction: column; align-items: flex-start; gap: 4px; }

.conv-last { color: var(--color-subtle); font-size: 14px; }

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--color-primary, #e7e7ea);
  color: #08090b;
  font-size: 12px;
  font-weight: 700;
}

.msg-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary, #e7e7ea);
}

/* events */
.event-item { border-left: 2px solid var(--color-border); padding: 4px 0 4px 14px; }

.event-date { color: var(--color-subtle); font-size: 13px; margin-right: 8px; }

.event-type { font-size: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); padding: 1px 8px; }

.event-message { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; }

/* thread / messages */
.thread {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.msg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

.msg { max-width: 85%; }

.msg-client { align-self: flex-end; }
.msg-list { align-items: stretch; }
.msg-client .msg-body { background: rgba(127, 178, 255, 0.10); }
.msg-admin .msg-body { background: var(--color-surface); }

.msg-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--color-subtle); flex-wrap: wrap; }

.msg-sender { font-weight: 600; color: var(--color-text); }

.msg-body {
  margin: 4px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-unread { color: #7fb2ff; font-weight: 600; }
.msg-read { color: var(--color-subtle); }
.msg-empty { list-style: none; }

/* composer */
.composer { display: flex; flex-direction: column; gap: 10px; }

.composer textarea {
  font-size: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text);
  padding: 12px 14px;
  width: 100%;
  resize: vertical;
}

.composer textarea:focus-visible { border-color: var(--color-primary); outline: 2px solid var(--color-primary); outline-offset: 1px; }

.composer .btn { align-self: flex-start; min-height: var(--tap-target-min); }

.poll-marker { display: none; }

.key-mask { font-family: var(--font-mono, ui-monospace, monospace); }

/* admin */
.counter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.counter-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--color-text);
}

.counter-value { font-size: 30px; font-weight: 700; }

.counter-label { color: var(--color-subtle); font-size: 14px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: top;
}

.admin-form { display: flex; flex-direction: column; gap: 14px; }

.admin-row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 0;
}

.admin-row-form input[type="text"] {
  flex: 1 1 220px;
  font-size: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text);
  padding: 10px 12px;
  min-height: var(--tap-target-min);
}

.admin-row-form select {
  font-size: 15px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  color: var(--color-text);
  padding: 8px 10px;
  min-height: var(--tap-target-min);
}

.checkbox-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--color-subtle); }

.admin-project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.admin-project-client { color: var(--color-subtle); font-size: 13px; margin-left: 10px; }

.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 40px; }

@media (min-width: 700px) {
  .counter-grid { grid-template-columns: repeat(3, 1fr); }
  .conv-link, .msg-brief-link { flex-direction: row; align-items: center; gap: 12px; }
}


/* mobile sticky bottom CTA dock */
.mobile-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(9, 10, 13, 0.95);
  border-top: 1px solid #373941;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.dock-btn { flex: 1; min-width: 0; white-space: normal; text-align: center; min-height: 48px; }

/* footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-border-soft);
  padding: 24px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--color-subtle);
  font-size: 14px;
}

.footer-brand { color: var(--color-text); font-weight: 700; letter-spacing: -0.055em; font-size: 18px; }

.footer-line { margin: 4px 0 0; }

.footer-note { margin: 0; line-height: 1.6; max-width: var(--reading-max); }

.env-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

.final-cta { text-align: left; }

.final-cta .hero-actions { max-width: 420px; }

/* tablet and up: progressive expansion (mobile-first base above) */
@media (min-width: 600px) {
  .container { padding-left: var(--gutter-tablet); padding-right: var(--gutter-tablet); }
  .reading { max-width: calc(var(--reading-max) + 2 * var(--gutter-tablet)); }
  .hero { padding-top: 64px; }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .direct-grid { flex-direction: row; gap: 40px; }
  .direct-copy { flex: 1; }
  .direct-points { flex: 1; }
}

/* QA fix: at <=360px the header CTA duplicates the sticky dock CTA and
   overflows the header row on 320px screens — keep burger only. */
@media (max-width: 360px) {
  .header-actions .btn { display: none; }
}

@media (min-width: 900px) {
  body { font-size: var(--body-desktop); padding-bottom: 0; }
  h1 { font-size: var(--h1-desktop); }
  h2 { font-size: var(--h2-desktop); }
  .hero { padding-top: 112px; padding-bottom: 80px; }
  .section { padding: 96px 0; }
  .hero-actions { flex-direction: row; }
  .container { padding-left: var(--gutter-desktop); padding-right: var(--gutter-desktop); }
  .reading { max-width: calc(var(--reading-max) + 2 * var(--gutter-desktop)); }

  /* desktop nav replaces burger; dock hidden */
  .site-nav { display: flex; }
  .header-cta { display: inline-flex; }
  .burger, .mobile-nav { display: none; }
  .mobile-dock { display: none; }

  .cards-3 { grid-template-columns: repeat(3, 1fr); }
  .cards-2 { grid-template-columns: repeat(2, 1fr); }
  .process-grid { grid-template-columns: repeat(3, 1fr); }
  .bento { grid-template-columns: repeat(3, 1fr); }
  .bento-1, .bento-6 { grid-column: span 2; }
  .hero-inner { flex-direction: row; align-items: center; gap: 56px; }
  .hero-copy { flex: 1.15; max-width: 640px; }
  .hero-title { text-wrap: balance; }
  .hero-visual { flex: 1; }
  .form-submit { width: auto; align-self: flex-start; }
  .footer-inner { flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .final-cta { text-align: center; }
  .final-cta .eyebrow, .final-cta .section-body, .final-cta .hero-actions { margin-left: auto; margin-right: auto; justify-content: center; }
  .final-cta h2 { margin-left: auto; margin-right: auto; max-width: 830px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .mobile-dock { backdrop-filter: none; -webkit-backdrop-filter: none; }
  html.reveal-ready .reveal { opacity: 1; transform: none; }
}

/* --- P5 guest AI chat widget ------------------------------------------------- */
.ai-chat-launcher,
.ai-chat-launcher-link {
  position: fixed;
  right: 14px;
  bottom: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 49;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border-radius: 999px;
  background: var(--color-background-raised, #14151a);
  border: 1px solid var(--color-border, #373941);
  color: var(--color-text, #E7E7EA);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 14px;
}

.ai-chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.55);
}

/* mobile-first: fullscreen sheet */
.ai-chat {
  position: fixed;
  z-index: 91;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-background, #08090b);
  border: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* JS toggles the `hidden` attribute — display:flex would override it. */
.ai-chat[hidden] { display: none; }

.ai-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-soft, #23252c);
}

.ai-chat-title { margin: 0; font-weight: 700; letter-spacing: -0.04em; }

.ai-chat-demo-badge {
  margin: 4px 0 0;
  font-size: 12px;
  color: #d9a441;
  border: 1px solid #4a3c1c;
  border-radius: 999px;
  padding: 3px 10px;
  display: inline-block;
}

.ai-chat-close {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--color-border, #373941);
  border-radius: 10px;
  color: var(--color-text, #E7E7EA);
  font-size: 16px;
}

.ai-chat-disclaimer {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--color-subtle, #868993);
  border-bottom: 1px solid var(--color-border-soft, #23252c);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-msg { max-width: 88%; }
.ai-chat-msg p { margin: 0; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; overflow-wrap: break-word; }
.ai-chat-msg.user { align-self: flex-end; }
.ai-chat-msg.user p { background: #23252c; }
.ai-chat-msg.assistant { align-self: flex-start; }
.ai-chat-msg.assistant p { background: #14151a; border: 1px solid var(--color-border-soft, #23252c); }

.ai-chat-note { align-self: center; max-width: 92%; }
.ai-chat-note p { margin: 0; font-size: 13px; color: var(--color-subtle, #868993); text-align: center; }

.ai-chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
.ai-chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border, #373941);
  background: transparent;
  color: var(--color-text, #E7E7EA);
  font-size: 14px;
}

.ai-chat-actions { padding: 4px 16px 8px; display: flex; gap: 16px; flex-wrap: wrap; }
.ai-chat-human { color: var(--color-text, #E7E7EA); font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.ai-chat-fullscreen { color: var(--color-subtle, #8A8D96); font-size: 13px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; text-underline-offset: 3px; }

.ai-chat-composer {
  display: flex;
  gap: 8px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--color-border-soft, #23252c);
}
.ai-chat-composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  font-size: 16px; /* >=16px: prevents iOS auto-zoom */
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border, #373941);
  background: #101116;
  color: var(--color-text, #E7E7EA);
  resize: none;
}
.ai-chat-send {
  min-width: 48px;
  min-height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--color-text, #E7E7EA);
  color: var(--color-background, #08090b);
  font-size: 18px;
}

/* hide the mobile dock while the chat sheet is open */
body.ai-chat-open .mobile-dock { display: none; }
.mobile-dock[data-hidden-for-chat="true"] { visibility: hidden; }

/* ===== /chat — full-page chat ========================================== */
/* The widget script mounts the same .ai-chat panel into #ai-chat-root.
   In page mode we override fixed positioning: the panel lives inside the
   page flow, fills the available height and has no backdrop. */
.chat-page { padding: 32px 0 48px; }
.chat-page-header h1 { margin: 10px 0 12px; }
.chat-page-sub {
  color: var(--color-subtle);
  max-width: 640px;
  font-size: 15px;
  line-height: 1.5;
}
.chat-page-root { margin-top: 24px; min-height: 70dvh; }

body:has(.chat-page-root) .ai-chat,
.chat-page-mode .ai-chat {
  position: static;
  width: 100%;
  max-width: 760px;
  height: min(72dvh, 780px);
  min-height: 420px;
  border: 1px solid var(--color-border, #373941);
  border-radius: 16px;
  background: var(--color-surface, #0c0d10);
}
body:has(.chat-page-root) .ai-chat-backdrop { display: none !important; }
body:has(.chat-page-root) .mobile-dock { display: none; }

.chat-page-nojs { color: var(--color-subtle); font-size: 15px; }
.chat-page-nojs a { color: var(--color-text); }

/* desktop: floating panel instead of fullscreen sheet */
@media (min-width: 900px) {
  .ai-chat {
    left: auto;
    right: 24px;
    bottom: 24px;
    top: auto;
    width: 400px;
    height: min(560px, calc(100dvh - 48px));
    border: 1px solid var(--color-border, #373941);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  }
  .ai-chat-backdrop { display: none; }
  .header-ai { display: inline-flex; }
}

@media (max-width: 899px) {
  .header-ai { display: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
