/* TUR-81 folders / move / trash / zip, TUR-82 batch of prompts (Fable 26.11). Theme tokens only (light + dark), soft
   shadows, no outlines, green accent (--rd-green / --rd-green-tint). Modals reuse the TUR-74 card (tur74.css). */

/* ---------- folder strip: All · folders · New folder ............ Trash ---------- */
.lib-strip { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 2px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; }
.lib-strip::-webkit-scrollbar { display: none; }
.lib-strip[hidden], .lib-note[hidden], .lib-more[hidden] { display: none; }
.lib-chip-f { flex: none; display: inline-flex; align-items: center; height: 38px; border-radius: 999px; background: var(--panel-2);
  color: var(--text); transition: background .15s, box-shadow .15s, transform .15s; }
.lib-chip-f:hover { background: var(--rd-green-tint, #ecfdf3); }
.lib-chip-b { display: inline-flex; align-items: center; gap: 7px; height: 100%; max-width: 240px; padding: 0 14px 0 12px; border: 0;
  border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.lib-chip-b .ico { flex: none; width: 16px; height: 16px; color: var(--muted); }
.lib-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-chip-b small { flex: none; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: color-mix(in srgb, currentColor 9%, transparent); font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--muted); font-variant-numeric: tabular-nums; }   /* owner 26.11: the count sits centred as a badge */
.lib-chip-f.on { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green-ink, #166534); box-shadow: inset 0 0 0 1.5px var(--rd-green, #16a34a); }
.lib-chip-f.on .lib-chip-b .ico, .lib-chip-f.on small { color: var(--rd-green, #16a34a); }
.lib-chip-f.on .lib-chip-b { padding-right: 4px; }
.lib-chip-f.on:not(:has(.lib-chip-more)) .lib-chip-b { padding-right: 14px; }
.lib-chip-more { display: grid; place-items: center; width: 30px; height: 30px; margin-right: 4px; border: 0; border-radius: 50%; line-height: 0;
  background: transparent; color: var(--rd-green, #16a34a); cursor: pointer; }
.lib-chip-more:hover { background: color-mix(in srgb, var(--rd-green, #16a34a) 16%, transparent); }
.lib-chip-more .ico { width: 16px; height: 16px; }
.lib-chip-b:focus-visible, .lib-chip-more:focus-visible, .lib-chip-new:focus-visible, .lib-in:focus-visible, .lib-row:focus-visible {
  outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rd-green, #16a34a) 35%, transparent); }
.lib-chip-new { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 10px; border: 0;
  border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--line); }
.lib-chip-new:hover { color: var(--rd-green, #16a34a); box-shadow: inset 0 0 0 1.5px var(--rd-green, #16a34a); }
.lib-chip-new .ico { width: 16px; height: 16px; }
.lib-chip-trash { margin-left: auto; background: transparent; }
.lib-chip-trash .lib-chip-b { color: var(--muted); }
.lib-chip-trash.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.lib-chip-trash.on .lib-chip-b { color: var(--text); }
.lib-chip-trash.on .lib-chip-b .ico, .lib-chip-trash.on small { color: var(--text); }
/* a tile is being dragged: every folder invites the drop, the one under the pointer lights up */
.lib-strip.dragging .lib-chip-f:not(.lib-chip-trash) { box-shadow: inset 0 0 0 1.5px var(--rd-green, #16a34a); }
.lib-strip.dragging .lib-chip-f.drop { background: var(--rd-green, #16a34a); color: #fff; transform: scale(1.05); }
.lib-strip.dragging .lib-chip-f.drop .ico, .lib-strip.dragging .lib-chip-f.drop small { color: #fff; }
.lib-strip.dragging .lib-chip-trash, .lib-strip.dragging .lib-chip-new { opacity: .4; }
.tile.lib-drag { opacity: .5; }
.tile[draggable="true"] .media { cursor: grab; }

/* small folder menu (rename / delete) */
.lib-menu { position: fixed; z-index: 60; min-width: 190px; padding: 6px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: 0 18px 44px rgba(15, 17, 21, .16); }
html[data-theme="dark"] .lib-menu { box-shadow: 0 18px 44px rgba(0, 0, 0, .55); }
.lib-menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.lib-menu button:hover { background: var(--panel-2); }
.lib-menu button .ico { width: 16px; height: 16px; color: var(--muted); }
.lib-menu button.danger, .lib-menu button.danger .ico { color: #dc2626; }

/* folder badge on a tile in "All" */
.lib-in { align-self: flex-start; justify-self: start; width: fit-content; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 22px; margin: 2px 0 0; padding: 0 8px 0 6px;
  border: 0; border-radius: 999px; background: var(--panel-2); color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.lib-in:hover { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green, #16a34a); }
.lib-in .ico { flex: none; width: 12px; height: 12px; }
.lib-in span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- trash ---------- */
.lib-note { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border-radius: 16px;
  background: var(--panel-2); color: var(--text); }
.lib-note-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--panel); color: var(--muted); }
.lib-note-ic .ico { width: 18px; height: 18px; }
.lib-note p { flex: 1; min-width: 0; margin: 0; font-size: 13.5px; line-height: 1.5; }
.lib-empty-btn { flex: none; border-radius: 999px; color: #dc2626; }
.lib-empty-btn .ico { color: #dc2626; }
.lib-left { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lib-left .ico { width: 13px; height: 13px; }
.lib-left.soon { color: #d97706; }
.tile.lib-trashed .media img, .tile.lib-trashed .media video { filter: saturate(.55); }
.tile.lib-trashed:hover .media img, .tile.lib-trashed:hover .media video { filter: none; }
.lib-loading { border: 0; }
.lib-loading .gen-ring { display: inline-block; }
.lib-more-row { display: flex; justify-content: center; padding: 22px 0 8px; }
.lib-more { border-radius: 999px; min-height: 40px; padding: 0 22px; }

/* ---------- selection bar: count · Select all · Move / Zip / Delete ---------- */
.gal-bar .lib-acts { display: flex; align-items: center; gap: 8px; }
html.rd-v6 .gal-bar { border: 0; border-radius: 18px; box-shadow: 0 10px 34px rgba(15, 17, 21, .14); }
html.rd-v6[data-theme="dark"] .gal-bar { background: var(--panel-2); box-shadow: 0 10px 34px rgba(0, 0, 0, .5); }
html.rd-v6 .gal-bar .btn { border-radius: 999px; }
html.rd-v6 .gal-bar .btn.ghost { border: 0; background: var(--panel-2); }
html.rd-v6[data-theme="dark"] .gal-bar .btn.ghost { background: var(--panel); }
html.rd-v6 .gal-bar .btn.ghost:hover:not(:disabled) { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green, #16a34a); }
html.rd-v6 .gal-bar .lib-all { background: transparent; color: var(--rd-green, #16a34a); font-weight: 700; }
html.rd-v6[data-theme="dark"] .gal-bar .lib-all { background: transparent; }
html.rd-v6 .tile.picked { outline-color: var(--rd-green, #16a34a); }
/* Delete = to the trash (it can come back): a soft red. Delete forever keeps the solid red (.gal-del) */
html.rd-v6 .gal-bar .btn.lib-del, .gal-bar .btn.lib-del { background: color-mix(in srgb, #dc2626 12%, var(--panel)) !important; color: #dc2626 !important; box-shadow: none !important; }
html.rd-v6 .gal-bar .btn.lib-del:hover:not(:disabled) { background: color-mix(in srgb, #dc2626 22%, var(--panel)) !important; }
.gal-bar .lib-del:disabled, .gal-bar .gal-del:disabled { opacity: .45; }
html[data-theme="dark"] .gal-bar .btn.lib-del { color: #fca5a5 !important; }

/* ---------- "Move to..." sheet ---------- */
.lib-rows { display: grid; gap: 4px; }
.lib-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 12px 6px 8px; border: 0; border-radius: 14px;
  background: transparent; color: var(--text); font: inherit; font-size: 15px; font-weight: 650; text-align: left; cursor: pointer; }
.lib-row:hover { background: var(--panel-2); }
.lib-row-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--panel-2); color: var(--muted); }
.lib-row:hover .lib-row-ic { background: var(--panel); }
.lib-row-ic .ico { width: 18px; height: 18px; }
.lib-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-row-n { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.lib-row-ok { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--rd-green, #16a34a); color: #fff; }
.lib-row-ok .ico { width: 13px; height: 13px; }
.lib-row.on .lib-row-ic { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green, #16a34a); }
.lib-row-new { margin-top: 4px; color: var(--rd-green, #16a34a); }
.lib-row-new .lib-row-ic { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green, #16a34a); }
.lib-modal .t74-footbar .btn.ghost { min-height: 46px; padding: 0 18px; }
.lib-modal label.t74-lab { display: block; }

/* ---------- batch of prompts ---------- */
.lib-batch-set { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--panel-2);
  color: var(--text); font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.lib-chip.strong { background: var(--text); color: var(--bg); }
.lib-chip.price { background: var(--rd-green-tint, #ecfdf3); color: var(--rd-green, #16a34a); font-weight: 800; }
.lib-batch-head { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.lib-batch-head .t74-lab { margin: 0; }
.lib-batch-count { font-size: 12.5px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-batch-count.bad { color: #dc2626; }
.lib-batch-up { margin-left: auto; border-radius: 999px; }
.lib-batch-ta { min-height: 150px; resize: vertical; white-space: pre; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.lib-batch-warn { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; padding: 9px 12px; border-radius: 12px; font-size: 13px; font-weight: 650;
  background: color-mix(in srgb, #dc2626 9%, var(--bg)); color: #b91c1c; }
html[data-theme="dark"] .lib-batch-warn { color: #fca5a5; }
.lib-batch-warn[hidden], .lib-batch-list[hidden] { display: none; }
.lib-batch-top { margin-left: auto; font-weight: 800; color: inherit; white-space: nowrap; }
.lib-batch-list { list-style: none; counter-reset: row; margin: 2px 0 0; padding: 4px; max-height: 196px; overflow: auto; border-radius: 14px; background: var(--panel-2); }
.lib-batch-list li { counter-increment: row; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 4px 0 0; border-radius: 9px; font-size: 13px; }
.lib-batch-list li::before { content: counter(row); flex: none; width: 30px; text-align: right; font-size: 11.5px; font-weight: 800; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.lib-batch-list li:hover { background: var(--panel); }
.lib-batch-list li.bad { color: #dc2626; }
.lib-batch-list li.bad::before { color: #dc2626; }
.lib-batch-p { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-batch-x { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.lib-batch-x:hover { background: var(--panel-2); color: #dc2626; }
.lib-batch-x .ico { width: 13px; height: 13px; }
.lib-batch-folder { position: relative; display: flex; align-items: center; }
.lib-batch-folder > span { position: absolute; left: 12px; display: grid; color: var(--rd-green, #16a34a); pointer-events: none; }
.lib-batch-folder .ico { width: 17px; height: 17px; }
.lib-batch-folder .t74-input { padding-left: 38px; }
.lib-batch .cmp4-total span { font-variant-numeric: tabular-nums; }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .lib-strip { margin: 0 -16px 12px; padding: 2px 16px; gap: 6px; }
  .lib-chip-f, .lib-chip-new { height: 40px; }
  .lib-chip-b { max-width: 180px; }
  .lib-chip-new { padding: 0; width: 40px; justify-content: center; }
  .lib-chip-new span { display: none; }
  .lib-chip-trash { margin-left: 0; }
  .lib-chip-trash .lib-chip-name { display: none; }
  .lib-chip-trash.on .lib-chip-name { display: inline; }
  .lib-note { align-items: flex-start; flex-wrap: wrap; }
  .lib-note p { flex: 1 1 60%; }
  .lib-empty-btn { margin-left: 48px; }
  /* select mode: the bar docks to the bottom edge, one thumb-sized button per action */
  .lib-page .gal-bar { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 40; flex-wrap: wrap; gap: 8px 10px; margin: 0;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0 !important;
    box-shadow: 0 -10px 34px rgba(15, 17, 21, .16) !important; }
  .lib-page .gal-bar .lib-acts { flex: 1 1 100%; gap: 8px; }
  .lib-page .gal-bar .lib-acts .btn { flex: 1; min-height: 46px; padding: 0 6px; font-size: 13px; }
  html.lib-selecting .lib-page { padding-bottom: 150px; }
  .lib-row { min-height: 56px; }
  .lib-batch-ta { min-height: 132px; font-size: 16px; }
  .lib-batch-up { padding: 0 10px; }
  .lib-batch-list { max-height: 150px; }
}
@media (prefers-reduced-motion: reduce) { .lib-chip-f { transition: none; } }

/* TUR-90 (owner 27.11): on phones the All / Image / Video / Audio / Motions / Favourites switch wrapped into three
   uneven rows inside one oval. It is one row now and scrolls sideways; the right edge fades to say there is more. */
@media (max-width: 640px) {
  .lib-page .gal-tools .seg-inline { display: flex; flex-wrap: nowrap; width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-padding: 0 24px; }
  .lib-page .gal-tools .seg-inline::-webkit-scrollbar { display: none; }
  .lib-page .gal-tools .seg-inline button, .lib-page .gal-tools .seg-inline button:nth-of-type(n+4) { grid-column: auto; flex: none; height: 36px; padding: 0 14px; white-space: nowrap; }
  .lib-page .gal-tools .seg-inline.is-more::after { content: ""; position: sticky; right: 0; flex: none; align-self: stretch; width: 1px; margin-left: -1px; pointer-events: none;
    box-shadow: 0 0 14px 16px var(--panel-2, #f1f5ee); }
}
