/* ==========================================================================
   Files Online — file manager
   Uses the tokens from site.css. Everything is prefixed with fm-.
   ========================================================================== */

:root {
  --fm-c-image: #2f9e6e;
  --fm-c-pdf: #d1372b;
  --fm-c-doc: #2557d6;
  --fm-c-sheet: #12704a;
  --fm-c-slides: #c4501c;
  --fm-c-archive: #8a6a1f;
  --fm-c-audio: #8b3fc7;
  --fm-c-video: #b23a6f;
  --fm-c-code: #0f7c8a;
  --fm-c-font: #5b5fc7;
  --fm-c-email: #3b6fb5;
  --fm-c-other: #7b8494;
  --fm-folder: #f5b83d;
  --fm-folder-back: #e09a1a;
  --fm-row-h: 44px;
}
:root[data-theme="dark"] {
  --fm-c-image: #4cc38a; --fm-c-pdf: #ef6a56; --fm-c-doc: #7ea2f5; --fm-c-sheet: #4cc38a;
  --fm-c-slides: #f0924a; --fm-c-archive: #d6ac4b; --fm-c-audio: #b98af0; --fm-c-video: #ea6aa8;
  --fm-c-code: #4fc4d2; --fm-c-font: #9a9df2; --fm-c-email: #82aee6; --fm-c-other: #8a91a0;
  --fm-folder: #e6ad3c; --fm-folder-back: #b8811b;
}

body.fm-open { overflow: hidden; }
[hidden] { display: none !important; }

/* ─── Landing ───────────────────────────────────────────────────────────── */

