/* ============================================================
   Files (Nautilus)
   ============================================================ */

.files-app {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ---------------- sidebar ---------------- */
.files-sidebar {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 6px;
  background: var(--c-sidebar-bg);
  border-right: 1px solid var(--c-border);
  overflow-y: auto;
  overflow-x: hidden;
}
.files-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--c-fg);
  width: 100%;
  text-align: left;
}
.files-side-head:hover { background: var(--c-hover); }
.files-side-head > svg { flex: 0 0 auto; opacity: .65; width: 16px; height: 16px; }
.files-side-sep { height: 1px; background: var(--c-border); margin: 7px 6px; }
.files-side-foot { margin-top: auto; padding: 10px 8px 4px; }
.files-side-foot-label { font-size: var(--fs-sm); font-weight: 700; }
.files-side-foot-sub { font-size: var(--fs-xs); color: var(--c-fg-muted); margin-top: 2px; }

.side-row .badge { margin-left: auto; font-size: 10px; }

/* ---------------- main ---------------- */
.files-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.files-pathbar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 0 6px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-headerbar-bg);
  flex: 0 0 auto;
  overflow: hidden;
}
.files-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-md);
  color: var(--c-fg-secondary);
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--dur-fast) ease;
}
.files-crumb:hover:not(.current) { background: var(--c-hover); color: var(--c-fg); }
.files-crumb.current { color: var(--c-fg); font-weight: 500; cursor: default; }
.files-crumb-sep { display: inline-flex; align-items: center; color: var(--c-fg-disabled); }
.files-crumb-sep svg { width: 10px; height: 10px; }
.files-path-spacer { flex: 1 1 auto; }
.files-path-entry {
  flex: 1 1 auto;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--c-view-bg);
  color: var(--c-fg);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
.files-path-entry:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--c-border);
  flex: 0 0 auto;
  min-height: 44px;
}
.files-toolbar-info { flex: 1 1 auto; font-size: var(--fs-sm); color: var(--c-fg-muted); }

.files-content { flex: 1 1 auto; overflow: auto; padding: 10px; min-height: 0; }
.files-empty { flex: 1 1 auto; min-height: 0; overflow: hidden; }

.files-status {
  flex: 0 0 auto;
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  color: var(--c-fg-muted);
  background: var(--c-headerbar-bg);
}

.files-search { position: relative; display: flex; align-items: center; width: 190px; }
.files-search-icon { position: absolute; left: 10px; color: var(--c-fg-muted); display: flex; }
.files-search .entry { padding-left: 30px; height: 30px; }
.files-sort { height: 30px; }

/* ---------------- grid view ---------------- */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px;
  align-content: start;
}
.files-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 8px;
  border-radius: 8px;
  cursor: default;
  border: 1px solid transparent;
  transition: background var(--dur-fast) ease;
  min-width: 0;
}
.files-cell:hover { background: var(--c-hover); }
.files-cell.selected {
  background: var(--c-selected);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.files-cell.selected .files-cell-label { color: var(--c-selected-fg); font-weight: 500; }
.files-cell-art { width: 48px; height: 48px; display: grid; place-items: center; }
.files-cell-art > svg { width: 42px; height: 42px; }
.files-cell-label {
  font-size: var(--fs-sm);
  text-align: center;
  line-height: 1.3;
  max-height: 32px;
  overflow: hidden;
  word-break: break-word;
  width: 100%;
  padding: 0 2px;
}
.files-thumb {
  width: 46px; height: 46px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
  display: grid;
  place-items: center;
  background: var(--c-view-bg);
}
.files-thumb svg { width: 100%; height: 100%; object-fit: cover; }
.files-star { position: absolute; top: 8px; right: 8px; color: var(--accent); }
.files-star svg { width: 12px; height: 12px; }

.files-rename {
  width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  text-align: center;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--c-view-bg);
  color: var(--c-fg);
  padding: 1px 4px;
}
.files-rename:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------------- list view ---------------- */
.files-list { display: flex; flex-direction: column; }
.files-list-row {
  display: grid;
  grid-template-columns: 1fr 110px 190px 150px;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 8px;
  border-radius: 5px;
  cursor: default;
  transition: background var(--dur-fast) ease;
}
.files-list-row:hover { background: var(--c-hover); }
.files-list-row.selected { background: var(--c-selected); }
.files-list-row.head {
  position: sticky;
  top: -10px;
  height: 30px;
  background: var(--c-window-bg);
  border-bottom: 1px solid var(--c-border);
  border-radius: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--c-fg-secondary);
  z-index: 2;
}
.files-list-row.head .files-list-cell { cursor: pointer; user-select: none; }
.files-list-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--fs-md);
  color: var(--c-fg-secondary);
  overflow: hidden;
}
.files-list-cell.name { color: var(--c-fg); }
.files-list-cell.right { justify-content: flex-end; }
.files-list-cell.sorted { color: var(--c-fg); }
.files-sort-arrow { display: inline-flex; margin-left: 3px; }
.files-sort-arrow svg { width: 10px; height: 10px; }
.files-list-icon { display: flex; flex: 0 0 auto; width: 18px; height: 18px; }
.files-list-icon > svg { width: 18px; height: 18px; }
.files-mini-thumb { width: 18px; height: 18px; border-radius: 3px; overflow: hidden; display: grid; place-items: center; background: var(--c-view-bg); }
.files-mini-thumb svg { width: 100%; height: 100%; }
.files-list-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- trash ---------------- */
.files-trash { display: flex; flex-direction: column; gap: 2px; }
.files-trash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 10px;
  border-radius: 6px;
}
.files-trash-row:hover { background: var(--c-hover); }
.files-trash-icon { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.files-trash-icon svg { width: 22px; height: 22px; }
.files-trash-main { flex: 1 1 auto; min-width: 0; }
.files-trash-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-trash-sub { font-size: var(--fs-xs); color: var(--c-fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- properties ---------------- */
.props { display: flex; flex-direction: column; gap: 2px; }
.props-row { display: flex; gap: 16px; padding: 5px 0; border-bottom: 1px solid var(--c-border); }
.props-row:last-child { border-bottom: 0; }
.props-key { flex: 0 0 110px; color: var(--c-fg-muted); font-size: var(--fs-sm); }
.props-val { flex: 1 1 auto; min-width: 0; word-break: break-word; }
.props-perms { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* ---------------- compact / mobile ---------------- */
@media (max-width: 820px) {
  .files-sidebar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 210px;
    z-index: 40;
    box-shadow: 6px 0 24px rgba(0, 0, 0, .28);
    transform: translateX(-102%);
    transition: transform 220ms var(--ease-shell);
  }
  .files-app.sidebar-open .files-sidebar { transform: translateX(0); }
  .files-app { position: relative; }
  .files-app.sidebar-open::after {
    content: "";
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .25);
    z-index: 30;
  }
  .files-list-row { grid-template-columns: 1fr 84px 120px; }
  .files-list-row .files-list-cell:nth-child(4) { display: none; }
}
@media (max-width: 560px) {
  .files-list-row { grid-template-columns: 1fr 74px; }
  .files-list-row .files-list-cell:nth-child(3) { display: none; }
  .files-search { width: 120px; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
