/* Caboodle File manager – Copyright (C) 2026 the Caboodle authors */
/* The folders on the left (the kit's side-list rows, indented), what's in the open one in the middle – a row for each
   folder and file: name, kind, size, changed – and the preview on the right. Every colour and corner is a token of
   shared/kit.css. */
#main { display: flex; flex-direction: row; flex: 1; min-width: 0; min-height: 0; background: var(--panel); }
#fm-left { min-height: 0; }
.fm-pane { display: flex; flex-direction: column; min-height: 0; }
.fm-pane.grow { flex: 1; }

/* ---------- the folders ---------- */
#fm-tree { flex: 1; min-height: 0; overflow: auto; }
.fm-lead { display: inline-flex; align-items: center; gap: 2px; }
.fm-twisty { flex: none; width: 18px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: var(--radius-xs); }
.fm-twisty:not(:empty) { cursor: pointer; }
.fm-twisty:not(:empty):hover { background: var(--line); color: var(--text); }
.fm-twisty .material-symbols-outlined { font-size: 18px; }
.fm-tic { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.fm-tic .material-symbols-outlined { font-size: var(--ic-s); }
.fm-tic .prog-icon { width: 16px; height: 16px; }
.fm-trow[data-key^="f:"] .fm-tic, .fm-trow[data-key="top"] .fm-tic { color: var(--accent); }
.fm-trow.fm-drop { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
/* a shared folder: its own colour and mark, so it can't be missed */
.fm-trow.fm-shared .fm-tic { color: var(--info); }
.fm-trow.fm-shared.own { background: var(--info-soft); }
.fm-trow.fm-shared.own.on { box-shadow: inset 3px 0 0 var(--info); }
.fm-trow.fm-shared .lr-meta { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--info); color: var(--surface); font-size: var(--fs-xs); font-weight: 600; }
#fm-meter { flex: none; padding: 9px 12px 11px; border-top: 1px solid var(--line-soft); font-size: var(--fs-xs); color: var(--muted); }
#fm-meter[hidden] { display: none; }
.fm-meter { height: 4px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; margin-bottom: 6px; }
.fm-meter > span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--accent); }
#fm-meter.full .fm-meter > span { background: var(--danger); }

