/* FalaAI Transcrição — the "familiar professional" light surface of DESIGN.md (FEMCA palette and
   type), arranged as one guided journey: Envie, Aguarde, Leia. 44px controls (48px on touch). */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/ibm-plex-sans-latin.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/space-grotesk-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/ibm-plex-mono-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/assets/fonts/ibm-plex-mono-500-latin.woff2) format('woff2'); }

:root {
  --key: #1b4d9b; --key-hover: #2f63bd; --focus-halo: #cfe0ff;
  --ink: #0a0f1c; --ink-2: #3b4a6b; --ink-3: #5f6f92;
  --paper: #f5f8fd; --sheet: #ffffff; --paper-tint: #f2f6ff; --paper-tint-hover: #e8edf7;
  --border: #e3e8f0; --border-strong: #c5d2e6;
  --live: #1f8a4c; --live-ink: #0f5a2f; --live-wash: #e6f6ec;
  --stamp: #f4923f; --stamp-ink: #0a0f1c; --hit: #ffe2c2;
  --danger-ink: #b7402f; --danger-wash: #fff1ee; --warn-ink: #8a4a08; --warn-wash: #fff6ec;
  --shadow-1: 0 1px 2px rgba(10, 15, 28, 0.06); --shadow-2: 0 10px 28px rgba(10, 15, 28, 0.16);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bar-h: 72px;
  --control-h: 44px;
  --control-lg: 52px;
  --icon-key: 36px;
}
@media (pointer: coarse) { :root { --control-h: 48px; --icon-key: 48px; } }

* { box-sizing: border-box; }
/* Component display rules must never override the `hidden` attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 0.9375rem/1.5 var(--font-body);
  font-variant-numeric: tabular-nums; min-height: 100vh; display: flex; flex-direction: column; caret-color: var(--key); }
::selection { background: var(--focus-halo); color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
svg { flex: none; }
a { color: var(--key); text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -56px; z-index: 20; background: var(--key); color: #fff; padding: 10px 14px; border-radius: 6px; font-weight: 600; }
.skip:focus { top: 10px; }
:focus-visible { outline: 2px solid var(--key); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------------------------------------------------------------- top bar */
.bar { position: sticky; top: 0; z-index: 10; height: var(--bar-h); background: var(--sheet); border-bottom: 1px solid var(--border); }
.bar-in { height: 100%; display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 16px; min-width: 0; color: var(--ink); text-decoration: none; border-radius: 6px; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-product { padding-left: 16px; border-left: 1px solid var(--border-strong); font: 600 1.0625rem/1.2 var(--font-display); color: var(--ink-2); white-space: nowrap; }
.status { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 46%; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--sheet); color: var(--ink-2); font-size: 0.8125rem; white-space: nowrap; }
.status > span { overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; transition: background-color 200ms var(--ease); }
.status[data-state=ok] .status-dot, .status[data-state=busy] .status-dot { background: var(--live); }
.status[data-state=busy] .status-dot { animation: dot-work 1.6s ease-in-out infinite; }
@keyframes dot-work { 50% { opacity: 0.35; } }
.status[data-state=warn] .status-dot { background: var(--stamp); }
.status[data-state=bad] .status-dot { background: var(--danger-ink); }

/* ---------------------------------------------------------------- intro */
.main { flex: 1; padding-top: 36px; padding-bottom: 40px; }
.intro { display: grid; gap: 6px; }
.intro h1 { font-size: 1.75rem; }
body:not([data-view=send]) .intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body:not([data-view=send]) .steps-wrap { margin-top: 4px; }
.lead { color: var(--ink-2); font-size: 1rem; max-width: 62ch; }

