/*
 * FlowForge: the tool's own components, styled in the site's design language (12 Nov 2026, automatic mode, on the
 * UltraCompress Pro template). The first part copies MicroTools' shared block (tokens, page, hero, buttons, toolbar and
 * pill tabs, fields, toasts, information sections; its numbered information cards renamed .how-card, since the tool's
 * steps use .step-num). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, theme toggle, focus rings) and
 * /libs/shared-nav.css (the site's header and footer). The second part is the original's components (the chain of steps,
 * old and new names, the table grid, the email list, code, the form builder and the form, menus, windows) on the site's
 * tokens: the original's token names are kept as aliases, its teal flow colour marks the chain of steps, its ink-black
 * buttons and chips became the site's gradient pills, its own header, bottom tab bar on phones and footer are gone.
 * Light is the default; dark applies when <html> has no data-theme. Written once from MicroTools' file and the
 * original's styles, then edited by hand: this file is the source.
 */


/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --head: 81px;
    /* the original's names, on the site's tokens */
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --faint: var(--text-3);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --accent-soft: var(--tint-brand);
    --good: var(--ok);
    --good-soft: var(--ok-soft);
    --info: #1d4ed8;
    --info-soft: rgba(29, 78, 216, 0.08);
    --focus: var(--brand);
    --del: #b91c1c;
    --del-soft: #fee2e2;
    --ins: #166534;
    --ins-soft: #dcfce7;
    --flow: #0b7285;
    --flow-ink: #ffffff;
    --flow-soft: #e2f3f5;
    --accent: #6d28d9;
    --accent-ink: #ffffff;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --shadow: 0 10px 30px rgba(20, 23, 31, 0.08);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --info: #93c5fd;
    --info-soft: rgba(147, 197, 253, 0.12);
    --del: #fca5a5;
    --del-soft: rgba(248, 113, 113, 0.16);
    --ins: #86efac;
    --ins-soft: rgba(74, 222, 128, 0.14);
    --flow: #4fc9d6;
    --flow-ink: #0d1a1d;
    --flow-soft: rgba(79, 201, 214, 0.14);
    --accent: #c4b5fd;
    --accent-ink: #0a0a14;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
