/*
 * ToolForge: the tool's own components, styled in the site's design language (on the UltraCompress Pro template).
 * 15 Nov 2026: MicroTools became part of ToolForge, so this is MicroTools' file (tokens, page, hero, buttons, toolbar and
 * pill tabs, fields, toasts, information sections, the step machine of Clean text, the tables, the link list, the clips,
 * the duplicate finder, Table to CSV, JSON to Excel, the windows and menus) with ToolForge's own Compare, Notes and
 * printing a note after them. The originals' token names are kept as aliases, their ink-black buttons and chips became the
 * site's gradient pills, their own headers, bottom tab bars on phones and footers are gone. One layer of side space (8 px
 * inside boxes at most). Base: /libs/site-pages.css and /libs/shared-nav.css. Light is the default; dark applies when
 * <html> has no data-theme. 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);
    --ember: #c2410c;
    --ember-ink: #9a3412;
    --ember-soft: #ffedd5;
    --del: #b91c1c;
    --del-soft: #fee2e2;
    --ins: #166534;
    --ins-soft: #dcfce7;
    --micro: #6d28d9;
    --micro-soft: rgba(139, 92, 246, 0.1);
    --del-strong: #fecaca;
    --ins-strong: #bbf7d0;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
: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);
    --ember: #fb923c;
    --ember-ink: #fdba74;
    --ember-soft: rgba(251, 146, 60, 0.14);
    --del: #fca5a5;
    --del-soft: rgba(248, 113, 113, 0.16);
    --ins: #86efac;
    --ins-soft: rgba(74, 222, 128, 0.14);
    --micro: #c4b5fd;
    --micro-soft: rgba(139, 92, 246, 0.16);
    --del-strong: rgba(248, 113, 113, 0.34);
    --ins-strong: rgba(74, 222, 128, 0.3);
}
@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 nine 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: 1599.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(3, minmax(0, 1fr)); width: 100%; border-radius: 22px; }
    .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; }
.step-card { position: relative; padding-top: 24px; }
.step-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); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-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); }

/* ===== The components of the shared tools ===== */

/* ----- Each tool ----- */
.screen { display: flex; flex-direction: column; gap: 24px; width: 100%; min-width: 0; }
.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; }
.view-title { font-size: clamp(1.4rem, 2.4vw, 1.75rem); color: var(--text-strong); }
.lead { margin-top: 4px; color: var(--muted); max-width: 76ch; }
.lead code { white-space: nowrap; }
.empty { color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 14px; padding: 22px 8px; text-align: center; font-size: 0.925rem; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty b { color: var(--text-strong); }
.empty .actions { justify-content: center; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 8px; border-radius: 12px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); font-size: 0.925rem; color: var(--text); }
.banner > span { flex: 1 1 220px; min-width: 0; }
.banner > .ico { color: var(--link); }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.warn > .ico { color: var(--warn); }
.banner.inline { align-items: flex-start; }
.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; }
}