/* ---------------------------------------------------------------- the three steps */
.steps-wrap { position: relative; margin: 32px 0 22px; }
.steps { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.step-key { display: grid; justify-items: center; align-content: start; gap: 6px; width: 100%; padding: 0 10px; border: 0; border-radius: 10px;
  background: none; color: inherit; font: inherit; text-align: center; }
button.step-key:disabled { cursor: default; }
button.step-key:not(:disabled) { cursor: pointer; }
.step-disc { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--sheet); color: var(--ink-3); font: 600 1rem/1 var(--font-display);
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease); }
.step-disc svg { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.step-title { font: 600 1.0625rem/1.25 var(--font-display); color: var(--ink-3); transition: color 200ms var(--ease); }
.step-note { max-width: 30ch; color: var(--ink-3); font-size: 0.8125rem; line-height: 1.4; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.step[data-state=current] .step-disc { border-color: var(--key); color: var(--key); box-shadow: 0 0 0 5px var(--focus-halo); }
.step[data-state=current] .step-title, .step[data-state=done] .step-title { color: var(--ink); }
.step[data-state=current] .step-note { color: var(--ink-2); }
.step[data-state=done] .step-disc { border-color: var(--key); background: var(--key); color: #fff; }
.step[data-state=done] .step-disc svg { display: block; }
.step[data-state=done] .step-n { display: none; }
.step[data-state=error] .step-disc { border-color: var(--danger-ink); background: var(--danger-wash); color: var(--danger-ink); }
.step[data-state=error] .step-title, .step[data-state=error] .step-note { color: var(--danger-ink); }
@media (hover: hover) {
  button.step-key:not(:disabled):hover .step-disc { box-shadow: 0 0 0 5px var(--paper-tint-hover); }
  button.step-key:not(:disabled):hover .step-title { color: var(--key); }
}
/* One rule from the first disc's centre to the last; it fills as the work advances. */
.steps-rule { position: absolute; top: 21px; left: calc(100% / 6); right: calc(100% / 6); height: 2px; background: var(--border-strong); border-radius: 2px; }
.steps-rule > i { display: block; height: 100%; width: 100%; background: var(--key); border-radius: 2px; transform: scaleX(0); transform-origin: left center; transition: transform 520ms var(--ease); }
/* While the page asks for a key or a licence there is no journey to show yet. */
body[data-gate] .steps-wrap { display: none; }
body[data-gate] .stage { margin-top: 28px; }

/* ---------------------------------------------------------------- stage */
.stage { background: var(--sheet); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-1); padding: 28px; }
.panel.is-entering { animation: panel-in 200ms var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- fields and keys */
label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.opt { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=url], input[type=password], input[type=search], select, textarea {
  width: 100%; height: var(--control-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--sheet); color: var(--ink); font: 400 0.9375rem/1.2 var(--font-body);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
select { padding-right: 30px; }
input::placeholder { color: var(--ink-3); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--key); box-shadow: 0 0 0 3px var(--focus-halo); }
input[aria-invalid=true] { border-color: var(--danger-ink); }
@media (hover: hover) { input:hover, select:hover, textarea:hover { border-color: var(--key-hover); } }
@media (pointer: coarse) { input, select, textarea { font-size: 1rem; } }
.field { display: grid; gap: 6px; align-content: start; }
.hint { font-size: 0.8125rem; line-height: 1.45; color: var(--ink-3); }
.hint.bad { color: var(--danger-ink); }
.hint.ok { color: var(--live-ink); }

.key { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); padding: 0 18px;
  border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--key);
  font: 600 0.875rem/1 var(--font-body); letter-spacing: 0.01em; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease); }
