/* Clean up — duplicates, the biggest files and folders, old big files (public/cleanup.js).
 *
 * One view's rules in its own sheet, for the reason push.css and security.css each got one.
 * It declares no tokens: every colour is a theme token, so all seven themes dress it with no
 * rule of their own. The rows are the app's `.rows .row`; only what sits around them is new.
 */

.cl-page { display: flex; flex-direction: column; gap: 12px; max-width: 1180px; padding-bottom: calc(24 * var(--sp)); }

/* ---- the scan strip ---- */
.cl-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: calc(9 * var(--sp)) calc(13 * var(--sp)); border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--panel);
}
.cl-stat-t { flex: 1; min-width: 12em; font-size: var(--fs-base); color: var(--mut); }
.cl-status.running .cl-stat-t { color: var(--text2); }
.cl-prog { flex: 1 1 160px; height: 5px; border-radius: var(--r-4xs); background: var(--track); overflow: hidden; position: relative; }
.cl-prog > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s var(--ease); }
/* Not knowing how long is said by a short bar drifting, slowly — never a spinner race. */
.cl-prog.ind > i { position: absolute; animation: clDrift 1.8s ease-in-out infinite alternate; }
@keyframes clDrift { from { left: 0; } to { left: 70%; } }
@media (prefers-reduced-motion: reduce) { .cl-prog.ind > i { animation: none; } }

.cl-notes { margin-top: 0; }

/* ---- tabs ---- */
.cl-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.cl-tabs::-webkit-scrollbar { display: none; }
.cl-tab {
  flex: none; display: flex; align-items: baseline; gap: 6px;
  padding: calc(9 * var(--sp)) calc(12 * var(--sp)); margin-bottom: -1px;
  font-size: var(--fs-base); font-weight: var(--fw-semi); color: var(--mut);
  border-bottom: 2px solid transparent; transition: color .14s, border-color .14s;
}
.cl-tab:hover { color: var(--text); }
.cl-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.cl-tab em { font-style: normal; font-family: var(--font-meta); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--faint); }
.cl-tab.on em { color: var(--accent-text); }

.cl-body { display: flex; flex-direction: column; gap: 12px; }
.cl-lead { margin: 0; }

/* ---- tools above a list ---- */
.cl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.cl-tools-t { font-size: var(--fs-md); color: var(--text2); font-weight: var(--fw-semi); }
.cl-tools-b { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-md); color: var(--mut); }
.cl-tools .btn { height: 30px; padding: 0 calc(11 * var(--sp)); font-size: var(--fs-md); }
.cl-oldf { justify-content: flex-start; gap: 8px 22px; }

/* ---- duplicate groups ---- */
.cl-group { width: 100%; }
.cl-ghead {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: calc(9 * var(--sp)) 13px; border-bottom: 1px solid var(--line-soft); background: var(--glass);
}
.cl-gname { font-weight: var(--fw-bold); color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cl-gmeta { font-family: var(--font-meta); font-size: var(--fs-sm); color: var(--faint); }
.cl-gkeep { margin-left: auto; }

/* ---- rows ---- */
.rows .cl-row { align-items: center; gap: 11px; padding: calc(8 * var(--sp)) 13px; }
.cl-row .row-name { min-width: 0; }
.cl-chk { flex: none; display: grid; place-items: center; width: 22px; height: 22px; cursor: pointer; }
.cl-chk > input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.cl-thumb { flex: none; width: 34px; height: 34px; display: grid; place-items: center; position: relative; }
.cl-thumb .badge { --tile: 34px; }
.cl-thumb.row-thumb { width: 34px; height: 34px; }
.cl-nm {
  display: block; max-width: 100%; padding: 0; border: 0; background: none;
  font: inherit; font-weight: var(--fw-semi); color: var(--text); text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cl-nm:hover { text-decoration: underline; text-underline-offset: 2px; }
.cl-row .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-size { flex: none; font-family: var(--font-meta); font-size: calc(var(--fs-sm) + var(--fs-half)); color: var(--text2); white-space: nowrap; min-width: 4.6em; text-align: right; }
.cl-keep { flex: none; gap: 0; height: 28px; padding: 0 calc(10 * var(--sp)); font-size: var(--fs-sm); }
.cl-row.selected .cl-keep { opacity: .7; }

/* A folder's share of the biggest one: a thin line under its name, nothing more. */
.cl-share { display: block; height: 3px; margin-top: 6px; border-radius: var(--r-4xs); background: var(--track); overflow: hidden; max-width: 320px; }
.cl-share > i { display: block; height: 100%; background: var(--accent); opacity: .75; }

.cl-more { align-self: flex-start; }

.cl-foot { display: flex; align-items: center; gap: 7px; color: var(--faint); margin-top: 4px; }
.cl-foot > svg { width: 14px; height: 14px; flex: none; }

/* ---- the selection bar ----
   Sticky to the bottom of the scrolling content, so it stays in reach under a long list
   without covering the app's own floating bars. */
.cl-act {
  position: sticky; bottom: calc(12 * var(--sp)); z-index: 3; max-width: 1180px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 6px; padding: calc(9 * var(--sp)) calc(12 * var(--sp));
  background: var(--panel-solid, var(--panel)); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--text) 14%, transparent);
}
.cl-act.hidden { display: none; }
.cl-act-t { flex: 1; min-width: 8em; font-weight: var(--fw-semi); color: var(--text); font-family: var(--font-meta); font-size: var(--fs-base); }