/* ----- Format text: your text, the steps, the result ----- */
.machine { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; }
@media (min-width: 1180px) { .machine { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px) minmax(0, 1fr); gap: 0 32px; } }
.pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 42px; }
.pane-head h2 { font-size: 1.05rem; color: var(--text-strong); }
.pane-head h2 label { cursor: default; }
.pane-body { position: relative; min-width: 0; }
.pane-text { height: clamp(260px, 52vh, 640px); min-height: 220px; display: block; width: 100%; }
textarea.pane-text { resize: vertical; }
.pane-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 36px; }
.out-actions .btn.primary { min-width: 9.5rem; }
.found { display: flex; flex-direction: column; gap: 8px; }
.found:empty { display: none; }
.found-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.875rem; font-weight: 600; color: var(--text-strong); }
.found-list { display: flex; flex-wrap: wrap; gap: 6px; }
.found-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px 4px 9px; border-radius: 9999px; border: 1px solid transparent; background: var(--ember-soft); color: var(--ember-ink); font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.found-chip .ico { width: 15px; height: 15px; }
.found-chip:hover { border-color: var(--ember); }
.found-chip.fixed { background: transparent; color: var(--muted); border-color: var(--border); font-weight: 500; }
.found-chip.fixed .ico { color: var(--good); }
.found-ok { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); font-family: 'Inter', sans-serif; white-space: normal; }
.found-ok .ico { color: var(--good); width: 16px; height: 16px; }
.steps { display: flex; flex-direction: column; }
.step { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) 36px; gap: 4px 10px; padding: 10px 0 12px; border-bottom: 1px solid var(--border); background: var(--bg); }
.step:first-child { border-top: 1px solid var(--border); }
.step::before { content: ""; position: absolute; left: 14px; top: 0; bottom: 0; width: 2px; background: var(--border-strong); }
.step:first-child::before { top: 22px; }
.step:last-child::before { bottom: calc(100% - 22px); }
.step:only-child::before { display: none; }
.node { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid var(--brand); background: var(--surface); color: var(--text-strong); font-family: inherit; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; display: grid; place-items: center; cursor: grab; touch-action: none; }
.node:hover, .step.changed .node { background: var(--gradient-brand); border-color: transparent; color: #fff; }
.step.off .node { border-style: dashed; border-color: var(--border-strong); color: var(--faint); background: var(--surface); }
.step.error .node { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.step.dragging { z-index: 5; box-shadow: var(--surface-hover-shadow); border-radius: 10px; opacity: 0.96; }
.step.dragging .node { cursor: grabbing; }
.step-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-top: 3px; }
.step-title { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: 0.925rem; cursor: pointer; line-height: 1.35; color: var(--text-strong); }
.step-title input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.step.off .step-title span { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.step-params { display: flex; flex-direction: column; gap: 6px; }
.step-params:empty { display: none; }
.mini-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; font-size: 0.8rem; color: var(--muted); }
.mini-field .input { color: var(--text); }
.mini-check { display: flex; gap: 8px; align-items: center; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.mini-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: none; }
.step-hint { font-size: 0.78rem; color: var(--muted); }
.step-note { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 2px 0; text-align: left; cursor: pointer; border-radius: 6px; font: inherit; font-size: 0.82rem; color: var(--muted); }
.step-note:empty { display: none; }
.step-note:hover { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.step.changed .step-note { color: var(--text); }
.step.changed .step-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ember); flex: none; }
.step.error .step-note { color: var(--bad); font-weight: 600; }
.step.peeking .node { background: var(--micro); border-color: var(--micro); color: var(--surface); }
.step.peeking .step-note { color: var(--micro); font-weight: 600; }
.step .sq-btn { margin-top: -2px; }
.steps-empty { color: var(--muted); font-size: 0.9rem; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.steps-foot { display: flex; gap: 8px; align-items: center; }
.steps-foot .btn:first-child { flex: 1; }
.banner.peek { background: var(--micro-soft); border-color: transparent; margin-bottom: 8px; }
.banner.peek > .ico { color: var(--micro); }

/* hidden characters and changes */
.xray, .diffview { font-family: var(--mono); font-size: 0.875rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--field-border); border-radius: 12px; padding: 10px 8px; background: var(--field); color: var(--text); overflow: auto; tab-size: 4; }
.xray .x { border-radius: 3px; }
.x-end { background: var(--ember-soft); color: var(--ember-ink); box-shadow: inset 0 0 0 1px var(--ember); }
.x-tab { color: var(--ember-ink); background: var(--ember-soft); }
.x-odd { color: var(--ember-ink); background: var(--ember-soft); outline: 1px dashed var(--ember); outline-offset: -1px; }
.x-inv { display: inline-block; width: 3px; height: 1.15em; vertical-align: -0.2em; margin: 0 1px; background: var(--del); border-radius: 1px; }
.x-quote, .x-dash { background: var(--ember-soft); color: var(--ember-ink); box-shadow: 0 2px 0 var(--ember); }
.x-nl { color: var(--faint); user-select: none; }
.x-more { display: block; margin-top: 10px; color: var(--muted); font-family: 'Inter', sans-serif; font-size: 0.85rem; }
.xkey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: 'Inter', sans-serif; font-size: 0.78rem; line-height: 1.4; color: var(--muted); padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); white-space: normal; }
.xkey span { display: inline-flex; align-items: center; gap: 6px; }
.xkey .x { font-family: var(--mono); padding: 0 3px; }
.xkey .x-inv { padding: 0; }
.diffview .dl { display: block; min-height: 1.55em; }
.diffview .dl.del { background: var(--del-soft); }
.diffview .dl.add { background: var(--ins-soft); }
del.d, .dl.del { color: var(--del); }
del.d { background: var(--del-soft); text-decoration: line-through; text-decoration-thickness: 1px; border-radius: 2px; }
ins.i, .dl.add { color: var(--ins); }
ins.i { background: var(--ins-soft); text-decoration: none; border-radius: 2px; }
.dl.del { text-decoration: line-through; text-decoration-thickness: 1px; }
.dsum { display: block; position: sticky; top: -10px; margin: -10px -8px 8px; padding: 8px; background: var(--field); border-bottom: 1px solid var(--border); font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--muted); }
.dskip { display: block; margin: 4px 0; padding: 2px 8px; border: 0; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-family: 'Inter', sans-serif; font-size: 0.8rem; text-align: left; width: 100%; cursor: pointer; }
.dskip:hover { color: var(--link); }

