/* Files (distributed file network) — azure-style repository explorer */
.files-page { max-width: 1200px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 42px) 48px; }
.files-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.files-back { margin-right: 2px; }
.files-toolbar .btn.active { background: #deebff; border-color: #1769e0; color: #1558b0; }
.files-crumb { display: flex; align-items: center; gap: 6px; font-size: 1.05rem; font-weight: 650; color: #172b4d; flex-wrap: wrap; }
.files-crumb-root { color: #52627a; }
.files-crumb-link { border: 0; background: transparent; padding: 2px 4px; border-radius: 4px; font-weight: 650; color: #1769e0; }
.files-crumb-link:hover { background: #eef3ff; }
.files-crumb-sep { color: #97a4b8; font-weight: 700; }
.files-repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.files-repo-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px 16px; border: 1px solid #e0e5ed; border-radius: 10px; background: #fff; text-align: left; transition: box-shadow .15s ease, border-color .15s ease; }
.files-repo-card:hover { border-color: #8bb6ff; box-shadow: 0 6px 18px rgba(23,43,77,.1); }
.files-repo-card > i { font-size: 1.7rem; color: #1769e0; margin-bottom: 6px; }
.files-repo-name { font-weight: 650; color: #172b4d; font-size: .95rem; }
.files-repo-desc { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.files-explorer { position: relative; min-height: 260px; border: 1px solid #e0e5ed; border-radius: 10px; background: #fff; padding: 14px 16px; }
.files-folder-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.files-folder { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #dfe3eb; border-radius: 8px; background: #f8faff; font-size: .85rem; color: #172b4d; }
.files-folder:hover { border-color: #8bb6ff; color: #1769e0; }
.files-folder i { color: #e8a33d; }
.files-table td a { color: #172b4d; text-decoration: none; }
.files-table td a:hover { color: #1769e0; text-decoration: underline; }
/* keep the details grid inside the bordered explorer: long agent filenames
   (e.g. WinSxS) must never push the table past the container */
.files-table { table-layout: fixed; }

.files-table th, .files-table td { overflow: hidden; text-overflow: ellipsis; }
.files-table td { white-space: nowrap; }
.files-table thead th.files-sortable { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-drop-overlay { position: fixed; inset: 0; z-index: 1250; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(23,105,224,.12); border: 3px dashed #1769e0; color: #1769e0; pointer-events: none; }
.files-context { position: fixed; z-index: 1400; min-width: 240px; padding: 6px; border: 1px solid #dfe3eb; border-radius: 8px; background: #fff; box-shadow: 0 12px 34px rgba(23,43,77,.2); }
.files-context-name { padding: 4px 10px 8px; font-weight: 650; font-size: .82rem; color: #172b4d; border-bottom: 1px solid #eef1f6; margin-bottom: 4px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-context-item { display: flex; align-items: center; width: 100%; border: 0; background: transparent; padding: 6px 10px; border-radius: 5px; font-size: .84rem; color: #172b4d; text-align: left; }
.files-context-item:hover { background: #f0f4ff; }
/* gallery + image preview modes */
.files-gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.files-gallery-small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.files-gallery-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.files-gallery-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1px solid #e3e7ef; border-radius: 8px; background: #fff; cursor: pointer; text-align: center; overflow: hidden; }
.files-gallery-item:hover { border-color: #8bb6ff; box-shadow: 0 4px 12px rgba(23,43,77,.08); }
.files-gallery-item i { font-size: 1.6rem; color: #8fa3c2; }
.files-gallery-folder i { color: #e8a33d; }
.files-gallery-item img { width: 100%; height: 72px; object-fit: cover; border-radius: 5px; background: #f4f5f7; }
.files-gallery-small .files-gallery-item img { height: 48px; }
.files-gallery-large .files-gallery-item img { height: 140px; }
.files-gallery-name { font-size: .78rem; color: #172b4d; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* activity table */
.files-activity-wrap { max-height: 55vh; overflow-y: auto; border: 1px solid #eef1f6; border-radius: 8px; }
.files-act { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.files-act_upload { background: #e7f8f0; color: #168356; }
.files-act_download { background: #e8f1ff; color: #1558b0; }
.files-act_delete, .files-act_delete_all { background: #ffebe7; color: #c9372c; }
.files-act_auto_cleanup, .files-act_github_cache, .files-act_github_proxy { background: #fff3df; color: #9b6500; }
.files-act_repo_created { background: #e7f8f0; color: #168356; }
.files-act_repo_deleted { background: #ffebe7; color: #c9372c; }
/* permissions dialog polish */
.files-page .board-perm-table { border: 1px solid #e3e7ef; border-radius: 8px; overflow: hidden; background: #fff; }
.files-page .board-perm-table td { padding: 8px 12px; }
.files-page .board-perm-assigned { min-height: 180px; background: #fbfcfe; }
.files-page .board-perm-row { box-shadow: 0 1px 2px rgba(23,43,77,.05); }
.files-page .board-perm-role { border-color: #d7deea; }
/* search split views (repo + global) and the search boxes */
.files-global-search { max-width: 300px; }
.files-splitview { display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow-y: auto; }
.files-split-section { border: 1px solid #e3e7ef; border-radius: 8px; background: #fff; padding: 10px 14px; }
.files-split-head { font-weight: 650; color: #172b4d; margin-bottom: 6px; }
.files-split-subhead { font-family: SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; color: #1558b0; background: #f0f4ff; border-radius: 4px; padding: 2px 8px; margin: 8px 0 4px; }
.files-split-subhead-folder { cursor: pointer; display: inline-block; }
.files-split-subhead-folder:hover { background: #dce8ff; text-decoration: underline; }
.files-gallery-search { margin: 2px 0 8px; }
/* split tables: fixed column grid so size/user/date align across sections */
.files-split-table { table-layout: fixed; }
.files-split-table .files-col-name { width: auto; }
.files-split-table .files-col-size { width: 96px; }
.files-split-table .files-col-user { width: 130px; }
.files-split-table .files-col-date { width: 165px; }
.files-split-table .files-col-jump { width: 40px; }
.files-split-table .files-cell-meta { color: #6b7a90; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-split-table .files-cell-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-split-table .files-cell-jump { text-align: right; }
.files-sort-select { width: 150px; }
.files-table .files-sortable { cursor: pointer; user-select: none; white-space: nowrap; color: #6b7a90; }
.files-table .files-sortable:hover { color: #172b4d; }
.files-table .files-sorted { color: #172b4d; }
/* git mirror bar */
.files-gitbar { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; padding: 6px 10px; background: #f6f8fc; border: 1px solid #e3e7ef; border-radius: 8px; }
.files-gitbar > i { color: #c2410c; font-size: 1.05rem; }
.files-git-ref { max-width: 340px; }
.files-git-head { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.files-spin { animation: files-rot 1s linear infinite; }
/* loading veil over the explorer while a folder listing loads — also swallows
   any clicks on folders/files so double-navigation can't race the state */
.files-loading-overlay { position: absolute; inset: 0; z-index: 20; display: flex; justify-content: center; background: rgba(255, 255, 255, .55); border-radius: 10px; }
.files-loading-box { display: flex; align-items: center; gap: 8px; margin-top: 28px; padding: 6px 14px; background: #fff; border: 1px solid #d9e1ec; border-radius: 20px; color: #44546a; font-size: .85rem; box-shadow: 0 2px 8px rgba(30, 55, 90, .12); height: fit-content; }
.files-loading-box .files-spin { width: 16px; height: 16px; border: 2px solid #b9c8dd; border-top-color: #1769e0; border-radius: 50%; }
@keyframes files-rot { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
/* disk usage bar (toolbar) */
.files-disk { display: flex; align-items: center; gap: 6px; }
.files-disk > i { color: #6b7a90; }
.files-disk-bar { width: 90px; height: 8px; background: #e6ebf4; border-radius: 5px; overflow: hidden; }
.files-disk-fill { height: 100%; background: linear-gradient(90deg, #8bb8ff, #3d8bfd); border-radius: 5px; transition: width .4s ease; }
.files-disk-label { font-size: .75rem; color: #48607e; font-variant-numeric: tabular-nums; }
/* search row directly under the path/toolbar */
.files-searchrow { margin: 2px 0 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.files-searchrow input { max-width: 430px; }
.files-searchrow-sep { width: 1px; height: 20px; background: #dde3ec; margin: 0 2px; }
/* repository list view (small details list) */
.files-repo-listview { padding: 8px 10px; }
.files-repo-listview .table th { white-space: nowrap; }
/* gallery: wrap long names (max 5 lines) + equal row heights */
.files-gallery { grid-auto-rows: auto; align-items: stretch; }
.files-gallery-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.files-gallery-item { height: 100%; justify-content: flex-start; }
.files-gallery-icon { font-size: 1.6rem; }
/* activity table sortable headers */
.files-act-table th.files-sortable { cursor: pointer; user-select: none; white-space: nowrap; color: #6b7a90; }
.files-act-table th.files-sortable:hover { color: #172b4d; }
.files-act-table th.files-sorted { color: #172b4d; }
/* preview cache block in settings */
.files-preview-cache { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e3e7ef; border-radius: 8px; background: #f8fafd; }
/* settings dialog panels (same box look as the SFTP share panel) */
.files-settings-panel { display: block; padding: 12px 14px; margin-top: 12px; border: 1px solid #e3e7ef; border-radius: 8px; background: #f8fafd; }
.files-settings-panel-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .85rem; margin-bottom: 10px; color: #43536b; }
.files-settings-panel-head .bi { color: #1769e0; }
/* switches inside settings panels: long labels must wrap beside the toggle */
.files-settings-panel .form-check { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 8px; }
.files-settings-panel .form-check .form-check-input { flex: 0 0 auto; margin-top: 2px; }
.files-settings-panel .form-check .form-check-label { flex: 1 1 220px; min-width: 0; white-space: normal; overflow-wrap: break-word; }
/* searchable ref combobox (git bar) */
.files-refcombo { position: relative; min-width: 260px; max-width: 460px; }
.files-refcombo-btn { width: 100%; display: flex; align-items: center; text-align: left; overflow: hidden; }
.files-refcombo-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-refcombo-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1060; background: #fff; border: 1px solid #cfd6e1; border-radius: 8px; box-shadow: 0 10px 28px rgba(23,43,77,.18); padding: 8px; }
.files-refcombo-list { max-height: 300px; overflow-y: auto; }
.files-refcombo-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #7a8aa0; padding: 6px 8px 2px; }
.files-refcombo-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; font-size: .85rem; color: #172b4d; }
/* sync progress bar (git bar) */
.files-sync-progress { display: flex; align-items: center; gap: 8px; flex: 1 1 160px; min-width: 160px; max-width: 340px; }
.files-sync-bar { flex: 1; height: 6px; background: #e6ebf3; border-radius: 3px; overflow: hidden; }
.files-sync-fill { height: 100%; background: #1769e0; border-radius: 3px; transition: width .3s ease; }
.files-sync-phase { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-refcombo-item:hover { background: #f0f5ff; }
.files-refcombo-item.active { background: #e3eeff; color: #1558b0; }
.files-refcombo-subj { word-break: break-word; }
/* changelog panel (git repos) */
.files-changelog { max-height: 260px; overflow-y: auto; border: 1px solid #e3e7ef; border-radius: 8px; background: #fff; margin: 0 0 10px; }
.files-changelog-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; border-bottom: 1px solid #f1f4f9; }
.files-changelog-row:hover { background: #f4f8ff; }
.files-changelog-row.active { background: #e8f1ff; }
.files-changelog-row.files-changelog-newer { opacity: .38; }
.files-changelog-row.files-changelog-newer:hover { opacity: .75; background: #f4f8ff; }
.files-changelog-row code { color: #1558b0; background: #f0f4ff; border-radius: 4px; padding: 1px 6px; }
.files-changelog-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-changelog-meta { margin-left: auto; white-space: nowrap; }
/* sortable header row above search split views (matches .files-split-table colgroup) */
.files-split-grid { display: grid; grid-template-columns: minmax(0, 1fr) 96px 130px 165px 40px; column-gap: 8px; align-items: center; }
.files-split-sorthead { padding: 4px 8px; background: #f4f7fc; border: 1px solid #e3e7ef; border-radius: 6px; font-size: .8rem; position: sticky; top: 0; z-index: 2; }
.files-split-sorthead .files-sortable { cursor: pointer; user-select: none; color: #6b7a90; white-space: nowrap; overflow: hidden; }
.files-split-sorthead .files-sortable:hover { color: #172b4d; }
.files-split-sorthead .files-sorted { color: #172b4d; font-weight: 600; }
/* empty folders stand out */
.files-folder.files-folder-empty { background: #fdf6e7; border-color: #ecd9a8; color: #8a6d1d; }
.files-gallery-folder.files-folder-empty { background: #fdf6e7; border-color: #ecd9a8; }
.files-folder.files-folder-empty i { color: #c9a227; }
/* push groups in settings */
.files-push-groups { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.files-toolbar-repo { font-size: 1.05rem; font-weight: 650; color: #172b4d; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-pathbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 6px 10px; margin-bottom: 8px; background: #f6f8fc; border: 1px solid #e4e9f2; border-radius: 8px; }
.files-pathbar-link { border: 0; background: transparent; padding: 2px 6px; border-radius: 5px; font-size: .85rem; font-weight: 600; color: #1769e0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-pathbar-link:hover { background: #e7efff; }
.files-pathbar-sep { font-size: .7rem; color: #97a4b8; }
.files-pathbar-counts { margin-left: auto; font-size: .78rem; color: #6b778c; white-space: nowrap; padding-left: 10px; }

/* --- gallery lightbox -------------------------------------------------- */
.files-lightbox { position: fixed; inset: 0; z-index: 2100; background: rgba(10, 14, 22, .92); display: flex; align-items: center; justify-content: center; }
.files-lightbox-topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 10px 60px 10px 12px; z-index: 2;
    background: linear-gradient(rgba(10,14,22,.75), transparent); }
.files-lightbox-topbar button { width: 38px; height: 38px; border: 0; border-radius: 8px; background: rgba(255,255,255,.12); color: #eef2f9; font-size: 1.05rem; display: inline-grid; place-items: center; }
.files-lightbox-topbar button:hover { background: rgba(255,255,255,.24); }
.files-lightbox-title { margin-left: 10px; color: #dbe2ee; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-lightbox-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: grab; }
.files-lightbox-stage:active { cursor: grabbing; }
.files-lightbox-stage img { max-width: 92vw; max-height: 92vh; object-fit: contain; transition: transform .08s linear; user-select: none; -webkit-user-drag: none; }
.files-lightbox-doc { display: flex; align-items: center; justify-content: center; }
.files-lightbox-fallback-icon { font-size: 7rem; }
.files-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 72px; border: 0; border-radius: 10px; background: rgba(255,255,255,.10); color: #eef2f9; font-size: 1.6rem; display: inline-grid; place-items: center; z-index: 2; }
.files-lightbox-nav:hover { background: rgba(255,255,255,.22); }
.files-lightbox-nav.prev { left: 14px; }
.files-lightbox-nav.next { right: 14px; }
.files-lightbox-close { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 8px; background: rgba(255,255,255,.14); color: #eef2f9; font-size: 1.1rem; display: inline-grid; place-items: center; z-index: 3; }
.files-lightbox-close:hover { background: rgba(214, 69, 69, .55); }

/* --- alias badge (github binary repos) --------------------------------- */
.files-alias-badge { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; background: #e3ecff; border: 1px solid #b9cdf5; color: #1558b0; font-size: .68rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.files-table th { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-col-grip { position: absolute; top: 0; right: 0; width: 12px; height: 100%; cursor: col-resize; z-index: 3; display: grid; place-items: center; }
.files-col-grip::after { content: ""; width: 3px; height: 16px; border-radius: 2px; background: transparent; transition: background .12s ease; }
.files-col-grip:hover::after { background: #1769e0; }
.files-table th:not(:first-child), .files-table td:not(:first-child) { border-left: 1px solid #e4e9f2; }
.files-table col { transition: none; }

/* --- upload status bar --------------------------------------------------- */
.files-uploadbar { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; margin-bottom: 8px; }
.files-upload { flex: 0 0 300px; display: flex; align-items: center; gap: 8px; padding: 5px 8px;
    background: #f6f8fc; border: 1px solid #e4e9f2; border-radius: 8px; font-size: .76rem; }
.files-upload.is-error { border-color: #f1aeb5; background: #fff5f5; }
.files-upload.is-paused { opacity: .75; }
.files-upload-progress { position: relative; flex: 0 0 80px; height: 14px; background: #e4e9f2; border-radius: 7px; overflow: hidden; }
.files-upload-bar { position: absolute; left: 0; top: 0; bottom: 0; background: #1769e0; transition: width .2s linear; }
.files-upload-pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: .62rem; font-weight: 700; color: #fff; text-shadow: 0 0 3px rgba(10, 20, 40, .7); }
.files-upload.is-done .files-upload-bar { background: #36b37e; }
.files-upload-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.files-upload-meta, .files-upload-eta, .files-upload-speed { color: #6b778c; white-space: nowrap; font-variant-numeric: tabular-nums; }
.files-upload-btn { border: 0; background: transparent; color: #52627a; padding: 0 2px; font-size: .85rem; cursor: pointer; }
.files-upload-btn:hover { color: #1769e0; }
.files-upload-btn.abort:hover { color: #d64545; }
.files-upload-done { color: #168356; }

/* --- column resize: inner horizontal scroll instead of container overflow --- */
.files-table-scroll, .files-split-scroll { overflow-x: auto; max-width: 100%; }
.files-split-sorthead .files-sortable { position: relative; border-left: 1px solid #e4e9f2; padding-left: 8px; }
.files-split-sorthead .files-sortable:first-child { border-left: 0; padding-left: 0; }
.files-split-table td:not(:first-child) { border-left: 1px solid #edf0f5; }
.files-dockerbar { background: #f0f6fb; border-color: #d4e3f0; }
.files-dockerbar > i.bi-box-seam { color: #0d6efd; }
.files-dockerbar-cmd { color: #33465c; background: #ffffffaa; border: 1px solid #d4e3f0; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
