/* The Files page (plan 27 P4). Builds on /static/app.css: its colour tokens (light and dark), buttons, inputs and dialog. */

:root {
  --fs-pdf: #B3361F;
  --fs-word: #1F5A9E;
  --fs-sheet: #2F7A45;
  --fs-slides: #B8650E;
  --fs-image: #7A4FA8;
  --fs-folder: #8A6A2E;
  --fs-sel: #E2F0E6;
  --fs-sel-line: #9CCBAA;
  --fs-drive: #2F6FB3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fs-pdf: #F08C78; --fs-word: #8DB7EA; --fs-sheet: #85CB98; --fs-slides: #F0B26A; --fs-image: #C4A4E8; --fs-folder: #D9B676;
    --fs-sel: #1C3324; --fs-sel-line: #3E7A51; --fs-drive: #8DB7EA;
  }
}
:root[data-theme="dark"] {
  --fs-pdf: #F08C78; --fs-word: #8DB7EA; --fs-sheet: #85CB98; --fs-slides: #F0B26A; --fs-image: #C4A4E8; --fs-folder: #D9B676;
  --fs-sel: #1C3324; --fs-sel-line: #3E7A51; --fs-drive: #8DB7EA;
}

.fs-boot { padding: 40px 24px; text-align: center; }
.login.signin-note { grid-template-columns: minmax(0, 1fr); }
.login.signin-note .login-card .brand { display: flex; }
/* Plan 36: the page sits in the shared shell (sidebar from shell.js); the folder tree is the page's own column. */
.fs-page { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.fs-top { display: flex; align-items: center; gap: 10px; padding: 12px 20px 4px; min-width: 0; flex-shrink: 0; }
.fs-search { flex: 1 1 auto; max-width: 480px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); min-width: 0; box-shadow: var(--shadow-card); }
.fs-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.fs-search svg { color: var(--muted); width: 16px; height: 16px; }
.fs-search input { border: none; min-height: 34px; padding: 0; background: transparent; box-shadow: none !important; }
.fs-narrow-only { display: none; }

/* -- body: folders | contents | details ----------------------------------------------------------------------- */
.fs-body { --fs-side-w: 208px; position: relative; display: grid; grid-template-columns: var(--fs-side-w) minmax(0, 1fr) auto; min-height: 0; flex: 1 1 auto; }
.fs-resize { position: absolute; top: 0; bottom: 0; left: calc(var(--fs-side-w) - 3px); width: 6px; cursor: col-resize; z-index: 5; touch-action: none; }
.fs-resize:hover, .fs-resize.dragging, .fs-resize:focus-visible { background: var(--accent); opacity: 0.35; outline: none; }
body.fs-resizing { cursor: col-resize; user-select: none; }
.fs-side { border-right: 1px solid var(--line); background: var(--bg); padding: 12px 8px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; }
.fs-new { padding: 0 4px; }
.fs-new .primary { min-height: 36px; padding: 0 16px 0 12px; border-radius: var(--r); width: 100%; justify-content: flex-start; }
.fs-tree, .fs-tree ul { list-style: none; margin: 0; padding: 0; }
.fs-tree { flex: 1 1 auto; }
.fs-node { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--d, 0) * 12px); border-radius: var(--r-sm); }
.fs-node:hover { background: var(--chip); }
.fs-node.cur { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.fs-node.cur .fs-node-name { font-weight: 600; }
.fs-node.cur .fs-node-name svg { color: var(--accent); }
.fs-node.drop-over, .fs-row.drop-over, .fs-card.drop-over, .fs-crumb.drop-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.fs-caret { min-height: 26px; min-width: 20px; padding: 0; border: none; background: none; color: var(--muted); font-size: 11px; }
.fs-caret svg { width: 13px; height: 13px; transition: transform 0.15s ease; }
.fs-caret[aria-expanded="false"] svg { transform: rotate(-90deg); }
.fs-caret.none { visibility: hidden; }
.fs-node-name { flex: 1 1 auto; min-width: 0; justify-content: flex-start; gap: 7px; min-height: 30px; padding: 0 6px; border: none; background: none; color: var(--ink-2); font-size: 13px; font-weight: 400; text-align: left; border-radius: var(--r-sm); }
.fs-node-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-node-name svg { width: 16px; height: 16px; color: var(--fs-folder); }
.fs-tree .muted { padding: 4px 28px; font-size: 12.5px; }
.fs-places { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--line); padding-top: 10px; }
.fs-place { justify-content: flex-start; gap: 9px; min-height: 32px; padding: 0 10px; border: none; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500; border-radius: var(--r-sm); }
.fs-place svg { width: 16px; height: 16px; color: var(--muted); }
.fs-place:hover { background: var(--chip); color: var(--ink); }
.fs-place[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-weight: 600; color: var(--ink); }
.fs-place[aria-current="page"] svg { color: var(--accent); }
.fs-place.drop-over { background: var(--bad-soft); box-shadow: inset 0 0 0 2px var(--bad); }
.fs-scrim { display: none; }