/* ---- the ways in ---- */
.stor-clean { display: block; margin: 8px 0 0; padding: 4px 0; font-size: var(--fs-sm); }
.cl-entry { display: block; margin: 10px 0 0; padding: 2px 0; font-size: var(--fs-sm); }

/* ---- narrow ---- */
/* On a phone the name gets the width, but the size keeps its own right-hand slot: it is the
   point of the Biggest tabs, and at the end of a long "in folder · date" line it was the part
   that got cut off. Duplicate rows drop it (every copy is the same size; the group says it).
   "Keep this" becomes "Keep", the selection bar puts its count on a line of its own, and the
   tabs sit two to a line. */
@media (max-width: 640px) {
  .rows .cl-row { gap: 8px; padding: calc(8 * var(--sp)) 10px; }
  .cl-row .cl-show, .cl-group .cl-row .cl-size { display: none; }
  .cl-size { min-width: 0; font-size: var(--fs-sm); }
  .cl-k-this, .cl-tools-l { display: none; }
  .cl-gkeep { margin-left: 0; }
  .cl-tools .btn { height: 28px; }
  .cl-act-t { flex-basis: 100%; }
  /* All four tabs in sight: two to a line rather than a strip that runs off the edge. */
  .cl-tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; border-bottom: 0; }
  .cl-tab { justify-content: center; border-bottom: 1px solid var(--line-soft); }
  .cl-tab.on { border-bottom: 2px solid var(--accent); }
  .cl-act .cl-clear { margin-left: auto; }
  .view-head .cl-again { height: 30px; }
  /* Copies of one file share a long prefix and differ at the end, and Keep newest asks which
     is newest: so a duplicate's name and folder wrap instead of cutting, and its date has a
     line of its own. */
  .cl-group .cl-nm { white-space: normal; overflow-wrap: anywhere; }
  .cl-group .cl-row .row-sub { white-space: normal; overflow-wrap: anywhere; }
  .cl-group .cl-sep { display: none; }
  .cl-group .cl-when { display: block; }
}
/* Scan again stays put when a tab has no scrollbar. */
html[data-view=cleanup] #content { scrollbar-gutter: stable; }

/* The empty state's button needs the room every other empty state's call to action gets. */
.cl-page .empty .btn { margin-top: 16px; }
/* The file-list controls in the top bar mean nothing here. */
html[data-view=cleanup] :is(#seg-layout, #seg-size, #btn-sort, #btn-pin) { display: none; }
.view-head .cl-again { margin-left: auto; align-self: center; height: 32px; }
/* A selected row is repainted by some themes (Luna's is solid blue); follow its text colour. */
.cl-row.selected .cl-size, .cl-row.selected .cl-show { color: inherit; }