/* ---------- the middle ---------- */
#fm-center { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
#fm-center.fm-drop > #fm-list { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
#fm-path { flex: none; display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); overflow: hidden; white-space: nowrap; font-size: var(--fs); }
.fm-crumb { flex: 0 1 auto; min-width: 0; max-width: 240px; padding: 3px 7px; border: 0; border-radius: var(--radius-s); background: none; font: inherit; color: var(--muted); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.fm-crumb:hover { background: var(--hover); color: var(--text); }
.fm-crumb.here { flex: 0 0 auto; color: var(--text); font-weight: 600; cursor: default; }
.fm-crumb.here:hover { background: none; }
.fm-crumb.fm-drop { background: var(--accent-soft); color: var(--accent-strong); outline: 2px solid var(--accent); outline-offset: -2px; }
.fm-crumb-sep { flex: none; color: var(--faint); }
#fm-share { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--info) 30%, transparent); background: var(--info-soft); color: var(--info); font-size: var(--fs-s); }
#fm-share[hidden] { display: none; }
.fm-share-ic { flex: none; display: inline-flex; }
.fm-share-ic .material-symbols-outlined { font-size: 18px; }
.fm-share-text { flex: 1; min-width: 0; font-weight: 500; }
.fm-row.fm-is-shared .fm-ic .material-symbols-outlined { color: var(--info); }
#fm-head, .fm-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 84px 124px; align-items: center; column-gap: 14px; }
#fm-head { flex: none; height: 28px; padding: 0 16px 0 14px; border-bottom: 1px solid var(--line-soft); }
#fm-head[hidden] { display: none; }
.fm-col { display: inline-flex; align-items: center; gap: 2px; height: 100%; min-width: 0; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.fm-col:hover, .fm-col.on { color: var(--text); }
.fm-col .material-symbols-outlined { font-size: 14px; }
.fm-col.fm-c-size, .fm-col.fm-c-when { justify-content: flex-end; }
#fm-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 0 28px; outline: none; }
.fm-row { height: 32px; margin: 0 4px; padding: 0 12px 0 10px; border-radius: var(--radius-s); font-size: var(--fs-m); color: var(--text-2); cursor: default; user-select: none; -webkit-user-select: none; outline: none; }
.fm-row:hover { background: var(--hover-soft); }
.fm-row.on { background: var(--sel-soft); }
.fm-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fm-row.fm-drop { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.fm-row.waiting .fm-name { color: var(--text-2); }
.fm-c-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fm-ic { flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.fm-ic .material-symbols-outlined { font-size: 20px; }
.fm-ic .prog-icon { width: 20px; height: 20px; }
.fm-row[data-key^="f:"] .fm-ic { color: var(--accent); }
.fm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fm-c-kind, .fm-c-size, .fm-c-when, .fm-c-gone { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-s); color: var(--muted); }
.fm-c-size, .fm-c-when { text-align: right; font-variant-numeric: tabular-nums; }
.fm-tag { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--sunk); color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }
.fm-tag .material-symbols-outlined { font-size: 13px; }
.fm-tag.shared { background: var(--info-soft); color: var(--info); }
.fm-edit { flex: 1; min-width: 80px; height: 24px; padding: 0 6px; border: 1px solid var(--accent); border-radius: var(--radius-xs); background: var(--surface); color: var(--text); font: inherit; outline: none; user-select: text; -webkit-user-select: text; }
.fm-row.gone { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto; column-gap: 6px; }
.fm-row.gone .fm-c-gone { padding-right: 8px; }

.fm-assist { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- files on their way up ---------- */
#fm-uploads { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--sunk); font-size: var(--fs-s); }
#fm-uploads[hidden] { display: none; }
.fm-up-ic { flex: none; display: inline-flex; color: var(--accent-strong); }
.fm-up-ic .material-symbols-outlined { font-size: 18px; }
.fm-up-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-up-bar { flex: 1; min-width: 60px; height: 6px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.fm-up-bar > i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width .2s; }
.fm-up-n { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- the preview ---------- */
.fm-preview { flex: 1; min-height: 0; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.fm-pv-media { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 132px; padding: 10px; border-radius: var(--radius); background: var(--sunk); overflow: hidden; }
.fm-pv-img { max-width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--radius-xs); background: var(--checker); }
.fm-pv-img.page { background: var(--surface); box-shadow: var(--shadow); }
.fm-pv-video { max-width: 100%; max-height: 260px; border-radius: var(--radius-xs); background: var(--toast); }
.fm-pv-audio { width: 100%; }
.fm-pv-page { max-width: 100%; height: auto; box-shadow: var(--shadow); }
.fm-pv-text { align-self: stretch; margin: 0; max-height: 300px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-xs); background: var(--surface); color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.5; white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; }
.fm-pv-icon { flex: none; align-self: center; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.fm-pv-icon .material-symbols-outlined { font-size: 64px; }
.fm-pv-icon.prog .prog-icon { width: 64px; height: 64px; }
.fm-pv-name { font-size: var(--fs-l); font-weight: 600; word-break: break-word; }
.fm-pv-sub { margin-top: 2px; font-size: var(--fs-s); color: var(--muted); }
.fm-pv-note { margin: 0; font-size: var(--fs-s); line-height: 1.5; color: var(--muted); }
.fm-pv-media .fm-pv-note { text-align: center; }
.fm-pv-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; margin: 0; font-size: var(--fs-s); }
.fm-pv-facts dt { color: var(--muted); }
.fm-pv-facts dd { margin: 0; word-break: break-word; }
.fm-pv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-pv-actions:empty { display: none; }
/* the file big, in a window */
.fm-look { display: flex; }
.fm-pv-media.big { flex: 1; min-height: 320px; gap: 14px; }
.fm-pv-media.big .fm-pv-img, .fm-pv-media.big .fm-pv-video { max-height: 68vh; }
.fm-pv-media.big .fm-pv-text { max-height: 68vh; font-size: var(--fs-s); }
.fm-pv-media.big .fm-pv-audio { max-width: 520px; }

/* ---------- windows ---------- */
.fm-pick { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.fm-dim { color: var(--muted); }
.fm-sharebox { display: flex; flex-direction: column; gap: 10px; }
.fm-sharebox .fm-dim { margin: 0; font-size: var(--fs-s); line-height: 1.5; }
.fm-people { display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow: auto; }
.fm-person { display: flex; align-items: center; gap: 8px; }
.fm-person-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.fm-person-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-person .inp { width: auto; flex: none; padding: 4px 6px; font-size: var(--fs-m); }
.fm-invite { display: flex; gap: 8px; align-items: center; }
.fm-invite .inp:first-child { flex: 1; }
.fm-invite select.inp { width: auto; flex: none; }

@media (max-width: 900px) {
  #fm-head, .fm-row { grid-template-columns: minmax(0, 1fr) 84px; }
  .fm-c-kind, .fm-c-when { display: none; }
}