.fs-main { container: fsmain / inline-size; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
/* -- plan 33 P7: the toolbar and the selection bar share one place, so picking something never moves the list ---------- */
.fs-barslot { position: relative; flex-shrink: 0; }
.fs-barwrap { position: relative; }  /* the toolbar and the selection bar share this box; the waiting strip sits above it (plan 38) */
/* Plan 38 (item 71): one slim strip above the toolbar while the project waits for its uploaded files: the count and the button. */
.fs-intake { display: flex; align-items: center; gap: 10px; padding: 7px 20px; min-height: 42px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.fs-intake[hidden] { display: none; }
.fs-intake .dot { width: 8px; height: 8px; flex: none; }
.fs-intake-text { flex: 1 1 0; min-width: 0; font-variant-numeric: tabular-nums; }
.fs-intake .primary { flex: none; }
.fs-tag-unknown { margin-left: 6px; vertical-align: 1px; }
@media (max-width: 700px) { .fs-intake { padding: 8px 12px; flex-wrap: wrap; } .fs-intake .primary { width: 100%; } }
.fs-bar, .fs-selbar { display: flex; align-items: center; gap: 12px; padding: 6px 20px; min-height: 50px; border-bottom: 1px solid var(--line-2); }
.fs-bar.covered { visibility: hidden; }
.fs-selbar { position: absolute; inset: 0; z-index: 1; background: var(--fs-sel); }
.fs-selhead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fs-selacts { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.fs-selbar .small-btn { gap: 6px; background: var(--surface); }
.fs-selbar .small-btn svg { width: 15px; height: 15px; }
.fs-selcount { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13.5px; }
/* The path is one line: the folders above the current one shrink first, the current folder last. */
.fs-crumbs { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; gap: 2px; min-width: 0; flex: 1 1 auto; font-size: 15px; }
.fs-crumb { min-height: 32px; padding: 0 6px; border: none; border-radius: var(--r-sm); background: none; color: var(--muted); font-size: inherit; font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 32px; }
.fs-crumb:hover { background: var(--chip); color: var(--ink); }
.fs-crumb[aria-current="page"] { color: var(--ink); font-weight: 600; }
.fs-crumb-sep { color: var(--faint); font-size: 13px; }
.fs-crumbs .fs-crumb { flex: 0 1000 auto; min-width: min(4em, 10%); }
.fs-crumbs .fs-crumb[aria-current="page"], .fs-crumbs h1 { flex: 0 1 auto; min-width: 0; max-width: none; }
.fs-crumbs .fs-crumb-sep, .fs-crumbs .muted { flex: none; }
.fs-crumbs h1 { font-size: 15px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.fs-sort { min-height: 32px; width: auto; font-size: 13px; padding-left: 10px; }
.fs-seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--chip); }
.fs-seg .icon-btn.small { min-height: 28px; min-width: 28px; }
.fs-seg [aria-pressed="true"], #fs-info-btn[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-card); }

.fs-content { flex: 1 1 auto; overflow-y: auto; padding: 6px 20px 96px; outline: none; min-height: 0; }
.fs-content:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.fs-note { margin: 10px 0; color: var(--muted); font-size: 13px; }
.fs-state { display: grid; place-items: center; text-align: center; padding: 64px 16px; gap: 10px; color: var(--muted); }
.fs-state > svg { width: 44px; height: 44px; color: var(--line-strong); stroke-width: 1.4; }
.fs-state strong { color: var(--ink); font-size: 15px; }
.fs-state .row { gap: 8px; justify-content: center; flex-wrap: wrap; }
.fs-state.error strong { color: var(--bad); }
.fs-loading { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.fs-loading i { display: block; height: 40px; border-radius: var(--r); background: linear-gradient(90deg, var(--line-2), var(--surface-2), var(--line-2)); background-size: 200% 100%; animation: fs-shimmer 1.2s infinite linear; }
@keyframes fs-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .fs-loading i { animation: none; } .fs-caret svg { transition: none; } }

/* -- list ------------------------------------------------------------------------------------------------------- */
.fs-list { display: flex; flex-direction: column; }
.fs-head, .fs-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 170px 90px 40px; align-items: center; gap: 12px; padding: 0 8px; }
.fs-list.trash .fs-head, .fs-list.trash .fs-row { grid-template-columns: minmax(0, 1fr) 170px 170px 90px 150px; }
.fs-list.search .fs-head, .fs-list.search .fs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) 150px 90px 40px; }
.fs-head { position: sticky; top: -6px; z-index: 2; background: var(--surface); min-height: 36px; border-bottom: 1px solid var(--line-2); font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.fs-head button { min-height: 32px; padding: 0; border: none; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; justify-content: flex-start; gap: 4px; }
.fs-head button:hover { color: var(--ink); }
.fs-head button[aria-sort="ascending"]::after { content: "↑"; }
.fs-head button[aria-sort="descending"]::after { content: "↓"; }
.fs-row { min-height: 42px; border-bottom: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: default; user-select: none; -webkit-user-select: none; font-size: 13.5px; }
.fs-row:hover { background: var(--surface-2); }
.fs-row.sel, .fs-card.sel { background: var(--fs-sel); box-shadow: inset 0 0 0 1px var(--fs-sel-line); }
.fs-row.focus, .fs-card.focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.fs-row.dragging, .fs-card.dragging { opacity: 0.5; }
.fs-row.cut, .fs-card.cut { opacity: 0.55; }
.fs-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fs-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-name .fs-sub { display: none; }
.fs-cell { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-cell.num { font-family: var(--mono); font-size: 12px; text-align: right; }
.fs-cell.path { color: var(--muted); }
.fs-more { min-height: 32px; min-width: 32px; padding: 0; border-radius: 8px; background: none; border: none; color: var(--muted); }
.fs-more:hover { background: var(--chip); color: var(--ink); }
.fs-more svg { width: 18px; height: 18px; }
.fs-ic { width: 22px; height: 22px; color: var(--muted); }
.fs-ic.folder { color: var(--fs-folder); }
.fs-ic.pdf { color: var(--fs-pdf); }
.fs-ic.word { color: var(--fs-word); }
.fs-ic.sheet { color: var(--fs-sheet); }
.fs-ic.slides { color: var(--fs-slides); }
.fs-ic.image, .fs-ic.video { color: var(--fs-image); }
.fs-more-row { display: flex; justify-content: center; padding: 14px; }

/* -- grid ------------------------------------------------------------------------------------------------------- */
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; padding-top: 8px; }
.fs-gridhead { grid-column: 1 / -1; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 2px 0; }
.fs-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; user-select: none; -webkit-user-select: none; min-width: 0; }
.fs-card:hover { border-color: var(--line-strong); }
.fs-card.folder { flex-direction: row; align-items: center; gap: 10px; padding: 0 6px 0 12px; min-height: 50px; }
.fs-card.folder .fs-card-name { flex: 1 1 auto; padding: 0; }
.fs-thumb { height: 120px; display: grid; place-items: center; background: var(--surface-2); border-bottom: 1px solid var(--line-2); overflow: hidden; }
.fs-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fs-thumb .fs-ic { width: 48px; height: 48px; stroke-width: 1.3; }
.fs-card-foot { display: flex; align-items: center; gap: 6px; padding: 6px 4px 6px 10px; min-width: 0; }
.fs-card-name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-card-foot .fs-ic { width: 18px; height: 18px; }

