/* ==========================================================================
   Aufilm surface — radical redesign, 2026-10-14.

   One shared presentation layer for every product screen (Login, Projects,
   Script Editor, Workbench). It REPLACES the previous "film / glass" layer:
   no translucent gradients, no blur, no rose-tinted glows. The direction is
   the Aufilm emblem: a cream crescent profile on night ink,
   striped like a constructivist poster. So the interface is
   print-like: warm paper, black ink, one signal red, poster typography,
   hairline rules and generous space.

   Loaded LAST on each page, after the page's own <style> block, so it wins on
   order. The filename stays (tests, service-worker cache, cache-busting query)
   — the content is new. Tokens live in theme.css.
   ========================================================================== */

/* ---------------------------------------------------------------- 0. base */
html body {
  background-color: var(--bg) !important;
  background-image: none !important;
  color: var(--ink);
  font-family: var(--font-ui);
}
/* the light theme stays light: fields and copy keep their contrast */
html:not([data-theme="dark"]) body {
  color: var(--ink) !important;
  background-color: var(--bg) !important;
}
/* body::before is the room itself (the light-leak atmosphere, §16) */
.grain { display: none !important; }

h1, h2, h3, .panel-head h1, .title-block h1, .proj-name {
  font-family: var(--font-ui) !important;
  letter-spacing: -.012em;
}
a { color: var(--red); text-underline-offset: 3px; }
::selection { background: var(--red); color: #fff; }

/* keyboard focus: one clear ring everywhere */
:focus-visible { outline: 2px solid var(--red) !important; outline-offset: 2px; }

/* ------------------------------------------------------------ 1. controls */
button, .cta, .hdr-btn {
  font-family: var(--font-ui);
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  background-image: none !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
button { background-color: var(--ink); color: var(--bg); }
button:hover { filter: none; background-color: var(--red); color: #fff; }
button.primary, .start-go, .cta, .run-cta.ready, .consent-go, .hdr-btn.primary {
  background-color: var(--red) !important; color: #fff !important; border-color: var(--red) !important;
}
button.primary:hover, .start-go:hover, .cta:hover, .run-cta.ready:hover, .hdr-btn.primary:hover {
  background-color: var(--red-hover) !important;
}
button.ghost, .ghost {
  background: transparent !important; color: var(--ink) !important;
  border: 1px solid var(--line) !important;
}
button.ghost:hover, .ghost:hover { border-color: var(--ink) !important; background: var(--card) !important; color: var(--ink) !important; }
button:disabled, button[disabled] {
  background: var(--card2) !important; color: var(--faint) !important;
  border-color: var(--line) !important; cursor: not-allowed;
}
button.busy { cursor: progress; }
.link-btn {
  background: transparent !important; color: var(--muted) !important; border: 0 !important;
  padding: 10px 4px !important; text-transform: none !important; letter-spacing: 0 !important;
  font: 600 13px/1.2 var(--font-ui) !important; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--red) !important; background: transparent !important; }

input, select, textarea { border-radius: var(--radius) !important; box-shadow: none !important; }
body.studio input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
body.studio select,
body.studio textarea {
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--red);
  opacity: 1 !important;
  background: var(--edit) !important;
  border: 1px solid var(--line) !important;
}
html:not([data-theme="dark"]) body.studio input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
html:not([data-theme="dark"]) body.studio select,
html:not([data-theme="dark"]) body.studio textarea {
  color: #16140f !important;
  -webkit-text-fill-color: #1a1917 !important;
}
body.studio input:focus, body.studio select:focus, body.studio textarea:focus {
  border-color: var(--ink) !important; outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent) !important;
}
body.studio ::placeholder { color: var(--faint) !important; -webkit-text-fill-color: var(--faint) !important; opacity: 1; }
body.studio select option { color: #16140f; background: #f8f5ee; }
input[type="checkbox"] { accent-color: var(--red); width: 18px; height: 18px; }

label {
  font: 700 10px/1.3 var(--font-ui) !important; letter-spacing: .1em !important;
  text-transform: uppercase; color: var(--muted) !important;
}

/* -------------------------------------------- 2. workbench shell (app) */
@media (min-width: 900px) {
  body.workbench { display: block !important; padding-left: var(--rail-w); }
  body.studio > .app-rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w);
    height: 100vh; overflow-y: auto; overflow-x: hidden; z-index: 50;
    display: flex; flex-direction: column; align-items: stretch;
  }
  .rail-menu { display: none !important; }
  body.studio main.page { overflow: visible; }
}
body.studio > .app-rail {
  background: var(--night) !important; color: var(--cream);
  border: 0 !important; border-right: 1px solid #000 !important;
  padding: 0; justify-content: flex-start;
}
body.studio > .app-rail::after { display: none !important; }
.app-rail .brand-lockup {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 22px 20px 18px; border-bottom: 1px solid rgba(239,231,210,.12);
}
.rail-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--cream); }
.rail-brand .rail-mark { width: 56px !important; height: 56px !important; object-fit: contain; display: block; }
.rail-names, .lockup-names { display: flex; flex-direction: column; gap: 5px; }
.app-rail .wordmark {
  font: 800 26px/1 var(--font-ui) !important; letter-spacing: .18em !important; color: var(--cream) !important;
}
.app-rail .master-mark-label {
  font: 700 9px/1 var(--font-ui) !important; letter-spacing: .32em !important;
  color: rgba(239,231,210,.55) !important; text-transform: uppercase;
}
.rail-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 16px 12px 0; gap: 18px; }
.rail-nav, .rail-steps { flex: none; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px;
  color: rgba(239,231,210,.82) !important; text-decoration: none; border-radius: var(--radius);
  font: 600 14px/1.2 var(--font-ui) !important; letter-spacing: 0 !important; text-transform: none !important;
  margin: 0 !important;
}
.rail-link:hover { background: rgba(239,231,210,.07); color: var(--cream) !important; }
.rail-ico { width: 22px; text-align: center; color: rgba(239,231,210,.5); font-size: 14px; }
.rail-where { display: none; }
.rail-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 0 4px;
}
.rail-step {
  display: flex; flex-direction: column; gap: 6px; padding-top: 8px;
  border-top: 3px solid rgba(239,231,210,.14);
  font: 700 9px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase;
  color: rgba(239,231,210,.42);
}
.rail-step b { font: 800 15px/1 var(--font-ui); letter-spacing: 0; }
.rail-step.on { border-top-color: var(--cream); color: var(--cream); }
.rail-step.now { border-top-color: #E2553F; }

.side-sections { display: flex; flex-direction: column; flex-wrap: nowrap !important; gap: 1px !important; padding: 0 2px 0 0 !important;
  flex: 1 1 auto; min-height: 120px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin;
  scrollbar-color: rgba(239,231,210,.2) transparent;
  position: static !important; background: transparent !important; border: 0 !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important; margin: 0 !important; }
.side-sections[hidden] { display: none !important; }
.side-sections-title { color: rgba(239,231,210,.45) !important; padding: 0 10px 8px; letter-spacing: .2em !important; font-size: 9px !important; }
.side-sections a {
  flex: none; /* never squash rows to fit; the list scrolls instead */
  display: flex !important; gap: 10px; align-items: baseline;
  padding: 7px 10px; border-radius: var(--radius); text-decoration: none;
  font: 500 12.5px/1.3 var(--font-ui) !important; letter-spacing: 0 !important; text-transform: none !important;
  color: rgba(239,231,210,.66) !important; white-space: normal !important;
  border-left: 2px solid transparent;
}
.side-sections a b { font: 700 10px/1 var(--font-mono) !important; color: rgba(239,231,210,.38) !important; min-width: 18px; }
.side-sections a:hover { background: rgba(239,231,210,.06); color: var(--cream) !important; }
.side-sections a.on { color: var(--cream) !important; border-left-color: #E2553F; background: rgba(239,231,210,.05); }
.side-sections a.on b { color: #E2553F !important; }

.rail-foot { margin-top: auto; flex: none; display: flex; flex-direction: column; gap: 12px; padding: 14px 8px 46px; border-top: 1px solid rgba(239,231,210,.12); }
.rail-tools { display: flex; gap: 8px; align-items: center; }
html body.studio .app-rail .lang-switch select, html body.studio .app-rail .theme-btn {
  background: transparent !important; color: var(--cream) !important; -webkit-text-fill-color: var(--cream) !important;
  border: 1px solid rgba(239,231,210,.25) !important; height: 34px;
}
.app-rail .lang-switch .globe, .app-rail .lang-switch::after { color: rgba(239,231,210,.7) !important; }
.app-rail .who { color: rgba(239,231,210,.7) !important; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.app-rail .who b { color: var(--cream); }
.app-rail .who a { color: var(--cream) !important; }
.app-rail .who button {
  display: inline-block; margin-top: 8px; background: var(--cream) !important; color: var(--night) !important;
  border: 0 !important; padding: 9px 12px !important; font: 700 10.5px/1.2 var(--font-ui) !important;
  letter-spacing: .06em !important; text-transform: uppercase; border-radius: var(--radius) !important;
}
.app-rail .who button:hover { background: #fff !important; }

/* page column. The document scrolls (not an inner box) so the sticky rail
   header and plan bar work on phones, and iOS gets its native scroll. */
html:has(body.workbench), body.workbench { height: auto !important; min-height: 100vh; }
body.studio main.page { overflow: visible !important; }
body.studio main.page { padding: 40px clamp(20px, 4vw, 64px) 120px; background: transparent !important; }
body.studio main .wrap { max-width: 1120px; margin: 0 auto; }

/* ------------------------------------------------------- 3. intake card */
body.studio .card {
  background: var(--card) !important; border: 1px solid var(--line) !important;
  border-radius: 10px !important; box-shadow: var(--shadow) !important;
  padding: 28px 30px !important; margin-bottom: 22px; overflow: visible !important;
}
body.studio .card::before, body.studio .card::after { display: none !important; content: none !important; }
body.studio .card h3 { font: 800 15px/1.2 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }

body.studio .card.start-card { padding: 0 !important; overflow: hidden !important; }
.start-hero {
  background: var(--night); color: var(--cream); padding: 34px 34px 30px; position: relative;
}
.start-hero::after {
  /* the emblem's stripes, as a poster rule */
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 34%;
  background: repeating-linear-gradient(180deg, rgba(239,231,210,.10) 0 7px, transparent 7px 15px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%);
  mask-image: linear-gradient(90deg, transparent, #000 70%);
  pointer-events: none;
}
.start-hero > * { position: relative; z-index: 1; }
.kicker { margin: 0 0 12px; font: 700 10px/1 var(--font-ui); letter-spacing: .24em; text-transform: uppercase; color: rgba(239,231,210,.6); }
.kicker-num { color: #E2553F; margin-right: 6px; }
body.studio .start-hero h3 {
  margin: 0 0 12px; color: var(--cream) !important;
  font: 800 clamp(30px, 4.2vw, 50px)/.98 var(--font-ui) !important; letter-spacing: -.02em !important; text-transform: uppercase;
}
.start-lead { margin: 0; max-width: 58ch; color: rgba(239,231,210,.78); font: 400 15.5px/1.55 var(--font-ui); }
.start-body { padding: 26px 30px 28px; }
.start-card.folded .start-body, .start-card.folded .start-hero { display: none; }
.start-reopen {
  width: 100%; display: flex !important; justify-content: space-between; align-items: center; gap: 14px;
  background: var(--card) !important; color: var(--ink) !important; border: 0 !important; border-radius: 0 !important;
  padding: 16px 22px !important; text-align: left; text-transform: none !important; letter-spacing: 0 !important;
}
.start-reopen[hidden] { display: none !important; }
.start-reopen:hover { background: var(--edit) !important; color: var(--ink) !important; }
.start-reopen-title { font: 600 14px/1.3 var(--font-ui); color: var(--muted); }
.start-reopen-cta { font: 700 11px/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--red); white-space: nowrap; }

.row.row-essentials { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 14px; align-items: end; }
.row.row-fine { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; margin-top: 6px; }
.row.row-fine .budget-intent { grid-column: span 1; }
.row-essentials input, .row-essentials select, .row-fine input, .row-fine select { width: 100%; height: 46px !important; font-size: 16px !important; }
.f-title input { font-weight: 700 !important; }

.script-zone {
  margin-top: 18px; border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; background: var(--card2);
  transition: border-color .15s ease, background-color .15s ease;
}
.script-zone.drag { border-color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--card2)); }
.script-zone > label { margin: 2px 2px 10px !important; }
.file-pick { position: relative; margin-bottom: 12px; }
.file-pick input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2;
}
.file-pick-face {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font: 400 13px/1.4 var(--font-ui); color: var(--muted);
}
.file-pick-face b { font: 700 15px/1.2 var(--font-ui); color: var(--ink); }
.file-pick:hover .file-pick-face, .file-pick:focus-within .file-pick-face { border-color: var(--ink); }
.file-pick:focus-within .file-pick-face { outline: 2px solid var(--red); outline-offset: 2px; }
.file-pick-badge {
  background: var(--red); color: #fff; padding: 5px 8px; border-radius: 4px;
  font: 800 9.5px/1 var(--font-ui); letter-spacing: .12em;
}
body.studio #script {
  min-height: 190px; font: 400 13.5px/1.75 var(--font-screenplay) !important; background: var(--edit) !important;
}

details.fine-tune { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
details.fine-tune > summary {
  list-style: none; cursor: pointer; padding: 12px 0; display: flex; align-items: center; gap: 10px;
  font: 700 12px/1.2 var(--font-ui) !important; letter-spacing: .08em !important; text-transform: uppercase; color: var(--ink) !important;
}
details.fine-tune > summary::-webkit-details-marker { display: none; }
details.fine-tune > summary::before {
  content: "+"; width: 22px; height: 22px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; font: 700 14px/1 var(--font-ui); color: var(--muted);
}
details.fine-tune[open] > summary::before { content: "−"; }
.opt-tag { font: 600 10px/1 var(--font-ui); letter-spacing: .08em; color: var(--faint); text-transform: lowercase; }
details.fine-tune p.muted { font-size: 12.5px; line-height: 1.55; max-width: 80ch; }
.polish-money-echo { color: var(--red) !important; }

.check-line {
  display: flex !important; gap: 10px; align-items: flex-start; margin: 14px 0 0 !important; cursor: pointer;
  font: 500 13px/1.45 var(--font-ui) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--muted) !important;
}
.check-line input { margin-top: 1px; flex: none; }
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.start-actions button { padding: 13px 18px; }
.start-go { padding: 16px 28px !important; font-size: 13px !important; }
.start-status { min-height: 18px; margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.start-status .err { color: var(--red); font-weight: 600; }

/* ------------------------------------------------------- 4. plan bar */
.plan-bar {
  position: sticky; top: 12px; z-index: 45; margin: 0 0 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px 12px 20px; background: var(--night); color: var(--cream);
  border: 1px solid rgba(239,231,210,.08);
  border-radius: 10px; box-shadow: 0 -14px 0 0 var(--bg), 0 12px 30px rgba(0,0,0,.18);
}
.plan-bar[hidden] { display: none !important; }
.plan-bar-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plan-bar-kicker { font: 700 9px/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; opacity: .6; }
.plan-bar-title { font: 800 18px/1.15 var(--font-ui); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.plan-bar-stats { font: 600 12px/1.2 var(--font-mono); opacity: .78; }
.plan-bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-bar .ghost {
  color: var(--cream) !important; border-color: rgba(239,231,210,.32) !important; background: transparent !important;
}
.plan-bar .ghost:hover { border-color: var(--cream) !important; background: rgba(239,231,210,.08) !important; color: var(--cream) !important; }
.plan-bar .primary { background-color: #C8331F !important; border-color: #C8331F !important; }
.plan-bar .primary:hover { background-color: #E2553F !important; }
.plan-bar button { padding: 11px 16px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: 290px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25); padding: 6px; animation: popIn .14s ease both;
}
.menu[hidden] { display: none; }
.menu button {
  display: flex !important; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  background: transparent !important; color: var(--ink) !important; border: 0 !important;
  padding: 11px 12px !important; text-align: left; text-transform: none !important; letter-spacing: 0 !important;
}
.menu button b { font: 700 14px/1.2 var(--font-ui); }
.menu button span { font: 500 11.5px/1.2 var(--font-ui); color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--card2) !important; }

/* -------------------------------------------------------- 5. the report */
.polish-note {
  border-left: 3px solid var(--red) !important; color: var(--muted) !important;
  font: 400 13.5px/1.55 var(--font-ui) !important; padding: 2px 0 2px 12px !important; margin: 4px 0 14px !important;
}
.report-sec { scroll-margin-top: 96px; }
body.studio .sec-head {
  border-top: 1px solid var(--line) !important; padding: 18px 4px 16px !important; margin: 0 !important;
  display: flex; align-items: center; gap: 16px; cursor: pointer;
}
body.studio .sec-head:hover h2 { color: var(--red); }
body.studio .sec-num { font: 800 13px/1 var(--font-mono) !important; color: var(--red) !important; min-width: 24px; }
body.studio .sec-head h2 {
  font: 800 clamp(16px, 1.55vw, 20px)/1.2 var(--font-ui) !important; letter-spacing: -.005em !important;
  text-transform: uppercase !important; color: var(--ink); transition: color .15s ease;
}
body.studio .sec-toggle {
  width: 30px !important; height: 30px !important; border-radius: 50% !important; padding: 0 !important;
  background: transparent !important; color: var(--ink) !important; border: 1px solid var(--line) !important;
  font: 700 15px/1 var(--font-ui) !important;
}
body.studio .sec-toggle:hover { border-color: var(--ink) !important; background: var(--card) !important; }
body.studio .sec-body { padding: 0 4px 26px 44px; }
@media (max-width: 640px) { body.studio .sec-body { padding-left: 4px; } }
.sec-body p, .sec-body li { line-height: 1.6; }

/* executive summary — the first screen of the plan */
body.studio .exec-summary {
  background: var(--card) !important; border: 1px solid var(--line) !important; border-top: 0 !important;
  border-radius: 10px !important; box-shadow: var(--shadow) !important; padding: 22px 24px !important;
  overflow: hidden; position: relative;
}
body.studio .exec-summary::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--red);
}
body.studio .exec-summary .exec-title { color: var(--red) !important; font: 800 10px/1 var(--font-ui) !important; letter-spacing: .22em !important; }
body.studio .exec-cell .x-val { font: 800 22px/1.1 var(--font-ui) !important; color: var(--ink); letter-spacing: -.01em; }
body.studio .exec-cell.lead .x-val { font-size: 34px !important; color: var(--red) !important; }
body.studio .exec-cell .x-label { color: var(--muted) !important; font: 700 9px/1.35 var(--font-ui) !important; letter-spacing: .12em !important; }

/* hero stat band — night poster with the emblem's stripes */
body.studio .hero {
  background: var(--night) !important; border: 0 !important; border-radius: 10px !important;
  box-shadow: var(--shadow) !important; padding: 30px 32px !important; overflow: hidden; position: relative;
}
body.studio .hero::before {
  content: "" !important; display: block !important; position: absolute; inset: 0 0 0 auto; width: 40%; height: auto; top: 0;
  background: repeating-linear-gradient(180deg, rgba(239,231,210,.08) 0 6px, transparent 6px 13px) !important;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000);
}
body.studio .hero > * { position: relative; z-index: 1; }
body.studio .hero .cell { border-left-color: rgba(239,231,210,.14) !important; }
body.studio .hero .h-val { color: var(--cream) !important; font: 800 28px/1 var(--font-ui) !important; }
body.studio .hero .cell.lead .h-val { font-size: 52px !important; color: #fff !important; letter-spacing: -.025em; }
body.studio .hero .h-label { color: rgba(239,231,210,.55) !important; font: 700 9px/1.3 var(--font-ui) !important; letter-spacing: .14em !important; }
body.studio .hero .cell.lead .h-label { color: #E2553F !important; }

/* tables: quiet, readable, scroll inside their own box */
body.studio .sec-body table { border-collapse: collapse; font-size: 13px; }
body.studio th {
  background: transparent !important; color: var(--muted) !important; border: 0 !important;
  border-bottom: 2px solid var(--ink) !important; padding: 9px 10px !important;
  font: 700 9.5px/1.2 var(--font-ui) !important; letter-spacing: .1em !important; text-transform: uppercase;
}
body.studio td { border: 0 !important; border-bottom: 1px solid var(--line2) !important; padding: 9px 10px !important; }
body.studio tr:nth-child(even) td { background: transparent !important; }
body.studio tr:hover td { background: var(--card2) !important; }
.sec-body { overflow-x: auto; }

body.studio pre { border-radius: var(--radius); background: var(--card2) !important; }
.callout-gold, .callout-red { border-left-width: 3px !important; }
.rentchip, .mb-item, .fp-card, .sb-col, .strip, .sb-banner { border-radius: var(--radius) !important; }

/* the end-of-report index: a tidy chip cloud */
.report-index {
  position: static !important; display: flex; flex-wrap: wrap; gap: 6px !important; padding: 18px 0 !important;
  border-top: 1px solid var(--line) !important; border-bottom: 0 !important; background: transparent !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
.report-index a {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; color: var(--muted) !important;
  font: 600 11px/1 var(--font-ui) !important; letter-spacing: .02em !important; text-transform: none !important;
}
.report-index a:hover { border-color: var(--ink); color: var(--ink) !important; }

/* credit seals (Export section) */
.credit-seals { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.kicker-ink { margin: 0 0 6px; font: 800 10px/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
/* the Founding Cohort seal beside the one price: sober, a hairline, no colour */
.cohort-seal {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  padding: 4px 8px 3px; border: 1px solid var(--ink); border-radius: 2px;
  font: 700 9px/1.2 var(--font-ui); letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink); white-space: nowrap;
}
.seal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seal-card {
  margin: 0; display: flex; gap: 16px; align-items: center; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.seal-card img { flex: none; max-width: 46%; height: auto; display: block; }
.seal-round img { width: 120px; height: 120px; }
.seal-card figcaption { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; }
.seal-card figcaption b { font: 800 13.5px/1.25 var(--font-ui); }
.seal-dls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.seal-dl {
  font: 700 10px/1 var(--font-ui); letter-spacing: .1em; padding: 7px 9px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--ink) !important; text-decoration: none;
}
.seal-dl:hover { border-color: var(--ink); background: var(--card2); }
@media (max-width: 760px) { .seal-row { grid-template-columns: 1fr; } }

/* plans / upgrade / writer cards keep the shared card */
#plans .row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
#plans [data-plan] { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* ------------------------------------------------- 6. analysis overlay */
.analysis-overlay {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px;
  color: var(--cream); background: rgba(14,13,11,.97); touch-action: none;
}
.analysis-overlay[hidden] { display: none; }
.analysis-stage { width: min(420px, 100%); text-align: center; padding: 20px; }
.analysis-mark {
  width: 132px; height: 132px; margin: 0 auto 26px; display: grid; place-items: center;
  animation: film-exposure 3.2s ease-in-out infinite;
}
.analysis-mark img { width: 132px; height: 132px; object-fit: contain; }
.analysis-kicker { margin: 0 0 12px; color: #E2553F; font: 800 10px/1 var(--font-ui); letter-spacing: .26em; text-transform: uppercase; }
.analysis-stage h2 { margin: 0; color: var(--cream); font: 800 32px/1.02 var(--font-ui) !important; text-transform: uppercase; letter-spacing: -.01em !important; }
.analysis-detail { min-height: 2.8em; margin: 14px auto 24px; max-width: 300px; color: rgba(239,231,210,.7); font-size: 14px; line-height: 1.5; }
.analysis-track { height: 3px; overflow: hidden; background: rgba(239,231,210,.14); }
.analysis-track span { display: block; width: 34%; height: 100%; background: var(--cream); animation: analysis-scan 1.3s cubic-bezier(.3,.7,.4,1) infinite; }
@keyframes film-exposure { 0%, 100% { transform: scale(.96); opacity: .86; } 50% { transform: scale(1.03); opacity: 1; } }
@keyframes analysis-scan { from { transform: translateX(-115%); } to { transform: translateX(315%); } }

/* ------------------------------------------------------------ 7. toast */
.aria-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 10001; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 14px; max-width: min(620px, calc(100vw - 32px));
  padding: 13px 14px 13px 18px; border-radius: 10px; background: var(--night); color: var(--cream);
  box-shadow: 0 18px 48px rgba(0,0,0,.35); border-left: 4px solid var(--cream);
  font: 500 14px/1.4 var(--font-ui); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.aria-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.aria-toast.ok { border-left-color: #6FBF7B; }
.aria-toast.err { border-left-color: #E2553F; }
.aria-toast-link { color: var(--cream) !important; font-weight: 700; white-space: nowrap; }
.aria-toast-x {
  background: transparent !important; color: rgba(239,231,210,.7) !important; border: 0 !important;
  font: 400 20px/1 var(--font-ui) !important; padding: 2px 6px !important; text-transform: none !important;
}
.aria-toast-x:hover { color: #fff !important; background: transparent !important; }

/* ------------------------------------- 8. feedback widget */
.aria-fb-btn {
  background: var(--ink) !important; color: var(--bg) !important; border-radius: 999px !important;
  letter-spacing: .1em; text-transform: uppercase; font: 700 10.5px/1 var(--font-ui) !important;
  padding: 12px 18px !important; box-shadow: 0 10px 26px rgba(0,0,0,.2) !important;
}
.aria-fb-btn:hover { background: var(--red) !important; color: #fff !important; }
.aria-fb-panel {
  background: var(--card) !important; border: 1px solid var(--line) !important; border-top: 4px solid var(--red) !important;
  border-radius: 10px !important; color: var(--ink) !important; box-shadow: 0 20px 54px rgba(0,0,0,.2) !important;
}
.aria-fb-panel h3 { color: var(--ink) !important; }
.aria-fb-panel p, .aria-fb-note { color: var(--muted) !important; }
.aria-fb-panel textarea, .aria-fb-panel input {
  background: var(--edit) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important;
}
.aria-fb-send { background: var(--red) !important; color: #fff !important; border-radius: var(--radius) !important; }
.aria-fb-close { color: var(--muted) !important; background: transparent !important; }

/* -------------------------------------------------- 9. auth (login) */
body.auth { background: var(--bg) !important; }
body.auth .brand-header {
  background: var(--night) !important; border-bottom: 0 !important; height: 68px; padding: 0 24px;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
body.auth .brand-header::after { display: none !important; }
body.auth .brand-header .brand-lockup img { width: 42px !important; height: 42px !important; }
body.auth .brand-header .wordmark { font: 800 18px/1 var(--font-ui) !important; letter-spacing: .2em !important; color: var(--cream) !important; }
body.auth .brand-header .master-mark-label { font: 700 9px/1 var(--font-ui) !important; letter-spacing: .3em !important; color: rgba(239,231,210,.55) !important; }
body.auth .nav-switch button { color: rgba(239,231,210,.6) !important; background: transparent !important; }
body.auth .nav-switch button.active, body.auth .nav-switch button:hover { color: var(--cream) !important; }
body.auth .nav-switch .divider { background: rgba(239,231,210,.2) !important; }
body.auth .lang-switch select { color: var(--cream) !important; -webkit-text-fill-color: var(--cream) !important; background: transparent !important; border: 1px solid rgba(239,231,210,.25) !important; }

body.auth .body {
  display: grid !important; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: stretch; padding: 0 !important; min-height: calc(100vh - 68px); gap: 0;
}
.auth-poster {
  background: var(--night); color: var(--cream); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(28px, 5vw, 76px);
}
.auth-poster::after {
  content: ""; position: absolute; right: -6%; top: 0; bottom: 0; width: 48%;
  background: repeating-linear-gradient(180deg, rgba(239,231,210,.07) 0 8px, transparent 8px 17px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%);
  pointer-events: none;
}
.auth-poster > * { position: relative; z-index: 1; }
.auth-poster img { width: clamp(150px, 18vw, 230px); height: auto; margin-bottom: 30px; }
.auth-poster .poster-kicker { font: 800 10px/1 var(--font-ui); letter-spacing: .3em; text-transform: uppercase; color: #E2553F; margin: 0 0 16px; }
.auth-poster h2 { margin: 0 0 18px; font: 800 clamp(34px, 4.4vw, 60px)/.95 var(--font-ui); letter-spacing: -.025em; text-transform: uppercase; color: var(--cream); }
.auth-poster p { margin: 0 0 26px; max-width: 46ch; font: 400 16px/1.55 var(--font-ui); color: rgba(239,231,210,.75); }
.auth-poster ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-poster li { display: flex; gap: 12px; align-items: baseline; font: 600 14px/1.4 var(--font-ui); color: rgba(239,231,210,.9); }
.auth-poster li b { font: 800 11px/1 var(--font-mono); color: #E2553F; min-width: 22px; }

body.auth .panel { align-self: center; justify-self: center; width: min(440px, calc(100% - 40px)); margin: 48px 0; }
body.auth .panel-head img { display: none !important; }
body.auth .panel-head h1, body.auth #heading, body.auth #welcomeHeading {
  color: var(--ink) !important; font: 800 32px/1.05 var(--font-ui) !important; text-transform: uppercase; letter-spacing: -.015em !important;
}
body.auth .panel-head .sub, body.auth .switch-line, body.auth .dz-sub { color: var(--muted) !important; }
body.auth .card {
  background: var(--card) !important; border: 1px solid var(--line) !important; border-top: 4px solid var(--ink) !important;
  border-radius: 10px !important; box-shadow: var(--shadow) !important;
}
body.auth .card::before { display: none !important; }
body.auth label, body.auth .field label, body.auth .pw-row label { color: var(--muted) !important; }
body.auth input:not([type="checkbox"]):not([type="radio"]), body.auth select, body.auth textarea {
  color: var(--ink) !important; -webkit-text-fill-color: var(--ink) !important; caret-color: var(--red);
  background: var(--edit) !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important;
}
body.auth input::placeholder { color: var(--faint) !important; -webkit-text-fill-color: var(--faint) !important; opacity: 1 !important; }
body.auth input:focus { border-color: var(--ink) !important; }
body.auth input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--edit) inset !important;
}
body.auth .cta { height: 50px; font: 800 12px/1 var(--font-ui) !important; letter-spacing: .14em !important; }
body.auth .run-cta { border-radius: var(--radius) !important; }
body.auth .skip-line button, body.auth .switch-line button, body.auth .nav-switch button,
body.auth .pw-row .forgot, body.auth .terms-link {
  background-color: transparent !important; background-image: none !important; box-shadow: none !important; border-radius: 0 !important;
}
body.auth .switch-line button, body.auth .pw-row .forgot, body.auth .terms-link { color: var(--red) !important; }
/* the no-account lane is a real entry, not a footnote: a proper button */
body.auth .skip-line { margin-top: 18px; text-align: center; }
body.auth .skip-line .guest-kicker { display: block; margin-bottom: 8px; font: 700 9.5px/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--faint) !important; }
body.auth #guestLine button {
  width: 100%; height: 50px; border: 1.5px solid var(--ink) !important; border-radius: var(--radius) !important;
  color: var(--ink) !important; text-decoration: none !important; font: 800 12px/1 var(--font-ui) !important;
  letter-spacing: .1em !important; text-transform: uppercase;
}
body.auth #guestLine button:hover { background-color: var(--ink) !important; color: var(--bg) !important; }
body.auth .dropzone { border-radius: 10px !important; background: var(--card2) !important; border-color: var(--line) !important; }
body.auth .dropzone .dz-main { color: var(--ink) !important; }
body.auth .terms-modal {
  background: var(--card) !important; color: var(--ink) !important; border: 1px solid var(--line) !important;
  border-top: 4px solid var(--red) !important; border-radius: 10px !important;
}
body.auth .terms-modal h2, body.auth .terms-modal h3, body.auth .terms-modal p,
html body.auth .terms-modal .terms-consent .terms-row span { color: var(--ink) !important; }
body.auth .terms-modal .intro, body.auth .terms-modal .ver, body.auth .terms-modal .notice { color: var(--muted) !important; }
body.auth .terms-modal .close { background: transparent !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
body.auth .transition-overlay, .transition-overlay { background: var(--night) !important; }
@media (max-width: 899px) {
  body.auth .body { grid-template-columns: 1fr; min-height: 0; }
  .auth-poster { padding: 34px 22px 30px; }
  .auth-poster img { width: 104px; margin-bottom: 18px; }
  .auth-poster p, .auth-poster ul { display: none; }
  .auth-poster h2 { font-size: 30px; margin-bottom: 0; }
  body.auth .panel { margin: 28px 0 60px; }
}

/* ------------------------------------------------- 10. projects page */
body.studio .title-block { border-top: 0 !important; }
body.studio .title-block .kicker { color: var(--red) !important; }
body.studio .title-block h1 { font: 800 clamp(34px, 5vw, 56px)/.95 var(--font-ui) !important; text-transform: uppercase; letter-spacing: -.025em !important; color: var(--ink); }
body.studio .proj, body.studio .dropzone, body.studio .join-strip, body.studio .foot-strip {
  background: var(--card) !important; border: 1px solid var(--line) !important; border-radius: 10px !important;
  box-shadow: var(--shadow) !important;
}
body.studio .proj { border-top: 4px solid var(--ink) !important; }
body.studio .proj:hover { border-color: var(--ink) !important; transform: translateY(-2px); }
body.studio .dropzone { border-style: dashed !important; border-width: 1.5px !important; background: var(--card2) !important; }
body.studio .dropzone:hover, body.studio .dropzone.drag { border-color: var(--red) !important; }
body.studio .badge-pdf, body.studio .tag-chip { border-radius: 4px !important; }
body.studio .open-link { color: var(--red) !important; }
body.studio .pipe-bar { background: var(--red) !important; }

/* projects header: night bar with the cream mark */
body.studio > .brand-header:not(.app-rail) {
  background: var(--night) !important; border-bottom: 0 !important; height: 68px;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
body.studio > .brand-header:not(.app-rail)::after { display: none !important; }
body.studio > .brand-header:not(.app-rail) .brand-lockup img { width: 42px !important; height: 42px !important; }
body.studio > .brand-header:not(.app-rail) .wordmark { font: 800 18px/1 var(--font-ui) !important; letter-spacing: .2em !important; color: var(--cream) !important; }
body.studio > .brand-header:not(.app-rail) .master-mark-label { font: 700 9px/1 var(--font-ui) !important; letter-spacing: .3em !important; color: rgba(239,231,210,.55) !important; }
body.studio > .brand-header:not(.app-rail) .lang-switch select,
body.studio > .brand-header:not(.app-rail) .theme-btn { color: var(--cream) !important; -webkit-text-fill-color: var(--cream) !important; background: transparent !important; border: 1px solid rgba(239,231,210,.25) !important; }
body.studio > .brand-header:not(.app-rail) .plan-label { color: rgba(239,231,210,.6) !important; }

/* --------------------------------------------- 11. script editor (flat) */
body.studio-flat > .brand-header {
  background: var(--night) !important; border-bottom: 0 !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
body.studio-flat > .brand-header::after { display: none !important; }
body.studio-flat .hdr-kicker, body.studio-flat .back-link { color: rgba(239,231,210,.75) !important; }
body.studio-flat .back-link { background: transparent !important; }
body.studio-flat .back-link:hover { color: var(--cream) !important; }
body.studio-flat .sync-chip { color: rgba(239,231,210,.6) !important; }
body.studio-flat .hdr-btn:not(.primary), body.studio-flat .theme-btn, body.studio-flat .lang-switch select {
  background: transparent !important; color: var(--cream) !important; -webkit-text-fill-color: var(--cream) !important;
  border: 1px solid rgba(239,231,210,.28) !important;
}
body.studio-flat .hdr-btn:not(.primary):hover { border-color: var(--cream) !important; }
body.studio-flat .page-card { background: var(--edit) !important; border: 1px solid var(--line) !important; border-radius: 4px !important; box-shadow: var(--shadow) !important; }
body.studio-flat .page-card::before { display: none !important; }
body.studio-flat .rail { background: var(--card2) !important; border-color: var(--line) !important; }
body.studio-flat .rail-kicker { color: var(--red) !important; }
body.studio-flat #title { font-family: var(--font-ui) !important; font-weight: 800 !important; text-transform: uppercase !important; }
body.studio-flat .el-btn { border-radius: var(--radius) !important; background: transparent !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
body.studio-flat .el-btn.cur { background: var(--ink) !important; color: var(--bg) !important; border-color: var(--ink) !important; }

/* ------------------------------------------------------------ 12. phones */
@media (max-width: 899px) {
  body.workbench { display: block !important; padding-left: 0; }
  body.studio > .app-rail {
    position: sticky; top: 0; z-index: 60; width: 100%; height: auto; display: block;
  }
  .app-rail .brand-lockup { padding: 10px 14px; border-bottom: 0; }
  .rail-brand .rail-mark { width: 40px !important; height: 40px !important; }
  .app-rail .wordmark { font-size: 20px !important; }
  .rail-menu {
    display: inline-flex !important; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 11px !important; background: transparent !important;
    border: 1px solid rgba(239,231,210,.25) !important;
  }
  .rail-menu span { display: block; height: 2px; background: var(--cream); border-radius: 1px; }
  .rail-body { display: none; max-height: calc(100vh - 64px); overflow-y: auto; border-top: 1px solid rgba(239,231,210,.12); }
  body.nav-open .rail-body { display: flex; }
  .rail-foot { padding-bottom: 20px; }
  body.studio main.page { padding: 18px 14px 110px; }
  .start-hero { padding: 26px 20px 22px; }
  .start-body { padding: 20px 16px 22px; }
  .row.row-essentials, .row.row-fine { grid-template-columns: 1fr; }
  .plan-bar { top: 64px; border-radius: 8px; padding: 8px 10px; gap: 8px; }
  .plan-bar-kicker, .plan-bar-stats { display: none; }
  .plan-bar-title { font-size: 14px; max-width: 86vw; }
  .plan-bar-actions { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .plan-bar-actions > * { flex: 1; }
  .plan-bar-actions button { width: 100%; padding: 10px 6px !important; font-size: 10px !important; white-space: nowrap; }
  .app-rail .who { display: block; }
  body.auth .brand-header { height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; justify-content: space-between; }
  body.auth .brand-header .brand-lockup img { width: 34px !important; height: 34px !important; }
  body.auth .body { min-height: 0; }
  .menu { left: 0; right: auto; width: min(320px, calc(100vw - 28px)); }
  .report-sec { scroll-margin-top: 170px; }
  body.studio .hero .cell.lead .h-val { font-size: 38px !important; }
  #plans .row { grid-template-columns: 1fr; }
  .aria-toast { bottom: 84px; }
}
@media (min-width: 900px) and (max-width: 1100px) {
  .row.row-essentials { grid-template-columns: 1fr 1fr; }
  .row.row-essentials .f-title { grid-column: 1 / -1; }
}

/* --------------------------------------------- 13. the emblem's texture
   The mark is printed, not flat: a stochastic stipple of dots and short
   squiggles that thins from cream through ochre into the night ground. The
   same grain (tools/build_brand_texture.py, seamless tiles) is laid on every
   surface so the interface and the emblem read as one printed object:
     - night panels carry cream grain + the crescent's warm ochre light
     - the paper page carries a faint ink grain
     - poster headlines are set in stippled cream -> ochre, like the mark
   Texture stays OFF the reading surfaces (cards, tables, inputs). */
:root {
  --tex-cream: url("/app/static/brand/grain-cream.png");
  --tex-ink-strong: url("/app/static/brand/grain-ink-strong.png");
  --ochre: #D9B47A;
  --crescent-light: radial-gradient(120% 90% at 0% 0%, rgba(217,180,122,.16), rgba(217,180,122,.05) 38%, transparent 64%);
}
html body { background-image: url("/app/static/brand/grain-ink-faint.png") !important; background-size: 320px 320px !important; }
html[data-theme="dark"] body { background-image: url("/app/static/brand/grain-cream-faint.png") !important; }

body.studio > .app-rail,
body.auth .brand-header,
body.studio > .brand-header:not(.app-rail),
body.studio-flat > .brand-header,
.analysis-overlay, .transition-overlay {
  background-image: var(--tex-cream), var(--crescent-light) !important;
  background-size: 320px 320px, 100% 100% !important;
}
.start-hero, .auth-poster, .plan-bar, body.studio .hero {
  background-image: var(--tex-cream), var(--crescent-light) !important;
  background-size: 320px 320px, 100% 100% !important;
}
.aria-toast { background-image: var(--tex-cream) !important; background-size: 320px 320px; }

/* stippled poster type: cream -> ochre through the grain, like the crescent */
.start-hero h3, .auth-poster h2, body.studio .hero .cell.lead .h-val,
.app-rail .wordmark, body.studio .title-block h1, .analysis-stage h2 {
  background-image: var(--tex-ink-strong), linear-gradient(105deg, #F7F1E1 0%, #EFE7D2 42%, var(--ochre) 100%) !important;
  background-size: 200px 200px, 100% 100% !important;
  -webkit-background-clip: text !important; background-clip: text !important;
  color: transparent !important; -webkit-text-fill-color: transparent !important;
}
/* the paper headline: ink stipple, not cream */
body.studio .title-block h1 {
  background-image: url("/app/static/brand/grain-cream.png"), linear-gradient(105deg, #16140F 0%, #2A251B 60%, #5E4A2A 100%) !important;
}
html[data-theme="dark"] body.studio .title-block h1 {
  background-image: var(--tex-ink-strong), linear-gradient(105deg, #F7F1E1 0%, #EFE7D2 42%, var(--ochre) 100%) !important;
}
/* Windows high-contrast / forced colours: plain readable text, no clip */
@media (forced-colors: active) {
  .start-hero h3, .auth-poster h2, body.studio .hero .cell.lead .h-val,
  .app-rail .wordmark, body.studio .title-block h1, .analysis-stage h2 {
    background: none !important; color: CanvasText !important; -webkit-text-fill-color: CanvasText !important;
  }
}

/* ------------------------------------------------ 14. phones & tablets
   Real-device rules, layered on the breakpoints above:
     - nothing zooms on focus (iOS zooms any field under 16px)
     - every tap target is >= 44px on touch screens
     - notch / home-indicator safe areas respected (viewport-fit=cover)
     - tablets (600-899px) get two-column forms and the full plan bar
     - no page is ever wider than the screen */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, a, summary, label, select, input[type="file"] { touch-action: manipulation; -webkit-tap-highlight-color: rgba(179,38,30,.15); }

@media (pointer: coarse), (max-width: 899px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select, textarea, body.studio #script { font-size: 16px !important; }
  input[type="checkbox"] { width: 22px; height: 22px; }
  body.studio .sec-toggle { width: 44px !important; height: 44px !important; }
  body.studio .sec-head { min-height: 56px; }
  .rail-link, .side-sections a { min-height: 44px; align-items: center !important; }
  .seal-dl { padding: 13px 14px; }
  .report-index a { padding: 11px 13px; }
  .menu button { min-height: 52px; }
  .start-actions button, .plan-bar button { min-height: 44px; }
  details.fine-tune > summary { min-height: 48px; }
  .theme-btn, .lang-switch select { min-height: 40px; }
  /* tooltips open on tap (focus) as well as hover */
  .term { -webkit-tap-highlight-color: transparent; }
}

/* safe areas: header under the notch, fixed widgets above the home bar */
@supports (padding: max(0px)) {
  body.studio > .app-rail .brand-lockup { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  body.auth .brand-header, body.studio > .brand-header:not(.app-rail), body.studio-flat > .brand-header {
    padding-left: max(16px, env(safe-area-inset-left)) !important; padding-right: max(16px, env(safe-area-inset-right)) !important;
  }
  .aria-fb-btn { bottom: max(14px, env(safe-area-inset-bottom)) !important; right: max(14px, env(safe-area-inset-right)) !important; }
  .aria-toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  @media (max-width: 899px) {
    body.studio > .app-rail { padding-top: env(safe-area-inset-top) !important; }
    body.studio main.page { padding-bottom: calc(110px + env(safe-area-inset-bottom)) !important; }
    .aria-toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  }
}

/* phones: drawer is a sheet that scrolls on its own; the page behind stays put */
@media (max-width: 899px) {
  body.nav-open { overflow: hidden; }
  /* the menu is a sheet over a dimmed page: tap the page to close it */
  body.nav-open .rail-body { max-height: min(78dvh, calc(100dvh - 140px - env(safe-area-inset-top))); box-shadow: 0 24px 40px rgba(0,0,0,.35); }
  body.nav-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(14,13,11,.45);
  }
  body.nav-open > .app-rail { z-index: 60; }
  .plan-bar { top: calc(64px + env(safe-area-inset-top)); }
  body.studio .hero { padding: 22px 20px !important; }
  body.studio .hero .cell { padding: 0 !important; }
  .exec-grid { gap: 14px 12px !important; }
  .seal-card { flex-direction: row; }
  .seal-round img { width: 96px; height: 96px; }
}

/* tablets in portrait (iPad, large phones in landscape) */
@media (min-width: 600px) and (max-width: 899px) {
  .row.row-essentials { grid-template-columns: 1fr 1fr; }
  .row.row-essentials .f-title { grid-column: 1 / -1; }
  .row.row-fine { grid-template-columns: 1fr 1fr; }
  .plan-bar-kicker, .plan-bar-stats { display: block; }
  .plan-bar-actions { width: auto; }
  .plan-bar-actions > * { flex: none; }
  .plan-bar-actions button { width: auto; padding: 11px 16px !important; font-size: 11px !important; }
  body.studio .hero { grid-template-columns: 1.4fr 1fr 1fr !important; }
  body.studio main.page { padding: 24px 24px 110px; }
  #plans .row { grid-template-columns: 1fr 1fr; }
}

/* small laptops / iPad landscape: a narrower rail leaves room for the plan */
@media (min-width: 900px) and (max-width: 1180px) {
  :root { --rail-w: 224px; }
  .rail-brand .rail-mark { width: 46px !important; height: 46px !important; }
  .app-rail .wordmark { font-size: 22px !important; }
}

/* projects page header on phones: one tidy row, nothing pushes the page wide */
@media (max-width: 640px) {
  body.studio > .brand-header:not(.app-rail) { height: auto !important; min-height: 60px; flex-wrap: nowrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  body.studio > .brand-header:not(.app-rail) .master-mark-label,
  body.studio > .brand-header:not(.app-rail) .plan-label,
  body.studio > .brand-header:not(.app-rail) .globe { display: none !important; }
  body.studio > .brand-header:not(.app-rail) > div:last-child { gap: 8px !important; min-width: 0; }
  body.studio > .brand-header:not(.app-rail) .lang-switch select { max-width: 110px; }
  body.studio .grid { grid-template-columns: 1fr !important; }
  .join-strip { flex-direction: column; align-items: stretch !important; }
  .join-strip input, .join-strip button { width: 100% !important; }
  .foot-strip { flex-wrap: wrap; }
}

/* script editor header on phones: two compact rows instead of three */
@media (max-width: 760px) {
  body.studio-flat > .brand-header { flex-wrap: wrap; gap: 8px; padding-top: 8px !important; padding-bottom: 8px !important; height: auto !important; }
  body.studio-flat .hdr-kicker, body.studio-flat .hdr-sep, body.studio-flat .globe { display: none !important; }
  body.studio-flat .hdr-right { gap: 6px !important; width: 100%; justify-content: flex-start !important; }
  body.studio-flat .hdr-btn { padding: 9px 10px !important; font-size: 10px !important; min-height: 40px; }
  body.studio-flat .hdr-btn.primary { flex: 1 1 100%; justify-content: center; }
  body.studio-flat .lang-switch select { max-width: 96px; font-size: 16px !important; padding-right: 22px !important; }
  body.studio-flat .sync-chip { order: 9; flex-basis: 100%; text-align: left; border: 0 !important; padding: 0 !important; }
}

/* ------------------------------------------------------ 13. reduced motion */
@media (prefers-reduced-motion: reduce) {
  .analysis-mark, .analysis-mark img, .analysis-track span, .menu { animation: none !important; }
  body.studio .proj:hover { transform: none; }
  .aria-toast { transition: none; }
}

#plans .row { align-items: start; }
a.cta { font: 700 12px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; }
@media (max-width: 560px) {
  .seal-card:not(.seal-round) { flex-direction: column; align-items: flex-start; }
  .seal-card:not(.seal-round) img { max-width: 100%; width: 260px; }
}

/* ------------------------------------------------ 15. touch targets (launch pass)
   Every control a thumb has to hit is at least 44 x 44 CSS px on touch screens
   and phones: legal links, sign-in switches, the language/theme controls, the
   section index, the editor toolbar, the feedback button. Inline links inside a
   sentence keep their line height (the WCAG inline exception). */
@media (pointer: coarse), (max-width: 899px) {
  .site-legal nav { gap: 0 14px; }
  .site-legal a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; }
  html .aria-fb-btn { min-height: 44px; padding: 0 16px; font-size: 11px; bottom: calc(14px + env(safe-area-inset-bottom)); right: 14px; opacity: .94; }
  body.auth .nav-switch button, .switch-line button, .pw-row .forgot, .skip-line button { min-height: 44px; padding: 12px 8px; }
  .theme-btn { min-width: 44px; min-height: 44px; }
  .report-nav a, .side-sections a, .rail-link { min-height: 44px; display: flex; align-items: center; }
  .who button, .who a { min-height: 44px; display: inline-flex; align-items: center; }
  .el-btn, .rev-btn, #lockBtn { min-height: 44px; }
  .back-link, .logout-btn, .dz-write, .btn { min-height: 44px; display: inline-flex; align-items: center; }
  .join-strip button { min-height: 44px; }
  .check-line { min-height: 44px; align-items: center; }
  input[type="checkbox"] { width: 22px; height: 22px; }
  #guestAccept { width: 22px !important; height: 22px !important; }
}

/* login on phones: the poster is a short banner above the form. A grid row in a
   fixed-height scroller squeezed it to 64px and clipped the emblem under the
   header; it now takes its natural height, without the emblem (the header
   already carries it), so the form starts within the first screen. */
@media (max-width: 899px) {
  body.auth .body { display: block !important; }
  body.auth .auth-poster { padding: 22px 22px 20px; }
  body.auth .auth-poster img, body.auth .auth-poster .poster-kicker { display: none; }
  body.auth .auth-poster h2 { font-size: clamp(26px, 7.4vw, 34px); }
  body.auth .panel { margin: 22px auto 40px; }
}
@media (max-width: 480px) {
  body.auth .nav-switch { gap: 4px; }
  body.auth .nav-switch button { white-space: nowrap; }
}
/* guide strip on phones: titles only, in one row */

/* line icons replace the system globe and sun/moon glyphs (no emoji anywhere) */
.globe { display: inline-flex; align-items: center; line-height: 1; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; }
.theme-btn svg { display: block; }

/* the rail is always night: its theme and language controls read cream in both themes */
.app-rail .theme-btn { color: var(--cream) !important; border-color: rgba(239,231,210,.28) !important; }
.app-rail .globe { color: rgba(239,231,210,.7); }

/* tablets in portrait: the export menu opens inward, like on phones, so it can
   never push the page wider than the screen */
@media (pointer: coarse), (max-width: 899px) {
  .hdr-btn { min-height: 44px; }
}

/* tablets in portrait: the export menu opens toward the screen, never off it */
@media (min-width: 600px) and (max-width: 899px) {
  .menu { left: auto; right: 0; }
}

.theme-btn { padding: 0 !important; }
.theme-btn svg, .globe svg { flex: none; }

/* ------------------------------------------------------- 16. the room
   Daniel's background, in the product (2026-11-07): the light-leak he sent
   for Aufilm — a dark maroon-black field, a golden bloom on the left, coral
   glows on the right, grainy haze — recreated in code, dimmed down and slow.
   It is the ROOM the work sits in, never wallpaper behind text: a dark wash
   rides over the glows so the reading field stays near-black, the colour
   pools at the edges of the viewport, and every panel above it is a solid
   or near-solid slab (§ theme.css dark tokens). Dark theme only; the paper
   theme remains the print alternate, one tap away. The layer is a fixed
   body::before at z-index -1: above the page's own background, below every
   surface, and it never takes pointer events. */
@keyframes leakPulse {
  from { opacity: .84; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.045); }
}
html[data-theme="dark"] body::before {
  content: ""; position: fixed; inset: -4%; z-index: -1; pointer-events: none;
  background:
    url("/app/static/brand/grain-cream-faint.png"),
    linear-gradient(180deg, rgba(10,7,6,.46), rgba(10,7,6,.34) 42%, rgba(10,7,6,.50)),
    radial-gradient(52% 44% at 5% 16%, rgba(232,163,61,.26), rgba(232,163,61,.08) 55%, transparent 72%),
    radial-gradient(40% 36% at 97% 10%, rgba(255,107,74,.19), rgba(255,107,74,.05) 55%, transparent 72%),
    radial-gradient(56% 48% at 88% 94%, rgba(178,38,30,.17), transparent 70%),
    radial-gradient(38% 32% at 20% 98%, rgba(217,180,122,.09), transparent 70%),
    linear-gradient(158deg, #1D110C 0%, #130C09 46%, #0B0807 100%);
  background-size: 320px 320px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  animation: leakPulse 16s ease-in-out infinite alternate;
  will-change: opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] body::before { animation: none !important; }
}

/* editorial discipline over the room: near-sharp corners and print shadows
   on the surfaces that used to float like dashboard cards (10px radii and
   soft all-round shadows were the generic-SaaS tell). Small controls keep
   their working radii via --radius (now 3px). */
body.studio .card, body.studio .exec-summary, body.studio .hero,
body.studio .proj, body.studio .dropzone, body.studio .join-strip,
body.studio .foot-strip, body.studio .script-zone,
.seal-card, .menu, .plan-bar, .aria-toast, .aria-fb-panel,
body.auth .card, body.auth .terms-modal, body.auth .dropzone {
  border-radius: 3px !important;
}
.aria-fb-btn { border-radius: 3px !important; box-shadow: 0 2px 0 rgba(0,0,0,.4) !important; }
.report-index a { border-radius: 2px; }
.menu { box-shadow: 0 2px 0 rgba(0,0,0,.45), 0 18px 34px rgba(0,0,0,.30) !important; }
.aria-toast { box-shadow: 0 2px 0 rgba(0,0,0,.5), 0 16px 30px rgba(0,0,0,.35) !important; }
.aria-fb-panel { box-shadow: 0 2px 0 rgba(0,0,0,.45), 0 18px 34px rgba(0,0,0,.30) !important; }
#plans [data-plan] { border-radius: 3px; }

/* the sticky plan bar's cover strip blends into the room's top edge
   instead of painting a flat band of page colour over the glow */
html[data-theme="dark"] .plan-bar {
  box-shadow: 0 -14px 0 0 #14100C, 0 16px 32px rgba(0,0,0,.34);
}
