/* File manager (ui/files.js). Same palette and controls as the map manager. */
#files { display: flex; flex-direction: column; gap: 10px; }
#files .fm-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
#files .fm-new { margin-left: auto; }
/* the folder we are in, as a trail of buttons */
#files .fm-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; min-width: 0; }
#files .fm-path button { background: none; border-color: transparent; padding: 3px 6px; color: var(--limb); }
#files .fm-path button:disabled { color: var(--cloud); opacity: 1; }
#files .fm-path > * + *::before { content: '/'; color: var(--haze); margin-right: 8px; margin-left: -4px; }
#files .fm-editing { padding: 3px 6px; font-weight: 700; }
#files .fm-editing.is-dirty::after { content: ' (not saved)'; font-weight: 400; color: var(--sun); }
#files .fm-list { flex: 1; overflow-y: auto; min-height: 0; align-content: start; display: grid; grid-auto-rows: max-content; }
#files.is-editing .fm-list, #files:not(.is-editing) .fm-edit { display: none; }
.fm-row { display: grid; grid-template-columns: minmax(0, 1fr) 6em 10.5em auto; gap: 4px 14px; align-items: center; padding: 5px 8px; border-bottom: 1px solid rgb(147 166 192 / .16); }
.fm-row:hover { background: rgb(147 166 192 / .07); }
#files .fm-name { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border-color: transparent; padding: 4px 6px; margin-left: -6px; text-align: left; }
#files .fm-name:disabled { opacity: 1; }
#files .fm-name:not(:disabled) { color: var(--limb); }
#files .fm-name.is-dir { color: var(--cloud); font-weight: 700; }
.fm-row > :first-child { grid-column: 1; }
.fm-hint { grid-column: 1; grid-row: 2; margin-top: -6px; color: var(--haze); font-size: 12px; }
.fm-size, .fm-time { color: var(--haze); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fm-size { text-align: right; }
.fm-acts { display: flex; gap: 6px; justify-content: flex-end; width: 17em; }
#files .fm-acts button { padding: 3px 10px; font-size: 13px; }
#files .fm-del.is-armed, #files .fm-close.is-armed { background: #7a2318; border-color: #e2725b; color: #fff; }
#files .fm-name-field { padding: 4px 8px; width: min(100%, 24em); box-sizing: border-box; }
.fm-empty { margin: 0; padding: 16px 0; color: var(--haze); }
/* the editor takes the place of the list */
#files .fm-edit { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 10px; min-height: 0; }
#files .fm-text { width: 100%; min-height: 0; box-sizing: border-box; resize: none; padding: 10px 12px; font: 13px/1.5 var(--mono); tab-size: 4; white-space: pre; overflow: auto; }
.fm-edit-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.fm-note { flex: 1 1 22em; color: var(--haze); font-size: 13px; }
.fm-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; color: var(--haze); font-size: 13px; }
#files.is-editing .fm-foot { display: none; }
#files .fm-foot button { padding: 3px 10px; font-size: 13px; }
/* a phone: a file is two lines, name above, size and what can be done with it below */
@media (max-width: 700px), (max-height: 520px) {
	.fm-row { grid-template-columns: minmax(0, 1fr) auto; padding: 6px 2px; }
	.fm-row > :first-child { grid-column: 1 / -1; }
	.fm-hint { grid-column: 1 / -1; }
	.fm-time { display: none; }
	.fm-size { text-align: left; grid-column: 1; }
	.fm-acts { width: auto; grid-column: 2; }
	#files { gap: 8px; }
	#files .fm-new { margin-left: 0; }
	#files :is(.fm-new, .fm-add) { flex: 1 1 40%; }
	#files .fm-note { flex-basis: 100%; order: 3; }
}
@media (pointer: coarse) { #files :is(.fm-tools, .fm-edit-bar) button { min-height: 40px; font-size: 16px; } #files .fm-acts button, #files .fm-foot button { min-height: 36px; } #files .fm-name { min-height: 36px; } #files .fm-text, #files .fm-name-field { font-size: 16px; } }

/* the path and the rows start at the page's left edge, like the tabs over them */
#files .fm-path { margin-left: -7px; }