.key svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.key:active:not(:disabled) { box-shadow: inset 0 1px 0 rgba(10, 15, 28, 0.14); }
.key:disabled { opacity: 0.5; cursor: default; }
.key-primary { background: var(--key); border-color: var(--key); color: #fff; }
.key-secondary { background: var(--sheet); border-color: var(--border-strong); color: var(--ink); }
.key-ghost { color: var(--ink-2); }
.key-danger { background: var(--danger-ink); border-color: var(--danger-ink); color: #fff; }
.key-lg { height: var(--control-lg); padding: 0 26px; font-size: 1rem; }
.key-icon { width: var(--icon-key); height: var(--icon-key); padding: 0; color: var(--ink-3); }
.key[aria-busy=true] { cursor: progress; }
@media (hover: hover) {
  .key:hover:not(:disabled) { background: var(--paper-tint); }
  .key-primary:hover:not(:disabled) { background: var(--key-hover); border-color: var(--key-hover); }
  .key-secondary:hover:not(:disabled) { border-color: var(--key-hover); background: var(--paper-tint); }
  .key-danger:hover:not(:disabled) { background: #9c3526; border-color: #9c3526; }
  .key-icon:hover:not(:disabled) { color: var(--key); }
}

/* ---------------------------------------------------------------- step 1: send */
.send { display: grid; grid-template-columns: minmax(0, 1.5fr) auto minmax(0, 1fr); gap: 28px; align-items: stretch; }
.drop { display: grid; justify-items: center; align-content: center; gap: 10px; min-height: 280px; padding: 32px 24px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--paper-tint);
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease); }
.drop.over { border-color: var(--key); border-style: solid; background: var(--paper-tint-hover); }
.drop.ready { border-style: solid; border-color: var(--key); background: var(--sheet); }
.drop-icon { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 4px; border-radius: 50%; background: var(--sheet);
  border: 1px solid var(--border); color: var(--key); transition: transform 220ms var(--ease); }
.drop.over .drop-icon { transform: translateY(-4px); }
.drop-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.drop.ready .drop-icon { background: var(--paper-tint); }
.drop-title { font-size: 1.3125rem; max-width: 28ch; overflow-wrap: anywhere; }
.drop-hint { color: var(--ink-2); font-size: 0.875rem; max-width: 46ch; }
.drop-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

.or { display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; gap: 10px; color: var(--ink-3); font-size: 0.8125rem; }
.or::before, .or::after { content: ''; width: 1px; background: var(--border); }

.link { display: grid; align-content: center; gap: 10px; padding: 8px 0; }
.link-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper-tint); color: var(--key); }
.link-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.link-title { font-size: 1.125rem; }
.link-title label { font: inherit; color: inherit; }
.link input { font-family: var(--font-mono); font-size: 0.875rem; }
.link .key { justify-self: start; }

.tune { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.tune summary { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control-h); padding-right: 6px; border-radius: 6px;
  list-style: none; cursor: pointer; color: var(--ink-2); font-size: 0.875rem; }
.tune summary::-webkit-details-marker { display: none; }
.tune-chev { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms var(--ease); }
.tune[open] .tune-chev { transform: rotate(90deg); }
.tune-label { font-weight: 600; color: var(--ink); }
.tune-sum { color: var(--ink-3); }
@media (hover: hover) { .tune summary:hover .tune-label { color: var(--key); } }
.tune-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; margin-top: 10px; }

.msg { margin-top: 16px; font-size: 0.875rem; color: var(--ink-2); }
.msg:empty { display: none; }
.msg.ok { color: var(--live-ink); }
.msg.bad { color: var(--danger-ink); }

/* ---------------------------------------------------------------- step 2: wait */
.wait-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.kind { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: var(--paper-tint); color: var(--key); }
.kind svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.wait-id { min-width: 0; }
.wait-id h2 { font-size: 1.3125rem; overflow-wrap: anywhere; }
.wait-meta { margin-top: 2px; color: var(--ink-3); font-size: 0.875rem; }
.wait-progress { margin-top: 28px; }
.meter { position: relative; height: 10px; border-radius: 999px; background: var(--paper-tint-hover); overflow: hidden; }
.meter > i { position: absolute; inset: 0; background: var(--key); border-radius: 999px; transform: scaleX(0); transform-origin: left center; transition: transform 520ms var(--ease); }
.meter.is-waiting > i { right: auto; width: 28%; transform: none; transition: none; animation: meter-wait 1.6s var(--ease) infinite; }
@keyframes meter-wait { from { transform: translateX(-100%); } to { transform: translateX(360%); } }
.wait-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; color: var(--ink-2); }
.wait-pct { font: 500 1.25rem/1 var(--font-mono); color: var(--ink); }
.reassure { margin-top: 14px; color: var(--ink-3); font-size: 0.875rem; max-width: 64ch; }
.wait-error { margin-top: 24px; padding: 14px 16px; border-radius: 6px; background: var(--danger-wash); color: var(--danger-ink); display: grid; gap: 4px; }
.wait-error.is-neutral { background: var(--paper-tint); color: var(--ink-2); }
.wait-error-title { font-weight: 600; }