.fm-hero { display: grid; gap: 14px; }
.fm-hero .pt-drop { cursor: default; }
.fm-hero__cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.fm-hero__again { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-hero__demo { background: none; border: 0; padding: 4px 0; color: var(--s-blue); font: 550 14.5px var(--s-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.fm-hero__demo:hover { color: var(--s-blue-ink); }
body.fm-dragging .fm-hero .pt-drop { border-color: var(--s-blue); background: var(--s-blue-wash); }

.fm-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 20px; }
.fm-links a { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--s-rule); border-radius: var(--s-radius-lg); background: var(--s-sheet); text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.fm-links a:hover { border-color: var(--s-rule-strong); box-shadow: var(--s-shadow-md); }
.fm-links strong { font: 620 15.5px/1.3 var(--s-display); color: var(--s-ink); }
.fm-links a:hover strong { color: var(--s-blue); }
.fm-links span { font-size: 14px; color: var(--s-ink-3); }

/* ─── App frame ─────────────────────────────────────────────────────────── */

.fm { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr auto; background: var(--s-paper); color: var(--s-ink); font: 14px/1.45 var(--s-body); }
.fm *, .fm-dialog *, .fm-menu * { box-sizing: border-box; }
.fm button, .fm-dialog button, .fm-menu button { font: inherit; color: inherit; }
.fm-body { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 0; }
.fm.has-details .fm-body { grid-template-columns: 248px minmax(0, 1fr) 344px; }
.fm-main { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; background: var(--s-sheet); }
.fm-scrim { display: none; }

.fm-i { display: inline-flex; width: 16px; height: 16px; flex: none; }
.fm-i svg { width: 100%; height: 100%; }
kbd { font: 500 11px/1 var(--s-mono); padding: 3px 5px; border: 1px solid var(--s-rule); border-bottom-width: 2px; border-radius: 5px; background: var(--s-paper-2); color: var(--s-ink-3); white-space: nowrap; }

/* Buttons */
.fm-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-weight: 550; font-size: 13.5px; white-space: nowrap; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.fm-btn:disabled { opacity: .4; cursor: default; }
.fm-btn--ghost { color: var(--s-ink-2); }
.fm-btn--ghost:hover:not(:disabled) { background: var(--s-paper-3); color: var(--s-ink); }
.fm-btn--secondary { background: var(--s-sheet); border-color: var(--s-rule-strong); box-shadow: var(--s-shadow-xs); }
.fm-btn--secondary:hover:not(:disabled) { background: var(--s-paper-2); }
.fm-btn--primary { background: var(--s-blue); color: #fff !important; box-shadow: var(--s-shadow-xs); }
:root[data-theme="dark"] .fm-btn--primary { color: #0d1220 !important; }
.fm-btn--primary:hover:not(:disabled) { background: var(--s-blue-ink); }
.fm-btn--accent { background: var(--s-blue-wash); border-color: var(--s-blue-wash-2); color: var(--s-blue) !important; }
.fm-btn--accent:hover { background: var(--s-blue-wash-2); }
.fm-btn--danger { background: var(--s-danger); color: #fff !important; }
.fm-iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--s-ink-2) !important; cursor: pointer; flex: none; }
.fm-iconbtn:hover { background: var(--s-paper-3); color: var(--s-ink) !important; }
.fm-iconbtn[aria-pressed="true"] { background: var(--s-blue-wash); color: var(--s-blue) !important; }
.fm-linkbtn { justify-self: start; text-align: left; background: none; border: 0; padding: 6px 0 0; color: var(--s-blue) !important; font-weight: 550; font-size: 13.5px; cursor: pointer; }
.fm-linkbtn:hover { text-decoration: underline; text-underline-offset: 2px; }
.fm :focus-visible, .fm-dialog :focus-visible, .fm-menu :focus-visible { outline: 2px solid var(--s-blue); outline-offset: 1px; }
.fm-list:focus-visible { outline: none; }

/* ─── Top bar ───────────────────────────────────────────────────────────── */

.fm-top { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; border-bottom: 1px solid var(--s-rule); background: var(--s-sheet); min-width: 0; }
.fm-top__menu { display: none; }
.fm-top__home { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; flex: none; }
.fm-top__home:hover { background: var(--s-paper-3); }
.fm-top__home > .fm-i { color: var(--s-ink-3); }
.fm-top__logo { display: inline-flex; }
.fm-top__logo svg { width: 24px; height: 24px; display: block; }
.fm-top__brand { font: 650 15px var(--s-display); letter-spacing: -.01em; }
.fm-crumbs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-left: 6px; border-left: 1px solid var(--s-rule); margin-left: 2px; }
.fm-crumbs::-webkit-scrollbar { display: none; }
.fm-crumbs__sep { color: var(--s-ink-3); width: 13px; height: 13px; opacity: .7; }
.fm-crumb { border: 0; background: none; padding: 5px 8px; border-radius: 7px; font-weight: 550; font-size: 14px; color: var(--s-ink-3) !important; white-space: nowrap; cursor: pointer; }
button.fm-crumb:hover { background: var(--s-paper-3); color: var(--s-ink) !important; }
.fm-crumb.is-current { color: var(--s-ink) !important; }
.fm-search { display: flex; align-items: center; gap: 8px; width: min(300px, 30vw); height: 36px; padding: 0 10px; border: 1px solid var(--s-rule); border-radius: 9px; background: var(--s-paper-2); color: var(--s-ink-3); flex: none; }
.fm-search:focus-within { border-color: var(--s-blue); background: var(--s-sheet); box-shadow: 0 0 0 3px var(--s-blue-wash); }
.fm-search__input { flex: 1; min-width: 0; border: 0; background: none; outline: none !important; font: inherit; color: var(--s-ink); }
.fm-search__input::placeholder { color: var(--s-ink-3); }
.fm-search:focus-within kbd { display: none; }
.fm-top__actions { display: flex; align-items: center; gap: 4px; flex: none; }
.fm-cmdk { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 9px; border: 1px solid var(--s-rule); border-radius: 9px; background: var(--s-sheet); color: var(--s-ink-2) !important; font-weight: 550; font-size: 13.5px; cursor: pointer; }
.fm-cmdk:hover { background: var(--s-paper-2); }
.fm-theme__sun { display: none; }
:root[data-theme="dark"] .fm-theme__sun { display: block; }
:root[data-theme="dark"] .fm-theme__moon { display: none; }
.fm-theme span { display: inline-flex; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */

.fm-side { display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); min-width: 0; overflow: hidden; min-height: 0; border-right: 1px solid var(--s-rule); background: var(--s-paper-2); }
.fm-side__add { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; }
.fm-side__add .fm-btn { justify-content: center; height: 36px; padding: 0 8px; }
.fm-side__add .fm-btn:only-child { grid-column: 1 / -1; }
.fm-side__scroll { overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.fm-side__title { margin: 14px 8px 6px; font: 650 11.5px var(--s-body); letter-spacing: .06em; text-transform: uppercase; color: var(--s-ink-3); }
.fm-side__empty { margin: 4px 8px; color: var(--s-ink-3); font-size: 13px; }
.fm-side__note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 12px 14px; border-top: 1px solid var(--s-rule); font-size: 12.5px; color: var(--s-ink-3); }
.fm-side__note .fm-i { color: var(--s-green); margin-top: 1px; }

.fm-tree__row { display: flex; align-items: center; border-radius: 7px; min-height: 30px; }
.fm-tree__row:hover { background: var(--s-paper-3); }
.fm-tree__row.is-active { background: var(--s-blue-wash); }
.fm-tree__row.is-active .fm-tree__name { color: var(--s-blue); font-weight: 600; }
.fm-tree__twist { display: grid; place-items: center; width: 18px; height: 26px; padding: 0; border: 0; background: none; color: var(--s-ink-3) !important; cursor: pointer; flex: none; }
.fm-tree__twist .fm-i { width: 12px; height: 12px; transition: transform .12s; }
.fm-tree__twist.is-open .fm-i { transform: rotate(90deg); }
.fm-tree__twist.is-leaf { visibility: hidden; }
.fm-tree__label { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; height: 30px; padding: 0 8px 0 2px; border: 0; background: none; text-align: left; cursor: pointer; }
.fm-tree__label > span:first-child { display: inline-flex; color: var(--s-ink-3); }
.fm-tree__label .fm-ico { --fm-ico: 18px; }
.fm-tree__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.fm-tree__count { font-size: 11.5px; color: var(--s-ink-3); font-variant-numeric: tabular-nums; }

.fm-meter { display: flex; gap: 2px; height: 8px; margin: 4px 8px 10px; border-radius: 99px; overflow: hidden; background: var(--s-paper-3); }
.fm-meter span { min-width: 3px; }
.fm-kind { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; border: 0; border-radius: 7px; background: none; text-align: left; font-size: 13.5px; cursor: pointer; }
.fm-kind:hover { background: var(--s-paper-3); }
.fm-kind.is-active { background: var(--s-blue-wash); color: var(--s-blue) !important; font-weight: 600; }
.fm-kind__dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.fm-kind__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-kind__size { font-size: 11.5px; color: var(--s-ink-3); }
.fm-kind__count { min-width: 22px; text-align: right; font-size: 11.5px; color: var(--s-ink-3); font-variant-numeric: tabular-nums; }

/* ─── Toolbar ───────────────────────────────────────────────────────────── */

.fm-main { container: fm-main / inline-size; }
.fm-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--s-rule); min-width: 0; }
.fm-bar__scroll { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.fm-bar__scroll::-webkit-scrollbar { display: none; }
.fm-bar__group { display: flex; align-items: center; gap: 2px; flex: none; }
.fm-bar__scroll .fm-bar__group + .fm-bar__group { padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--s-rule); }
@container fm-main (max-width: 900px) { .fm-btn--compact .fm-btn__label { display: none; } .fm-btn--compact { padding: 0 9px; } }
@container fm-main (max-width: 640px) { .fm-bar .fm-btn__label { display: none; } .fm-bar .fm-btn { padding: 0 8px; } .fm-bar { padding: 8px; gap: 4px; } .fm-bar__scroll { gap: 2px; } .fm-bar__scroll .fm-bar__group + .fm-bar__group { padding-left: 3px; margin-left: 1px; } .fm-seg { margin: 0; } }
.fm-seg { display: flex; padding: 2px; border-radius: 9px; background: var(--s-paper-3); margin: 0 4px; }
.fm-seg .fm-iconbtn { width: 30px; height: 28px; border-radius: 7px; }
.fm-seg .fm-iconbtn[aria-pressed="true"] { background: var(--s-sheet); color: var(--s-ink) !important; box-shadow: var(--s-shadow-xs); }

