:root {
  --fm-ink: var(--sv-color-text);
  --fm-muted: var(--sv-color-text-muted);
  --fm-line: var(--sv-color-border);
  --fm-paper: var(--sv-color-canvas);
  --fm-panel: var(--sv-color-surface);
  /* Shared semantic palette. */
  --fm-accent: var(--sv-color-brand);
  --fm-accent-rgb: var(--sv-brand-rgb);
  --fm-shadow: var(--sv-shadow-panel);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body.has-app-rail {
  padding-left: var(--app-rail-width, 64px);
  color: var(--fm-ink);
  background:
    radial-gradient(circle at 18% -8%, rgba(var(--fm-accent-rgb), 0.12), transparent 32rem),
    linear-gradient(130deg, #faf6ee 0%, #eee8dc 100%);
  font-family: var(--sv-font-sans);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: linear-gradient(rgba(32, 28, 22, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(32, 28, 22, .18) 1px, transparent 1px);
  background-size: 38px 38px;
}

.fm-shell { position: relative; z-index: 1; width: min(1760px, 100%); height: 100dvh; margin: 0 auto; padding: 16px 28px 16px; display: flex; flex-direction: column; overflow: hidden; }
.fm-header { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 12px; }
.fm-kicker { margin: 0 0 4px; color: var(--fm-accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.fm-heading h1 { margin: 0; font-family: inherit; font-size: clamp(22px, 1.8vw, 26px); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.fm-heading > p:last-child { margin: 6px 0 0; color: var(--fm-muted); font-size: 12px; font-weight: 400; line-height: 1.5; max-width: 42em; }
.fm-header-actions { display: flex; gap: 10px; align-items: center; }
.fm-link-button, .fm-upload-button, .fm-primary-action, .fm-secondary-action, .fm-danger-action { min-height: 42px; border-radius: 12px; padding: 0 18px; border: 1px solid var(--fm-line); font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.fm-link-button { color: var(--fm-ink); background: rgba(255,255,255,.45); }
.fm-upload-button, .fm-primary-action { border-color: #1d1c1a; color: var(--sv-color-text); background: var(--sv-color-surface-elevated); box-shadow: 0 10px 24px rgba(29,28,26,.16); }
.fm-upload-button span { font-size: 19px; font-weight: 400; line-height: 0; }
.fm-link-button:hover, .fm-upload-button:hover, .fm-primary-action:hover { transform: translateY(-1px); }
.fm-link-button:active, .fm-upload-button:active, .fm-primary-action:active, .fm-secondary-action:active, .fm-danger-action:active { transform: translateY(1px) scale(.99); }
.fm-link-button:focus-visible, .fm-upload-button:focus-visible, .fm-primary-action:focus-visible, .fm-secondary-action:focus-visible, .fm-danger-action:focus-visible, .fm-nav-item:focus-visible { outline: 3px solid rgba(var(--fm-accent-rgb), .24); outline-offset: 2px; }

.fm-stats { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px; margin-bottom: 10px; }
.fm-stat { position: relative; min-height: 78px; padding: 12px 16px; border: 1px solid var(--fm-line); border-radius: 16px; background: var(--sv-color-surface); overflow: hidden; }
.fm-stat::before { content: ""; position: absolute; width: 72px; height: 72px; border: 1px solid rgba(var(--fm-accent-rgb),.16); border-radius: 50%; right: -22px; top: -25px; }
.fm-stat span, .fm-stat small { display: block; color: var(--fm-muted); font-size: 11px; font-weight: 700; }
.fm-stat strong { display: block; margin: 5px 0 4px; font-family: var(--sv-font-sans); font-size: 24px; line-height: 1; }
.fm-stat-total { color: var(--sv-color-text); background: var(--sv-color-surface-hover); border-color: #26231e; }
.fm-stat-total span, .fm-stat-total small { color: var(--sv-color-text-muted); }

.fm-index-policy { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 10px; padding: 9px 14px; border: 1px solid rgba(var(--fm-accent-rgb), .22); border-radius: 14px; background: var(--sv-color-surface); }
.fm-index-policy > div:first-child { display: flex; align-items: center; gap: 14px; }
.fm-policy-mark { flex: 0 0 auto; padding: 7px 9px; color: var(--fm-accent); background: rgba(var(--fm-accent-rgb), .1); font-family: var(--sv-font-mono); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.fm-index-policy strong, .fm-index-policy p { display: block; }
.fm-index-policy strong { font-size: 13px; }
.fm-index-policy p { max-width: 760px; margin: 4px 0 0; color: var(--fm-muted); font-size: 11px; line-height: 1.6; }
.fm-policy-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.fm-policy-actions a, .fm-policy-actions button { min-height: 36px; padding: 0 13px; border: 1px solid var(--fm-line); border-radius: 10px; color: var(--fm-ink); background: transparent; font: inherit; font-size: 11px; font-weight: 750; text-decoration: none; cursor: pointer; }
.fm-policy-actions a, .fm-policy-actions .fm-policy-primary { display: inline-flex; align-items: center; color: var(--sv-color-text); background: var(--sv-color-surface-hover); }

.fm-workspace { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(190px, .45fr) minmax(520px, 1.35fr) minmax(360px, .8fr); height: auto; border: 1px solid var(--fm-line); border-radius: 24px; background: var(--fm-panel); box-shadow: var(--fm-shadow); overflow: hidden; }
.fm-navigation { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 12px 14px; border-right: 1px solid var(--fm-line); background: rgba(238,232,220,.42); overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
.fm-nav-group { flex: 0 0 auto; padding-top: 2px; }
.fm-nav-group + .fm-nav-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(49, 45, 39, 0.08); }
.fm-nav-label { display: block; margin: 0 10px 8px; color: var(--sv-color-text-muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; line-height: 1.3; }
.fm-nav-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 2px; padding: 0 4px 0 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.fm-nav-toggle .fm-nav-label { margin: 0 5px 0 10px; }
.fm-nav-toggle small { flex: 0 0 auto; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sv-color-text-muted); font-size: 10px; font-weight: 400; letter-spacing: 0; }
.fm-nav-toggle::after { content: "▾"; flex: 0 0 auto; margin-right: 6px; color: var(--sv-color-text-muted); font-size: 10px; font-weight: 400; transition: transform .18s ease; }
.fm-nav-group.is-collapsed .fm-nav-toggle::after { transform: rotate(-90deg); }
.fm-nav-group.is-collapsed .fm-nav-stack[hidden] { display: none !important; }
.fm-nav-note { margin: -2px 10px 8px; color: var(--sv-color-text-muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.fm-nav-stack { display: grid; gap: 1px; }
.fm-nav-item { width: 100%; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px; border: 0; border-radius: 8px; color: #3f3b36; background: transparent; font: inherit; font-size: 12.5px; font-weight: 400; line-height: 1.35; text-align: left; cursor: pointer; transition: color .18s ease, background .18s ease; }
.fm-nav-item > span { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-nav-item > b { flex: 0 0 auto; }
.fm-nav-item:hover { color: var(--fm-ink); background: rgba(255,255,255,.55); }
.fm-nav-item.is-active { color: var(--fm-ink); background: var(--sv-color-surface); box-shadow: inset 2px 0 0 var(--fm-ink); font-weight: 500; }
.fm-nav-item b { color: var(--sv-color-text-muted); font-family: var(--sv-font-mono); font-size: 10px; font-weight: 400; font-variant-numeric: tabular-nums; }
.fm-nav-dates { flex: 0 0 auto; }
.fm-nav-dates .fm-nav-stack { max-height: none; overflow: visible; }
.fm-nav-foot { flex: 0 0 auto; margin-top: 18px; padding: 14px 9px 4px; border-top: 1px solid var(--fm-line); background: rgba(238,232,220,.92); }
.fm-nav-foot > span { display: block; width: 18px; height: 1px; margin-bottom: 10px; background: rgba(29,28,26,.35); }
.fm-nav-foot p { margin: 0; color: var(--fm-muted); font-size: 11px; font-weight: 400; line-height: 1.65; }
.fm-nav-foot a { display: inline-block; margin-top: 9px; color: var(--fm-ink); font-size: 11px; font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(29,28,26,.22); }
.fm-coach { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--fm-line); background: rgba(29,28,26,.035); }
.fm-coach[hidden] { display: none !important; }
.fm-coach strong { display: block; font-size: 13px; font-weight: 600; }
.fm-coach p { margin: 5px 0 0; max-width: 640px; color: var(--fm-muted); font-size: 11px; font-weight: 400; line-height: 1.65; }
.fm-coach-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.fm-coach-actions button { min-height: 34px; padding: 0 12px; border: 1px solid var(--fm-line); border-radius: 10px; color: var(--fm-ink); background: var(--sv-color-surface); font: inherit; font-size: 11px; font-weight: 500; cursor: pointer; }
.fm-coach-actions button:last-child { border-color: #1d1c1a; color: var(--sv-color-text); background: var(--sv-color-surface-elevated); }
.fm-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(130px, 180px) auto; gap: 9px; padding: 16px; border-bottom: 1px solid var(--fm-line); align-items: center; }
.fm-search { position: relative; }
.fm-search svg { position: absolute; left: 13px; top: 12px; width: 17px; height: 17px; fill: none; stroke: var(--fm-muted); stroke-width: 1.8; }
.fm-search input, .fm-toolbar select { width: 100%; height: 42px; border: 1px solid transparent; border-radius: 13px; outline: none; color: var(--fm-ink); background: rgba(29,28,26,.055); font: inherit; font-size: 13px; }
.fm-search input { padding: 0 14px 0 40px; }
.fm-toolbar select { padding: 0 12px; }
.fm-search input:focus, .fm-toolbar select:focus { border-color: rgba(var(--fm-accent-rgb),.42); background: var(--sv-color-surface); }
.fm-batch-toggle { height: 42px; border-radius: 12px; border: 1px solid var(--fm-line); padding: 0 14px; background: #fff; color: var(--fm-ink); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.fm-batch-toggle.is-active { border-color: rgba(var(--fm-accent-rgb),.45); background: rgba(var(--fm-accent-rgb),.1); color: var(--fm-accent); }
.fm-batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 16px; border-bottom: 1px solid var(--fm-line); background: rgba(var(--fm-accent-rgb),.06); }
.fm-batch-bar[hidden] { display: none !important; }
.fm-batch-select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--fm-ink); font-size: 12px; font-weight: 700; cursor: pointer; }
.fm-batch-select-all input { width: 15px; height: 15px; accent-color: var(--fm-accent); }
.fm-batch-bar #fmBatchCount { color: var(--fm-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fm-batch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.fm-batch-actions .fm-secondary-action, .fm-batch-actions .fm-danger-action { min-height: 36px; padding: 0 12px; font-size: 12px; }
.fm-batch-actions button:disabled { opacity: .45; cursor: not-allowed; }
.fm-ledger { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--fm-line); overflow: hidden; }
.fm-ledger-head { display: grid; grid-template-columns: minmax(240px, 1.5fr) minmax(150px, .8fr) 120px 90px; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--fm-line); color: var(--fm-muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
body.fm-batch-on .fm-ledger-head { grid-template-columns: 28px minmax(220px, 1.5fr) minmax(140px, .8fr) 120px 90px; padding-left: 14px; }
.fm-file-list { min-height: 0; flex: 1 1 auto; overflow: auto; scrollbar-width: thin; }
.fm-file-list::-webkit-scrollbar { width: 8px; }
.fm-file-list::-webkit-scrollbar-thumb { background: rgba(49, 45, 39, 0.22); border-radius: 999px; }
.fm-file-list::-webkit-scrollbar-track { background: transparent; }
.fm-file-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: stretch; width: 100%; min-height: 76px; padding: 0; border: 0; border-bottom: 1px solid rgba(49,45,39,.08); color: inherit; background: transparent; text-align: left; transition: background .18s ease; }
body.fm-batch-on .fm-file-row { grid-template-columns: 36px minmax(0, 1fr); }
.fm-file-row:hover { background: rgba(var(--fm-accent-rgb),.055); }
.fm-file-row.is-active { background: rgba(var(--fm-accent-rgb),.1); box-shadow: inset 3px 0 0 var(--fm-accent); }
.fm-file-row.is-checked { background: rgba(154,64,56,.06); }
.fm-check { display: grid; place-items: center; padding-left: 10px; cursor: pointer; }
.fm-check input { width: 15px; height: 15px; accent-color: var(--fm-accent); }
.fm-file-main { display: grid; grid-template-columns: minmax(240px, 1.5fr) minmax(150px, .8fr) 120px 90px; gap: 14px; align-items: center; width: 100%; min-height: 76px; padding: 10px 18px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; font: inherit; }
body.fm-batch-on .fm-file-main { padding-left: 8px; }
.fm-file-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.fm-mini-icon { flex: 0 0 42px; height: 50px; border-radius: 8px 12px 8px 8px; display: grid; place-items: end center; padding-bottom: 7px; color: var(--sv-color-text); background: var(--sv-color-surface-hover); font-family: var(--sv-font-sans); font-size: 10px; font-weight: 800; letter-spacing: .08em; box-shadow: 0 7px 16px rgba(39,34,28,.13); clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%); }
.fm-mini-icon[data-kind="pdf"] { background: #a94b3c; }
.fm-mini-icon[data-kind="word"] { background: #385f78; }
.fm-mini-icon[data-kind="slides"] { background: #ad6535; }
.fm-mini-icon[data-kind="sheets"] { background: #5c6a5e; }
.fm-mini-icon[data-kind="bills"] { background: #8a6a36; }
.fm-file-name { min-width: 0; }
.fm-file-name strong, .fm-file-name small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fm-file-name strong { font-size: 13px; font-weight: 500; }
.fm-file-name small { margin-top: 5px; color: var(--fm-muted); font-size: 11px; font-weight: 400; }
.fm-link-cell strong, .fm-link-cell small { display: block; }
.fm-link-cell strong { font-size: 12px; font-weight: 500; }
.fm-link-cell small { margin-top: 4px; color: var(--fm-muted); font-size: 10px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-date-cell { color: var(--fm-muted); font-size: 11px; font-weight: 400; }
.fm-status { justify-self: start; border-radius: 999px; padding: 6px 9px; font-size: 10px; font-weight: 500; }
.fm-status.ready { color: var(--sv-color-text-faint); background: var(--sv-color-surface-strong); }
.fm-status.processing { color: #79602c; background: #f3ead2; }
.fm-status.failed { color: #9a4038; background: #f5dfdb; }
.fm-status.indexed { color: var(--sv-color-text-faint); background: var(--sv-color-surface-strong); }
.fm-list-empty { padding: 70px 24px; text-align: center; color: var(--fm-muted); }
.fm-list-empty strong, .fm-list-empty p { display: block; }
.fm-list-empty p { max-width: 420px; margin: 8px auto; line-height: 1.7; }
.fm-list-empty a { color: var(--fm-accent); text-decoration: none; font-weight: 750; }
.fm-list-footer { display: flex; justify-content: space-between; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--fm-line); color: var(--fm-muted); font-size: 11px; }
.fm-list-footer span:first-child { color: var(--fm-ink); font-family: var(--sv-font-mono); font-variant-numeric: tabular-nums; }
.fm-list-footer button { margin-left: auto; border: 1px solid var(--fm-line); border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.72); color: var(--fm-ink); font: inherit; cursor: pointer; }
.fm-list-footer button:hover:not(:disabled) { border-color: var(--fm-accent); color: var(--fm-accent); }

.fm-detail { min-width: 0; min-height: 0; position: relative; overflow: auto; scrollbar-width: thin; background: linear-gradient(160deg, rgba(255,255,255,.5), rgba(246,239,228,.75)); }
.fm-detail::-webkit-scrollbar { width: 8px; }
.fm-detail::-webkit-scrollbar-thumb { background: rgba(49, 45, 39, 0.22); border-radius: 999px; }
.fm-detail-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.fm-empty-mark { width: 76px; height: 86px; margin-bottom: 20px; border: 1px solid var(--fm-line); border-radius: 18px; display: grid; gap: 8px; place-content: center; transform: rotate(3deg); box-shadow: 12px 12px 0 rgba(var(--fm-accent-rgb),.08); }
.fm-empty-mark span { width: 36px; height: 2px; background: rgba(29,28,26,.24); }
.fm-detail-empty h2 { margin: 0; font-family: var(--sv-font-sans); font-size: 25px; }
.fm-detail-empty p { max-width: 290px; margin: 10px 0 0; color: var(--fm-muted); font-size: 13px; line-height: 1.7; }
.fm-detail-content { display: none; padding: 27px; }
.fm-detail:not(.is-empty) .fm-detail-empty { display: none; }
.fm-detail:not(.is-empty) .fm-detail-content { display: block; animation: fm-enter .35s cubic-bezier(.16,1,.3,1); }
@keyframes fm-enter { from { opacity: 0; transform: translateY(8px); } }
.fm-detail-header { display: flex; gap: 16px; align-items: center; }
.fm-file-emblem { flex: 0 0 66px; height: 78px; display: grid; place-items: end center; padding-bottom: 12px; clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%); color: var(--sv-color-text); background: var(--sv-color-surface-hover); font-family: var(--sv-font-sans); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.fm-detail-header p { margin: 0 0 5px; color: var(--sv-color-text-muted); font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.fm-detail-header h2 { max-width: 430px; margin: 0; font-family: inherit; font-size: 18px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.fm-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.fm-detail-actions .fm-primary-action,
.fm-detail-actions .fm-secondary-action,
.fm-detail-actions .fm-danger-action { min-height: 38px; padding: 0 14px; border-radius: 10px; box-shadow: none; font-size: 12px; font-weight: 500; }
.fm-detail-actions .fm-primary-action { border-color: #1d1c1a; color: var(--sv-color-text); background: var(--sv-color-surface-elevated); }
.fm-detail-actions .fm-secondary-action { border-color: rgba(49,45,39,.18); color: var(--fm-ink); background: var(--sv-color-surface); }
.fm-detail-actions .fm-danger-action { border-color: rgba(154,64,56,.28); color: #8a3b34; background: transparent; }
.fm-index-note { display: grid; gap: 5px; margin: -8px 0 22px; padding: 13px 14px; border-left: 3px solid #a8896c; color: var(--sv-color-text-faint); background: rgba(240, 234, 222, .72); font-size: 11px; line-height: 1.55; }
.fm-index-note strong { font-weight: 500; }
.fm-index-note span { color: var(--sv-color-text-faint); }
.fm-metadata { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 22px; border: 1px solid var(--fm-line); border-radius: 16px; overflow: hidden; background: var(--fm-line); }
.fm-metadata > div { padding: 12px 13px; background: var(--sv-color-surface); }
.fm-metadata dt { color: var(--fm-muted); font-size: 11px; font-weight: 500; letter-spacing: .02em; }
.fm-metadata dd { margin: 5px 0 0; font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.fm-summary-panel, .fm-related-panel { padding-top: 20px; border-top: 1px solid var(--fm-line); }
.fm-related-panel { margin-top: 24px; }
.fm-section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 13px; }
.fm-section-title span { color: var(--sv-color-text-muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.fm-section-title h3 { margin: 4px 0 0; font-family: inherit; font-size: 15px; font-weight: 500; }
.fm-section-title a { color: var(--fm-muted); font-size: 11px; text-decoration: none; }
.fm-summary-copy { max-height: 235px; overflow: auto; padding: 16px 17px; border-left: 3px solid var(--fm-accent); border-radius: 0 14px 14px 0; color: #4f4a42; background: rgba(255,255,255,.48); font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.fm-related-docs { display: grid; gap: 8px; }
.fm-related-doc { display: flex; justify-content: space-between; gap: 12px; padding: 12px 13px; border: 1px solid var(--fm-line); border-radius: 13px; color: inherit; background: rgba(255,255,255,.38); text-decoration: none; }
.fm-related-doc strong { display: block; font-size: 12px; }
.fm-related-doc small { display: block; margin-top: 4px; color: var(--fm-muted); font-size: 10px; }
.fm-related-doc span { color: var(--fm-accent); }
.fm-related-empty { display: grid; gap: 5px; padding: 14px; border: 1px dashed var(--fm-line); color: var(--fm-muted); font-size: 11px; line-height: 1.6; }
.fm-related-empty strong { color: var(--fm-ink); }
.fm-progress { position: fixed; z-index: 1200; right: 28px; bottom: 26px; display: flex; align-items: center; gap: 10px; padding: 13px 17px; border-radius: 999px; color: var(--sv-color-text); background: var(--sv-color-surface-hover); box-shadow: 0 18px 44px rgba(20,18,15,.28); font-size: 12px; font-weight: 700; }
.fm-progress[hidden] { display: none; }
.fm-progress-dot { width: 8px; height: 8px; border-radius: 50%; background: #e9a27e; animation: fm-pulse 1s ease infinite; }
@keyframes fm-pulse { 50% { transform: scale(1.55); opacity: .45; } }

.fm-organize-dialog { width: min(760px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); padding: 0; border: 0; border-radius: 22px; color: var(--fm-ink); background: var(--sv-color-canvas); box-shadow: 0 34px 110px rgba(28,22,16,.34); overflow: hidden; }
.fm-organize-dialog::backdrop { background: rgba(24,20,16,.58); backdrop-filter: blur(5px); }
.fm-organize-shell { display: grid; grid-template-rows: auto minmax(180px,1fr) auto; max-height: min(760px, calc(100dvh - 32px)); }
.fm-organize-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 24px 26px 20px; border-bottom: 1px solid var(--fm-line); background: linear-gradient(135deg, rgba(var(--fm-accent-rgb),.12), transparent 60%); }
.fm-organize-head span { color: var(--fm-accent); font: 800 10px/1 var(--sv-font-mono); letter-spacing: .16em; }
.fm-organize-head h2 { margin: 7px 0 5px; font-family: var(--sv-font-sans); font-size: 28px; line-height: 1.1; }
.fm-organize-head p { margin: 0; color: var(--fm-muted); font-size: 12px; }
.fm-organize-head button { width: 38px; height: 38px; border: 1px solid var(--fm-line); border-radius: 11px; color: var(--fm-muted); background: rgba(255,255,255,.45); font-size: 22px; cursor: pointer; }
.fm-organize-body { min-height: 0; padding: 22px 26px; overflow: auto; }
.fm-organize-loading { min-height: 230px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; }
.fm-organize-loading i { width: 42px; height: 42px; border: 2px solid rgba(var(--fm-accent-rgb),.2); border-top-color: var(--fm-accent); border-radius: 50%; animation: fm-organize-spin .8s linear infinite; }
.fm-organize-loading strong { margin-top: 8px; font-size: 15px; }.fm-organize-loading span { color: var(--fm-muted); font-size: 11px; }
@keyframes fm-organize-spin { to { transform: rotate(360deg); } }
.fm-organize-summary { display: grid; gap: 16px; }
.fm-organize-verdict { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: center; padding: 17px; border: 1px solid rgba(var(--fm-accent-rgb),.22); border-radius: 16px; background: rgba(255,255,255,.5); }
.fm-organize-verdict b { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 14px; color: var(--sv-color-text); background: var(--sv-color-surface-hover); font: 700 20px/1 var(--sv-font-sans); }
.fm-organize-verdict strong,.fm-organize-verdict span { display:block }.fm-organize-verdict strong{font-size:15px}.fm-organize-verdict span{margin-top:5px;color:var(--fm-muted);font-size:11px;line-height:1.6}
.fm-organize-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.fm-organize-group { padding:13px 14px; border:1px solid var(--fm-line); border-radius:13px; background:rgba(255,255,255,.32); }
.fm-organize-group strong { display:flex;justify-content:space-between;gap:10px;font-size:12px }.fm-organize-group span{color:var(--fm-muted);font-size:11px}.fm-organize-group small{display:block;margin-top:6px;color:var(--fm-muted);font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fm-organize-boundary { padding:13px 15px; border-left:3px solid var(--fm-accent); color:var(--sv-color-text-faint); background:rgba(var(--fm-accent-rgb),.07); font-size:11px; line-height:1.7; }
.fm-organize-next { padding:14px 15px; border:1px solid var(--fm-line); border-radius:14px; background:rgba(255,255,255,.42); }
.fm-organize-next strong { display:block; font-size:13px; }
.fm-organize-next ol { margin:8px 0 0; padding-left:18px; color:var(--fm-muted); font-size:11px; line-height:1.7; }
.fm-organize-next-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.fm-organize-next-actions button { min-height:34px; padding:0 12px; border:1px solid var(--fm-line); border-radius:10px; color:var(--fm-ink); background:var(--sv-color-surface); font:inherit; font-size:11px; font-weight:750; cursor:pointer; }
.fm-organize-next-actions button:last-child { border-color:#28241f; color:var(--sv-color-text); background:var(--sv-color-surface-hover); }
.fm-organize-result { padding:18px; border:1px solid rgba(79,128,81,.25); border-radius:16px; background:rgba(88,137,89,.08); }.fm-organize-result strong{display:block;color:#3d7044;font-size:16px}.fm-organize-result p{margin:7px 0 0;color:var(--sv-color-text-faint);font-size:12px;line-height:1.7}.fm-organize-result code{display:inline-block;margin-top:9px;color:#49624b;font-size:10px}
.fm-organize-actions { display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:15px 26px;border-top:1px solid var(--fm-line);background:rgba(238,232,220,.7); }.fm-organize-actions>span{margin-right:auto;color:var(--fm-muted);font-size:11px}.fm-organize-actions button{min-height:40px;padding:0 16px;border:1px solid #28241f;border-radius:11px;color:var(--sv-color-text);background:var(--sv-color-surface-hover);font:750 12px/1 inherit;cursor:pointer}.fm-organize-actions button:disabled{opacity:.42;cursor:not-allowed}.fm-organize-actions .is-approve{border-color:var(--fm-accent);background:var(--fm-accent)}

@media (max-width: 1380px) {
  html, body { height: auto; min-height: 100%; overflow: auto; }
  .fm-shell { height: auto; min-height: 100dvh; overflow: visible; }
  .fm-workspace { grid-template-columns: 210px minmax(0, 1fr); min-height: 680px; height: auto; }
  .fm-navigation { grid-row: span 2; }
  .fm-ledger { min-height: 560px; border-right: 0; }
  .fm-detail { min-height: 520px; border-top: 1px solid var(--fm-line); }
}
@media (max-width: 760px) {
  .fm-shell { padding: 20px 14px; }
  .fm-header { align-items: flex-start; flex-direction: column; }
  .fm-stats { grid-template-columns: 1fr 1fr; }
  .fm-index-policy { align-items: flex-start; flex-direction: column; }
  .fm-policy-actions { width: 100%; }
  .fm-policy-actions > * { flex: 1; justify-content: center; }
  .fm-workspace { grid-template-columns: 1fr; }
  .fm-navigation { grid-row: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--fm-line); }
  .fm-nav-dates .fm-nav-stack { max-height: none; }
  .fm-nav-foot { margin-top: 12px; }
  .fm-toolbar { grid-template-columns: 1fr; }
  .fm-batch-actions { margin-left: 0; width: 100%; }
  .fm-ledger-head { display: none; }
  .fm-file-main { grid-template-columns: minmax(0, 1fr) auto; }
  .fm-link-cell, .fm-date-cell { display: none; }
  .fm-list-footer span:last-child { display: none; }
  .fm-organize-groups { grid-template-columns:1fr; }
  .fm-organize-actions { align-items:stretch; flex-direction:column; }.fm-organize-actions>span{margin:0}.fm-organize-actions button{width:100%}
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Theme follow-up: roles and readable states. */
body.has-app-rail { background:var(--sv-color-canvas); }
body::after { content:none; }
.fm-sidebar { background:var(--sv-color-canvas-raised); }
.fm-detail { background:var(--sv-color-surface); }
.fm-stat,.fm-index-policy,.fm-organize-dialog,.fm-organize-actions,.fm-index-note { background:var(--sv-color-surface-subtle); border-color:var(--sv-color-border); }
.fm-summary-copy { color:var(--sv-color-text); background:var(--sv-color-surface-subtle); }
.fm-upload-button,.fm-primary-action,.fm-detail-actions .fm-primary-action,.fm-organize-actions .is-approve { background:var(--sv-color-brand); color:var(--sv-color-on-brand); border-color:var(--sv-color-brand); box-shadow:none; }
.fm-status.processing { color:var(--sv-color-warning); background:rgba(var(--sv-color-warning-rgb),.08); }
.fm-status.failed { color:var(--sv-color-danger); background:rgba(var(--sv-color-danger-rgb),.08); }
.fm-detail-actions .fm-danger-action { color:var(--sv-color-danger); border-color:var(--sv-color-danger); }


.fm-navigation { background:var(--sv-color-canvas-raised); }
@media(min-width:1101px) { .fm-workspace { grid-template-columns:190px minmax(0,1.35fr) minmax(280px,.8fr); } }

.fm-nav-foot { background:var(--sv-color-surface-subtle); }