/* ----- Menus (inside the tool) ----- */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 14px; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22); padding: 6px; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-family: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--tint-brand); color: var(--link); outline: none; }
.menu-item .ico { color: var(--muted); width: 17px; height: 17px; }
.menu-item.danger, .menu-item.danger .ico { color: var(--bad); }
.menu-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.menu-item .sub { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.menu-head { padding: 6px 10px 4px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* ----- Clipboard ----- */
.clip-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.clip-add textarea { min-height: 52px; resize: vertical; }
.clip-add .btn { min-height: 52px; }
.clip-bar { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; }
.clip-bar .search-wrap { flex: 1 1 260px; max-width: 420px; }
.clip-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.clip-grid > .empty { grid-column: 1 / -1; }
@media (min-width: 700px) { .clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .clip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.clip { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--surface-border); border-radius: 16px; background: var(--surface); box-shadow: var(--surface-shadow); transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.clip:hover { transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.clip.pinned { border-top: 3px solid var(--brand); }
.clip.flash { border-color: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.clip-main { display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 15px 15px 0 0; min-height: 84px; min-width: 0; flex: 1; font-family: inherit; color: var(--text); cursor: pointer; }
.clip-main:hover { background: var(--tint-brand); }
.clip-name { font-weight: 700; font-size: 0.9rem; color: var(--text-strong); overflow-wrap: anywhere; }
.clip-text { font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.clip-text .blank { background: var(--ember-soft); color: var(--ember-ink); border-radius: 4px; padding: 0 2px; }
.clip-swatch { display: inline-block; width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--border); }
.clip-img { display: block; width: 100%; height: 120px; object-fit: contain; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; border-radius: 8px; border: 1px solid var(--border); }
.clip-meta { display: flex; align-items: center; gap: 4px 8px; padding: 4px 4px 4px 8px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--faint); flex-wrap: wrap; }
.clip-meta .grow { min-width: 4px; }
.clip-meta .sq-btn { width: 34px; height: 34px; }
.clip-meta .sq-btn .ico { width: 16px; height: 16px; }
.clip-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.catch-row { margin-top: -8px; }
.catch-row .hint { display: inline; }

/* ----- Open links ----- */
.links { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1100px) { .links { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 0 40px; } }
.links-in { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.links-in textarea { min-height: 220px; height: clamp(220px, 42vh, 520px); }
@media (min-width: 1100px) { .links-in { position: sticky; top: calc(var(--head) + 16px); } }
.links-out { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.links-sum { font-size: 1.02rem; font-weight: 600; min-height: 1.5em; color: var(--text-strong); }
.links-sum .muted { font-weight: 500; }
.open-bar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.progress { flex: 1 1 120px; height: 6px; border-radius: 3px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; width: 0; background: var(--gradient-brand); transition: width 0.2s; }
.progress.big { height: 10px; border-radius: 5px; flex: none; width: 100%; }
.progress.busy i { width: 30% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.links-list-head { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.links-list { display: flex; flex-direction: column; }
.lrow { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lrow input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.lmono { width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; color: var(--muted); }
.lbody { min-width: 0; display: flex; flex-direction: column; }
.lhost { font-weight: 600; font-size: 0.925rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.lrest { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.ltags:empty { display: none; }
.lacts { display: flex; gap: 2px; align-items: center; }
.lrow.dup .lhost, .lrow.bad .lhost { color: var(--muted); }
.lrow.opened .lmono { background: var(--good-soft); color: var(--good); border-color: transparent; }
.lrow.blocked .lmono { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.lgroup { display: flex; align-items: center; gap: 10px; padding: 12px 0 6px; font-weight: 700; border-bottom: 1px solid var(--border); color: var(--text-strong); }
.lgroup .meta { font-weight: 500; }
.lgroup .grow { min-width: 4px; }

/* ----- Text to table, and the tables of the other tools ----- */
.tsrc { display: flex; flex-direction: column; gap: 8px; }
.tsrc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.tsrc textarea { min-height: 120px; height: 160px; }
.tsrc-opts { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.ttools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; }
.ttools .search-wrap { flex: 0 1 280px; }
.ttools .search-wrap .input { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
.ttools .grow { min-width: 0; }
.tgrid-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
.tgrid-wrap:empty { display: none; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 0.875rem; min-width: 100%; color: var(--text); }
.grid th, .grid td { border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; text-align: left; vertical-align: top; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-strong); }
:root:not([data-theme="light"]) .grid thead th, :root:not([data-theme="light"]) .grid tfoot td, :root:not([data-theme="light"]) .grid .rn { background: #1c1c29; }
.grid tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.grid .rn { position: sticky; left: 0; z-index: 1; background: var(--surface-2); color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; min-width: 44px; }
.grid thead .rn, .grid tfoot .rn { z-index: 3; }
.rn-btn { width: 100%; min-height: 34px; border: 0; background: transparent; color: inherit; padding: 6px 8px; text-align: right; font-family: inherit; font-size: 0.8rem; cursor: pointer; }
.rn-btn:hover { color: var(--link); background: var(--tint-brand); }
.grid .rn span.rn-btn { display: block; cursor: default; }
.th { display: flex; align-items: stretch; min-width: 110px; }
.th-sort { flex: 1; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px 6px 8px 8px; font-family: inherit; font-weight: 700; text-align: left; min-width: 0; color: var(--text-strong); cursor: pointer; }
.th-sort span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-sort .ico { width: 14px; height: 14px; color: var(--muted); opacity: 0; }
.th-sort:hover .ico, .th-sort[aria-sort] .ico { opacity: 1; }
.th-sort[aria-sort="descending"] .ico { transform: rotate(180deg); }
.th-menu { width: 30px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; cursor: pointer; }
.th-menu:hover { color: var(--link); background: var(--tint-brand); }
.th-type { display: block; padding: 0 8px 6px; font-size: 0.72rem; color: var(--faint); font-weight: 500; }
.th-plain { padding: 8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.th-name { flex: 1; padding: 8px 6px 8px 8px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid td.c { padding: 7px 8px; min-width: 110px; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.grid td.c:focus { box-shadow: inset 0 0 0 2px var(--brand); background: var(--surface); }
.grid td.c.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.c:empty::before { content: "\00a0"; }
.grid tbody tr:hover td.c { background: var(--tint-brand); }
.grid tfoot td.st { padding: 6px 8px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid td.c.hit { background: var(--warn-soft); }
.grid td.c.spanned { color: var(--muted); font-style: italic; }
.grid td.c.b { color: var(--info); font-family: var(--mono); font-size: 0.8rem; }
.tmore { display: flex; justify-content: center; padding: 10px; }
.texport { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }
.texport-head { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.texport-head h2 { font-size: 1.05rem; color: var(--text-strong); }
.fmt-opts { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; }
.code { margin: 0; font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; background: var(--field); color: var(--text); border: 1px solid var(--field-border); border-radius: 12px; padding: 10px 8px; max-height: 300px; overflow: auto; white-space: pre; tab-size: 4; }
.small-code { max-height: 180px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tall-code { max-height: 460px; }
.empty-table { padding: 22px 8px; }

/* ----- Duplicate files ----- */
.dup, .names { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dup-start { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 980px) { .dup-start { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 32px; } }
/* the drop zone as on the other tools: a tint, a lift and a larger icon on hover */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; min-height: 260px; padding: 24px 8px; border: 2px dashed rgba(139, 92, 246, 0.45); border-radius: 20px; background: var(--surface); transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; }
.dropzone:hover { border-color: var(--brand); background: var(--tint-brand); transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.dropzone > .ico { width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: var(--gradient-brand); color: #fff; stroke-width: 1.8; box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3); transition: transform 0.3s ease; box-sizing: border-box; }
.dropzone:hover > .ico { transform: scale(1.1); }
.dz-title { font-weight: 700; font-size: 1.15rem; color: var(--text-strong); font-family: 'Space Grotesk', 'Inter', sans-serif; }
.dropzone .actions { justify-content: center; margin-top: 6px; }
.dup-opts { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dup-opts legend { margin-bottom: 4px; padding: 0; }
.dup-opts .opt-line { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.dup-progress { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 32px 0; max-width: 720px; }
.dp-line { font-size: 1.02rem; }
.dup-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dup-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.dup-headline { font-size: 1.05rem; flex: 1 1 320px; }
.dup-tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.dup-tools .search-wrap { flex: 0 1 260px; }
.dup-tools .search-wrap .input { min-height: 36px; }
.dup-tools .grow { min-width: 0; }
.dup-groups { display: flex; flex-direction: column; gap: 16px; }
.dgroup { border: 1px solid var(--surface-border); border-radius: 16px; background: var(--surface); box-shadow: var(--surface-shadow); min-width: 0; overflow: hidden; }
.dg-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--border); }
.dg-head .grow { min-width: 0; }
.dg-list { margin: 0; padding: 0; }
.dfile { display: grid; grid-template-columns: 22px 48px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 8px; border-top: 1px solid var(--border); }
.dfile:first-child { border-top: 0; }
.dfile input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--bad); }
.dfile.ticked { background: var(--bad-soft); }
.dfile.ticked .dname { text-decoration: line-through; text-decoration-color: var(--bad); }
.dfile.kept { background: var(--good-soft); }
.dthumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--border); display: block; }
.dext { display: grid; place-items: center; font-size: 0.68rem; font-weight: 800; color: var(--muted); letter-spacing: 0.02em; }
.dbody { display: flex; flex-direction: column; min-width: 0; }
.dname { font-weight: 600; overflow-wrap: anywhere; color: var(--text-strong); }
.dmark { color: var(--bad); }
.dpath, .dfacts { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.dfacts { font-variant-numeric: tabular-nums; }
.dacts { display: flex; align-items: center; gap: 4px; }
@media (max-width: 560px) {
    .dfile { grid-template-columns: 22px 40px minmax(0, 1fr); }
    .dthumb { width: 40px; height: 40px; }
    .dacts { grid-column: 3; }
}
.dup-bar { position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border); }
.dup-sel { flex: 1 1 220px; min-width: 0; }
.names { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1100px) { .names { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 0 40px; } }
.names-in, .names-out { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.names-in textarea { min-height: 200px; height: clamp(200px, 36vh, 440px); }
.names-wrap { max-height: 60vh; }
.names-grid td.c { max-width: none; }
.names-grid tr.changed td.c:last-child { color: var(--good); font-weight: 600; }
.names-grid tr.dropped td.c:first-child { color: var(--muted); text-decoration: line-through; }
.names-grid .tag { margin-left: 8px; }

/* ----- Table to CSV ----- */
.csv-in { display: flex; flex-direction: column; gap: 8px; }
.paste-zone { min-height: 120px; max-height: 160px; overflow: hidden; border: 2px dashed rgba(139, 92, 246, 0.45); border-radius: 20px; background: var(--surface); display: grid; place-items: center; text-align: center; padding: 16px 8px; color: var(--muted); cursor: text; caret-color: transparent; transition: border-color 0.3s ease, background-color 0.3s ease; }
.paste-zone:hover { border-color: var(--brand); background: var(--tint-brand); }
.paste-zone:empty::before { content: attr(data-ph); font-weight: 600; }
.paste-zone[data-filled="1"]:empty::before { content: "Paste another table here to replace this one"; font-weight: 500; }
.paste-zone:focus { outline: 2px solid var(--brand); outline-offset: 2px; border-color: transparent; background: var(--tint-brand); }
.csv-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.csv-src .grow { min-width: 4px; }
.csv-in textarea { min-height: 140px; height: 200px; font-size: 0.82rem; }
.csv-tables { display: flex; flex-direction: column; gap: 6px; }
.csv-body { display: flex; flex-direction: column; gap: 16px; }
.csv-opts { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; }
.opt-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-group.checks { gap: 0; }
.opt-group .select { min-width: 220px; }
.csv-grid { overflow: auto; max-height: 56vh; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); }
#csvWrap { display: flex; flex-direction: column; gap: 8px; border: 0; max-height: none; overflow: visible; background: transparent; }
.csv-tname { font-weight: 700; margin-top: 4px; color: var(--text-strong); }

/* ----- JSON to Excel ----- */
.xl { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.xl-in { display: flex; flex-direction: column; gap: 8px; }
.xl-in textarea { min-height: 180px; height: clamp(180px, 32vh, 420px); font-size: 0.85rem; }
.xl-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; min-height: 1.5em; }
.xl-status .ico { color: var(--good); }
.xl-status.bad { color: var(--bad); font-weight: 600; }
.xl-status.bad .ico { color: var(--bad); }
.xl-body { display: flex; flex-direction: column; gap: 14px; }
.xl-sheets { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.sheet-tab { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-bottom: 0; border-radius: 12px 12px 0 0; background: transparent; padding: 8px 12px; font-family: inherit; font-weight: 600; color: var(--muted); margin-bottom: -1px; min-height: 40px; cursor: pointer; }
.sheet-tab .n { font-weight: 500; font-size: 0.8rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.sheet-tab:hover { color: var(--link); }
.sheet-tab[aria-selected="true"] { background: var(--surface); border-color: var(--border); color: var(--text-strong); }
.xl-actions { align-items: center; }

/* ===== ToolForge's own components ===== */

/* ----- Compare ----- */
.cmp-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .cmp-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; } }
.cmp-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cmp-side .pane-head { min-height: 36px; }
.cmp-side textarea { min-height: 160px; height: clamp(160px, 30vh, 420px); }
.cmp-opts { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.cmp-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 14px; }
.cmp-sum p { font-weight: 600; color: var(--text-strong); }
.cmp-sum p .muted { font-weight: 500; }
.cmp-view { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); overflow: auto; max-height: 75vh; }
.cmp-view:empty { display: none; }
.dtable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; table-layout: fixed; color: var(--text); }
.dtable td { padding: 1px 8px; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.dtable td.ln { text-align: right; color: var(--muted); user-select: none; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.dtable td.sg { text-align: center; user-select: none; color: var(--muted); }
.dtable tr.del td.tx, .dtable td.tx.del { background: var(--del-soft); }
.dtable tr.add td.tx, .dtable td.tx.add { background: var(--ins-soft); }
/* the empty side of a removed or added line: stripes (the original meant them, but its row colour rule won) */
.dtable tr td.tx.blank { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--surface-2) 5px 10px); }
.dtable del.d { background: var(--del-strong); color: var(--text-strong); }
.dtable ins.i { background: var(--ins-strong); color: var(--text-strong); }
.dtable tr.del td.sg { color: var(--del); }
.dtable tr.add td.sg { color: var(--ins); }
.dtable tr.fold td { background: var(--surface-2); padding: 0; }
.dtable tr.fold button { width: 100%; border: 0; background: transparent; color: var(--muted); font-family: 'Inter', sans-serif; font-size: 0.8rem; padding: 4px 8px; text-align: left; cursor: pointer; }
.dtable tr.fold button:hover { color: var(--link); }
.dtable tr.fold .x-more { margin: 0; padding: 4px 8px; }
.dtable tr.flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: inset 0 0 0 999px var(--warn-soft); } }
.cmp-same { padding: 22px 8px; text-align: center; color: var(--muted); }

/* ----- Notes ----- */
.notes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; min-height: 60vh; }
.nside { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.nfolders { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.nfolder { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 12px; border: 1px solid var(--chip-border); border-radius: 9999px; background: var(--surface); font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text-2); white-space: nowrap; text-align: left; cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.nfolder .ico { width: 16px; height: 16px; color: var(--muted); }
.nfolder .n { margin-left: auto; color: var(--faint); font-size: 0.8rem; font-weight: 500; font-variant-numeric: tabular-nums; padding-left: 8px; }
.nfolder:hover { border-color: var(--brand); color: var(--link); }
.nfolder[aria-current="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.nfolder[aria-current="true"] .ico, .nfolder[aria-current="true"] .n { color: inherit; }
.nfolder.add { color: var(--muted); border-style: dashed; }
.ntags { display: flex; flex-wrap: wrap; gap: 6px; }
.ntags:empty { display: none; }
.nlist-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.nlist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; }
.nlist-head h2 { font-size: 1rem; color: var(--text-strong); }
.nlist { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.nitem { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 10px 8px; border-radius: 0; font-family: inherit; color: var(--text); cursor: pointer; }
.nitem:hover { background: var(--tint-brand); }
.nitem[aria-current="true"] { background: var(--surface); box-shadow: inset 3px 0 0 var(--brand); }
.nitem-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nitem-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; color: var(--text-strong); }
.nitem-title.untitled { color: var(--muted); font-weight: 500; font-style: italic; }
.nitem-top .ico { width: 15px; height: 15px; color: var(--ember); }
.nitem-snip { color: var(--muted); font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nitem-meta { display: flex; gap: 6px 10px; flex-wrap: wrap; font-size: 0.78rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.nitem mark, .clip mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
.nlist-empty { color: var(--muted); font-size: 0.9rem; padding: 18px 8px; }
.neditor { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ned-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ned-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.ned-tools .sq-btn .ico { width: 17px; height: 17px; }
.ned-tools .sq-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ned-title { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 6px 0 8px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.25rem, 2vw, 1.55rem); font-weight: 700; letter-spacing: -0.01em; border-radius: 0; color: var(--text-strong); }
.ned-title:focus { outline: none; border-bottom-color: var(--brand); box-shadow: 0 1px 0 var(--brand); }
.ned-title::placeholder { color: var(--placeholder); font-weight: 600; }
.ned-body { width: 100%; min-height: 52vh; border: 0; border-left: 3px solid transparent; background: transparent; padding: 4px 0 4px 10px; resize: vertical; font-family: inherit; font-size: 1rem; line-height: 1.7; max-width: 80ch; color: var(--text); }
.ned-body:focus { outline: none; border-left-color: var(--brand); }
.ned-body::placeholder { color: var(--placeholder); }
.ned-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.ned-foot .meta { font-variant-numeric: tabular-nums; }
.ned-trash { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px; border-radius: 12px; background: var(--warn-soft); font-size: 0.9rem; color: var(--text); }
.ned-trash span { flex: 1 1 200px; }
.ned-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; color: var(--muted); padding: 24px 0; }
.md { font-size: 1rem; line-height: 1.7; max-width: 80ch; overflow-wrap: anywhere; min-height: 40vh; color: var(--text); }
.md p, .md li { line-height: inherit; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 1.1em 0 0.35em; line-height: 1.3; color: var(--text-strong); }
.md h1 { font-size: 1.5rem; }
.md h2 { font-size: 1.25rem; }
.md h3 { font-size: 1.08rem; }
.md h4, .md h5, .md h6 { font-size: 1rem; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md .md-table { margin: 0 0 0.75em; }
.md ul, .md ol { padding-left: 1.4em; }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li.task { list-style: none; margin-left: -1.4em; }
.md li.task label { display: inline-flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.md li.task input { width: 18px; height: 18px; margin-top: 0.3em; accent-color: var(--brand); flex: none; }
.md li.task.done > label > span { color: var(--muted); text-decoration: line-through; }
/* the site's blockquote is a card: in a note it is the original's plain line at the left */
.md blockquote { border: 0; border-left: 3px solid var(--line-strong); border-radius: 0; background: none; box-shadow: none; padding: 0 0 0 12px; font-style: normal; color: var(--muted); }
.md pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 8px; overflow: auto; font-size: 0.85rem; }
.md pre code { border: 0; padding: 0; background: none; }
.md a { color: var(--link); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md .md-tag { color: var(--ember-ink); font-weight: 600; }
.md mark { background: var(--warn-soft); color: inherit; }
.md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 0.9rem; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
@media (min-width: 760px) {
    .notes { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
    .nside { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .nside .search-wrap { flex: 0 1 280px; }
    .nfolders { flex: 1; min-width: 0; }
    .ned-back { display: none !important; }
}
@media (min-width: 1180px) {
    .notes { grid-template-columns: 220px minmax(260px, 320px) minmax(0, 1fr); gap: 0 32px; }
    .nside { grid-column: auto; flex-direction: column; align-items: stretch; position: sticky; top: calc(var(--head) + 16px); }
    .nside .search-wrap { flex: none; }
    .nfolders { flex-direction: column; overflow: visible; }
    .nfolder { border-color: transparent; background: transparent; border-radius: 12px; }
    .nfolder:hover { background: var(--tint-brand); border-color: transparent; }
    .nfolder[aria-current="true"] { background: var(--gradient-brand); }
    .nfolder.add { border-color: transparent; }
    .nlist-wrap { position: sticky; top: calc(var(--head) + 16px); max-height: calc(100vh - var(--head) - 32px); }
    .nlist { overflow: auto; }
}
@media (max-width: 759.98px) {
    .notes[data-mode="list"] .neditor { display: none; }
    .notes[data-mode="edit"] .nside, .notes[data-mode="edit"] .nlist-wrap { display: none; }
}

/* ----- Printing a note: only the note ----- */
.print-sheet { display: none; }
@media print {
    @page { margin: 16mm; }
    body { background: #fff !important; color: #000; display: block; padding: 0; }
    body > *:not(#printSheet) { display: none !important; }
    .print-sheet { display: block !important; color: #000; font-size: 11pt; line-height: 1.55; }
    .print-sheet h1.pt { font-size: 18pt; margin: 0 0 10pt; }
    .print-sheet a, .print-sheet .md-tag { color: #000; }
    .print-sheet li.task { list-style: none; }
}

/* ----- 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-actions.split .grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; }
@media (min-width: 520px) { .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.palette { width: min(640px, calc(100vw - 16px)); margin-top: 10vh; }
.palette .dialog-body { gap: 8px; }
.search-wrap.big .input { min-height: 50px; font-size: 1.05rem; }
.palette-list { max-height: min(56vh, 460px); overflow: auto; display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-width: 0; margin: 0; color: var(--text); }
.palette-list li .ico { color: var(--muted); }
.palette-list li .pl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list li .pk { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.palette-list li[aria-selected="true"] { background: var(--gradient-brand); color: #fff; }
.palette-list li[aria-selected="true"] .ico, .palette-list li[aria-selected="true"] .pk { color: inherit; }
.palette-list .pempty { color: var(--muted); cursor: default; }
.palette-hint { text-align: right; }
.picker { display: flex; flex-direction: column; gap: 16px; max-height: min(62vh, 560px); overflow: auto; padding-right: 2px; }
.picker h3 { font-size: 0.85rem; color: var(--muted); margin: 0 0 4px; }
.picker-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (min-width: 620px) { .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; } }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; border: 0; border-radius: 10px; background: transparent; padding: 8px; font-family: inherit; color: var(--text); cursor: pointer; }
.pick:hover, .pick:focus-visible { background: var(--tint-brand); }
.pick b { font-size: 0.925rem; color: var(--text-strong); }
.pick span { color: var(--muted); font-size: 0.8rem; }
.recipes { display: flex; flex-direction: column; gap: 18px; max-height: min(64vh, 600px); overflow: auto; }
.recipe-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.recipe { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.recipe b { display: block; color: var(--text-strong); overflow-wrap: anywhere; }
.recipe .muted { font-size: 0.85rem; }
.recipe .actions { flex-wrap: nowrap; }
.save-recipe { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.save-recipe .field { flex: 1 1 220px; }
.settings { display: flex; flex-direction: column; gap: 22px; max-height: min(70vh, 640px); overflow: auto; }
.set-block { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.set-block:first-child { border-top: 0; padding-top: 0; }
.set-block h3 { margin: 0; font-size: 1rem; color: var(--text-strong); }
.help { max-height: min(76vh, 760px); overflow: auto; }
.help p { color: var(--text); font-size: 0.925rem; }
.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); }

/* ----- Drop veil ----- */
.drop-veil { position: fixed; inset: 0; z-index: 2900; background: rgba(10, 10, 20, 0.5); display: grid; place-items: center; pointer-events: none; }
.drop-veil > div { display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--text-strong); border: 2px dashed var(--brand); border-radius: 20px; padding: 22px 28px; font-weight: 700; font-size: 1.05rem; }
.drop-veil .ico { width: 26px; height: 26px; color: var(--link); }

@media (forced-colors: active) { .x-inv, .node { forced-color-adjust: none; } }

/* ----- 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; }
    .step-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, .clip, .dropzone, .dropzone > .ico, .dialog, .toast, .progress i, .progress.busy i, .nfolder, .dtable tr.flash td { transition: none; animation: none; }
    .btn:hover, .icon-btn:hover, .chip:hover, .seg button:hover, .info-card:hover, .clip:hover, .dropzone: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, .meta, .tag, .empty, .link, .check-row, .inline-field, .mini-field, .mini-check, .step-note, .step-hint, .found-chip, .menu-item, .lrest, .dpath, .dfacts, .th-type, .grid, .code, .clip-text, .clip-meta, .xray, .diffview, .xkey, .nfolder, .nitem-snip, .nitem-meta, .nlist-empty, .ned-trash, .ned-empty, .md, .dtable, .cmp-same) { 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 .input.mini, .dialog .select { min-height: 44px; }
    main .seg button, main .chip, main .found-chip, main .rn-btn, main .input.mini, main .select, main .sheet-tab, main .step-note, main .dskip, main .nfolder, main .dtable tr.fold button { min-height: 44px; }
    main .th-menu { min-width: 44px; }
    main .check-row, main .step-title, main .mini-check { min-height: 44px; align-items: center; }
    main .pick-box { display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -12px; }
    main .md li.task label { min-height: 44px; align-items: center; }
    main .md li.task input { margin-top: 0; }
    .toast button { min-height: 44px; min-width: 44px; }
    main .step { grid-template-columns: 44px minmax(0, 1fr) 44px; }
    main .step::before { left: 21px; }
    main .node { width: 44px; height: 44px; }
    main .grid .rn { min-width: 48px; }
    .inline-field { white-space: normal; flex-wrap: wrap; }
    .inline-field .select, .inline-field .input { flex: none; }
    .dialog :is(p, .hint, .label, .input, .pick span, .muted, dd, dt) { font-size: 1rem; }
    main .menu-item { min-height: 44px; }
}
