/* ============================================================= Fonts */
/* Nunito — the same woff2 subsets used by the original Nimbus bundle,
   served locally. Declared as weight ranges (variable subset). */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/nunito-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/nunito-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/nunito-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url('/fonts/nunito-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

/* ============================================================= Tokens */
:root {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --line: #ececf3;
  --line-soft: #eeedf5;
  --ink: #201f2b;
  --muted: #8a8998;
  --muted-2: #9a99a8;
  --faint: #b3b2c0;
  --accent: #6a48f5;
  --accent-dark: #5a3fd6;
  --accent-soft: #efeafe;
  --accent-tint: #f0eefb;
  --danger: #e5484d;
  --radius: 14px;
}

/* ============================================================= Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
::selection { background: #e2d9ff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcdae8; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c7c4da; background-clip: content-box; border: 3px solid transparent; }
img { user-select: none; -webkit-user-drag: none; }
button { cursor: pointer; border: none; background: none;
  transition: transform .14s cubic-bezier(.2,.7,.2,1), background-color .18s ease, border-color .18s ease, box-shadow .2s ease, color .15s ease; }
button:active { transform: scale(.96); }

/* ============================================================= Animations */
@keyframes nb-pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes nb-toast { from { opacity: 0; transform: translate(-50%,12px); } to { opacity: 1; transform: translate(-50%,0); } }
@keyframes nb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nb-rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes nb-treerow { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
@keyframes nb-spin { to { transform: rotate(360deg); } }

/* ============================================================= Layout */
/* 100dvh tracks the real visible height on phones (the URL bar collapses);
   plain 100vh leaves the bottom of the app hidden behind mobile browser chrome. */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.body { flex: 1; display: flex; min-height: 0; position: relative; }

/* Password gate lives in its own layer over the main area (never inside .main),
   so the render loop can never rebuild it while you type. */
.gate-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.gate-overlay { position: absolute; inset: 0 0 0 252px; pointer-events: auto;
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background: var(--bg); animation: nb-fade .16s ease both; }
@media (max-width: 980px) { .gate-overlay { left: 0; } }

/* ---- Header ---- */
.header { height: 62px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: relative; z-index: 30; }
.logo { width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: linear-gradient(135deg, #9a80ff, var(--accent));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 13px rgba(106,72,245,.34); }
.brand { font-size: 18px; font-weight: 800; letter-spacing: -.2px; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  background: #f3f2f9; border-radius: 11px; color: #3a3947; }
.icon-btn:hover { background: #e9e7f3; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-dark); }
.spacer { flex: 1; }

/* ---- Search ---- */
.search-wrap { position: relative; flex: 1; max-width: 520px; }
.search { width: 100%; height: 42px; padding: 0 40px 0 40px; border: 1.5px solid #e6e4f0;
  border-radius: 12px; font-size: 14.5px; font-weight: 600; color: var(--ink); background: #fbfbfe; outline: none; }
.search:focus { border-color: var(--accent); background: #fff; }
.search::placeholder { color: var(--faint); }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; color: var(--faint); pointer-events: none; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.search-clear:hover { background: #eceaf5; }
.suggest { position: absolute; top: 50px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 44px rgba(30,25,60,.16); padding: 6px; z-index: 40;
  animation: nb-pop .16s ease both; max-height: 60vh; overflow: auto; }
.suggest-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.suggest-item:hover { background: #f5f4fb; }
.suggest-name { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.suggest-path { font-size: 11.5px; font-weight: 600; color: var(--muted-2); }

/* ---- Sidebar ---- */
.sidebar { width: 252px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; }
.side-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }
.side-section { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--faint); padding: 8px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 11px; border-radius: 11px;
  color: #4a4956; font-weight: 700; font-size: 14px; cursor: pointer; width: 100%; }
.nav-item:hover { background: #f5f4fb; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 800; color: var(--accent);
  background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; }
.tree { margin-top: 4px; }
.tree-row { display: flex; align-items: center; height: 34px; border-radius: 9px; cursor: pointer;
  color: #41404f; font-weight: 600; font-size: 13.5px; animation: nb-treerow .18s ease both; }
.tree-row:hover { background: #f5f4fb; }
.tree-row.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.tree-chevron { width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center;
  color: #9d9cae; border-radius: 6px; transition: transform .16s ease; }
.tree-chevron:hover { background: #e9e7f3; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-lock { margin-left: auto; margin-right: 8px; color: var(--faint); }
.stats { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 800; }

/* ---- Main ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.toolbar { flex: none; display: flex; align-items: center; gap: 12px; padding: 16px 24px 10px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 5px; font-size: 15px; min-width: 0; flex-wrap: wrap; }
.crumb { font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.crumb:hover { color: var(--accent); }
.crumb.current { color: var(--ink); font-weight: 800; cursor: default; }
.crumb-sep { color: #cfcedd; }
.folder-tag { font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 99px; }
.tools-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.seg { display: flex; background: #f0eff6; border-radius: 11px; padding: 3px; }
.seg button { width: 34px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #6c6b7d; }
.seg button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(30,25,60,.12); }
.pill { height: 36px; padding: 0 13px; border-radius: 11px; background: #fbfbfe; border: 1px solid #e6e4f0;
  display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: #4a4956; }
.pill:hover { border-color: #cfc9ec; }
.pill.on { background: var(--accent-tint); border-color: #b7a6f5; color: var(--accent-dark); }
.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 18px 44px rgba(30,25,60,.16); padding: 6px; z-index: 45; animation: nb-pop .15s ease both; min-width: 180px; }
.menu-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: #4a4956; cursor: pointer; width: 100%; }
.menu-item:hover { background: #f5f4fb; }
.menu-item.on { color: var(--accent-dark); }
.menu-check { margin-left: auto; color: var(--accent); }

/* ---- Filters ---- */
.filters { flex: none; padding: 4px 24px 8px; display: flex; flex-direction: column; gap: 10px;
  animation: nb-rise .2s ease both; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; background: #fbfbfe; border: 1px solid #e6e4f0;
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: #4a4956; }
.chip.on { background: var(--accent-tint); border-color: #b7a6f5; color: var(--accent-dark); }
.chip-dot { width: 9px; height: 9px; border-radius: 3px; }
.chip-count { font-size: 11px; font-weight: 800; color: var(--faint); }
.chip.on .chip-count { color: #8a72e8; }

/* ---- Content ---- */
.content { flex: 1; overflow-y: auto; padding: 8px 24px 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { background: #fff; border: 1.5px solid var(--line-soft); border-radius: 16px; overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; animation: nb-rise .26s ease both; }
.card:hover { border-color: #d9d2f6; box-shadow: 0 8px 22px rgba(30,25,60,.08); transform: translateY(-2px); }
.card.sel { border-color: #b7a6f5; box-shadow: 0 6px 18px rgba(106,72,245,.14); }
.card-preview { height: 118px; display: flex; align-items: center; justify-content: center; position: relative; }
.card-preview img { width: 100%; height: 100%; object-fit: cover; }
.card-badge { font-size: 12px; font-weight: 900; letter-spacing: .5px; color: #fff; padding: 5px 9px; border-radius: 8px; }
.card-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 4px; }
.card-name { font-size: 13.5px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 11.5px; font-weight: 700; color: var(--muted-2); }
.card-path { font-size: 11px; font-weight: 600; color: var(--muted-2); opacity: .85; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.tag { font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.folder-glyph { display: flex; align-items: center; justify-content: center; }
.dl-btn { position: absolute; top: 9px; right: 9px; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(255,255,255,.92); color: #4a4956; display: flex; align-items: center; justify-content: center;
  opacity: 0; box-shadow: 0 2px 8px rgba(30,25,60,.16); }
.card:hover .dl-btn { opacity: 1; }
.dl-btn:hover { color: var(--accent); }

/* ---- List ---- */
.list { display: flex; flex-direction: column; }
.list-head { display: flex; align-items: center; gap: 12px; padding: 6px 14px; margin-bottom: 6px; font-size: 11px; font-weight: 800;
  letter-spacing: .5px; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line-soft); }
.row { display: flex; align-items: center; padding: 9px 14px; border-radius: 11px; cursor: pointer;
  animation: nb-rise .2s ease both; gap: 12px; }
.row:hover { background: #f7f6fc; }
.row.sel { background: #f2effc; box-shadow: inset 0 0 0 1.5px rgba(106,72,245,.28); }
.row-ico, .col-ico { width: 38px; flex: none; }
.row-ico { height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.row-main { flex: 1; min-width: 0; }
.row-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-name { font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name-line .tag { flex: none; }
.row-sub { font-size: 12px; font-weight: 600; color: var(--muted-2); }
.row-path { font-size: 11.5px; font-weight: 600; color: var(--muted-2); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col { font-size: 12.5px; font-weight: 700; color: var(--muted); flex: none; }
.col-ext { width: 74px; }
.col-size { width: 92px; text-align: right; }
.col-mod { width: 132px; text-align: right; }
.col-act { width: 34px; flex: none; display: flex; align-items: center; justify-content: center; }

/* ---- Empty / loading ---- */
.empty { text-align: center; color: var(--muted-2); padding: 80px 20px; font-weight: 700; }
.empty svg { color: #d5d3e4; margin-bottom: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #e6e3f4; border-top-color: var(--accent);
  animation: nb-spin .8s linear infinite; margin: 80px auto; }

/* ---- Gate ---- */
.gate-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.gate { width: 360px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 34px 30px; text-align: center; box-shadow: 0 20px 50px rgba(30,25,60,.12); animation: nb-rise .3s ease both; }
.gate-ico { width: 62px; height: 62px; border-radius: 18px; background: #f0edff; color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.gate-title { font-size: 18px; font-weight: 800; }
.gate-desc { font-size: 13.5px; font-weight: 600; color: var(--muted-2); margin-top: 8px; line-height: 1.5; }
.gate-input { width: 100%; height: 46px; margin-top: 20px; padding: 0 15px; border: 1.5px solid #e6e4f0;
  border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--ink); outline: none; text-align: center; letter-spacing: 1px; }
.gate-input:focus { border-color: var(--accent); }
.gate-input.err { border-color: #f2b8ba; }
.gate-err { font-size: 12.5px; font-weight: 700; color: var(--danger); margin-top: 10px; }
.gate-btn { width: 100%; height: 46px; margin-top: 16px; background: var(--accent); color: #fff;
  border-radius: 12px; font-size: 14.5px; font-weight: 800; box-shadow: 0 5px 14px rgba(106,72,245,.32); }
.gate-btn:hover { background: var(--accent-dark); }
.gate-btn:disabled { background: #c9c2e6; box-shadow: none; cursor: not-allowed; }
.gate-back { width: 100%; height: 40px; margin-top: 9px; background: transparent; color: var(--muted-2); font-size: 13px; font-weight: 800; }
.gate-back:hover { color: #6c6b7d; }

/* ---- Preview modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(24,20,44,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; animation: nb-fade .18s ease both; padding: 24px; }
.modal { background: #fff; border-radius: 20px; width: min(960px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 30px 80px rgba(20,15,45,.4); animation: nb-rise .22s ease both; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); flex: none; }
.modal-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.modal-title { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-sub { font-size: 12px; font-weight: 700; color: var(--muted-2); }
.modal-body { flex: 1; overflow: auto; min-height: 200px; display: flex; align-items: center; justify-content: center;
  background: #faf9fd; }
.modal-body.text { align-items: stretch; background: #1e1e2a; }
.modal-body img, .modal-body video { max-width: 100%; max-height: 82vh; display: block; }
.modal-body iframe { width: 100%; height: 80vh; border: none; background: #fff; }
.modal pre { margin: 0; padding: 20px 22px; font: 13px/1.6 ui-monospace, 'SF Mono', Menlo, monospace;
  color: #e6e6f0; white-space: pre; overflow: auto; width: 100%; }
.modal pre .hl-c { color: #6a9955; }
.modal pre .hl-s { color: #ce9178; }
.modal pre .hl-n { color: #b5cea8; }
.modal pre .hl-k { color: #569cd6; }
.audio-wrap { padding: 40px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.audio-art { width: 130px; height: 130px; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #9a80ff, var(--accent)); color: #fff; box-shadow: 0 14px 34px rgba(106,72,245,.34); }

/* ---- Toasts ---- */
.toasts { position: fixed; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #201f2b; color: #fff; font-size: 13px; font-weight: 700; padding: 10px 18px;
  border-radius: 11px; box-shadow: 0 8px 24px rgba(20,15,45,.3); animation: nb-toast .2s ease both; }

/* ---- Drawer (mobile) ---- */
.scrim { position: fixed; inset: 0; background: rgba(20,15,45,.4); z-index: 25; animation: nb-fade .18s ease both; }
@media (max-width: 980px) {
  .sidebar { position: fixed; top: 62px; bottom: 0; left: 0; z-index: 26; box-shadow: 8px 0 30px rgba(20,15,45,.14);
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.7,.2,1); }
  .sidebar.open { transform: none; }
}
@media (min-width: 981px) { .hamburger { display: none; } .scrim { display: none; } }
@media (max-width: 640px) {
  .header { padding: 0 14px; gap: 10px; }
  .brand { display: none; }
  .content { padding: 8px 14px 24px; }
  .toolbar { padding: 12px 14px 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
}

/* ============================================================= Additions */

/* Suppress the entry animation on in-place re-renders (sort/filter/view/select). */
.card.no-anim, .row.no-anim, .tree-row.no-anim { animation: none; }

/* ---- Multi-select for download ---- */
.sel-check { width: 24px; height: 24px; border-radius: 7px; flex: none;
  border: 2px solid #cfcede; background: rgba(255,255,255,.94); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(30,25,60,.14); }
.card .sel-check { position: absolute; top: 9px; left: 9px; opacity: 0; z-index: 2; }
.card:hover .sel-check, .card .sel-check.on { opacity: 1; }
.card.selected { border-color: #b7a6f5; box-shadow: 0 6px 18px rgba(106,72,245,.18); }
.row .sel-check { margin-right: 2px; opacity: .35; }
.row:hover .sel-check, .row .sel-check.on { opacity: 1; }
.row.selected { background: #f2effc; box-shadow: inset 0 0 0 1.5px rgba(106,72,245,.28); }
.sel-check.on { background: var(--accent); border-color: var(--accent); }
.sel-check svg { display: block; }

.sel-bar { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: none; align-items: center; gap: 14px; z-index: 150;
  max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center;
  background: #201f2b; color: #fff; padding: 10px 12px 10px 18px; border-radius: 14px;
  box-shadow: 0 12px 34px rgba(20,15,45,.4); animation: nb-toast .2s ease both; }
.sel-bar.show { display: flex; }
.sel-bar-count { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.sel-bar button { display: inline-flex; align-items: center; gap: 7px; height: 34px;
  padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.sel-bar button svg { display: block; }
.sel-bar .sel-dl { background: var(--accent); color: #fff; }
.sel-bar .sel-dl:hover { background: var(--accent-dark); }
.sel-bar .sel-clear { background: transparent; color: #c9c7d8; }
.sel-bar .sel-clear:hover { color: #fff; }

/* ---- Keyboard focus ---- */
.card:focus-visible, .row:focus-visible, .tree-row:focus-visible,
.pill:focus-visible, .chip:focus-visible, .nav-item:focus-visible,
.icon-btn:focus-visible, .seg button:focus-visible, .suggest-item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.card:focus-visible { box-shadow: 0 6px 18px rgba(106,72,245,.14); }

/* ---- Folder description + custom emoji glyphs ---- */
.folder-desc { padding: 0 24px 4px; font-size: 13px; font-weight: 600; color: var(--muted-2); max-width: 70ch; }
.folder-emoji { font-size: 42px; line-height: 1; }
.row-emoji { font-size: 20px; line-height: 1; }
.tree-emoji { display: inline-flex; align-items: center; justify-content: center; width: 18px; font-size: 15px; }

/* ---- Search: filter chips + match highlight ---- */
.suggest-modes { display: flex; gap: 4px; padding: 4px 4px 6px; }
.suggest-mode { flex: 1; font-size: 12px; font-weight: 800; padding: 6px 8px; border-radius: 9px; background: transparent; color: var(--muted); }
.suggest-mode:hover { background: var(--line-soft); }
.suggest-mode.on { background: var(--accent-tint); color: var(--accent-dark); }
.suggest-snippet { font-size: 11.5px; font-weight: 600; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-snippet mark { background: #ffe7a3; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] .suggest-snippet mark { background: #5b4f2a; color: #ffe7a3; }
.suggest-filters { display: flex; gap: 6px; padding: 4px 6px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.suggest-chip { font-size: 11.5px; font-weight: 800; padding: 3px 11px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.suggest-chip.on { background: var(--accent-tint); border-color: #b7a6f5; color: var(--accent-dark); }
.suggest-name mark { background: #ffe7a3; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---- Image preview meta / EXIF ---- */
.img-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px; width: 100%; }
.img-wrap img { max-width: 100%; max-height: 74vh; border-radius: 6px; transition: transform .18s ease; }
.img-wrap img.zoomable { cursor: zoom-in; }
.img-wrap img.zoomed { transform: scale(2); cursor: zoom-out; }
.img-meta { font-size: 12px; font-weight: 700; color: var(--muted-2); text-align: center; }

/* Lightbox prev/next arrows (over the whole overlay, outside the modal). */
.lightbox-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 48px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(4px); z-index: 110; }
.lightbox-nav:hover { background: rgba(255,255,255,.28); }
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }
@media (max-width: 640px) { .lightbox-nav { width: 40px; height: 40px; } .lightbox-nav.prev { left: 8px; } .lightbox-nav.next { right: 8px; } }

/* ---- Modern video player ---- */
.vplayer { position: relative; width: 100%; background: #000; display: flex; overflow: hidden;
  align-items: center; justify-content: center; --vp-fill: #7a5cff; }
.vplayer .vp-video { width: 100%; max-height: 82vh; display: block; background: #000; cursor: pointer; }
.vplayer.fs { width: 100vw; height: 100vh; }
.vplayer.fs .vp-video { max-height: 100vh; height: 100vh; object-fit: contain; }
.vplayer.hide-ui { cursor: none; }

/* Center play/pause badge (shown while paused). */
.vp-big { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(20,16,40,.5); color: #fff; backdrop-filter: blur(3px); opacity: 0;
  transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.vplayer.paused .vp-big { opacity: 1; pointer-events: auto; }
.vp-big:hover { transform: translate(-50%, -50%) scale(1.06); }
.vp-big svg { width: 34px; height: 34px; margin-left: 3px; }

/* Controls bar. */
.vp-controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px;
  display: flex; flex-direction: column; gap: 6px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.28) 60%, transparent);
  opacity: 1; transition: opacity .25s ease; }
.vplayer.hide-ui .vp-controls { opacity: 0; }
.vp-row { display: flex; align-items: center; gap: 6px; }
.vp-spacer { flex: 1; }
.vp-btn { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: #fff; background: transparent; transition: background .12s ease; flex: none; }
.vp-btn:hover { background: rgba(255,255,255,.16); }
.vp-btn.on { color: var(--vp-fill); }
.vp-text { width: auto; min-width: 40px; padding: 0 9px; font-size: 13px; font-weight: 800; }
.vp-time { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0 6px; white-space: nowrap; }

/* Scrubber. */
.vp-scrub { position: relative; height: 6px; border-radius: 4px; background: rgba(255,255,255,.28);
  cursor: pointer; margin: 0 6px; touch-action: none; transition: height .12s ease; }
.vp-scrub:hover { height: 9px; }
.vp-buffered, .vp-played { position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px; }
.vp-buffered { background: rgba(255,255,255,.34); width: 0; }
.vp-played { background: var(--vp-fill); width: 0; }
.vp-knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%) scale(0); transition: transform .12s ease; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.vp-scrub:hover .vp-knob { transform: translate(-50%, -50%) scale(1); }

/* Hovered-time bubble over the scrubber (a real frame preview arrives in a later
   phase via backend sprites — a client-side one would flood /api/file). */
.vp-thumb { position: absolute; bottom: 18px; left: 0; transform: translateX(-50%);
  display: none; pointer-events: none; }
.vp-scrub:hover .vp-thumb { display: block; }
.vp-thumb-t { font-size: 12px; font-weight: 800; color: #fff; background: rgba(0,0,0,.78);
  padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.4); }

/* Volume: slider expands on hover for a tidy default width. */
.vp-volume { display: flex; align-items: center; }
.vp-vol { width: 0; opacity: 0; height: 4px; margin: 0; accent-color: var(--vp-fill); cursor: pointer;
  transition: width .18s ease, opacity .18s ease; }
.vp-volume:hover .vp-vol, .vp-vol:focus { width: 78px; opacity: 1; margin-left: 4px; }

@media (max-width: 640px) {
  .vp-vol { width: 60px; opacity: 1; margin-left: 4px; }
}

/* ---- Text / markdown preview ---- */
.text-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; flex: none;
  border-bottom: 1px solid rgba(255,255,255,.08); }
.text-bar-label { font-size: 12px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: #b9b8c8; }
.text-toggle { margin-left: auto; font-size: 12.5px; font-weight: 800; color: #b7a6f5; padding: 4px 10px; border-radius: 8px; }
.text-toggle:hover { background: rgba(255,255,255,.08); }
.modal-body.text .load-more, .modal-body.md .load-more { margin-left: 12px; }
.modal-body.md { align-items: stretch; background: var(--surface); flex-direction: column; }
.modal-body.md .text-bar { border-bottom-color: var(--line); }
.modal-body.md .text-bar-label { color: var(--muted); }
.modal-body.md .text-toggle { color: var(--accent); }
.md-body { padding: 22px 28px; width: 100%; overflow: auto; line-height: 1.62; color: var(--ink);
  font-size: 14.5px; font-weight: 500; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { font-weight: 800; margin: 18px 0 8px; line-height: 1.3; }
.md-body h1 { font-size: 26px; } .md-body h2 { font-size: 21px; } .md-body h3 { font-size: 17px; }
.md-body p { margin: 8px 0; }
.md-body ul { margin: 8px 0 8px 22px; }
.md-body li { margin: 3px 0; }
.md-body a { color: var(--accent); text-decoration: underline; }
.md-body code { background: var(--accent-tint); color: var(--accent-dark); padding: 1px 5px; border-radius: 5px;
  font: 12.5px ui-monospace, 'SF Mono', Menlo, monospace; }
.md-body pre.md-code { background: #1e1e2a; color: #e6e6f0; padding: 14px 16px; border-radius: 10px; overflow: auto; margin: 10px 0; }
.md-body pre.md-code code { background: none; color: inherit; padding: 0; }

/* ---- Archive (ZIP) content preview ---- */
.modal-body.archive { align-items: stretch; background: var(--surface); flex-direction: column; }
.archive-view { width: 100%; padding: 8px 0; }
.archive-head { padding: 12px 20px; font-size: 12px; font-weight: 800; letter-spacing: .3px;
  text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line-soft); }
.archive-list { display: flex; flex-direction: column; padding: 6px 12px 12px; }
.archive-row { display: flex; align-items: center; gap: 11px; padding: 7px 8px; border-radius: 9px; }
.archive-row:hover { background: var(--bg); }
.archive-ico { width: 26px; flex: none; display: flex; justify-content: center; color: var(--muted); }
.archive-badge { width: 26px; flex: none; font-size: 8px; font-weight: 900; letter-spacing: .3px; color: #fff;
  background: var(--muted); border-radius: 4px; padding: 3px 0; text-align: center; }
.archive-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-name.dir { color: var(--muted); }
.archive-size { flex: none; font-size: 12px; font-weight: 700; color: var(--muted-2); }

/* ---- In-folder quick filter ---- */
.quick-filter { height: 36px; width: 150px; padding: 0 12px; border: 1px solid #e6e4f0; border-radius: 11px;
  background: #fbfbfe; font-size: 13px; font-weight: 600; color: var(--ink); outline: none; }
.quick-filter:focus { border-color: var(--accent); background: #fff; width: 190px; }
.quick-filter::placeholder { color: var(--faint); }
:root[data-theme="dark"] .quick-filter { background: #232130; border-color: #322f42; }
:root[data-theme="dark"] .quick-filter:focus { background: #201e2c; }
@media (max-width: 640px) { .quick-filter { width: 110px; } .quick-filter:focus { width: 130px; } }

/* ---- File info panel (preview) ---- */
.modal-info { flex: none; border-bottom: 1px solid var(--line); background: var(--bg);
  padding: 8px 16px; display: flex; flex-direction: column; max-height: 42vh; overflow: auto; }
.info-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.info-label { width: 92px; flex: none; font-size: 11px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--faint); }
.info-val { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink); word-break: break-all; }
.info-val.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; font-weight: 600; }
.info-copy { flex: none; width: 28px; height: 28px; border-radius: 8px; color: var(--muted);
  display: flex; align-items: center; justify-content: center; }
.info-copy:hover { background: var(--line-soft); color: var(--accent); }

/* ---- Share dialog ---- */
.share-dialog { background: var(--surface); border-radius: 18px; width: min(380px, 100%);
  box-shadow: 0 30px 80px rgba(20,15,45,.4); animation: nb-rise .22s ease both; overflow: hidden; }
.share-dialog-head { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.share-dialog-head .modal-title { flex: 1; }
.share-dialog-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.share-qr { display: flex; justify-content: center; }
.share-qr svg { border-radius: 10px; width: 180px; height: 180px; }
.share-qr-fail { color: var(--muted-2); font-weight: 700; font-size: 13px; padding: 30px; text-align: center; }
.share-link-row { display: flex; gap: 8px; }
.share-link { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 12.5px; font-weight: 600; }
.share-opts { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.share-opt { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: #4a4956; }
:root[data-theme="dark"] .share-opt { color: #cdccdb; }
.share-ttl { height: 32px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--bg);
  color: var(--ink); font-weight: 700; font-size: 12.5px; padding: 0 8px; }
.share-note { font-size: 12px; font-weight: 600; color: var(--muted-2); line-height: 1.5; }

/* ---- Standalone share page (/s/<token>) ---- */
.share-head { display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.share-title { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-sub { font-size: 12.5px; font-weight: 700; color: var(--muted-2); }
.share-body { max-width: 1100px; margin: 0 auto; padding: 20px 24px 40px; }
.share-crumbs { margin-bottom: 16px; }
.share-file { max-width: 640px; margin: 30px auto; text-align: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 30px; }
.share-fileicon { width: 70px; height: 70px; border-radius: 18px; margin: 0 auto; display: flex; align-items: center;
  justify-content: center; background: var(--accent-tint); color: var(--accent); }
.share-msg { text-align: center; padding: 90px 20px; color: var(--muted-2); }

/* ============================================================= Dark theme */
:root[data-theme="dark"] {
  --bg: #131219;
  --surface: #1c1b25;
  --line: #2c2a38;
  --line-soft: #262433;
  --ink: #ececf3;
  --muted: #a6a4b6;
  --muted-2: #908ea1;
  --faint: #6e6c7f;
  --accent: #9a80ff;
  --accent-dark: #b3a1ff;
  --accent-soft: #2a2442;
  --accent-tint: #241f36;
  --danger: #ff6b6f;
}
:root[data-theme="dark"] body { background: var(--bg); }
:root[data-theme="dark"] .icon-btn { background: #26232f; color: #cdccdb; }
:root[data-theme="dark"] .icon-btn:hover { background: #302c3c; }
:root[data-theme="dark"] .search { background: #232130; border-color: #322f42; color: var(--ink); }
:root[data-theme="dark"] .search:focus { background: #26243300; background-color: #201e2c; border-color: var(--accent); }
:root[data-theme="dark"] .suggest,
:root[data-theme="dark"] .menu,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .gate,
:root[data-theme="dark"] .modal { background: var(--surface); }
:root[data-theme="dark"] .suggest-item:hover,
:root[data-theme="dark"] .menu-item:hover,
:root[data-theme="dark"] .nav-item:hover,
:root[data-theme="dark"] .tree-row:hover { background: #262433; }
:root[data-theme="dark"] .tree-chevron:hover { background: #302c3c; }
:root[data-theme="dark"] .seg { background: #26232f; }
:root[data-theme="dark"] .seg button.on { background: #12111a; color: var(--accent-dark); }
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .suggest-chip { background: #232130; border-color: #322f42; color: #cdccdb; }
:root[data-theme="dark"] .pill:hover { border-color: #4a4568; }
:root[data-theme="dark"] .pill.on,
:root[data-theme="dark"] .chip.on,
:root[data-theme="dark"] .suggest-chip.on { background: var(--accent-tint); border-color: #5b4f8f; color: var(--accent-dark); }
:root[data-theme="dark"] .card:hover { border-color: #4a4568; box-shadow: 0 8px 22px rgba(0,0,0,.4); }
:root[data-theme="dark"] .card.sel { border-color: #6a5aa8; }
:root[data-theme="dark"] .card-preview img { }
:root[data-theme="dark"] .dl-btn { background: rgba(28,27,37,.92); color: #cdccdb; }
:root[data-theme="dark"] .row:hover { background: #201e2b; }
:root[data-theme="dark"] .row.sel { background: #241f38; }
:root[data-theme="dark"] .row.selected { background: #241f38; }
/* Sidebar folder/nav labels are hard-coded dark greys — lighten them for dark mode. */
:root[data-theme="dark"] .nav-item { color: #cdccdb; }
:root[data-theme="dark"] .tree-row { color: #c6c4d6; }
:root[data-theme="dark"] .tree-chevron { color: #8f8da0; }
:root[data-theme="dark"] .sel-check { background: #26232f; border-color: #423e50; }
:root[data-theme="dark"] .sel-check.on { background: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .card.selected { border-color: #6a5aa8; }
:root[data-theme="dark"] .gate-input { background: #232130; border-color: #322f42; color: var(--ink); }
:root[data-theme="dark"] .gate-ico { background: var(--accent-tint); }
:root[data-theme="dark"] .modal-body { background: #17161f; }
:root[data-theme="dark"] .suggest-name mark { background: #5b4f2a; color: #ffe7a3; }
:root[data-theme="dark"] ::selection { background: #3a2f6a; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #34313f; background-clip: content-box; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #423e50; background-clip: content-box; }

/* ---- Search results view ---- */
.result-count { margin-left: 8px; font-size: 11.5px; font-weight: 800; color: var(--muted-2);
  background: var(--line-soft); border-radius: 99px; padding: 2px 8px; vertical-align: 1px; }
.crumbs .seg { flex: none; }
.crumbs .seg button { width: auto; padding: 0 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.suggest-all { display: block; width: 100%; text-align: center; margin-top: 4px; padding: 9px 10px;
  border-top: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 800; color: var(--accent); }
.suggest-all:hover { background: var(--accent-tint); border-radius: 0 0 10px 10px; }
.line-badge { flex: none; font-size: 10px; font-weight: 900; color: var(--accent-dark);
  background: var(--accent-tint); border-radius: 5px; padding: 2px 5px; }
.row-sub.snippet, .card-meta.snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub.snippet mark, .card-meta.snippet mark { background: #ffe7a3; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] .row-sub.snippet mark,
:root[data-theme="dark"] .card-meta.snippet mark { background: #5b4f2a; color: #ffe7a3; }

/* ---- Code preview: per-line blocks with a gutter ---- */
.modal-body.text { flex-direction: column; }
.text-view { width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal pre.code { padding: 14px 0; flex: 1; }
.modal pre.code .cl { display: block; padding: 0 22px; }
.modal pre.code.nums .cl { padding-left: 12px; }
.modal pre.code .ln { display: inline-block; text-align: right; margin-right: 16px; color: #55546a;
  user-select: none; -webkit-user-select: none; }
.modal pre.code .lc:empty::after { content: "\200B"; }
.modal pre.code .cl.hit { background: rgba(255,215,102,.14); box-shadow: inset 3px 0 0 #ffd766; }
.text-toggle.follow.on { background: var(--accent); color: #fff; }
.text-toggle.follow.on:hover { background: var(--accent-dark); }

/* ---- CSV / TSV table preview ---- */
.csv-wrap { width: 100%; padding: 14px 18px 20px; overflow-x: auto; }
table.csv { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.csv th { text-align: left; font-weight: 800; font-size: 12px; color: var(--muted);
  background: var(--line-soft); padding: 8px 12px; cursor: pointer; user-select: none;
  -webkit-user-select: none; white-space: nowrap; border-bottom: 2px solid var(--line); }
table.csv th:hover { color: var(--accent-dark); }
table.csv th:first-child { border-radius: 8px 0 0 0; }
table.csv th:last-child { border-radius: 0 8px 0 0; }
table.csv td { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); font-weight: 600;
  color: var(--ink); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.csv tbody tr:hover { background: #f5f4fb; }
:root[data-theme="dark"] table.csv tbody tr:hover { background: #201e2b; }
.csv-dir { color: var(--accent); }
.csv-note { padding: 10px 2px 0; font-size: 12px; font-weight: 700; color: var(--muted-2); }

/* ---- JSON tree preview ---- */
.json-tree { width: 100%; padding: 16px 22px 22px; font: 13px/1.7 ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--ink); overflow-x: auto; }
.json-tree summary { list-style: none; cursor: pointer; }
.json-tree summary::-webkit-details-marker { display: none; }
.jt-sum::before { content: "\25B8"; display: inline-block; width: 14px; color: var(--muted-2);
  transition: transform .12s ease; }
details[open] > .jt-sum::before { transform: rotate(90deg); }
.jt-kids { padding-left: 20px; margin-left: 5px; border-left: 1px solid var(--line-soft); }
.jt-leaf { padding-left: 14px; }
.jt-key { color: #7a4fd0; font-weight: 700; }
.jt-str { color: #0a7d4d; }
.jt-num { color: #1a6fc4; }
.jt-lit { color: #c04343; font-weight: 700; }
.jt-badge { color: var(--muted-2); font-weight: 700; font-size: 11px; }
.jt-more { color: var(--muted-2); font-style: italic; padding-left: 14px; }
:root[data-theme="dark"] .jt-key { color: #b7a6f5; }
:root[data-theme="dark"] .jt-str { color: #7ee0a3; }
:root[data-theme="dark"] .jt-num { color: #8fc7ff; }
:root[data-theme="dark"] .jt-lit { color: #ff9d9d; }

/* ============================================================= Mobile */
/* Phone-width refinements (must stay last so they win the cascade): the
   toolbar stacks into tidy rows, secondary list columns and pill labels give
   way, overlays go near-fullscreen, and focusable inputs stay at 16px so iOS
   doesn't auto-zoom the page on focus. */
@media (max-width: 640px) {
  /* iOS Safari zooms the whole viewport when a focused input is under 16px. */
  .search, .quick-filter, .gate-input, .share-link { font-size: 16px; }

  /* The spacer competes with the search box for flex space — drop it so the
     search field uses the full remaining header width. */
  .spacer { display: none; }

  /* Toolbar: breadcrumbs get their own line, controls wrap in rows below. */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .crumbs { font-size: 14px; }
  .crumb { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .tools-right { margin-left: 0; flex-wrap: wrap; }
  .quick-filter { flex: 1 1 130px; width: auto; min-width: 0; }
  .quick-filter:focus { width: auto; }
  .toolbar .pill-label { display: none; }
  .filters { padding: 4px 14px 8px; }
  .folder-desc { padding: 0 14px 4px; }

  /* Search suggestions: span the viewport instead of the narrow input. */
  .suggest { position: fixed; left: 10px; right: 10px; top: 66px; }

  /* List view: keep name + size; Type/Modified never fit a phone, and the
     folder tags would squeeze the name itself to nothing (grid + filters
     still show them). */
  .col-ext, .col-mod { display: none; }
  .col-size { width: 74px; }
  .row { padding: 9px 8px; gap: 10px; }
  .list-head { padding: 6px 8px; gap: 10px; }
  .row-name-line .tag { display: none; }

  /* Preview modal: near-fullscreen; the action buttons move to their own
     row (icon-only) so the file name keeps its space. */
  .overlay { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .modal-head { flex-wrap: wrap; padding: 10px 12px; }
  .modal-actions { order: 2; flex: 1 1 100%; justify-content: flex-end; }
  .modal-head .pill-label { display: none; }
  .modal-head .pill { padding: 0 11px; }
  .modal-body iframe { height: 72vh; }

  .gate-overlay { padding: 20px; }
  .gate { padding: 28px 22px; }

  /* Standalone share page (/s/<token>) */
  .share-head { padding: 12px 14px; }
  .share-body { padding: 16px 14px 32px; }
  .share-file { margin: 18px auto; padding: 24px 18px; }
}