/* ─── File icons ────────────────────────────────────────────────────────── */

.fm-ico { --fm-ico: 22px; position: relative; display: inline-block; width: calc(var(--fm-ico) * .8); height: var(--fm-ico); flex: none; border-radius: calc(var(--fm-ico) * .12); background: var(--s-sheet); border: 1.5px solid var(--kc, var(--fm-c-other)); clip-path: polygon(0 0, 64% 0, 100% 28%, 100% 100%, 0 100%); }
.fm-ico::after { content: ""; position: absolute; top: -1.5px; right: -1.5px; width: 40%; height: 31%; background: var(--kc, var(--fm-c-other)); opacity: .55; border-bottom-left-radius: 2px; }
.fm-ico__ext { position: absolute; left: 0; right: 0; bottom: 12%; text-align: center; font: 700 calc(var(--fm-ico) * .26)/1 var(--s-body); letter-spacing: -.02em; color: var(--kc, var(--fm-c-other)); }
.fm-ico[data-kind="image"] { --kc: var(--fm-c-image); } .fm-ico[data-kind="pdf"] { --kc: var(--fm-c-pdf); }
.fm-ico[data-kind="document"] { --kc: var(--fm-c-doc); } .fm-ico[data-kind="sheet"] { --kc: var(--fm-c-sheet); }
.fm-ico[data-kind="slides"] { --kc: var(--fm-c-slides); } .fm-ico[data-kind="archive"] { --kc: var(--fm-c-archive); }
.fm-ico[data-kind="audio"] { --kc: var(--fm-c-audio); } .fm-ico[data-kind="video"] { --kc: var(--fm-c-video); }
.fm-ico[data-kind="code"] { --kc: var(--fm-c-code); } .fm-ico[data-kind="font"] { --kc: var(--fm-c-font); }
.fm-ico[data-kind="email"] { --kc: var(--fm-c-email); }
.fm-ico--folder { width: var(--fm-ico); height: var(--fm-ico); border: 0; background: none; clip-path: none; border-radius: 0; }
.fm-ico--folder::after { content: none; }
.fm-ico--folder svg { width: 100%; height: 100%; display: block; }
.fm-ico__back { fill: var(--fm-folder-back); }
.fm-ico__front { fill: var(--fm-folder); }

/* ─── List ──────────────────────────────────────────────────────────────── */

