/* ==========================================================================
   ToolCMB — JSON Formatter (extends /assets/css/style.css design tokens)
   ==========================================================================
   01. Page & hero        06. Tree & table views     11. Content blocks
   02. App card, toolbar  07. Query bar, notes       12. Overlays, toasts, lang
   03. Panes & editors    08. Settings panel         13. Responsive
   04. Status & errors    09. Form controls          14. Contrast
   05. Output tabs/empty  10. Full screen
   ========================================================================== */

/* ---------- 01. Page & hero --------------------------------------------- */
.jf-wide { max-width: 1480px; }
.jf-hero { position: relative; padding: 32px 0 18px; isolation: isolate; overflow: hidden; }
.jf-hero .hero-bg { opacity: .8; }
.jf-hero .breadcrumbs ol { margin-bottom: 20px; }
.jf-hero .breadcrumbs .icon { width: 16px; height: 16px; }
.jf-hero-head { display: flex; align-items: center; gap: 18px; }
.jf-hero-head h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.03em; }
.jf-hero-head .lead { margin: 6px 0 0; font-size: 1.05rem; max-width: 820px; }
.jf-trust { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.jf-trust li {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 550; color: var(--text-2);
}
.jf-trust .icon { color: var(--primary); }
.jf-tool { padding: 6px 0 64px; }

/* quick actions */
.jf-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.jf-quick-lbl { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.jf-qc {
    display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .83rem; font-weight: 650; cursor: pointer;
    transition: border-color .15s var(--ease), color .15s, background-color .15s, box-shadow .15s;
}
.jf-qc:hover { border-color: var(--primary); color: var(--link); }
.jf-qc.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--link); box-shadow: inset 0 0 0 1px var(--primary-ring); }
.jf-qc:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.jf-noscript { margin-bottom: 16px; padding: 18px 20px; border-radius: var(--radius-lg); background: rgba(220, 38, 38, .08); border: 1px solid rgba(220, 38, 38, .25); }
.jf-noscript p { margin: 6px 0 0; }

/* ---------- 02. App card & toolbar -------------------------------------- */
.jf-app {
    --jf-ed-h: clamp(460px, calc(100vh - 230px), 860px);
    --jf-active: rgba(6, 182, 212, .05); --jf-active-g: rgba(6, 182, 212, .10);
    --jf-sel: rgba(6, 182, 212, .22); --jf-match: rgba(6, 182, 212, .14);
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
[data-theme="dark"] .jf-app { --jf-active: rgba(34, 211, 238, .05); --jf-active-g: rgba(34, 211, 238, .10); --jf-sel: rgba(34, 211, 238, .25); --jf-match: rgba(34, 211, 238, .16); }
.jf-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.jf-bar-main, .jf-bar-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.jf-btn { height: 38px; padding: 0 14px; font-size: .88rem; gap: 7px; }
.jf-btn .icon, .btn .icon { width: 1.05em; height: 1.05em; }
.jf-btn.btn-ghost.is-active { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }
.jf-toggle[aria-pressed="true"] { border-color: var(--primary); color: var(--link); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-ring); }
.jf-ib { width: 38px; height: 38px; }
.jf-ib[aria-pressed="true"], .jf-ib[aria-expanded="true"] { border-color: var(--primary); color: var(--link); background: var(--primary-soft); }
.jf-bar #jfIndent { width: auto; min-width: 110px; }