/* -- trash and activity ------------------------------------------------------------------------------------------ */
.fs-banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin: 8px 0 4px; border-radius: 10px; background: var(--info-soft); color: var(--info-ink); font-size: 14px; }
.fs-banner svg { width: 18px; height: 18px; }
.fs-banner .fs-banner-act { margin-left: auto; flex: none; }
.fs-trash-last { display: flex; align-items: center; gap: 4px; }
.fs-row .small-btn { min-height: 32px; }
.fs-acts { list-style: none; margin: 0; padding: 0; }
.fs-act { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 4px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.fs-act .avatar { width: 30px; height: 30px; font-size: 12px; }
.fs-act-text { min-width: 0; overflow-wrap: anywhere; }
.fs-act-when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.fs-act .link-btn { min-height: 0; padding: 0; color: var(--ink); font-weight: 600; font-size: inherit; white-space: normal; text-align: left; display: inline; }
.fs-act .link-btn:hover { color: var(--accent); }
.fs-day { padding: 14px 4px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* -- details panel ---------------------------------------------------------------------------------------------- */
.fs-info { width: 340px; border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; min-height: 0; padding: 0 0 32px; }
.fs-info-head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 1; }
.fs-info-head h2 { flex: 1 1 auto; font-size: 15px; overflow-wrap: anywhere; }
.fs-info-preview { margin: 16px 18px 0; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); height: 150px; display: grid; place-items: center; overflow: hidden; }
.fs-info-preview img { width: 100%; height: 100%; object-fit: contain; }
.fs-info-preview .fs-ic { width: 56px; height: 56px; stroke-width: 1.2; }
.fs-info-sec { padding: 14px 18px 0; }
.fs-info-sec h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.fs-facts { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 10px; margin: 0; font-size: 13px; }
.fs-facts dt { color: var(--muted); }
.fs-facts dd { margin: 0; overflow-wrap: anywhere; }
.fs-chat { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-2); }
.fs-chat.ok { background: var(--ok-soft); color: var(--ok); }
.fs-chat.busy { background: var(--info-soft); color: var(--info); }
.fs-chat.bad { background: var(--bad-soft); color: var(--bad); }
.fs-vers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fs-ver { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 13px; flex-wrap: wrap; }
.fs-ver strong { font-family: var(--mono); font-size: 12px; }
.fs-ver .grow { min-width: 0; }
.fs-ver .link-btn { min-height: 26px; padding: 0 6px; }
.fs-ver.current { border-color: var(--fs-sel-line); background: var(--fs-sel); }
.fs-info-acts { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }

/* -- context menu ---------------------------------------------------------------------------------------------- */
.fs-menu { position: fixed; z-index: 80; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.fs-menu button { justify-content: flex-start; gap: 10px; min-height: 36px; padding: 0 12px; border: none; border-radius: 8px; background: none; color: var(--ink); font-size: 14px; font-weight: 400; }
.fs-menu button:hover, .fs-menu button:focus-visible { background: var(--chip); outline: none; }
.fs-menu button svg { width: 18px; height: 18px; color: var(--muted); }
.fs-menu button.danger-text, .fs-menu button.danger-text svg { color: var(--bad); }
.fs-menu .fs-kbd, .fs-kbd { margin-left: auto; padding-left: 24px; font-family: var(--mono); font-size: 12px; color: var(--muted); background: none; border: none; box-shadow: none; white-space: nowrap; }
.fs-menu hr { border: none; border-top: 1px solid var(--line-2); margin: 4px 6px; }

/* -- dialogs: rename, folder picker, conflicts -------------------------------------------------------------------- */
.fs-dialog form { display: flex; flex-direction: column; gap: 14px; }
.fs-dialog .row.end { gap: 8px; flex-wrap: wrap; }
.fs-dialog .error { min-height: 0; }
.fs-pick { border: 1px solid var(--line); border-radius: 10px; max-height: 320px; min-height: 160px; overflow-y: auto; padding: 4px; }
.fs-pick-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; }
.fs-pick-crumbs .fs-crumb { min-height: 30px; line-height: 30px; }
.fs-pick-row { width: 100%; justify-content: flex-start; gap: 10px; min-height: 38px; padding: 0 10px; border: none; border-radius: 8px; background: none; color: var(--ink); font-weight: 400; font-size: 14px; }
.fs-pick-row:hover { background: var(--chip); }
.fs-pick-row:disabled { opacity: 0.45; }
.fs-pick-row svg { color: var(--fs-folder); }
.fs-choice { display: flex; flex-direction: column; gap: 8px; }
.fs-choice button { justify-content: flex-start; text-align: left; white-space: normal; height: auto; padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 2px; }
.fs-choice button span { font-weight: 400; font-size: 13px; color: var(--muted); }
.fs-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.fs-check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* -- viewer ---------------------------------------------------------------------------------------------------- */
.fs-viewer { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: #12110F; color: #EDEAE3; }
.fs-viewer-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 56px; }
.fs-viewer-head .icon-btn { color: #EDEAE3; }
.fs-viewer-head .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.fs-viewer-head .icon-btn:disabled { opacity: 0.3; }
.fs-viewer-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fs-viewer-body { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 0 12px 12px; }
.fs-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; background: #fff; }
.fs-viewer-body iframe { width: 100%; height: 100%; border: none; border-radius: 6px; background: #fff; }
.fs-viewer-body .fs-state { color: #CFCAC0; }
.fs-viewer-body .fs-state strong { color: #fff; }

/* -- plan 29 C: text, CSV, JSON, media, email, zip, maps in the viewer ------------------------------------------------- */
.fs-viewer-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.fs-viewer-body .fs-vx { width: 100%; height: 100%; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; color: #EDEAE3; }
.fs-vtools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.fs-vinfo { font-size: 13px; color: #CFCAC0; }
.fs-vchip { min-height: 30px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px; background: transparent; color: #EDEAE3; font-size: 13px; font-weight: 500; cursor: pointer; }
.fs-vchip:hover { background: rgba(255, 255, 255, 0.12); }
.fs-vchip[aria-pressed="true"] { background: rgba(255, 255, 255, 0.92); color: #12110F; border-color: transparent; }
.fs-vfilter { min-height: 30px; width: min(280px, 100%); padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.08); color: #EDEAE3; font-size: 13px; }
.fs-vscroll { flex: 1 1 auto; min-height: 0; overflow: auto; border-radius: 8px; background: #1B1A17; border: 1px solid rgba(255, 255, 255, 0.1); }
.fs-vnote { padding: 10px 14px; font-size: 13px; color: #CFCAC0; }
.fs-text { margin: 0; padding: 10px 14px 10px 0; font: 13px/1.5 var(--mono); color: #E6E2D8; counter-reset: line; white-space: pre; tab-size: 4; }
.fs-text.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.fs-text .l { display: block; counter-increment: line; padding-left: 62px; position: relative; min-height: 1.5em; }
.fs-text .l::before { content: counter(line); position: absolute; left: 0; width: 50px; text-align: right; color: #7E796E; user-select: none; }
.fs-mailbody .fs-text { padding-left: 14px; }
.fs-mailbody .fs-text .l { padding-left: 0; }
.fs-table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; color: #E6E2D8; }
.fs-table th, .fs-table td { padding: 5px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); text-align: left; vertical-align: top; max-width: 420px; overflow-wrap: anywhere; }
.fs-table thead th { position: sticky; top: 0; background: #2A2823; z-index: 1; font-weight: 600; }
.fs-table .n { color: #7E796E; text-align: right; user-select: none; width: 1%; white-space: nowrap; }
.fs-table .r { text-align: right; white-space: nowrap; }
.fs-ziptable td:first-child { display: flex; align-items: center; gap: 8px; max-width: none; }
.fs-ziptable td:first-child small { color: #E9A58F; margin-left: 6px; }
.fs-ziptable tr.file { cursor: pointer; }
.fs-ziptable tr.file:hover, .fs-ziptable tr.file:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
.fs-ziptable tr.bad { opacity: 0.6; }
.fs-ziptable .fs-ic { width: 18px; height: 18px; flex: 0 0 auto; }
.fs-viewer-body .fs-media { max-width: 100%; max-height: 100%; background: #000; border-radius: 6px; }
.fs-viewer-body audio.fs-media { width: min(520px, 100%); background: transparent; }
.fs-audio { display: grid; justify-items: center; gap: 14px; text-align: center; }
.fs-audio > svg { width: 64px; height: 64px; color: #CFCAC0; stroke-width: 1.2; }
.fs-mail { gap: 0; }
.fs-mailhead { flex: 0 0 auto; padding: 4px 4px 10px; display: grid; gap: 8px; }
.fs-mailhead h2 { margin: 0; font-size: 18px; color: #fff; overflow-wrap: anywhere; }
.fs-mailhead dl { margin: 0; display: grid; gap: 2px; font-size: 13px; }
.fs-mailhead dl > div { display: flex; gap: 10px; }
.fs-mailhead dt { width: 44px; flex: 0 0 auto; color: #A8A296; }
.fs-mailhead dd { margin: 0; overflow-wrap: anywhere; }
.fs-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fs-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.22); color: #EDEAE3; text-decoration: none; font-size: 13px; }
.fs-chip:hover { background: rgba(255, 255, 255, 0.12); }
.fs-chip .fs-ic { width: 18px; height: 18px; flex: 0 0 auto; }
.fs-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-chip small { color: #A8A296; }
.fs-mailbody { flex: 1 1 auto; min-height: 0; overflow: auto; border-radius: 8px; background: #1B1A17; border: 1px solid rgba(255, 255, 255, 0.1); }
.fs-mailbody:has(iframe) { background: #fff; overflow: hidden; }
.fs-viewer-body .fs-mailbody iframe { border-radius: 0; }
.fs-mapwrap { flex: 1 1 auto; min-height: 0; display: flex; gap: 10px; }
.fs-mapbox { position: relative; flex: 1 1 auto; min-width: 0; border-radius: 8px; overflow: hidden; background: #1B1A17; border: 1px solid rgba(255, 255, 255, 0.1); }
.fs-mapsvg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
.fs-mapsvg.grab { cursor: grabbing; }
.fs-mapsvg .poly { fill: rgba(95, 184, 122, 0.18); stroke: #5FB87A; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.fs-mapsvg .line { fill: none; stroke: #86B6E0; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.fs-mapsvg .pt { fill: #EDEAE3; stroke: #12110F; stroke-width: 1; vector-effect: non-scaling-stroke; r: var(--pr); }
.fs-mapsvg .on { stroke-width: 3.2; }
.fs-mapsvg .poly.on { fill: rgba(95, 184, 122, 0.38); }
.fs-mapsvg .line.on { stroke: #fff; }
.fs-fit { position: absolute; right: 10px; top: 10px; background: rgba(18, 17, 15, 0.8); }
.fs-maplist { flex: 0 0 280px; min-height: 0; overflow: auto; border-radius: 8px; background: #1B1A17; border: 1px solid rgba(255, 255, 255, 0.1); }
.fs-maplist .fs-vinfo { margin: 0; padding: 10px 12px 4px; }
.fs-maplist ul { list-style: none; margin: 0; padding: 0 4px 6px; }
.fs-maplist button { width: 100%; display: grid; justify-items: start; gap: 2px; text-align: left; padding: 8px 10px; border: none; border-radius: 6px; background: transparent; color: #EDEAE3; font-size: 13px; cursor: pointer; }
.fs-maplist button:hover, .fs-maplist button.on { background: rgba(255, 255, 255, 0.1); }
.fs-maplist button span { color: #A8A296; font-size: 12px; }
@media (max-width: 760px) { .fs-mapwrap { flex-direction: column; } .fs-maplist { flex: 0 0 38%; } }
.fs-extract { position: fixed; left: 20px; bottom: 20px; z-index: 96; width: min(380px, calc(100vw - 32px)); border-radius: 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-pop); overflow: hidden; }
.fs-extract[hidden] { display: none; }
.fs-ex-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; background: var(--sidebar); border-bottom: 1px solid var(--line); font-size: 14px; }
.fs-ex-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-ex-body { padding: 12px 16px 14px; display: grid; gap: 8px; font-size: 14px; }
.fs-ex-body p { margin: 0; }
.fs-ex-bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.fs-ex-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.4s; }
.fs-ex-skipped ul { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; font-size: 12px; }
.fs-ex-skipped small { color: var(--muted); }
.bad-text { color: var(--bad); }
@media (max-width: 600px) { .fs-extract { left: 16px; bottom: 16px; } }

/* -- uploads panel ---------------------------------------------------------------------------------------------- */
.fs-uploads { position: fixed; right: 20px; bottom: 20px; z-index: 70; width: min(400px, calc(100vw - 32px)); border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); overflow: hidden; }
.fs-up-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; background: var(--sidebar); border-bottom: 1px solid var(--line); font-size: 14px; }
.fs-up-head #fs-up-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
.fs-up-list { list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow-y: auto; }
.fs-up { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 10px 8px 14px; font-size: 13px; }
.fs-up .fs-ic { width: 20px; height: 20px; }
.fs-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fs-up-status { grid-column: 2; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.fs-up-status.bad { color: var(--bad); }
.fs-up-status.ok { color: var(--ok); }
.fs-up .bar { grid-column: 2; height: 4px; }
.fs-up-btns { grid-column: 3; grid-row: 1 / span 3; display: flex; gap: 2px; }
.fs-up-btns .link-btn { min-height: 28px; padding: 0 6px; }

.fs-drop { position: absolute; inset: 8px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); pointer-events: none; text-align: center; color: var(--accent-ink); font-weight: 600; }
.fs-drop svg { width: 40px; height: 40px; }
.fs-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); }
.fs-toast .link-btn { color: var(--bg); font-weight: 600; text-decoration: underline; min-height: 30px; }
.fs-toast.bad { background: var(--bad); color: #fff; }

/* -- narrow screens --------------------------------------------------------------------------------------------- */
/* The list fits the space it has (the details panel takes some of it). */
@container fsmain (max-width: 820px) {
  .fs-head, .fs-row { grid-template-columns: minmax(0, 1fr) 130px 90px 40px; }
  .fs-col-by { display: none; }
  .fs-list.trash .fs-head, .fs-list.trash .fs-row { grid-template-columns: minmax(0, 1fr) 150px 90px 150px; }
  .fs-list.search .fs-head, .fs-list.search .fs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) 90px 40px; }
  .fs-list.search .fs-col-mod { display: none; }
}
@container fsmain (max-width: 560px) {
  .fs-head { display: none; }
  .fs-row, .fs-list.trash .fs-row, .fs-list.search .fs-row { grid-template-columns: minmax(0, 1fr) 40px; }
  .fs-list.trash .fs-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fs-row .fs-cell { display: none; }
  .fs-row { min-height: 56px; padding: 4px 4px 4px 8px; }
  .fs-name { align-items: flex-start; }
  .fs-name .fs-ic { margin-top: 2px; }
  .fs-name > span { display: flex; flex-direction: column; white-space: normal; overflow-wrap: anywhere; }
  .fs-name .fs-sub { display: block; color: var(--muted); font-size: 12px; }
  .fs-act { grid-template-columns: 30px minmax(0, 1fr); }
  .fs-act-when { grid-column: 2; }
}
/* Plan 33 P7: labels show only when the list area is wider than 900 px; under 640 px the bars take two rows (the details panel takes room). */
@container fsmain (max-width: 900px) {
  .fs-btn-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .fs-selacts { gap: 4px; }
  .fs-selacts .small-btn { padding: 0; min-width: 36px; }
}
@container fsmain (max-width: 640px) {
  .fs-bar, .fs-selbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; min-height: 0; }
  .fs-selacts { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-end; margin-left: 0; }
  .fs-crumbs { flex-basis: 100%; font-size: 15px; }
  .fs-tools { margin-left: auto; }
  .fs-selhead { flex-basis: 100%; }
  .fs-selbar { align-content: center; }
}
@media (max-width: 1100px) { .fs-wide-only { display: none; } }
@media (max-width: 900px) {
  .fs-top { padding: 8px 12px 4px; gap: 8px; }
  .fs-narrow-only { display: inline-flex; }
  .fs-search { flex: 1 1 200px; max-width: none; }
  .fs-body { grid-template-columns: minmax(0, 1fr); }
  .fs-resize { display: none; }
  .fs-side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-105%); transition: transform 0.2s ease; }
  .fs-side.open { transform: none; box-shadow: var(--shadow-pop); }
  .fs-scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(20, 19, 17, 0.4); z-index: 55; }
  .fs-info { position: fixed; inset: 0; width: auto; z-index: 65; border-left: none; }
  .fs-bar, .fs-selbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; min-height: 0; }
  .fs-crumbs { flex-basis: 100%; font-size: 15px; }
  .fs-tools { margin-left: auto; }
  .fs-selhead { flex-basis: 100%; }
  .fs-selbar { align-content: center; }
  .fs-content { padding: 4px 8px 96px; }
  .fs-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .fs-uploads { right: 16px; bottom: 16px; }
  .fs-facts { grid-template-columns: 100px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .fs-side { transition: none; } }

/* -- plan 27 P6: previews, the page viewer, the project's chat index ---------------------------------------------- */
.fs-thumb img.fs-page { object-fit: cover; object-position: top; background: #fff; }
.fs-info-preview img.fs-page { background: #fff; }
.fs-viewer-body .fs-pageview { width: 100%; height: 100%; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.fs-viewer-body .fs-pageview img { max-width: 100%; max-height: none; height: auto; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45); }
.fs-viewer-foot { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 12px 12px; flex-wrap: wrap; }
.fs-vmode { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(255, 255, 255, 0.1); }
.fs-vmode button { min-height: 30px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; color: #CFCAC0; font-size: 13px; font-weight: 500; }
.fs-vmode button:hover { color: #fff; }
.fs-vmode button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.92); color: #12110F; }
.fs-pager { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #CFCAC0; }
.fs-pager[hidden] { display: none; }
.fs-pager .icon-btn { color: #EDEAE3; }
.fs-pager .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.fs-pager .icon-btn:disabled { opacity: 0.3; }
.fs-pager input { width: 64px; min-height: 30px; padding: 0 6px; text-align: center; background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.fs-proj { border-top: 1px solid var(--line); padding: 10px 6px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.fs-proj h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.fs-proj p { margin: 0; }
.fs-proj #fs-prev-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 6px; }
.fs-proj #fs-prev-box[hidden] { display: none; }
.fs-idx-text.ok { color: var(--ok); }
.fs-idx-text.busy { color: var(--info); }
.fs-idx-text.bad { color: var(--bad); }

/* -- the All projects home (plan 27 follow-up): every project as a folder --------------------------------------------- */
.fs-places[hidden] { display: none; }
.fs-node-name svg.fs-tdrive, .fs-ic.drive { color: var(--fs-drive); }
.fs-allprojects svg { color: var(--accent); }
.fs-banner.bad { background: var(--bad-soft); color: var(--bad); }
.fs-banner .link-btn { min-height: 0; padding: 0; color: inherit; font-weight: 600; text-decoration: underline; }
.fs-where { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.fs-where.own { background: var(--ok-soft); color: var(--ok); }
.fs-where.drive { background: var(--info-soft); color: var(--info); }
.fs-pchat { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.fs-pchat.ok { color: var(--ok); }
.fs-pchat.busy { color: var(--info); }
.fs-list.home .fs-head, .fs-list.home .fs-row { grid-template-columns: minmax(0, 1fr) 120px 90px 90px 190px 100px; }
.fs-list.home .fs-head .num { text-align: right; justify-content: flex-end; }
a.fs-prow { color: var(--ink); text-decoration: none; cursor: pointer; min-height: 56px; }
a.fs-prow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fs-prow .fs-name > span { display: flex; flex-direction: column; line-height: 1.3; }
.fs-prow .fs-name > span { font-weight: 500; }
.fs-psub { color: var(--muted); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.fs-prow .fs-ic { width: 24px; height: 24px; flex-shrink: 0; }
.fs-pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding-top: 4px; }
.fs-pcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.fs-pcard:hover { border-color: var(--line-strong); color: var(--ink); }
.fs-pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fs-pcard-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.fs-pcard-head .fs-ic { width: 30px; height: 30px; flex-shrink: 0; stroke-width: 1.5; }
.fs-pcard-name { display: flex; flex-direction: column; min-width: 0; }
.fs-pcard-name strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-pcard-name small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-pfacts { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 4px 8px; margin: 0; font-size: 13px; }
.fs-pfacts dt { color: var(--muted); }
.fs-pfacts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-drive-note { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin: 12px 0; border-radius: 10px; background: var(--info-soft); color: var(--info-ink); font-size: 14px; }
.fs-drive-note svg { width: 22px; height: 22px; flex-shrink: 0; }
.fs-drive-note p { margin: 0; }
.fs-drive-btns { margin-top: 14px; gap: 8px; flex-wrap: wrap; }
.fs-drive-btns .as-btn { text-decoration: none; gap: 6px; }
@container fsmain (max-width: 820px) {
  .fs-list.home .fs-head, .fs-list.home .fs-row { grid-template-columns: minmax(0, 1fr) 120px 80px 80px 90px; }
  .fs-list.home .fs-col-last { display: none; }
}
@container fsmain (max-width: 560px) {
  .fs-list.home .fs-row { grid-template-columns: minmax(0, 1fr); }
  .fs-prow .fs-name .fs-sub { display: block; }
}
@media (max-width: 900px) { .fs-pgrid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; } }

/* -- plan 29 B: explorer actions (shortcut list, copy link) ---------------------------------------------------------- */
.fs-keys { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.fs-keytable { width: 100%; border-collapse: collapse; font-size: 14px; }
.fs-keytable th { text-align: left; padding: 14px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fs-keytable td { padding: 5px 0; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.fs-keytable td:first-child { width: 42%; padding-right: 12px; white-space: nowrap; }
.fs-keytable kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin-right: 2px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; text-align: center; }
.fs-keywrap { max-height: 62vh; overflow-y: auto; margin-top: 8px; }
.fs-up-tag { color: var(--muted); }

/* -- find and organize (plan 29 D): filters, stars, snippets, Recent days, storage ---------------------------------------- */
.fs-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; font-size: 13px; color: var(--muted); }
.fs-filters[hidden] { display: none; }
.fs-filters label { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.fs-filters select { min-height: 32px; width: auto; font-size: 13px; padding-left: 10px; }
.fs-starmark { width: 13px; height: 13px; margin-left: 6px; vertical-align: -1px; fill: var(--fs-slides); stroke: var(--fs-slides); }
.fs-row.has-snip { padding-top: 8px; padding-bottom: 8px; align-items: start; }
.fs-row.has-snip .fs-name { align-items: flex-start; }
.fs-row.has-snip .fs-name .fs-ic { margin-top: 1px; }
.fs-row.has-snip .fs-name > span { display: flex; flex-direction: column; white-space: normal; gap: 2px; }
.fs-snip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.4; user-select: text; -webkit-user-select: text; }
.fs-snip mark { background: var(--accent-soft); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.fs-dayrow { padding: 14px 8px 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fs-cell .link-btn { min-height: 0; padding: 0; color: var(--muted); font-size: inherit; font-weight: 400; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; text-align: left; }
.fs-cell .link-btn:hover { color: var(--accent); text-decoration: underline; }
.fs-storage { padding: 0 12px; margin: -4px 0 0; }
@media (max-width: 760px) { .fs-filters { padding: 8px 12px; gap: 8px 10px; } }