.live { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.live h3 { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.live-text { position: relative; margin-top: 10px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  font-size: 1rem; line-height: 1.75; color: var(--ink); max-width: 72ch;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.75em); mask-image: linear-gradient(to bottom, transparent 0, #000 1.75em); }
/* Everything sits on one 1.75em line grid (gaps of one line, a box of eight), so scrolled to the
   end the first visible line is always whole and the fade reads as a fade, not as clipping. */
.live-text { max-height: calc(1.75em * 8); }
.live-text p { margin: 0; }
.live-text p + p { margin-top: 1.75em; }
.live-text p.is-new { animation: line-in 260ms var(--ease); }
@keyframes line-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-keys { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* ---------------------------------------------------------------- step 3: read */
.read-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 24px; }
.read-id { min-width: 0; flex: 1 1 320px; }
.read-id h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.read-meta { margin-top: 4px; color: var(--ink-3); font-size: 0.875rem; }
.read-keys { display: flex; flex-wrap: wrap; gap: 10px; }
.read-tools { position: sticky; top: var(--bar-h); z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 20px -28px 0; padding: 12px 28px; background: var(--sheet); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.find { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; max-width: 480px; height: var(--control-h); padding: 0 4px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--sheet); color: var(--ink-3);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.find:focus-within { border-color: var(--key); box-shadow: 0 0 0 3px var(--focus-halo); }
.find > svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.find input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0 6px; background: transparent; box-shadow: none !important; }
.find input::-webkit-search-cancel-button { cursor: pointer; }
.find-count { font: 400 0.75rem/1 var(--font-mono); color: var(--ink-3); white-space: nowrap; padding: 0 4px; }
.find-count:empty { display: none; }
.find .key-icon { width: 34px; height: 34px; }

.read-notes { display: grid; gap: 8px; margin-top: 18px; }
.read-notes:empty { display: none; }
.note { padding: 10px 14px; border-radius: 6px; background: var(--warn-wash); color: var(--warn-ink); font-size: 0.875rem; max-width: 76ch; }

.doc { margin-top: 14px; display: grid; gap: 2px; }
.para { display: grid; grid-template-columns: 72px minmax(0, 68ch) 40px; column-gap: 12px; align-items: start; padding: 10px 8px 10px 0; border-radius: 6px;
  transition: background-color 160ms var(--ease); }
.ts { padding: 0.32rem 0 0 8px; font: 400 0.8125rem/1.5 var(--font-mono); color: var(--ink-3); }
.para-text { font-size: 1.0625rem; line-height: 1.75; color: var(--ink); overflow-wrap: anywhere; }
.para-copy { width: 36px; height: 36px; }
.para.is-gap .para-text { color: var(--ink-3); font-size: 0.9375rem; }
@media (hover: hover) {
  .para:hover { background: var(--paper-tint); }
  .para:hover .para-copy { color: var(--key); }
}
mark.hit { background: var(--hit); color: var(--ink); border-radius: 2px; padding: 0 1px; }
mark.hit.is-current { background: var(--stamp); box-shadow: 0 0 0 2px var(--stamp); }
.skel { display: grid; gap: 14px; padding: 10px 0; }
.skel i { display: block; height: 14px; border-radius: 4px; background: var(--paper-tint-hover); animation: skel 1.4s ease-in-out infinite; }
.skel i:nth-child(3n) { width: 72%; } .skel i:nth-child(3n+1) { width: 94%; } .skel i:nth-child(3n+2) { width: 86%; }
@keyframes skel { 50% { opacity: 0.55; } }
.doc-empty { padding: 28px 0; color: var(--ink-3); }

/* ---------------------------------------------------------------- recent transcriptions */
.history { margin-top: 40px; }
.history-head { display: flex; align-items: baseline; gap: 10px; }
.history-head h2 { font-size: 1.1875rem; }
.history-count { color: var(--ink-3); font-size: 0.875rem; }
.jobs { list-style: none; margin: 14px 0 0; padding: 0; background: var(--sheet); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-1); }
.job { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.job:first-child { border-top: 0; border-radius: 10px 10px 0 0; }
.job:last-child { border-radius: 0 0 10px 10px; }
.job:only-child { border-radius: 10px; }
.job[aria-current=true] { background: var(--paper-tint); }
.job .kind { width: 40px; height: 40px; border-radius: 10px; }
.job .kind svg { width: 20px; height: 20px; }
.job-open { display: grid; gap: 2px; min-width: 0; padding: 4px 0; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.job-name { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.job-meta { color: var(--ink-3); font-size: 0.8125rem; }
.job-why { color: var(--danger-ink); font-size: 0.8125rem; }
@media (hover: hover) { .job-open:hover .job-name { color: var(--key); } }
.job-state { display: grid; justify-items: end; gap: 6px; min-width: 116px; }
.job-state .meter { width: 116px; height: 4px; }
.job-pct { font: 400 0.75rem/1 var(--font-mono); color: var(--ink-3); }
.job-acts { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 128px; }
.job-acts .key-icon { color: var(--ink-2); }
.job-acts .key-icon svg { width: 22px; height: 22px; stroke-width: 3.2; }
.job-confirm { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; color: var(--ink-2); font-size: 0.875rem; }
.job-confirm p { margin-right: auto; }
.more { display: flex; justify-content: center; margin-top: 14px; }

/* ---------------------------------------------------------------- status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
  font: 600 0.75rem/1.4 var(--font-body); white-space: nowrap; }
.pill.queued { color: var(--ink-2); background: var(--paper-tint); border-color: var(--border); }
.pill.active { color: var(--live-ink); background: var(--live-wash); }
.pill.active::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.pill.completed { color: var(--stamp-ink); background: var(--stamp); }
.pill.failed { color: var(--danger-ink); background: var(--danger-wash); }
.pill.canceled { color: var(--ink-3); background: var(--paper-tint); border-color: var(--border); }

/* ---------------------------------------------------------------- menus */
.menu { position: relative; display: inline-flex; }
.menu .chev { width: 16px; height: 16px; transition: transform 160ms var(--ease); }
.menu > .key[aria-expanded=true] .chev { transform: rotate(180deg); }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; display: grid; min-width: 232px; padding: 6px;
  background: var(--sheet); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-2); text-align: left;
  animation: menu-in 160ms var(--ease); transform-origin: top right; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.menu-list button { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 6px; background: none; color: var(--ink); font: 400 0.875rem/1.2 var(--font-body); text-align: left; cursor: pointer; }
.menu-list button span { color: var(--ink-3); font: 400 0.75rem/1 var(--font-mono); }
.menu-list button.danger { color: var(--danger-ink); }
.menu-list hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--border); }
.menu-list button:focus-visible { outline-offset: -2px; }
@media (hover: hover) { .menu-list button:hover { background: var(--paper-tint); } }

/* ---------------------------------------------------------------- gates: access key, licence */
.panel-gate { display: grid; justify-items: start; gap: 12px; max-width: 640px; padding: 8px 0; }
.gate-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--paper-tint); color: var(--key); }
.gate-icon-warn { background: var(--warn-wash); color: var(--warn-ink); }
.gate-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.panel-gate h2 { font-size: 1.375rem; }
.gate-text { color: var(--ink-2); max-width: 62ch; }
.gate-form { display: grid; gap: 6px; width: 100%; margin-top: 6px; }
.gate-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.gate-row input { flex: 1 1 260px; }
.gate-row-start { justify-content: flex-start; }
.gate-aside { padding: 10px 14px; border-radius: 6px; background: var(--paper-tint); color: var(--ink-2); font-size: 0.875rem; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--control-h); margin-top: 2px; font-weight: 400; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--key); cursor: pointer; }
.gate-it { width: 100%; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--ink-2); font-size: 0.875rem; }
.gate-it summary { display: list-item; padding: 10px 0; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.gate-it summary::marker { color: var(--ink-3); }
.gate-it p { max-width: 62ch; margin-top: 4px; }
.gate-it code, .panel-gate code { padding: 1px 6px; border-radius: 4px; background: var(--paper-tint); font: 400 0.8125rem/1.5 var(--font-mono); color: var(--ink); }
@media (hover: hover) { .gate-it summary:hover { color: var(--key); } }
.panel-gate textarea { height: auto; min-height: 104px; padding: 10px 12px; font: 0.8125rem/1.5 var(--font-mono); word-break: break-all; resize: vertical; }

/* ---------------------------------------------------------------- footer, toast */
.foot { border-top: 1px solid var(--border); padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: 0.8125rem; }
.foot-in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.foot-link { margin-left: auto; min-height: 32px; padding: 0; border: 0; background: none; color: var(--ink-3); font: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
@media (hover: hover) { .foot-link:hover { color: var(--key); } }
.tech summary { cursor: pointer; border-radius: 4px; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.tech summary::marker { color: var(--border-strong); }
.tech[open] summary { color: var(--ink-2); }
.tech p { margin-top: 6px; font: 400 0.75rem/1.6 var(--font-mono); color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 0.875rem; box-shadow: var(--shadow-2);
  animation: toast-in 200ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 860px) {
  .send { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .drop { min-height: 220px; }
  .or { grid-template-rows: none; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .or::before, .or::after { width: auto; height: 1px; }
  .tune-body { grid-template-columns: minmax(0, 1fr); }
  .job { grid-template-columns: auto minmax(0, 1fr) auto; }
  .job-state { grid-column: 2; grid-row: 2; justify-items: start; min-width: 0; grid-auto-flow: column; align-items: center; }
  .job-acts { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 640px) {
  :root { --bar-h: 60px; }
  .brand { gap: 12px; }
  .brand-logo { height: 30px; }
  .brand-product { padding-left: 12px; font-size: 0.9375rem; }
  .status { padding: 6px 10px; max-width: 42%; }
  .main { padding-top: 24px; }
  .intro h1 { font-size: 1.4375rem; }
  .lead { font-size: 0.9375rem; }
  .steps-wrap { margin: 24px 0 16px; }
  .step-key { padding: 0 4px; gap: 4px; }
  .step-disc { width: 38px; height: 38px; font-size: 0.9375rem; }
  .steps-rule { top: 18px; }
  .step-title { font-size: 0.9375rem; }
  .step-note { font-size: 0.75rem; }
  .stage { padding: 18px; border-radius: 10px; }
  .drop { padding: 24px 16px; min-height: 0; }
  .drop-title { font-size: 1.125rem; }
  .drop-keys, .drop-keys .key { width: 100%; }
  .link .key { justify-self: stretch; }
  .read-tools { margin: 16px -18px 0; padding: 10px 18px; flex-wrap: wrap; }
  .find { max-width: none; flex-basis: 100%; }
  .read-tools > .key { padding: 0 6px; }
  .read-id h2 { font-size: 1.25rem; }
  .read-keys { width: 100%; }
  .read-keys > .key, .read-keys > .menu { flex: 1 1 0; }
  .read-keys .menu > .key { width: 100%; }
  .para { grid-template-columns: minmax(0, 1fr) 40px; padding: 10px 0; }
  .ts { grid-column: 1 / -1; padding: 0; }
  .para-text { font-size: 1rem; }
  .wait-head { grid-template-columns: auto minmax(0, 1fr); }
  .wait-head .pill { grid-column: 2; justify-self: start; }
  .panel-keys .key { flex: 1 1 auto; }
  .menu-list { right: auto; left: 0; }
  .read-keys .menu-list, .job-acts .menu-list { left: auto; right: 0; }
}
@media (max-width: 640px) {
  .job { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
  .job-acts { display: contents; }
  .job-acts > .menu { grid-column: 3; grid-row: 1; justify-self: end; }
  .job-acts > .key { grid-column: 3; grid-row: 2; align-self: center; }
  .job-state { grid-column: 2; grid-row: 2; align-self: center; }
  .job-name { -webkit-line-clamp: 4; line-clamp: 4; }
}
@media (max-width: 480px) {
  .brand-product { display: none; }
  .status { max-width: 58%; }
  .job-acts { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .meter.is-waiting > i { transform: none; }
}
@media (forced-colors: active) {
  .key, .pill, .stage, .jobs, input, select, .find, .step-disc { border: 1px solid ButtonText; }
  .meter > i, .steps-rule > i { background: Highlight; }
  mark.hit.is-current { outline: 2px solid Highlight; }
}