/* ---------- 03. Panes & editors ----------------------------------------- */
.jf-panes { display: grid; grid-template-columns: minmax(0, var(--jf-l, 1fr)) 12px minmax(0, var(--jf-r, 1fr)); height: var(--jf-ed-h); }
.jf-panes.is-dragging { cursor: col-resize; user-select: none; }
.jf-panes.is-dragging .jf-editor { pointer-events: none; }
.jf-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.jf-pane-head { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.jf-pane-title { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 0 4px; font-size: .9rem; font-weight: 700; letter-spacing: -.01em; }
.jf-pane-title .icon { width: 17px; height: 17px; color: var(--primary); }
.jf-pane-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.jf-tb {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 9px; border: 1px solid transparent; border-radius: 9px;
    background: none; color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.jf-tb .icon { width: 16px; height: 16px; flex: none; }
.jf-tb:hover:not([disabled]) { background: var(--surface-2); color: var(--text); }
.jf-tb:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.jf-tb[disabled] { opacity: .45; cursor: not-allowed; }
.jf-tb[aria-pressed="true"] { color: var(--link); background: var(--primary-soft); border-color: var(--primary-ring); }
.jf-tb--icon { padding: 0; width: 34px; }
.jf-tb--danger:hover:not([disabled]) { color: var(--danger); }
.jf-dl { height: 34px; margin-left: 4px; padding: 0 12px; gap: 6px; font-size: .82rem; }
.jf-dl[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.jf-full-off { display: none; }
.jf-app.is-full .jf-full-on { display: none; }
.jf-app.is-full .jf-full-off { display: block; }

.jf-editor { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--surface); }
.jf-editor .cm-editor { height: 100%; }
.jf-fallback { width: 100%; height: 100%; padding: 12px 14px; border: 0; resize: none; background: transparent; color: var(--muted); font: .9rem/1.6 var(--mono); }
.jf-pane--in .jf-editor { border-bottom-left-radius: 0; }

.jf-gutter { position: relative; display: flex; align-items: center; justify-content: center; cursor: col-resize; background: var(--surface-2); border-left: 1px solid var(--border); border-right: 1px solid var(--border); touch-action: none; }
.jf-gutter span { width: 4px; height: 36px; border-radius: 4px; background: var(--border-strong); transition: background-color .15s, height .15s; }
.jf-gutter:hover span, .jf-gutter:focus-visible span, .jf-panes.is-dragging .jf-gutter span { background: var(--primary); height: 56px; }
.jf-gutter:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary-ring); }

/* narrow panes: icons only (data-w is set from the pane width by a ResizeObserver; wraps as a last resort) */
.jf-pane-head { flex-wrap: wrap; }
.jf-pane:not([data-w="l"]) .jf-tab span, .jf-pane--out:not([data-w="l"]) .jf-tb span { display: none; }
.jf-pane:not([data-w="l"]) .jf-tab { padding: 0 9px; }
.jf-pane--out:not([data-w="l"]) .jf-tb:not(.jf-tb--icon) { width: 34px; padding: 0; }
.jf-pane[data-w="s"] .jf-tb span, .jf-pane[data-w="s"] .jf-dl span { display: none; }
.jf-pane[data-w="s"] .jf-tb { width: 34px; padding: 0; }
.jf-pane[data-w="s"] .jf-dl { width: 34px; padding: 0; justify-content: center; }

/* stacked layout */
.jf-panes[data-layout="stack"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; }
.jf-panes[data-layout="stack"] .jf-gutter { display: none; }
.jf-panes[data-layout="stack"] .jf-pane { height: calc(var(--jf-ed-h) * .72); }
.jf-panes[data-layout="stack"] .jf-pane--out { border-top: 1px solid var(--border); }