.fm-listwrap { position: relative; min-height: 0; overflow: hidden; }
.fm-list { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.fm-head, .fm-row { display: grid; grid-template-columns: 34px 30px minmax(0, 1fr) 92px 104px 132px; align-items: center; gap: 0 6px; padding: 0 12px 0 8px; }
.fm-head { position: sticky; top: 0; z-index: 2; height: 34px; background: var(--s-sheet); border-bottom: 1px solid var(--s-rule); }
.fm-th { display: inline-flex; align-items: center; gap: 4px; height: 100%; padding: 0; border: 0; background: none; font: 600 12px var(--s-body); color: var(--s-ink-3) !important; text-align: left; cursor: pointer; }
.fm-th:hover, .fm-th.is-sorted { color: var(--s-ink) !important; }
.fm-th__arrow { width: 12px; height: 12px; }
.fm-th--size { justify-content: flex-end; }
.fm-rows--list { padding: 4px 0 40px; }
.fm-row { height: var(--fm-row-h); margin: 0 6px; padding: 0 6px 0 2px; border-radius: 8px; cursor: default; user-select: none; -webkit-user-select: none; }
.fm-row:hover { background: var(--s-paper-2); }
.fm-row.is-selected { background: var(--s-blue-wash); }
.fm-row.is-selected + .fm-row.is-selected { border-top-left-radius: 0; border-top-right-radius: 0; }
.fm-row.is-selected:has(+ .fm-row.is-selected) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fm-row__icon { display: grid; place-items: center; }
.fm-row__name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.fm-row__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 520; font-size: 14px; }
.fm-row__path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--s-ink-3); flex: 0 2 auto; min-width: 40px; }
.fm-row__kind, .fm-row__size, .fm-row__date { font-size: 12.5px; color: var(--s-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-row__size { text-align: right; font-variant-numeric: tabular-nums; }
.fm-row.is-droptarget, .fm-tile.is-droptarget, .fm-tree__row.is-droptarget, .fm-crumb.is-droptarget { background: var(--s-blue-wash-2) !important; box-shadow: inset 0 0 0 2px var(--s-blue); }

.fm-check { display: grid; place-items: center; width: 18px; height: 18px; margin: 0 auto; border: 1.5px solid var(--s-rule-strong); border-radius: 5px; background: var(--s-sheet); color: transparent; cursor: pointer; opacity: 0; transition: opacity .1s; }
.fm-check .fm-i { width: 12px; height: 12px; }
.fm-check .fm-i svg { stroke-width: 2.6; }
.fm-row:hover .fm-check, .fm-tile:hover .fm-check, .fm-check--all, .is-selected > .fm-check { opacity: 1; }
.is-selected > .fm-check, .fm-check--all.is-on { background: var(--s-blue); border-color: var(--s-blue); color: #fff; }
@media (hover: none) { .fm-check { opacity: 1; } }

.fm-tag { display: inline-block; padding: 1px 6px; border-radius: 99px; font: 650 10.5px/1.5 var(--s-body); letter-spacing: .02em; background: var(--s-paper-3); color: var(--s-ink-3); flex: none; }
.fm-tag--new { background: var(--s-green-wash); color: var(--s-green); }
.fm-tag--warn { background: var(--s-orange-wash); color: var(--s-orange); }

/* Grid */
.fm-rows--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; padding: 14px 14px 48px; }
.fm-tile { position: relative; display: grid; gap: 4px; padding: 8px; border: 1px solid transparent; border-radius: 12px; cursor: default; user-select: none; -webkit-user-select: none; }
.fm-tile:hover { background: var(--s-paper-2); }
.fm-tile.is-selected { background: var(--s-blue-wash); border-color: var(--s-blue-wash-2); }
.fm-tile .fm-check { position: absolute; top: 14px; left: 14px; z-index: 1; margin: 0; }
.fm-tile__thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--s-paper-2); overflow: hidden; }
.fm-tile.is-selected .fm-tile__thumb, .fm-tile:hover .fm-tile__thumb { background: var(--s-paper-3); }
.fm-tile__thumb .fm-ico { --fm-ico: 52px; }
.fm-tile__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fm-tile[data-key^="f"] .fm-tile__thumb img { background: #fff; }
.fm-tile__name { padding: 2px 2px 0; font-weight: 550; font-size: 13px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fm-tile__meta { display: flex; align-items: center; gap: 6px; padding: 0 2px; font-size: 11.5px; color: var(--s-ink-3); }
.fm-more { height: 1px; grid-column: 1 / -1; }

.fm-blank { display: grid; justify-items: center; gap: 8px; max-width: 420px; margin: 0 auto; padding: 11vh 20px 40px; text-align: center; }
.fm-blank__icon { width: 46px; height: 46px; padding: 11px; border-radius: 13px; background: var(--s-blue-wash); color: var(--s-blue); }
.fm-blank h2 { font: 650 19px var(--s-display); letter-spacing: -.01em; margin: 6px 0 0; }
.fm-blank p { color: var(--s-ink-3); margin: 0; }
.fm-blank__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.fm-blank--drop { margin-top: 5vh; padding: 7vh 24px; border: 1.5px dashed var(--s-rule-strong); border-radius: var(--s-radius-xl); }

.fm-dropveil { position: absolute; inset: 8px; display: none; place-items: center; border: 2px dashed var(--s-blue); border-radius: 14px; background: color-mix(in srgb, var(--s-blue-wash) 88%, transparent); color: var(--s-blue); pointer-events: none; z-index: 5; }
.fm-dropveil div { display: grid; justify-items: center; gap: 8px; font-size: 16px; }
.fm-dropveil .fm-i { width: 30px; height: 30px; }
body.fm-dragging .fm-dropveil { display: grid; }

/* ─── Status bar ────────────────────────────────────────────────────────── */

.fm-status { display: flex; align-items: center; gap: 16px; height: 32px; padding: 0 14px; border-top: 1px solid var(--s-rule); background: var(--s-paper-2); font-size: 12.5px; color: var(--s-ink-3); min-width: 0; }
.fm-status__main { font-weight: 600; color: var(--s-ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fm-status__note { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fm-status__note .fm-i { color: var(--s-green); width: 14px; height: 14px; }
.fm-status__keys { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--s-ink-3) !important; font-size: 12px; cursor: pointer; white-space: nowrap; }
.fm-status__keys kbd:not(:first-child) { margin-left: 8px; }

/* ─── Details ───────────────────────────────────────────────────────────── */

.fm-details { display: grid; grid-template-rows: auto 1fr; min-height: 0; border-left: 1px solid var(--s-rule); background: var(--s-sheet); }
.fm-dhead { display: flex; align-items: flex-start; gap: 8px; padding: 14px 10px 12px 16px; border-bottom: 1px solid var(--s-rule); }
.fm-dhead__text { flex: 1; min-width: 0; }
.fm-dhead h2 { margin: 0; font: 650 15.5px/1.3 var(--s-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.fm-dhead p { margin: 2px 0 0; font-size: 12.5px; color: var(--s-ink-3); }
.fm-dhead__close { display: none; }
.fm-dbody { overflow-y: auto; padding: 14px 16px 28px; display: grid; grid-auto-rows: max-content; gap: 18px; align-content: start; min-height: 0; }
.fm-dsec { display: grid; gap: 8px; min-width: 0; }
.fm-dsec__title { margin: 0; font: 650 11.5px var(--s-body); letter-spacing: .06em; text-transform: uppercase; color: var(--s-ink-3); }
.fm-dsec__hint { margin: 0; font-size: 12px; color: var(--s-ink-3); }
.fm-dquick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fm-dquick .fm-btn { justify-content: center; }
.fm-dicon { display: grid; place-items: center; padding: 20px 0 6px; }
.fm-dicon .fm-ico { --fm-ico: 72px; }
.fm-dnote { display: flex; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--s-paper-2); color: var(--s-ink-3); font-size: 12.5px; }
.fm-dnote .fm-i { margin-top: 1px; }

.fm-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13px; }
.fm-facts dt { color: var(--s-ink-3); }
.fm-facts dd { margin: 0; overflow-wrap: anywhere; }

.fm-actions { display: grid; gap: 2px; margin: 0 -8px; }
.fm-action { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 5px 8px; border: 0; border-radius: 8px; background: none; text-align: left; font-weight: 520; font-size: 13.5px; cursor: pointer; }
.fm-action:hover { background: var(--s-paper-3); }
.fm-action > .fm-i:first-child { color: var(--s-blue); }
.fm-action.is-danger, .fm-action.is-danger > .fm-i:first-child { color: var(--s-danger) !important; }
.fm-action__label { flex: 1; min-width: 0; }
.fm-action__hint { font-size: 11.5px; color: var(--s-ink-3); font-weight: 450; text-align: right; }
.fm-action__ext, .fm-menu__ext { width: 13px; height: 13px; color: var(--s-ink-3); opacity: .8; }

.fm-breakdown ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.fm-breakdown li { display: grid; grid-template-columns: auto 1fr auto 70px; gap: 8px; align-items: center; }
.fm-breakdown .fm-meter { margin: 0 0 10px; }
.fm-breakdown__n, .fm-breakdown__size { color: var(--s-ink-3); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.fm-toplist { list-style: none; margin: 0 -8px; padding: 0; }
.fm-toplist button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 8px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; font-size: 13px; }
.fm-toplist button:hover { background: var(--s-paper-3); }
.fm-toplist .fm-ico { --fm-ico: 18px; }
.fm-toplist__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-toplist__size { color: var(--s-ink-3); font-size: 12px; }
.fm-warn { display: flex; gap: 8px; margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--s-orange-wash); color: var(--s-orange); font-size: 12.5px; }
.fm-warn .fm-i { margin-top: 1px; }

/* ─── Preview ───────────────────────────────────────────────────────────── */

.fm-preview { display: grid; place-items: center; min-height: 170px; max-height: 340px; border: 1px solid var(--s-rule); border-radius: 12px; background: var(--s-paper-2); overflow: hidden; position: relative; }
.fm-preview > * { max-width: 100%; }
.fm-pv-loading { color: var(--s-ink-3); font-size: 13px; padding: 24px; }
.fm-pv-img { max-width: 100%; max-height: 340px; object-fit: contain; display: block; background: repeating-conic-gradient(var(--s-paper-3) 0 25%, var(--s-sheet) 0 50%) 0 0 / 16px 16px; }
.fm-pv-media { width: 100%; max-height: 340px; background: #000; display: block; }
.fm-pv-audio { width: calc(100% - 24px); margin: 0 12px 14px; }
.fm-pv-empty { display: grid; justify-items: center; gap: 10px; padding: 26px 16px; text-align: center; color: var(--s-ink-3); font-size: 13px; }
.fm-pv-empty .fm-ico { --fm-ico: 58px; }
.fm-pv-empty p { margin: 0; }
.fm-pv-pages { display: grid; gap: 10px; justify-items: center; width: 100%; max-height: inherit; overflow: auto; padding: 12px; align-self: stretch; }
.fm-pv-page { max-width: 100%; height: auto; background: #fff; box-shadow: var(--s-shadow); border-radius: 2px; }
.fm-pv-text { align-self: stretch; justify-self: stretch; margin: 0; padding: 12px 14px; max-height: inherit; overflow: auto; font: 12px/1.55 var(--s-mono); color: var(--s-ink-2); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; background: var(--s-sheet); }
.fm-pv-text--prose { font: 13.5px/1.6 var(--s-body); }
.fm-pv-note { margin: 0; padding: 8px 12px; font-size: 12px; color: var(--s-ink-3); text-align: center; justify-self: stretch; }
.fm-pv-actions { padding: 0 12px 16px; }
.fm-pv-listhead { display: flex; align-items: center; gap: 10px; justify-self: stretch; padding: 10px 12px; border-bottom: 1px solid var(--s-rule); font-size: 13px; background: var(--s-sheet); }
.fm-pv-listhead span { color: var(--s-ink-3); flex: 1; }
.fm-pv-list { list-style: none; margin: 0; padding: 6px 0; align-self: stretch; justify-self: stretch; max-height: 250px; overflow: auto; font-size: 12.5px; background: var(--s-sheet); }
.fm-pv-list li { display: flex; gap: 10px; padding: 3px 12px; }
.fm-pv-list span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.fm-pv-list small { color: var(--s-ink-3); white-space: nowrap; }
.fm-pv-font { justify-self: stretch; padding: 16px; display: grid; gap: 8px; font-size: 16px; overflow-wrap: anywhere; background: var(--s-sheet); }
.fm-pv-font p { margin: 0; }
.fm-pv-font__big { font-size: 44px; line-height: 1.1; }
.fm-pv-table { align-self: stretch; justify-self: stretch; overflow: auto; background: var(--s-sheet); }
.fm-pv-table table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.fm-pv-table th, .fm-pv-table td { padding: 6px 12px; border-bottom: 1px solid var(--s-rule); text-align: left; white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.fm-pv-table th { position: sticky; top: 0; background: var(--s-paper-2); font-weight: 600; }

/* ─── Menus, toasts, tasks ──────────────────────────────────────────────── */

.fm-menu { position: fixed; z-index: 400; min-width: 220px; max-width: 340px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 5px; border: 1px solid var(--s-rule); border-radius: 11px; background: var(--s-sheet); box-shadow: var(--s-shadow-lift); font: 13.5px/1.4 var(--s-body); color: var(--s-ink); outline: none; }
.fm-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 5px 9px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; }
.fm-menu__item:hover:not(:disabled), .fm-menu__item:focus-visible { background: var(--s-blue-wash); outline: none; }
.fm-menu__item:disabled { opacity: .4; cursor: default; }
.fm-menu__item > .fm-i:first-child { color: var(--s-ink-3); }
.fm-menu__item.is-danger, .fm-menu__item.is-danger > .fm-i:first-child { color: var(--s-danger) !important; }
.fm-menu__label { flex: 1; }
.fm-menu__hint { font-size: 11.5px; color: var(--s-ink-3); }
.fm-menu__sep { height: 1px; margin: 5px 4px; background: var(--s-rule); }
.fm-menu__heading { padding: 7px 9px 3px; font: 650 11px var(--s-body); letter-spacing: .06em; text-transform: uppercase; color: var(--s-ink-3); }

.fm-toasts { position: fixed; left: 50%; bottom: 46px; z-index: 600; display: grid; gap: 8px; justify-items: center; transform: translateX(-50%); pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.fm-toast { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 11px; background: #1c2130; color: #fff; font: 520 13.5px/1.4 var(--s-body); box-shadow: var(--s-shadow-lift); pointer-events: auto; opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; }
:root[data-theme="dark"] .fm-toast { background: #eceef2; color: #14171d; }
.fm-toast.is-in { opacity: 1; transform: none; }
.fm-toast--success::before { content: "✓"; font-weight: 800; color: #5fd39a; }
:root[data-theme="dark"] .fm-toast--success::before { color: #12704a; }
.fm-toast--error::before { content: "!"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ef6a56; color: #fff; font-weight: 800; font-size: 12px; flex: none; }
.fm-toast__action { border: 0; background: none; padding: 0; color: #9db8ff !important; font: inherit; font-weight: 650; cursor: pointer; }
:root[data-theme="dark"] .fm-toast__action { color: #2557d6 !important; }

.fm-task { position: fixed; right: 16px; bottom: 46px; z-index: 590; width: min(340px, calc(100vw - 32px)); padding: 12px 12px 14px 14px; border: 1px solid var(--s-rule); border-radius: 12px; background: var(--s-sheet); box-shadow: var(--s-shadow-lift); font: 13.5px var(--s-body); color: var(--s-ink); }
.fm-task__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fm-task__label { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-task__pct { color: var(--s-ink-3); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.fm-task .fm-iconbtn { width: 24px; height: 24px; }
.fm-task__track { height: 6px; border-radius: 99px; background: var(--s-paper-3); overflow: hidden; }
.fm-task__bar { height: 100%; width: 0; border-radius: 99px; background: var(--s-blue); transition: width .15s; }
.fm-task__bar.is-indeterminate { width: 35%; animation: fm-slide 1.1s ease-in-out infinite; }
@keyframes fm-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }

/* ─── Dialogs ───────────────────────────────────────────────────────────── */

.fm-dialog { padding: 0; border: 1px solid var(--s-rule); border-radius: 16px; background: var(--s-sheet); color: var(--s-ink); box-shadow: var(--s-shadow-lift); font: 14px/1.5 var(--s-body); width: min(var(--w, 520px), calc(100vw - 24px)); max-height: min(86vh, 860px); overflow: hidden; }
.fm-dialog[open] { display: flex; flex-direction: column; }
.fm-dialog::backdrop { background: rgba(16, 20, 30, .42); backdrop-filter: blur(2px); }
.fm-dialog--s { --w: 440px; }
.fm-dialog--m { --w: 560px; }
.fm-dialog--l { --w: 820px; }
.fm-dialog__head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 20px; border-bottom: 1px solid var(--s-rule); flex: none; }
.fm-dialog__head h2 { flex: 1; min-width: 0; margin: 0; font: 650 16.5px var(--s-display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-dialog__body { padding: 18px 20px; overflow-y: auto; min-height: 0; display: grid; grid-auto-rows: max-content; gap: 14px; align-content: start; }
.fm-dialog__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--s-rule); background: var(--s-paper-2); flex: none; }
.fm-dialog__foot .fm-btn { height: 36px; padding: 0 14px; }
.fm-dialog__foot .fm-btn--ghost { border-color: var(--s-rule-strong); background: var(--s-sheet); }
.fm-dialog__text { margin: 0; color: var(--s-ink-2); }

.fm-form { display: grid; gap: 14px; align-content: start; }
.fm-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fm-field { display: grid; gap: 5px; min-width: 0; }
.fm-field__label { font-weight: 600; font-size: 13px; }
.fm-field__hint { margin: 0; font-size: 12.5px; color: var(--s-ink-3); }
.fm-input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--s-rule-strong); border-radius: 9px; background: var(--s-sheet); color: var(--s-ink); font: inherit; }
.fm-input:focus { outline: none; border-color: var(--s-blue); box-shadow: 0 0 0 3px var(--s-blue-wash); }
.fm-opt { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.fm-opt input { width: 16px; height: 16px; accent-color: var(--s-blue); margin: 0; }
.fm-rangewrap { display: flex; align-items: center; gap: 12px; }
.fm-range { flex: 1; accent-color: var(--s-blue); }
.fm-rangewrap output { min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; color: var(--s-ink-2); }
.fm-error { margin: 0; color: var(--s-danger); font-weight: 550; font-size: 13px; }

.fm-rename { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; }
.fm-rename__preview { display: grid; grid-template-rows: auto 1fr; gap: 8px; min-height: 0; padding: 12px; border-radius: 12px; background: var(--s-paper-2); border: 1px solid var(--s-rule); }
.fm-rename__summary { margin: 0; font-weight: 600; font-size: 13px; }
.fm-rename__list { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; display: grid; gap: 2px; font-size: 12.5px; align-content: start; }
.fm-rename__list li { display: grid; grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr); gap: 6px; align-items: center; padding: 3px 0; }
.fm-rename__list .fm-i { width: 12px; height: 12px; color: var(--s-ink-3); }
.fm-rename__old { color: var(--s-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-rename__new { font-weight: 600; color: var(--s-green); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-same .fm-rename__new { color: var(--s-ink-3); font-weight: 450; }

.fm-folderpick { list-style: none; margin: -6px -8px; padding: 0; max-height: 46vh; overflow: auto; }
.fm-folderpick button { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; padding-right: 10px; }
.fm-folderpick button:hover:not(:disabled) { background: var(--s-blue-wash); }
.fm-folderpick button:disabled { opacity: .4; cursor: default; }
.fm-folderpick .fm-ico { --fm-ico: 18px; }
.fm-folderpick span:first-child { display: inline-flex; }

.fm-statrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fm-statrow div { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--s-rule); border-radius: 12px; background: var(--s-paper-2); }
.fm-statrow strong { font: 700 20px var(--s-display); letter-spacing: -.02em; }
.fm-statrow span { font-size: 12.5px; color: var(--s-ink-3); }
.fm-dupes { display: grid; gap: 10px; }
.fm-dupes__group { border: 1px solid var(--s-rule); border-radius: 11px; overflow: hidden; }
.fm-dupes__group header { display: flex; justify-content: space-between; padding: 7px 12px; background: var(--s-paper-2); font-size: 12.5px; font-weight: 600; color: var(--s-ink-2); }
.fm-dupes__group ul { list-style: none; margin: 0; padding: 4px 0; }
.fm-dupes__group li { display: flex; align-items: center; gap: 9px; padding: 5px 12px; font-size: 13px; }
.fm-dupes__group .fm-ico { --fm-ico: 18px; }
.fm-dupes__group li > span:first-child { display: inline-flex; }
.fm-dupes__path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fm-sums { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fm-sums li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 8px 6px 8px 12px; border: 1px solid var(--s-rule); border-radius: 10px; }
.fm-sums li.is-match { border-color: var(--s-green); background: var(--s-green-wash); }
.fm-sums__name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-sums code { grid-column: 1; font: 11.5px/1.5 var(--s-mono); color: var(--s-ink-2); overflow-wrap: anywhere; }
.fm-sums .fm-iconbtn { grid-column: 2; grid-row: 1 / span 2; }
.fm-sums__wait { color: var(--s-ink-3); border-style: dashed !important; }
.fm-sums__verdict { margin: 0; padding: 9px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; }
.fm-sums__verdict.is-ok { background: var(--s-green-wash); color: var(--s-green); }
.fm-sums__verdict.is-bad { background: var(--s-danger-wash); color: var(--s-danger); }

.fm-keys { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; align-items: center; }
.fm-keys dt { text-align: right; }
.fm-keys dd { margin: 0; color: var(--s-ink-2); }

/* Quick Look */
.fm-ql { --w: 1080px; height: min(90vh, 900px); max-height: 90vh; }
.fm-ql__title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.fm-ql__title h2 { flex: 0 1 auto; }
.fm-ql__meta, .fm-ql__count { font-size: 12.5px; color: var(--s-ink-3); white-space: nowrap; }
.fm-ql__tools { display: flex; gap: 2px; }
.fm-ql.is-single .fm-ql__prev, .fm-ql.is-single .fm-ql__next { display: none; }
.fm-ql__stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; background: var(--s-paper-2); }
.fm-ql__stage > * { max-width: 100%; }
.fm-ql__stage .fm-pv-img { max-height: 100%; max-width: 100%; }
.fm-ql__stage .fm-pv-media { max-height: 100%; height: 100%; }
.fm-ql__stage .fm-pv-pages { padding: 20px; gap: 16px; align-self: start; }
.fm-ql__stage .fm-pv-page { max-width: min(100%, 900px); }
.fm-ql__stage .fm-pv-text { align-self: stretch; padding: 20px 24px; font-size: 13px; max-height: none; }
.fm-ql__stage .fm-pv-text--prose { font-size: 15px; max-width: 76ch; justify-self: center; }
.fm-ql__stage .fm-pv-list { max-height: none; align-self: start; }
.fm-ql__stage .fm-pv-table { align-self: start; max-height: 100%; }
.fm-ql__stage .fm-pv-font { align-self: start; font-size: 22px; padding: 32px; }
.fm-ql__stage .fm-pv-font__big { font-size: 84px; }
.fm-ql__stage .fm-pv-empty .fm-ico { --fm-ico: 96px; }

/* Command palette */
.fm-palette { --w: 620px; margin-top: 12vh; max-height: 70vh; border-radius: 14px; }
.fm-palette__head { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--s-rule); color: var(--s-ink-3); flex: none; }
.fm-palette__input { flex: 1; min-width: 0; height: 50px; border: 0; background: none; outline: none !important; font: 16px var(--s-body); color: var(--s-ink); }
.fm-palette__list { overflow-y: auto; padding: 6px; min-height: 0; }
.fm-palette__group { padding: 9px 10px 4px; font: 650 11px var(--s-body); letter-spacing: .06em; text-transform: uppercase; color: var(--s-ink-3); }
.fm-palette__item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.fm-palette__item.is-active { background: var(--s-blue-wash); }
.fm-palette__item > .fm-i:first-child { color: var(--s-ink-3); }
.fm-palette__item.is-active > .fm-i:first-child { color: var(--s-blue); }
.fm-palette__label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 520; }
.fm-palette__hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--s-ink-3); }
.fm-palette__item kbd { margin-left: auto; }
.fm-palette__none { margin: 0; padding: 22px; text-align: center; color: var(--s-ink-3); }

/* ─── Narrow screens ────────────────────────────────────────────────────── */

@media (max-width: 1099px) {
  .fm.has-details .fm-body, .fm-body { grid-template-columns: 232px minmax(0, 1fr); }
  .fm-details { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(380px, 100vw); box-shadow: var(--s-shadow-lift); transform: translateX(105%); transition: transform .2s; }
  .fm.is-details-open .fm-details { transform: none; }
  .fm.is-details-open .fm-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(16, 20, 30, .35); }
  .fm-dhead__close { display: inline-grid; }
}
@media (max-width: 860px) {
  .fm-body, .fm.has-details .fm-body { grid-template-columns: minmax(0, 1fr); }
  .fm-top__menu { display: inline-grid; }
  .fm-side { position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(290px, 86vw); box-shadow: var(--s-shadow-lift); transform: translateX(-105%); transition: transform .2s; }
  .fm.is-side-open .fm-side { transform: none; }
  .fm.is-side-open .fm-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(16, 20, 30, .35); }
  .fm-top__brand, .fm-cmdk > span:not(.fm-i), .fm-cmdk kbd, .fm-search kbd, .fm-status__note, .fm-status__keys { display: none; }
  .fm-top { gap: 6px; padding: 0 8px; }
  .fm-search { min-width: 0; }
  .fm-cmdk { padding: 0; width: 36px; justify-content: center; border: 0; }
  .fm-top__home { padding-right: 4px; }
  .fm-search { flex: 1; width: auto; }
  .fm-crumbs { display: none; }
  .fm-head, .fm-row { grid-template-columns: 30px 30px minmax(0, 1fr) 84px; }
  .fm-th--kind, .fm-th--date, .fm-row__kind, .fm-row__date { display: none; }
  .fm-hide-s { display: none !important; }
  .fm-rename { grid-template-columns: 1fr; }
  .fm-form__row { grid-template-columns: 1fr; }
  .fm-statrow { grid-template-columns: 1fr; }
  .fm-rows--grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 10px; }
  .fm-status { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .fm *, .fm-toast, .fm-task__bar { transition: none !important; animation: none !important; }
}

.fm-menu:focus, .fm-menu:focus-visible { outline: 0; }
.fm-palette__item .fm-menu__ext { margin-left: auto; }
.fm-palette__item .fm-menu__ext + kbd { margin-left: 0; }

/* ─── Tool dialogs (search, compare, treemap, strip, photosort, editor) ─── */

/* compare */
.fm-compare { display: flex; flex-direction: column; gap: 14px; }
.fm-compare__out { display: flex; flex-direction: column; gap: 10px; }
.fm-compare__stats { grid-template-columns: repeat(4, 1fr); }
.fm-compare__list { border: 1px solid var(--s-rule); border-radius: var(--s-radius-lg); background: var(--s-sheet); }
.fm-compare__list > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; cursor: pointer; font-family: var(--s-body); color: var(--s-ink); font-weight: 600; }
.fm-compare__list ul { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; border-top: 1px solid var(--s-rule); }
.fm-compare__list li + li { border-top: 1px solid var(--s-rule); }
.fm-compare__row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 12px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--s-ink); font: inherit; }
.fm-compare__row:hover, .fm-compare__row:focus-visible { background: var(--s-paper-2); }
.fm-compare__path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--s-mono); font-size: 12.5px; }
.fm-compare__size { color: var(--s-ink-3); font-size: 12px; white-space: nowrap; }
.fm-compare__empty, .fm-compare__more { margin: 0; padding: 10px 12px; color: var(--s-ink-3); font-size: 13px; }
@media (max-width: 600px) { .fm-compare__stats { grid-template-columns: repeat(2, 1fr); } }

/* editor */
.fm-editor .fm-dialog__body { display: flex; flex-direction: column; gap: 8px; min-height: 70vh; }
.fm-editor__area { flex: 1 1 auto; min-height: 60vh; width: 100%; box-sizing: border-box; resize: none; padding: 12px; font-family: var(--s-mono); font-size: 13px; line-height: 1.55; tab-size: 2; color: var(--s-ink); background: var(--s-sheet); border: 1px solid var(--s-rule-strong); border-radius: var(--s-radius-lg); }
.fm-editor__area:focus { outline: 2px solid var(--s-blue); outline-offset: -1px; }
.fm-editor__status { display: flex; align-items: center; gap: 8px; color: var(--s-ink-3); font-size: 12px; }

/* photosort */
.fm-photosort__preview { margin-top: 16px; }
.fm-photosort__summary { margin: 0 0 8px; color: var(--s-ink-2); font-size: 13px; }
.fm-photosort__list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; border: 1px solid var(--s-rule); border-radius: var(--s-radius-lg); background: var(--s-paper-2); }
.fm-photosort__list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--s-rule); font-family: var(--s-mono); font-size: 12px; }
.fm-photosort__list li:last-child { border-bottom: 0; }
.fm-photosort__list li.is-same { color: var(--s-ink-3); }
.fm-photosort__list .fm-i { flex: none; color: var(--s-ink-3); }
.fm-photosort__old, .fm-photosort__new { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-photosort__old { flex: 1 1 0; color: var(--s-ink-2); }
.fm-photosort__new { flex: 1 1 0; color: var(--s-ink); }
.fm-photosort__list .fm-tag { flex: none; margin-left: auto; }

/* search */
.fm-csearch__body { display: flex; flex-direction: column; gap: 12px; min-height: 320px; }
.fm-csearch__bar { display: flex; gap: 8px; align-items: center; }
.fm-csearch__bar .fm-input { flex: 1; min-width: 0; }
.fm-csearch__opts { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.fm-csearch__status { margin: 0; font-size: 13px; color: var(--s-ink-2); }
.fm-csearch__status--warn { color: var(--s-danger); }
.fm-csearch__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fm-csearch__hit { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: var(--s-ink); background: var(--s-sheet); border: 1px solid var(--s-rule); border-radius: var(--s-radius-lg); cursor: pointer; }
.fm-csearch__hit:hover, .fm-csearch__hit:focus-visible { background: var(--s-blue-wash); border-color: var(--s-blue); }
.fm-csearch__head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fm-csearch__icon { display: inline-flex; flex: none; }
.fm-csearch__path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fm-csearch__snippet { margin: 0; font-family: var(--s-mono); font-size: 12px; line-height: 1.5; color: var(--s-ink-2); overflow-wrap: anywhere; }
.fm-csearch__snippet mark { background: var(--s-orange-wash); color: var(--s-ink); border-radius: 2px; padding: 0 1px; }
.fm-csearch__note { font-size: 13px; color: var(--s-ink-3); }

/* strip */
.fm-strip__modes { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }

/* treemap */
.fm-treemap { display: flex; flex-direction: column; gap: 10px; }
.fm-treemap__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.fm-treemap__crumb { background: none; border: 0; padding: 2px 6px; border-radius: 6px; color: var(--s-blue); font: inherit; cursor: pointer; }
.fm-treemap__crumb:hover:not(:disabled) { background: var(--s-blue-wash); }
.fm-treemap__crumb:disabled { color: var(--s-ink); font-weight: 600; cursor: default; }
.fm-treemap__sep { color: var(--s-ink-3); }
.fm-treemap__map { position: relative; width: 100%; overflow: hidden; background: var(--s-paper-2); border: 1px solid var(--s-rule); border-radius: var(--s-radius-lg); }
.fm-treemap__tile { position: absolute; box-sizing: border-box; margin: 1px; padding: 5px 7px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; overflow: hidden; text-align: left; cursor: pointer; font-family: var(--s-body); font-size: 12px; color: var(--s-ink); border: 1px solid var(--s-rule); border-left: 3px solid var(--s-rule-strong); border-radius: 4px; background: var(--s-sheet); }
.fm-treemap__tile:hover { border-color: var(--s-blue); }
.fm-treemap__tile:focus-visible { outline: 2px solid var(--s-blue); outline-offset: -2px; z-index: 1; }
.fm-treemap__tile--folder { background: var(--s-paper-3); font-weight: 600; }
.fm-treemap__tile--other { background: var(--s-paper-2); color: var(--s-ink-2); border-style: dashed; }
.fm-treemap__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-treemap__size { color: var(--s-ink-3); font-family: var(--s-mono); font-size: 11px; font-weight: 400; }
.fm-treemap__info { margin: 0; color: var(--s-ink-2); font-size: 13px; }

/* zipcrypt */