@media (max-width: 639.98px) { :root { --head: 65px; } }

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- The site's text rules (p, ul, li, headings, tables) must not reach the tool: same weight as the site's ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.dialog) p, :where(.dialog) ul, :where(.dialog) li { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.dialog) h2, :where(.dialog) h3 { margin: 0; line-height: 1.25; }
:where(.app-shell) table, :where(.dialog) table { width: auto; margin: 0; border-radius: 0; overflow: visible; background: none; }
:where(.app-shell) th, :where(.app-shell) td { border: 0; padding: 0; color: inherit; }
:where(.app-shell) pre, :where(.dialog) pre { margin: 0; }
.app-shell, .dialog { font-size: 1rem; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden], .menu [hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.mono { font-family: var(--mono); }
.meta { color: var(--muted); font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.82rem; font-weight: 400; line-height: 1.45; }
.hint:empty { display: none; }
.hint.block { display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
.app-shell code, .dialog code { font-family: var(--mono); font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); border-bottom-width: 2px; background: var(--chip); color: var(--text-strong); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Buttons: the original's classes in the site's pills ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--surface-border); border-radius: 9999px; background: var(--surface); color: var(--text-strong); font-family: inherit; font-weight: 600; font-size: 0.925rem; line-height: 1.2; padding: 10px 20px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn.primary { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { border-color: var(--brand); }
.btn.danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; }
.small-btn { min-height: 36px; padding: 7px 14px; font-size: 0.85rem; }
.small-btn .ico { width: 16px; height: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.icon-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sq-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; padding: 0; cursor: pointer; text-decoration: none; }
.sq-btn:hover { background: var(--panel-2); color: var(--link); }
.sq-btn[aria-pressed="true"] { color: var(--link); }

/* ----- Toolbar and the seven tools as pill tabs ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; display: flex; flex-direction: column; gap: 20px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 26px; background: var(--surface-2); max-width: 100%; }
.tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.875rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.tab .ico { width: 16px; height: 16px; }
.tab:hover { color: var(--link); }
.tab[aria-current="page"] { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.tab .short, .tab .tiny { display: none; }
@media (max-width: 1279.98px) { .tab .long { display: none; } .tab .short { display: inline; } }
@media (max-width: 899.98px) { .tab .ico { display: none; } }
@media (max-width: 639.98px) {
    .app-toolbar { flex-direction: column-reverse; align-items: stretch; }
    .toolbar-right { justify-content: flex-start; } /* away from the site's round theme button at the right edge */
    .tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; border-radius: 22px; } /* five tools: 3 + 2, both rows full */
    .tab { grid-column: span 2; }
    .tab:nth-child(n + 4) { grid-column: span 3; }
    .tab { padding: 8px 4px; min-width: 0; }
    .tab .short { display: none; }
    .tab .tiny { display: inline; }
}
.shell-hint { margin: 0; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.875rem; color: var(--text-strong); }
.input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.55; }
textarea.input.mono, .input.mono { font-family: var(--mono); font-size: 0.875rem; }
.input.mini { min-height: 36px; padding: 6px 10px; font-size: 0.875rem; border-radius: 10px; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check-row.small { font-size: 0.85rem; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.inline-field .input { width: auto; color: var(--text); }
.opt-line { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button .ico { width: 15px; height: 15px; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .n { color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 500; }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.85; }
.search-wrap { position: relative; display: block; min-width: 0; }
.search-wrap > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 38px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 600; padding: 1px 9px; border-radius: 9999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 460px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.how-card { position: relative; padding-top: 24px; }
.how-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.how-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.how-head h3 { margin: 0; }
.how-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== FlowForge components ===== */

/* ---------- each tool: the page gives the side space, the tool adds none ---------- */
.screen { display: flex; flex-direction: column; gap: 24px; width: 100%; min-width: 0; }
.view-title { font-size: clamp(1.4rem, 2.4vw, 1.75rem); color: var(--text-strong); }
.ws h2, .ws .h2, .f-title { font-size: 1.08rem; font-weight: 700; color: var(--text-strong); font-family: inherit; letter-spacing: 0; }
.f-title { font-size: 1.35rem; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lead { margin-top: 4px; color: var(--muted); max-width: 76ch; }

/* ---------- small parts of the original's fields and buttons, on the site's tokens ---------- */
.input.num { max-width: 9rem; }
.input.is-missing, .chip.is-missing { border-color: var(--warn); }
.chip.is-missing { border-style: dashed; }
textarea.input { font-family: var(--mono); font-size: 0.85rem; }
.field.w-s { flex: 0 1 9.5rem; }
.field > .seg { align-self: flex-start; }
.hint.sub { display: block; margin-top: 2px; }
.hint.err, .warn-text { color: var(--bad); font-weight: 600; }
.count { font-size: 0.75rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.seg .count { margin-left: 2px; padding: 0 7px; }
.seg button[aria-checked="true"] .count { background: rgba(255, 255, 255, 0.22); color: #fff; }
.chip-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; background: #fff; color: #5b21b6; font-size: 0.7rem; font-weight: 800; }
.tag-btn { cursor: pointer; font-family: inherit; }
.tag-btn .ico { width: 12px; height: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; margin-left: 8px; }
.pill .ico { width: 14px; height: 14px; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--flow-soft); color: var(--text); font-weight: 500; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 2px solid currentColor; font-size: 0.925rem; }
.note > span { color: var(--text); flex: 1; }
.note.good { color: var(--good); }
.note.bad { color: var(--bad); }
.note.warn { color: var(--warn); }
.note .btn { flex: none; }
.app-shell code { overflow-wrap: anywhere; }
.btn[aria-pressed="true"] { border-color: var(--brand); color: var(--link); background: var(--tint-brand); }
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.view-head .short { display: none; }
@media (max-width: 560px) {
  .view-head .long { display: none; }
  .view-head .short { display: inline; }
  .view-head .actions { width: 100%; }
  .view-head .actions .btn { flex: 1; padding: 9px 10px; }
}
.ws { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px 48px; align-items: start; }
@media (min-width: 1100px) {
  .ws { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
  .ws.ws-even { grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr); }
}
.ws-side, .ws-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.ws-side .block, .ws-main .block { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.src { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.src .ico { color: var(--flow); }
details.fold > summary { cursor: pointer; font-weight: 700; list-style-position: inside; min-height: 32px; display: flex; align-items: center; gap: 6px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin: 0 4px 0 2px; transition: transform 0.15s; }
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > summary { list-style: none; }
details.fold[open] > summary { margin-bottom: 4px; }

.empty { color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 22px 8px; text-align: center; font-size: 0.925rem; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .actions { justify-content: center; }
.empty.big { padding: 48px 8px; min-height: 320px; justify-content: center; background: var(--panel); }
.empty-ico { width: 40px; height: 40px; color: var(--flow); stroke-width: 1.6; }
.empty-title { color: var(--text); font-weight: 700; font-size: 1.1rem; }
.empty.big .muted { max-width: 52ch; }
.busy { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--flow); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.more { align-self: flex-start; }

/* ---------- the chain of steps ---------- */
.rail-wrap { display: flex; flex-direction: column; gap: 10px; }
.rail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; position: relative; }
.rail::before { content: ""; position: absolute; left: 15px; top: 16px; bottom: 16px; width: 2px; background: var(--flow); opacity: 0.45; border-radius: 1px; }
.rail:has(> .rail-empty)::before, .rail:has(> .step:only-child)::before { display: none; }
.rail-empty { color: var(--muted); font-size: 0.9rem; padding: 6px 0; list-style: none; }
.step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; position: relative; }
.step-num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; margin-top: 6px;
  background: var(--panel); border: 2px solid var(--flow); color: var(--text); font-weight: 800; font-size: 0.85rem; padding: 0;
  font-variant-numeric: tabular-nums; position: relative; z-index: 1;
}
button.step-num:hover { background: var(--flow-soft); }
.step.selected .step-num { background: var(--flow); color: var(--flow-ink); }
.step.off .step-num { border-style: dashed; border-color: var(--border-strong); color: var(--muted); }
.step.has-error .step-num { border-color: var(--bad); color: var(--bad); }
.step-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 4px 4px 8px; min-width: 0; }
.step.open .step-card { border-color: var(--border-strong); box-shadow: var(--shadow); }
.step.selected .step-card { border-color: var(--flow); }
.step.off .step-card { background: transparent; }
.step-head { display: flex; align-items: center; gap: 4px; }
.step-title { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 4px; border-radius: 8px; display: flex; flex-direction: column; gap: 1px; color: var(--text-strong); font-family: inherit; }
.step-title:hover .step-sum { text-decoration: underline; text-underline-offset: 2px; }
.step-kind { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.step-sum { font-weight: 600; font-size: 0.925rem; overflow-wrap: anywhere; }
.step.off .step-sum { color: var(--muted); text-decoration: line-through; }
.step-stat { font-size: 0.8rem; color: var(--flow); font-weight: 600; }
.step.is-quiet .step-stat { color: var(--muted); font-weight: 500; }
.step.has-error .step-stat { color: var(--bad); }
.step-err { color: var(--bad); font-size: 0.85rem; font-weight: 600; padding: 0 4px 6px; }
.step-body { display: flex; flex-wrap: wrap; gap: 12px 12px; padding: 6px 4px 8px; border-top: 1px solid var(--border); margin-top: 2px; }
.step-body > .field { flex: 1 1 100%; }
.step-body > .field.w-s { flex: 1 1 7rem; max-width: 12rem; }
.step-body > .check-row { flex: 1 1 100%; padding: 0; }
.add-step { align-self: flex-start; border-style: dashed; margin-left: 42px; }
.rail:has(> .rail-empty) + .add-step { margin-left: 0; }
.tokens { display: flex; flex-wrap: wrap; gap: 4px; }
.token { border: 1px solid var(--border); background: var(--panel-2); border-radius: 7px; padding: 2px 8px; font-size: 0.78rem; font-weight: 600; color: var(--muted); min-height: 28px; }
.token:hover { color: var(--text); border-color: var(--border-strong); }

/* switch */
.switch { position: relative; display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch .track { pointer-events: none; width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative; transition: background 0.15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--flow); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.sq-btn {
  width: 40px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; padding: 0; flex: none;
}
.sq-btn:hover { background: var(--panel-2); color: var(--text); }
.sq-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--text); }

/* ---------- results header and actions ---------- */
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.pv-count { font-size: 1rem; }
.pv-count b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 4px; }
.pv-actions .hint { flex-basis: 100%; }

/* ---------- old and new names ---------- */
.pv-list { border-top: 2px solid var(--text); font-family: var(--mono); font-size: 0.875rem; }
.pv-row {
  display: grid; grid-template-columns: 3.2ch minmax(0, 1fr) 22px minmax(0, 1fr) 40px; gap: 4px 10px; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border); min-height: 46px;
}
.pv-n { color: var(--faint); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }
.pv-from, .pv-to { min-width: 0; overflow-wrap: anywhere; }
.pv-from { color: var(--muted); }
.pv-row:not(.is-changed) .pv-to { color: var(--muted); }
.pv-path { color: var(--faint); }
.pv-arrow { color: var(--faint); display: grid; place-items: center; }
.pv-row.is-changed .pv-arrow { color: var(--flow); }
.pv-row .pv-edit { opacity: 0.6; }
.pv-row:hover .pv-edit, .pv-row .pv-edit:focus-visible { opacity: 1; }
del { background: var(--del-soft); color: var(--del); text-decoration: line-through; text-decoration-thickness: 1.5px; border-radius: 3px; }
ins { background: var(--ins-soft); color: var(--ins); text-decoration: none; border-radius: 3px; font-weight: 700; }
.pv-msg { grid-column: 2 / -1; list-style: none; margin: 0; padding: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 0.82rem; display: flex; flex-direction: column; gap: 2px; }
.pv-msg li { display: flex; gap: 6px; align-items: center; }
.pv-msg .ico { width: 14px; height: 14px; }
.pv-msg .error { color: var(--bad); font-weight: 600; }
.pv-msg .warn { color: var(--warn); }
.pv-msg.skip { color: var(--faint); }
.pv-row.lvl-error { box-shadow: inset 3px 0 0 var(--bad); }
.pv-row.lvl-warn { box-shadow: inset 3px 0 0 var(--warn); }
.pv-row.is-skipped { opacity: 0.6; }
.pv-input { min-height: 36px; padding: 5px 8px; font-size: 0.875rem; }
@media (max-width: 640px) {
  .pv-row { grid-template-columns: 3ch 18px minmax(0, 1fr) 40px; }
  .pv-row .pv-n { grid-row: 1 / span 2; align-self: start; padding-top: 3px; }
  .pv-from { grid-column: 2 / 4; }
  .pv-arrow { grid-column: 2; grid-row: 2; }
  .pv-to { grid-column: 3; grid-row: 2; }
  .pv-edit { grid-column: 4; grid-row: 1 / span 2; }
  .pv-msg { grid-column: 2 / -1; }
}

/* ---------- the data grid ---------- */
.grid-wrap { overflow: auto; max-height: min(72vh, 760px); border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.grid-wrap.small { max-height: 420px; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 0.85rem; min-width: 100%; }
.grid th, .grid td { padding: 6px 10px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: left; vertical-align: top; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); padding: 0; vertical-align: bottom; }
.grid .rn { position: sticky; left: 0; z-index: 1; background: var(--panel-2); color: var(--faint); font-weight: 500; font-size: 0.75rem; text-align: right; padding: 6px 6px; min-width: 3.4ch; font-variant-numeric: tabular-nums; }
.grid thead .rn { z-index: 3; }
.grid td.is-empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--panel-2) 6px 8px); }
.grid td.is-changed { background: var(--ins-soft); color: var(--ins); font-weight: 600; }
.grid td.is-new, .grid th.is-new { box-shadow: inset 0 0 0 9999px var(--flow-soft); }
.grid th.is-new .colh { border-top: 3px solid var(--flow); }
.colh { display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 9rem; text-align: left; background: none; border: 0; padding: 7px 10px 6px; border-radius: 0; color: var(--text); font-family: inherit; }
.colh:hover { background: var(--accent-soft); }
.colh .cn { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; color: var(--text); }
.colh .cn .ico { width: 14px; height: 14px; color: var(--muted); }
.colh .ct { display: flex; align-items: center; gap: 5px; font-weight: 500; font-size: 0.74rem; color: var(--muted); }
.colh .ct .ico { width: 13px; height: 13px; }
.colh .fill { display: block; height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; }
.colh .fill i { display: block; height: 100%; background: var(--flow); }
.grid .cn { font-weight: 700; }
.grid-hint .key-new { background: var(--flow-soft); padding: 0 4px; border-radius: 3px; color: var(--text); }
.grid-hint .key-changed { background: var(--ins-soft); color: var(--ins); padding: 0 4px; border-radius: 3px; font-weight: 600; }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 70; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22); padding: 4px;
  display: flex; flex-direction: column; animation: pop 0.12s ease-out;
}
.menu.wide { max-width: min(420px, calc(100vw - 16px)); }
.menu-item { display: flex; align-items: flex-start; gap: 10px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; min-height: 40px; color: var(--text); }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item:hover { box-shadow: none; }
.menu-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.menu-item.danger { color: var(--bad); }
.menu-item .ico { margin-top: 1px; color: var(--muted); }
.menu-item.danger .ico { color: var(--bad); }
.ico-gap { width: 18px; flex: none; }
.mi-text { display: flex; flex-direction: column; min-width: 0; }
.mi-label { font-weight: 600; font-size: 0.9rem; }
.mi-hint { color: var(--muted); font-size: 0.8rem; }
.menu-head { font-size: 0.78rem; font-weight: 700; color: var(--muted); padding: 8px 10px 2px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ---------- emails ---------- */
.email-in { min-height: 260px; }
.funnel { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; border-top: 2px solid var(--text); padding-top: 12px; }
.fn-step { display: flex; flex-direction: column; min-width: 4.8rem; padding: 2px 8px 2px 0; }
.fn-step b { font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fn-step span { font-size: 0.8rem; color: var(--muted); }
.fn-arrow { display: grid; place-items: center; color: var(--flow); padding: 0 2px; }
.fn-fix b { color: var(--info); }
.fn-bad b { color: var(--bad); }
.fn-dup b, .fn-left b { color: var(--warn); }
.fn-ready { padding-left: 8px; border-left: 3px solid var(--flow); }
.fn-ready b { font-size: 1.9rem; }
.em-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px 40px; align-items: start; }
@media (min-width: 1500px) { .em-cols { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); } }
.em-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.em-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.em-st { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding-top: 3px; }
.em-st .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.st-fix .em-st .dot { background: var(--info); }
.st-bad .em-st { color: var(--bad); }
.st-bad .em-st .dot { background: var(--bad); }
.st-dup .em-st .dot, .st-left .em-st .dot { background: var(--warn); }
.st-dup .em-addr, .st-left .em-addr { font-style: italic; } /* the original faded these rows, which lowered the text's contrast */
.em-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.em-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.em-addr { font-size: 0.875rem; overflow-wrap: anywhere; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.em-from { color: var(--muted); }
.em-arrow { width: 14px; height: 14px; color: var(--flow); }
.em-name { font-size: 0.85rem; color: var(--muted); }
.em-why { font-size: 0.82rem; color: var(--muted); }
.st-bad .em-why { color: var(--bad); }
.em-act { display: flex; gap: 2px; align-items: center; }
@media (max-width: 560px) {
  .em-row { grid-template-columns: minmax(0, 1fr) auto; }
  .em-st { grid-column: 1 / -1; }
}
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bar-btn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; width: 100%; background: none; border: 0; padding: 6px 6px; border-radius: 8px; text-align: left; color: var(--text); font-family: inherit; }
.bar-btn:hover { background: var(--panel); }
.bar-btn[aria-pressed="true"] { background: var(--flow-soft); }
.bar-label { font-family: var(--mono); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-n { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--flow); border-radius: 3px; }
.opts-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; }
.opts-row .field { flex: 0 1 auto; }
.groups { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.groups li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

/* ---------- code ---------- */
.code {
  margin: 0; font-family: var(--mono); font-size: 0.82rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px; max-height: 420px; overflow: auto; tab-size: 2;
}
.code.tall { max-height: min(70vh, 760px); }
.code-in { min-height: 340px; }
.t-key { color: #2a5db0; }
.t-str { color: #17794a; }
.t-num { color: #a3480d; }
.t-kw { color: #7c3aad; font-weight: 600; }
.t-type { color: #0b7285; }
.t-com { color: var(--faint); font-style: italic; }
:root:not([data-theme="light"]) .t-key { color: #8fb4ff; }
:root:not([data-theme="light"]) .t-str { color: #74dca6; }
:root:not([data-theme="light"]) .t-num { color: #ffb37a; }
:root:not([data-theme="light"]) .t-kw { color: #d2a8ff; }
:root:not([data-theme="light"]) .t-type { color: #4fc9d6; }
.out-head:empty { display: none; }
.test .test-out { display: flex; flex-direction: column; gap: 8px; }
.problems { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.problems li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.problems code { color: var(--bad); }
.learn-opts { display: flex; flex-direction: column; gap: 10px; }
.opts { display: flex; flex-direction: column; gap: 12px; }

/* ---------- form builder ---------- */
.builder { display: flex; flex-direction: column; gap: 14px; }
.b-wrap { display: flex; flex-direction: column; gap: 10px; }
.b-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 2px solid var(--text); }
.b-field { border-bottom: 1px solid var(--border); padding: 6px 0; }
.b-head { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px 40px; gap: 6px; align-items: center; }
.b-head .b-label { grid-column: 1 / -1; }
.b-label { min-height: 40px; padding: 7px 10px; font-weight: 600; }
.b-kind { min-height: 40px; padding: 7px 8px; font-size: 0.875rem; }
.b-req { font-size: 0.85rem; padding: 0; gap: 6px; white-space: nowrap; }
.b-req input { width: 18px; height: 18px; }
.b-details { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 6px; padding-left: 8px; border-left: 2px solid var(--flow); }
.b-details .row .field { flex: 0 1 8rem; }
.b-details .b-wrap { padding-top: 4px; }
.add-field { align-self: flex-start; border-style: dashed; }

.starts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.start-btn { width: 100%; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 10px 16px; border-radius: 16px; white-space: normal; }
.start-btn .hint { font-weight: 500; }

/* ---------- the form itself (same look as the saved web page) ---------- */
.form-preview { display: flex; flex-direction: column; gap: 12px; border-top: 2px solid var(--text); padding-top: 14px; max-width: 46rem; }
.f-title { font-size: 1.35rem; }
.f-intro { color: var(--muted); }
.f-form { display: flex; flex-direction: column; gap: 22px; }
.f-fields { display: flex; flex-wrap: wrap; gap: 18px 20px; }
.f-field, .f-group, .f-repeat { flex: 1 1 100%; min-width: 0; margin: 0; }
.f-half { flex: 1 1 calc(50% - 10px); min-width: 14rem; }
.f-label, .f-legend { display: block; font-weight: 600; margin: 0 0 6px; padding: 0; }
.f-req { color: var(--bad); }
.f-help { color: var(--muted); font-size: 0.875rem; margin: -2px 0 6px; }
.f-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; }
textarea.f-input { min-height: 110px; resize: vertical; }
.f-input:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.f-input[aria-invalid="true"] { border-color: var(--bad); }
fieldset.f-group, fieldset.f-repeat, fieldset.f-choices, fieldset.f-rating { border: 0; padding: 0; }
.f-group > .f-legend, .f-repeat > .f-legend { float: left; width: 100%; border-top: 2px solid var(--text); padding-top: 12px; margin-bottom: 10px; font-size: 1.02rem; }
.f-group > .f-legend + *, .f-repeat > .f-legend + * { clear: both; }
.f-row { display: flex; flex-wrap: wrap; gap: 2px 18px; }
.f-check { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; cursor: pointer; }
.f-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.f-stars { display: flex; gap: 6px; flex-wrap: wrap; }
.f-star { position: relative; }
.f-star input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f-star span { display: grid; place-items: center; min-width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; font-weight: 700; background: var(--panel); }
.f-star input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.f-star input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.f-items { display: flex; flex-direction: column; gap: 12px; }
.f-item { border-left: 3px solid var(--border-strong); padding-left: 8px; }
.f-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.f-list-row { display: flex; gap: 8px; }
.f-add, .f-remove { background: transparent; border: 1px solid var(--border-strong); color: var(--text); border-radius: 10px; padding: 7px 12px; font: inherit; font-weight: 600; font-size: 0.875rem; min-height: 40px; }
.f-add { margin-top: 10px; align-self: flex-start; }
.f-add:hover, .f-remove:hover { background: var(--panel); }
.f-error { color: var(--bad); font-size: 0.875rem; font-weight: 600; margin: 6px 0 0; }
.f-send { align-self: flex-start; }
.f-summary { border-top: 2px solid var(--bad); padding-top: 10px; color: var(--bad); }
.f-summary ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--text); }
.f-summary a { color: var(--bad); font-weight: 600; }

/* ---------- dropping files ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border: 3px dashed var(--flow);
}
.drop-overlay span { background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px 18px; font-weight: 700; box-shadow: var(--shadow); }

/* ----- Windows (the original's: the head and the buttons sit inside the body) ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog.wide { width: min(820px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-body h2 { font-size: 1.2rem; color: var(--text-strong); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; align-items: center; }
.dialog .seg { align-self: flex-start; }
.dialog .code { max-height: 46vh; }
.help { max-height: min(76vh, 760px); overflow: auto; }
.help p { color: var(--text); font-size: 0.925rem; max-width: 75ch; }
.help h3 { margin-top: 8px; font-size: 1rem; color: var(--text-strong); }
.keys { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.keys div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; font-size: 0.9rem; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }

@media (forced-colors: active) {
    .switch .track, .colh .fill i, .bar i { forced-color-adjust: none; }
    del, ins { border: 1px solid; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body { padding: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .how-num { left: 16px; }
    .keys div { grid-template-columns: 7rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .icon-btn, .tab, .seg button, .chip, .info-card, .dialog, .toast, .menu, .spinner, .switch .track, .switch .track::after { transition: none; animation: none; }
    .btn:hover, .icon-btn:hover, .chip:hover, .seg button:hover, .info-card:hover { transform: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"], main .btn,
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
    main .icon-btn, main .sq-btn { width: 44px; height: 44px; min-width: 44px; }
    main .tab { min-width: 44px; }
    main :is(p, li, .hint, .label, .input, .seg button, .chip, .tab, .muted, .tag, .empty, .link, .check-row, .step-kind, .step-sum, .step-stat, .step-err, .token, .pv-msg, .menu-item, .mi-label, .mi-hint, .grid, .code, .em-st, .em-addr, .em-name, .em-why, .bar-label, .fn-step span, .f-help, .f-error, .b-req, .b-kind) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog input:not([type="checkbox"]), .dialog select { min-height: 44px; }
    .dialog .icon-btn { width: 44px; height: 44px; }
    .dialog :is(p, .hint, .label, .input, .muted, dd, dt, .seg button) { font-size: 1rem; }
    main .seg button, main .chip, main .token, main .select { min-height: 44px; }
    main .check-row { min-height: 44px; align-items: center; }
    main .menu-item, .menu .menu-item { min-height: 44px; }
    main .switch { width: 44px; height: 44px; }
    main .grid .rn { min-width: 48px; }
    main .block-head .link, main .link.small-link { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    main .seg button, .dialog .seg button { min-width: 44px; }
    main .step { grid-template-columns: 44px minmax(0, 1fr); }
    main .step-num { width: 44px; height: 44px; margin-top: 0; }
    main .rail::before { left: 21px; }
    main .add-step { margin-left: 54px; }
    main details.fold > summary { min-height: 44px; }
    main .f-check, .dialog .check-row { min-height: 44px; align-items: center; }
}