/* syntax colours (CodeMirror + tree) */
.tk-key, .jf-tv-key { color: #1D4ED8; }
.tk-str, .jf-tv-string { color: #047857; }
.tk-num, .jf-tv-number { color: #B45309; }
.tk-lit, .jf-tv-boolean, .jf-tv-null { color: #A21CAF; }
.tk-kw { color: #7C3AED; font-weight: 600; }
.tk-tag { color: #1D4ED8; }
.tk-attr { color: #0E7490; }
.tk-com { color: var(--muted); font-style: italic; }
.tk-punc { color: var(--muted); }
[data-theme="dark"] .tk-key, [data-theme="dark"] .jf-tv-key { color: #7DD3FC; }
[data-theme="dark"] .tk-str, [data-theme="dark"] .jf-tv-string { color: #86EFAC; }
[data-theme="dark"] .tk-num, [data-theme="dark"] .jf-tv-number { color: #FCD34D; }
[data-theme="dark"] .tk-lit, [data-theme="dark"] .jf-tv-boolean, [data-theme="dark"] .jf-tv-null { color: #F0ABFC; }
[data-theme="dark"] .tk-kw { color: #C4B5FD; }
[data-theme="dark"] .tk-tag { color: #7DD3FC; }
[data-theme="dark"] .tk-attr { color: #67E8F9; }
.jf-fold { display: inline-block; width: 10px; height: 10px; margin-top: 5px; opacity: .55; background: currentColor; clip-path: polygon(20% 10%, 85% 50%, 20% 90%); transition: transform .15s; }
.jf-fold.is-open { transform: rotate(90deg); }
.cm-gutterElement:hover .jf-fold { opacity: 1; color: var(--primary); }

/* ---------- 04. Status & errors ----------------------------------------- */
.jf-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 36px; padding: 6px 12px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.jf-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--text-2); }
.jf-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.jf-state[data-state="ok"], .jf-state[data-state="jsonl"] { color: var(--success); }
.jf-state[data-state="ok"]::before, .jf-state[data-state="jsonl"]::before { background: var(--success); box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); }
.jf-state[data-state="bad"] { color: var(--danger); }
.jf-state[data-state="bad"]::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.jf-state[data-state="busy"]::before { background: var(--primary); animation: jf-pulse 1s ease-in-out infinite; }
[data-theme="dark"] .jf-state[data-state="ok"], [data-theme="dark"] .jf-state[data-state="jsonl"] { color: #34D399; }
[data-theme="dark"] .jf-state[data-state="bad"] { color: #F87171; }
.jf-cursor { margin-left: auto; }
.jf-live-hint { margin-left: auto; color: var(--text-2); }
.jf-live-hint[hidden] { display: none; }
@keyframes jf-pulse { 50% { opacity: .35; } }

.jf-error { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-top: 1px solid rgba(220, 38, 38, .25); background: rgba(220, 38, 38, .06); animation: pop .2s var(--ease); }
.jf-error[hidden] { display: none; }
.jf-error-ico { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--danger); }
.jf-error-body { flex: 1; min-width: 0; }
.jf-error-title { margin: 0; font-size: .84rem; font-weight: 750; color: var(--danger); font-variant-numeric: tabular-nums; }
.jf-error-msg { margin: 2px 0 0; font-size: .86rem; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.jf-error-actions { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
[data-theme="dark"] .jf-error-title, [data-theme="dark"] .jf-error-ico { color: #F87171; }

/* ---------- 05. Output tabs / empty state ------------------------------- */
.jf-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.jf-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer; }
.jf-tab .icon { width: 15px; height: 15px; }
.jf-tab:hover { color: var(--text); }
.jf-tab[aria-selected="true"] { background: var(--surface); color: var(--link); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--primary-ring); }
.jf-tab:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.jf-pane-head .jf-target { flex: none; width: auto; min-width: 104px; font-weight: 650; }
.jf-app[data-view="tree"] .jf-target, .jf-app[data-view="table"] .jf-target { opacity: .5; }
.jf-out, .jf-treebox, .jf-table { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.jf-out[hidden], .jf-treebox[hidden], .jf-table[hidden] { display: none; }
.jf-out-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--surface); }
.jf-out-empty[hidden] { display: none; }
.jf-out-empty[data-kind="empty"] .jf-oe-error, .jf-out-empty[data-kind="error"] .jf-oe-empty { display: none; }
.jf-oe-ico { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: var(--primary); background: var(--primary-soft); }
.jf-oe-ico .icon { width: 28px; height: 28px; }
.jf-oe-ico.is-bad { color: var(--danger); background: rgba(220, 38, 38, .08); }
.jf-oe-title { margin: 14px 0 4px; font-weight: 750; font-size: 1.05rem; }
.jf-oe-text { margin: 0 auto; max-width: 380px; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.jf-oe-private { display: inline-flex; align-items: center; gap: 7px; margin: 18px 0 0; padding: 6px 12px; border-radius: 999px; background: rgba(5, 150, 105, .08); color: #047857; font-size: .8rem; font-weight: 650; }
[data-theme="dark"] .jf-oe-private { color: #34D399; background: rgba(52, 211, 153, .1); }
.jf-link { display: inline; padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.jf-link:hover { text-decoration-thickness: 2px; }

/* ---------- 06. Tree & table views -------------------------------------- */
.jf-tree-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.jf-find { position: relative; flex: 1; min-width: 0; }
.jf-find > .icon { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.jf-find .jf-input { padding-left: 32px; padding-right: 56px; }
.jf-find-count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: .75rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.jf-tree { flex: 1; min-height: 0; overflow: auto; padding: 6px 0 14px; font: var(--jf-fs, 13.5px)/1.65 var(--mono); }
.jf-tv, .jf-tv-kids { margin: 0; padding: 0; list-style: none; }
.jf-tv-kids[hidden] { display: none; }
.jf-tv-row { display: flex; align-items: baseline; gap: 6px; padding: 1px 12px 1px calc(var(--d, 0) * 18px + 8px); white-space: nowrap; cursor: default; border-radius: 0; outline: none; }
.jf-tv-row:hover { background: var(--jf-active); }
.jf-tv-row.is-sel { background: var(--jf-active-g); box-shadow: inset 3px 0 0 var(--primary); }
.jf-tv-row.is-hit .jf-tv-key, .jf-tv-row.is-hit .jf-tv-val { background: rgba(250, 204, 21, .35); border-radius: 3px; }
.jf-tv-row:focus-visible { box-shadow: inset 0 0 0 2px var(--primary-ring); }
.jf-tv-tog { flex: none; width: 14px; height: 14px; align-self: center; }
.jf-tv-item[data-c="1"] > .jf-tv-row .jf-tv-tog { cursor: pointer; background: var(--muted); clip-path: polygon(25% 15%, 80% 50%, 25% 85%); transition: transform .15s; }
.jf-tv-item.is-open > .jf-tv-row .jf-tv-tog { transform: rotate(90deg); }
.jf-tv-item[data-c="1"] > .jf-tv-row { cursor: pointer; }
.jf-tv-idx { color: var(--muted); }
.jf-tv-colon, .jf-tv-brace { color: var(--muted); }
.jf-tv-colon { margin-left: -5px; }
.jf-tv-count { font-family: var(--font); font-size: .74rem; font-weight: 650; color: var(--muted); padding: 0 6px; border-radius: 6px; background: var(--surface-2); }
.jf-tv-item.is-open > .jf-tv-row .jf-tv-brace:last-child { display: none; }
.jf-tv-val { overflow: hidden; text-overflow: ellipsis; }
.jf-tv-more .jf-link { margin: 2px 0; padding-left: calc(var(--d, 0) * 18px + 28px); font-family: var(--font); font-size: .82rem; }
.jf-path { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.jf-path-lbl { font-size: .72rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.jf-path code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: .82rem var(--mono); color: var(--text); }

.jf-table { overflow: hidden; }
.jf-tbl-wrap { flex: 1; min-height: 0; overflow: auto; }
.jf-tbl { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font: var(--jf-fs, 13.5px)/1.5 var(--mono); }
.jf-tbl th, .jf-tbl td { max-width: 360px; padding: 6px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.jf-tbl thead th { position: sticky; top: 0; z-index: 1; padding: 0; background: var(--surface-2); font-family: var(--font); }
.jf-tbl-sort { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .8rem; font-weight: 700; text-align: left; cursor: pointer; }
.jf-tbl-sort::after { content: "↕"; opacity: .35; font-size: .8em; }
.jf-tbl-sort.is-asc::after { content: "↑"; opacity: 1; color: var(--link); }
.jf-tbl-sort.is-desc::after { content: "↓"; opacity: 1; color: var(--link); }
.jf-tbl-sort:hover { background: var(--border); }
.jf-tbl .jf-tbl-n { position: sticky; left: 0; background: var(--surface-2); color: var(--muted); text-align: right; font-size: .78em; min-width: 44px; }
.jf-tbl thead .jf-tbl-n { z-index: 2; padding: 8px 12px; }
.jf-tbl tbody tr:hover td { background: var(--jf-active); }
.jf-tbl-miss { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 7px); }
.jf-tbl-note { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); }
.jf-empty { margin: auto; padding: 32px 24px; max-width: 420px; text-align: center; color: var(--muted); font-size: .92rem; }

/* ---------- 07. Query bar & notes --------------------------------------- */
.jf-query { padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.jf-query[hidden] { display: none; }
.jf-query-row { position: relative; display: flex; align-items: center; gap: 6px; }
.jf-query-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; display: flex; }
.jf-query-ico .icon { width: 15px; height: 15px; }
.jf-query .jf-input { padding-left: 32px; height: 38px; }
.jf-query .jf-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.jf-query-info { flex: none; font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.jf-query-info[data-kind="ok"] { color: var(--success); }
.jf-query-info[data-kind="bad"] { color: var(--danger); }
.jf-query-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; font-size: .75rem; color: var(--muted); }
.jf-qex { padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-2); font: .74rem var(--mono); cursor: pointer; }
.jf-qex:hover { border-color: var(--primary); color: var(--link); }

.jf-notes { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.jf-notes[hidden] { display: none; }
.jf-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 12px 7px 34px; position: relative; font-size: .8rem; line-height: 1.45; color: var(--text-2); }
.jf-note::before { content: "i"; position: absolute; left: 12px; top: 8px; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font: 700 .7rem/1 var(--font); color: #fff; background: var(--primary-dark); }
.jf-note.is-warn { background: rgba(217, 119, 6, .07); }
.jf-note.is-warn::before { content: "!"; background: #B45309; }
.jf-note.is-ok::before { content: "✓"; background: var(--success); }
.jf-note .jf-link { font-size: .8rem; }

/* ---------- 08. Settings panel ------------------------------------------ */
.jf-panel {
    position: absolute; top: 58px; right: 10px; z-index: 40; width: 360px; max-height: calc(100% - 68px); overflow: auto; overscroll-behavior: contain;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); scrollbar-width: thin;
}
.jf-panel[hidden] { display: none; }
.jf-panel-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 12px 12px 10px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.jf-panel-title { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 0; font-size: 1rem; }
.jf-panel-title .icon { color: var(--primary); }
.jf-panel-body { padding: 4px 18px 18px; }
.jf-link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600; border-radius: 8px; cursor: pointer; }
.jf-link-btn:hover { color: var(--link); background: var(--surface-2); }
.jf-link-btn .icon { width: 14px; height: 14px; }
.jf-sub { margin: 18px 0 0; font-size: .74rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.jf-set-note { display: flex; gap: 8px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: .78rem; line-height: 1.5; color: var(--muted); }
.jf-set-note .icon { flex: none; margin-top: 2px; color: var(--primary); }
.jf-keys { margin-top: 18px; border-top: 1px solid var(--border); }
.jf-keys summary { display: flex; align-items: center; gap: 8px; padding: 14px 0 0; font-size: .86rem; font-weight: 650; cursor: pointer; list-style: none; }
.jf-keys summary::-webkit-details-marker { display: none; }
.jf-keys summary .icon:first-child { color: var(--primary); }
.jf-keys .jf-caret { margin-left: auto; transition: transform .2s var(--ease); color: var(--muted); }
.jf-keys[open] .jf-caret { transform: rotate(180deg); }
.jf-keys dl { display: grid; gap: 6px; margin: 10px 0 0; }
.jf-keys dl div { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; }
.jf-keys dd { margin: 0; color: var(--muted); }
.jf-keys kbd, .jf-app kbd { font: 650 .72rem var(--font); padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }

/* ---------- 09. Form controls ------------------------------------------- */
.jf-field { margin: 12px 0 0; padding: 0; border: 0; min-width: 0; }
.jf-field > legend, .jf-field > label { display: block; padding: 0; margin: 0 0 7px; font-size: .84rem; font-weight: 650; color: var(--text-2); }
.jf-field--row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.jf-field--row > label, .jf-field--row > legend { margin: 0; float: left; }
.jf-field--row .jf-seg { margin-left: auto; min-width: 170px; }
.jf-w { width: 150px; flex: none; }
.jf-help { margin: 6px 0 0; font-size: .76rem; line-height: 1.45; color: var(--muted); }
.jf-seg { display: grid; gap: 3px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.jf-seg--2 { grid-template-columns: repeat(2, 1fr); }
.jf-seg--3 { grid-template-columns: repeat(3, 1fr); }
.jf-seg--4 { grid-template-columns: repeat(4, 1fr); }
.jf-seg label { position: relative; margin: 0; }
.jf-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jf-seg span { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 3px 4px; border-radius: 9px; font-size: .78rem; font-weight: 650; line-height: 1.2; text-align: center; color: var(--text-2); cursor: pointer; transition: all .15s var(--ease); }
.jf-seg span:hover { color: var(--text); }
.jf-seg input:checked + span { background: var(--surface); color: var(--link); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--primary-ring); }
.jf-seg input:focus-visible + span { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.jf-seg--mono span { font-family: var(--mono); }
.jf-input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; outline: none; transition: border-color .2s, box-shadow .2s; }
select.jf-input { padding-right: 8px; cursor: pointer; }
.jf-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.jf-input--sm { height: 34px; font-size: .84rem; border-radius: 9px; }
.jf-input--mono { font-family: var(--mono); font-size: .84rem; }
.jf-switch { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0 0; font-size: .86rem; line-height: 1.4; color: var(--text-2); cursor: pointer; }
.jf-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jf-switch-ui { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background-color .2s var(--ease); }
.jf-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .2s var(--ease); }
.jf-switch input:checked + .jf-switch-ui { background: var(--primary-dark); }
.jf-switch input:checked + .jf-switch-ui::after { transform: translateX(16px); }
.jf-switch input:focus-visible + .jf-switch-ui { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.jf-mini { width: 34px; height: 34px; flex: none; }
.btn-xs { height: 32px; padding: 0 12px; font-size: .8rem; gap: 6px; }

/* ---------- 10. Full screen --------------------------------------------- */
.jf-app.is-full { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; border-radius: 0; border: 0; }
.jf-app.is-full .jf-panes { flex: 1; height: auto; min-height: 0; }
.jf-app.is-full .jf-panes[data-layout="stack"] { overflow: auto; }
body.jf-noscroll { overflow: hidden; }

/* ---------- 11. Content blocks ------------------------------------------ */
.jf-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.jf-step { position: relative; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.jf-step h3 { margin: 16px 0 8px; }
.jf-step p { margin: 0; color: var(--muted); font-size: .95rem; }
.jf-step-n { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); }
.jf-features { grid-template-columns: repeat(4, 1fr); }
.jf-guide { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; }
.jf-guide-main { max-width: 800px; min-width: 0; }
.jf-guide-main > h2:first-child { margin-top: 0; }
.jf-guide-main > p { margin: 0 0 1em; }
.jf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1em; }
.jf-gtable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.jf-gtable th, .jf-gtable td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.jf-gtable thead th { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); }
.jf-gtable th[scope="row"] { white-space: nowrap; font-weight: 650; }
.jf-gtable code { white-space: nowrap; }
.jf-gtable code.is-bad { color: #B91C1C; background: rgba(220, 38, 38, .07); }
.jf-gtable code.is-good { color: #047857; background: rgba(5, 150, 105, .08); }
[data-theme="dark"] .jf-gtable code.is-bad { color: #FCA5A5; }
[data-theme="dark"] .jf-gtable code.is-good { color: #6EE7B7; }
.jf-ad { min-height: 120px; margin-top: 20px; }

/* ---------- 12. Overlays, toasts, language ------------------------------ */
.jf-lang { position: relative; }
.jf-lang-btn { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; }
.jf-lang-code { font-size: .76rem; font-weight: 750; letter-spacing: .03em; }
.jf-lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 150; min-width: 180px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.jf-lang-menu a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: .92rem; font-weight: 550; text-decoration: none !important; }
.jf-lang-menu a:hover { background: var(--surface-2); }
.jf-lang-menu a[aria-current] { color: var(--link); font-weight: 650; }
.jf-dropveil { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; padding: 16px; background: rgba(6, 182, 212, .14); backdrop-filter: blur(3px); animation: fade .15s; pointer-events: none; }
.jf-dropveil[hidden] { display: none; }
.jf-dropveil > div { display: grid; place-content: center; justify-items: center; gap: 10px; width: 100%; height: 100%; border: 3px dashed var(--primary); border-radius: var(--radius-xl); color: var(--primary-dark); font-size: 1.3rem; font-weight: 750; }
[data-theme="dark"] .jf-dropveil > div { color: var(--primary-light); }
.jf-dropveil .icon { width: 56px; height: 56px; }
.jf-toasts { position: fixed; left: 50%; bottom: 24px; z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.jf-toast { padding: 10px 18px; border-radius: 999px; background: var(--navy); color: #fff; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); transition: opacity .3s, transform .3s; white-space: nowrap; }
[data-theme="dark"] .jf-toast { background: #1E293B; border: 1px solid var(--border-strong); }
.jf-toast.is-ok { background: #047857; }
.jf-toast.is-warn { background: #B45309; }
.jf-toast.is-out { opacity: 0; transform: translateY(8px); }
.jf-langhint { position: fixed; left: 16px; bottom: 16px; z-index: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop .25s var(--ease); }
.jf-langhint[hidden] { display: none; }
.jf-langhint span { flex: 1 1 200px; }

/* ---------- 13. Responsive ---------------------------------------------- */
@media (max-width: 1280px) {
    .jf-features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
    .jf-guide { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .jf-guide-side .sticky { position: static; }
}
@media (max-width: 900px) {
    .header-actions { margin-left: auto; }
    .jf-panes, .jf-panes[data-layout="split"] { grid-template-columns: minmax(0, 1fr); height: auto; }
    .jf-gutter { display: none; }
    .jf-pane, .jf-panes[data-layout="stack"] .jf-pane { height: clamp(340px, 62vh, 620px); }
    .jf-pane--out { border-top: 1px solid var(--border); }
    .jf-steps { grid-template-columns: 1fr; }
    .jf-panel { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); z-index: 960; }
    .jf-app.is-full .jf-panes { overflow: auto; }
}
@media (max-width: 600px) {
    .jf-lang-btn { width: 40px; padding: 0; justify-content: center; }
    .jf-lang-code { display: none; }
    .jf-hero { padding: 20px 0 10px; }
    .jf-hero-head .tile { display: none; }
    .jf-trust { gap: 6px; }
    .jf-trust li { font-size: .78rem; padding: 5px 10px; }
    .jf-quick { flex-wrap: nowrap; gap: 6px; margin: 0 -16px 12px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .jf-quick::-webkit-scrollbar { display: none; }
    .jf-quick-lbl { display: none; }
    .jf-qc { flex: none; }
    .jf-app { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
    .jf-bar { padding: 8px 10px; }
    .jf-bar-main { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; gap: 6px; }
    .jf-bar-main .jf-btn { padding: 0 6px; font-size: .8rem; gap: 5px; justify-content: center; }
    .jf-bar-main .jf-btn .icon { display: none; }
    .jf-bar-opts { width: 100%; }
    .jf-bar-opts #jfIndent { flex: 1; }
    .jf-bar-opts .jf-toggle { flex: 1; justify-content: center; }
    .jf-pane-head { flex-wrap: wrap; padding: 6px 8px; }
    .jf-pane--out .jf-pane-head .jf-pane-tools { width: 100%; justify-content: space-between; margin: 0; }
    .jf-dl { margin-left: auto; }
    .jf-pane-head .jf-target { flex: 1; min-width: 0; }
    .jf-tab { padding: 0 9px; }
    .jf-error { flex-wrap: wrap; }
    .jf-error-actions { width: 100%; padding-left: 30px; }
    .jf-cursor { display: none; }
    .jf-toast { white-space: normal; text-align: center; }
    .jf-features { grid-template-columns: 1fr; }
    .jf-langhint { left: 12px; right: 12px; bottom: 12px; max-width: none; }
    .jf-query-ex { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .jf-qex { flex: none; }
}
@media print { .jf-tool, .jf-langhint { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .jf-app *, .jf-toast, .jf-panel { animation: none !important; transition: none !important; } }

/* ---------- 14. Contrast (WCAG AA for small text, light theme) ---------- */
:root:not([data-theme="dark"]) .jf-qc.is-active,
:root:not([data-theme="dark"]) .jf-tab[aria-selected="true"],
:root:not([data-theme="dark"]) .jf-seg input:checked + span,
:root:not([data-theme="dark"]) .jf-toggle[aria-pressed="true"],
:root:not([data-theme="dark"]) .jf-tb[aria-pressed="true"],
:root:not([data-theme="dark"]) .jf-link,
:root:not([data-theme="dark"]) .jf-tbl-sort.is-asc::after,
:root:not([data-theme="dark"]) .jf-tbl-sort.is-desc::after { color: #0E7490; }
