/* Files v2 uses the site's Matrix / Mutation tokens. */
.files-v2 { --v2-motion: 240ms; position:relative; }
.files-v2 [hidden], .v2-dialog [hidden] { display:none!important; }
.has-files-v2 .dashboard { padding-top:24px; }
.has-files-v2 .dashboard > .tab-bar { margin-bottom:20px; }
.v2-heading, .v2-heading-title, .v2-selection-head, .v2-list-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.v2-heading { min-height:74px; margin-bottom:12px; }
.v2-heading-title { justify-content:flex-start; min-width:0; }
.v2-heading-title > div { min-width:0; }
.v2-heading h2 { font-size:clamp(24px,3vw,36px); margin:5px 0 0; font-weight:400; overflow-wrap:anywhere; }
.v2-heading .eyebrow { margin:0; }
.v2-up { min-width:44px; font-size:20px; text-align:center; }
.v2-selection-head { min-height:74px; margin-bottom:12px; animation:v2-rise 180ms ease-out; }
.v2-selection-head strong { font-size:14px; font-weight:500; }
.files-v2 .v2-path { width:100%; flex-wrap:nowrap; overflow-x:auto; padding:4px 0 12px; margin:0 0 8px; }
.files-v2 .v2-path .path-chip { flex-shrink:0; }
.v2-sr { position:absolute!important; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.files-v2 .v2-controls { display:grid; grid-template-columns:minmax(140px,1fr) 140px 160px auto; gap:10px; margin-bottom:12px; }
.files-v2 .v2-controls input, .files-v2 .v2-controls select { min-height:44px; }
.files-v2 .v2-controls label { display:block; margin:0; }
.v2-list-toolbar { margin:8px 0 12px; flex-wrap:wrap; }
.v2-list-toolbar .content-tabs { margin:0; }
.v2-list-toolbar .toolbar-actions { display:flex; width:auto; gap:10px; align-items:center; }
.v2-list-toolbar [data-visible-count] { color:var(--muted); font:11px "SFMono-Regular",Consolas,monospace; }
.files-v2 .files-list { min-height:200px; }
.files-v2 .v2-item { min-height:76px; border-radius:3px; animation:none; transition:background 180ms ease,box-shadow 180ms ease; }
.files-v2 .files-list .v2-item { display:grid; grid-template-columns:minmax(0,1fr) 90px 140px 44px; grid-template-rows:auto; gap:10px; padding:5px 10px; }
.files-v2.is-selecting .files-list .v2-item { grid-template-columns:30px minmax(0,1fr) 90px 140px; }
.files-v2 .v2-item:hover, .files-v2 .v2-item:focus-within { transform:none; }
.files-v2 .v2-item-open { grid-column:auto; grid-row:auto; display:flex; align-items:center; gap:12px; min-width:0; width:100%; min-height:64px; border:0; border-radius:0; background:transparent; color:var(--ink); padding:8px 0; text-align:left; touch-action:pan-y; }
.files-v2 .v2-item-open .row-title { display:block; min-width:0; max-width:100%; }
.files-v2 .v2-item-open strong { display:block; font-size:14px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.files-v2 .v2-item-open small { display:block; margin-top:5px; font-size:11px; color:var(--muted); }
.files-v2 .v2-item-open .row-glyph { width:38px; height:42px; flex-shrink:0; }
.files-v2 .v2-item-menu { width:44px; min-height:44px; padding:0; font-size:21px; letter-spacing:1px; }
.files-v2 .v2-item, .files-v2 .v2-item * { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; -webkit-user-drag:none; }
.files-v2 input, .files-v2 textarea, .v2-dialog input { -webkit-user-select:text; user-select:text; -webkit-touch-callout:default; }
.files-v2 .v2-check { display:none; align-items:center; justify-content:center; min-width:30px; min-height:44px; margin:0; }
.files-v2 .v2-check input { width:20px; min-height:20px; height:20px; padding:0; accent-color:var(--ink); }
.files-v2.is-selecting .v2-check { display:flex; animation:v2-rise 160ms ease-out; }
.files-v2.is-selecting .v2-item-menu { display:none; }
.files-v2 .v2-item.is-selected { background:color-mix(in srgb,var(--ink) 10%,var(--bg)); box-shadow:inset 2px 0 var(--ink); }
.files-v2 .files-grid { gap:12px; min-height:200px; }
.files-v2 .files-grid .v2-item { min-width:0; position:relative; display:block; min-height:160px; padding:12px; }
.files-v2 .files-grid .v2-item-open { display:flex; flex-direction:column; align-items:flex-start; gap:18px; padding:12px 0 0; }
.files-v2 .files-grid .row-size, .files-v2 .files-grid .row-date { display:none; }
.files-v2 .files-grid .v2-item-menu, .files-v2 .files-grid .v2-check { position:absolute; top:7px; right:7px; }
.v2-footer { position:sticky; bottom:12px; z-index:12; display:flex; align-items:center; justify-content:flex-end; margin-top:18px; padding:8px 0; pointer-events:none; }
.v2-footer > * { pointer-events:auto; }
.v2-add { box-shadow:0 8px 24px color-mix(in srgb,var(--bg) 65%,transparent); }
.v2-batch { display:flex; justify-content:space-evenly; gap:8px; padding:10px; width:100%; border:1px solid var(--line-hard); background:var(--bg); box-shadow:0 12px 30px color-mix(in srgb,var(--bg) 75%,transparent); animation:v2-rise 220ms cubic-bezier(.2,.8,.2,1); }
.v2-batch .mini-button { flex:1; min-height:44px; }
.v2-dialog { color:var(--ink); background:var(--bg); padding:0; border:1px solid var(--line-hard); width:min(440px,calc(100vw - 36px)); max-width:100%; max-height:calc(100dvh - 48px); overflow:auto; overscroll-behavior:contain; box-shadow:var(--shadow); }
.v2-dialog::backdrop { background:rgba(0,0,0,.64); backdrop-filter:blur(3px); }
.v2-dialog[open] { animation:v2-dialog-in 240ms cubic-bezier(.2,.8,.2,1); }
.v2-dialog-card { padding:22px; background:linear-gradient(145deg,var(--card-shade),transparent 45%),var(--bg); }
.v2-dialog-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.v2-dialog-head h2 { font-size:20px; font-weight:400; margin:0; overflow-wrap:anywhere; }
.v2-dialog-head .mini-button { min-width:44px; min-height:44px; flex-shrink:0; font-size:20px; }
.v2-handle { display:none; }
.v2-action, .v2-destination { display:flex; align-items:center; gap:12px; width:100%; min-height:48px; border:1px solid transparent; background:transparent; color:var(--ink); padding:11px 12px; text-align:left; font-size:14px; transition:background 160ms,border-color 160ms; }
.v2-action:hover, .v2-destination:hover { background:var(--card-shade); border-color:var(--line); }
.v2-action:active, .v2-destination:active { transform:scale(.985); }
.v2-action.danger { color:#ff8585; }
body.is-mutation .v2-action.danger { color:#ad2424; }
.v2-dialog hr { border:0; border-top:1px solid var(--line); margin:10px 0; }
.v2-destination-path { padding:12px; margin:12px 0; border:1px solid var(--line); background:var(--card-shade); overflow-wrap:anywhere; font:12px/1.6 "SFMono-Regular",Consolas,monospace; }
.v2-destination-summary, .v2-empty, .v2-delete-warning { color:var(--muted); line-height:1.6; font-size:13px; }
.v2-destinations { max-height:40dvh; overflow:auto; overscroll-behavior:contain; }
.v2-destination span:first-child { color:#e9bf60; font-size:24px; }
body.is-mutation .v2-destination span:first-child { color:#84621c; }
.v2-destination span:nth-child(2) { flex:1; overflow-wrap:anywhere; }
.v2-destination span:last-child { color:var(--muted); }
.v2-destination:disabled, .v2-dialog button:disabled { cursor:not-allowed; opacity:.4; }
.v2-confirm-destination, .v2-download { width:100%; margin:14px 0 0; }
.v2-error { border:1px solid #ff8585; padding:12px; line-height:1.6; font-size:13px; margin:14px 0 0; }
.v2-details { display:grid; grid-template-columns:80px minmax(0,1fr); gap:12px; margin:20px 0; font-size:13px; }
.v2-details dt { color:var(--muted); }
.v2-details dd { margin:0; overflow-wrap:anywhere; }
.has-files-v2 .action-modal[open] { animation:v2-dialog-in 240ms cubic-bezier(.2,.8,.2,1); }
.has-files-v2 .action-modal[open] .modal-card { animation:none; }
.has-files-v2 .action-modal input, .has-files-v2 .action-modal textarea { -webkit-user-select:text; user-select:text; }
@keyframes v2-rise { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes v2-dialog-in { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:980px) {
  .files-v2 .files-list .v2-item { grid-template-columns:minmax(0,1fr) 44px; }
  .files-v2.is-selecting .files-list .v2-item { grid-template-columns:30px minmax(0,1fr); }
  .files-v2 .files-list .row-size, .files-v2 .files-list .row-date { display:none; }
}
@media(max-width:760px) {
  .has-files-v2 .dashboard { padding-top:12px; padding-bottom:28px; }
  .has-files-v2 .files-explorer { display:block; }
  .has-files-v2 .explorer-sidebar { display:none; }
  .has-files-v2 .explorer-main { padding:14px 12px; }
  .has-files-v2 .tab-bar { margin-bottom:12px; }
  .files-v2 .v2-controls { grid-template-columns:1fr 1fr; gap:8px; }
  .files-v2 .v2-controls .search-control { grid-column:1 / -1; }
  .files-v2 .v2-controls .filter-control { grid-column:auto; }
  .files-v2 .v2-controls .view-toggle { grid-column:1 / -1; }
  .files-v2 .v2-controls input, .files-v2 .v2-controls select { font-size:16px; }
  .v2-heading { min-height:58px; }
  .v2-heading h2 { font-size:26px; }
  .v2-heading .eyebrow { display:none; }
  .v2-list-toolbar { gap:8px; }
  .v2-list-toolbar [data-visible-count] { display:none; }
  .files-v2 .v2-item-open { min-height:64px; }
  .files-v2 .files-list .v2-item { padding:4px 7px; }
  .v2-footer { bottom:max(8px,env(safe-area-inset-bottom)); }
  .v2-batch { gap:6px; padding:8px; }
  .v2-batch .mini-button { min-width:0; padding:10px 12px; }
  .v2-dialog, .has-files-v2 .action-modal { position:fixed; inset:auto 0 0; margin:0; width:100%; max-width:100%; max-height:calc(100dvh - 20px); border:1px solid var(--line-hard); border-radius:5px 5px 0 0; padding:0; }
  .v2-dialog-card, .has-files-v2 .action-modal .modal-card { padding:14px 18px max(22px,env(safe-area-inset-bottom)); }
  .v2-handle { display:block; height:3px; width:32px; margin:0 auto 18px; background:var(--line-hard); }
  .v2-dialog[open], .has-files-v2 .action-modal[open] { animation:v2-sheet-in 280ms cubic-bezier(.2,.8,.2,1); }
  .has-files-v2 .action-modal input { font-size:16px; }
  .v2-dialog-head h2 { font-size:18px; }
}
@keyframes v2-sheet-in { from { opacity:.5; transform:translateY(100%); } to { opacity:1; transform:translateY(0); } }
@media(prefers-reduced-motion:reduce) {
  .files-v2 *, .v2-dialog, .v2-dialog *, .has-files-v2 .action-modal { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}
/* Keep legacy full-width mobile buttons out of compact v2 headers. */
.v2-heading > .mini-button, .v2-selection-head > .mini-button, .v2-heading-title > .mini-button { width:auto; flex-shrink:0; }
.v2-heading-title { flex:1; }
.v2-dialog-head .mini-button { width:44px; }
.v2-dialog-head h2 { min-width:0; flex:1; }
/* Transformed dialogs turn the viewport-positioned decorative cursor into
   scrollable content. Use the native pointer inside dialogs instead. */
.has-files-v2 dialog .cursor { display:none; }
/* Keep parent navigation within reach while browsing long folders. */
.v2-footer { gap:12px; flex-wrap:wrap; }
.v2-bottom-up { margin-right:auto; width:auto; min-height:48px; padding:12px 16px; background:var(--bg); border:1px solid var(--line-hard); box-shadow:var(--shadow); white-space:nowrap; }
.files-v2.is-selecting .v2-bottom-up { display:none; }
@media(max-width:760px) {
  .v2-footer > .v2-add { width:auto; min-width:110px; }
  .v2-bottom-up { font-size:12px; }
  [data-links-panel] { min-width:0; }
  [data-links-panel] .table-wrap { overflow:visible; min-width:0; }
  .short-links-table, .short-links-table tbody { display:block; width:100%; }
  .short-links-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .short-links-table .short-link-row { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; padding:18px 14px; margin-bottom:14px; border:1px solid var(--line-hard); background:var(--card-shade); }
  .short-links-table .short-link-row td { display:block; min-width:0; padding:0; border:0; }
  .short-links-table td[data-label]::before { content:attr(data-label); display:block; margin-bottom:7px; font:11px/1.4 "SFMono-Regular",Consolas,monospace; text-transform:uppercase; color:var(--muted); }
  .short-links-table td a { display:block; font-size:14px; line-height:1.6; overflow-wrap:anywhere; }
  .short-links-table .short-clicks { display:flex!important; gap:12px; align-items:baseline; font-size:14px; }
  .short-links-table .table-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
  .short-links-table .table-actions .mini-button { min-height:44px; white-space:nowrap; width:100%; }
  [data-links-panel] input { font-size:16px; }
}
/* Avoid an artificial body scroll container trapping the sticky footer. */
body.has-files-v2:not(.has-open-dialog) { overflow-x:clip; }
