:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f7f8fa; --fg: #11141b; --muted: #6b7385; --line: #e5e7ec;
  --hover: #eff1f5; --sel: #e6edff; --sel-line: #b7caff; --accent: #3b6cff; --accent-fg: #fff; --accent-soft: #e8efff;
  --danger: #e5484d; --ok: #1f9d55; --warn: #c2410c; --shadow: 0 12px 40px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
  --k-dir: #3b6cff; --k-video: #8b5cf6; --k-audio: #f97316; --k-image: #10b981; --k-pdf: #ef4444; --k-file: #64748b;
  --side: 256px; --top: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12; --panel: #12151d; --panel-2: #161a24; --fg: #eceff5; --muted: #8a92a6; --line: #232837;
    --hover: #1a1f2b; --sel: #1b2748; --sel-line: #34509a; --accent: #5b86ff; --accent-soft: #1a2442;
    --shadow: 0 12px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3); --warn: #fb923c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
button:disabled { opacity: .45; cursor: default !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
svg.flip { transform: rotate(180deg); }

/* ---------- buttons ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--fg); }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.icon-only { width: 36px; padding: 0; color: var(--muted); }
.btn.wide { width: 100%; height: 44px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; gap: 5px; }
.btn.sm svg { width: 16px; height: 16px; }
.icon-btn { appearance: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; flex: none; }
.logo.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 26px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--hover); color: var(--muted); vertical-align: 1px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 34px 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.login-card h1 { margin: 6px 0 0; font-size: 22px; letter-spacing: -.01em; }
.login-card p { margin: 0 0 6px; text-align: center; }
.login-card input { width: 100%; height: 46px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); padding: 0 14px; font-size: 16px; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.err { color: var(--danger); margin: 0; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: var(--top) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; letter-spacing: -.01em; color: var(--fg); text-decoration: none; width: calc(var(--side) - 30px); flex: none; }
.search { flex: 1; max-width: 600px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); min-width: 0; cursor: text; }
.search:focus-within { border-color: var(--accent); background: var(--panel); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 14px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.sidebar { grid-row: 2; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; padding: 12px 8px 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--fg); text-decoration: none; font-weight: 550; border: 1.5px solid transparent; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .ni { display: grid; }
.tree-label { margin: 18px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tree { flex: 1; overflow: auto; min-height: 0; padding-bottom: 8px; }
.trow { display: flex; align-items: center; gap: 4px; height: 32px; padding-right: 8px; border-radius: 8px; cursor: pointer; color: var(--fg); white-space: nowrap; border: 1.5px solid transparent; }
.trow:hover { background: var(--hover); }
.trow.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.trow .ticon { color: var(--k-dir); display: grid; }
.trow .ticon svg { width: 17px; height: 17px; }
.trow .tlabel { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.twist { appearance: none; border: 0; background: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; cursor: pointer; color: var(--muted); padding: 0; flex: none; }
.twist svg { width: 14px; height: 14px; transition: transform .15s; }
.twist.open svg { transform: rotate(90deg); }
.twist.none { visibility: hidden; }
.twist:hover { background: var(--line); }
.side-foot { border-top: 1px solid var(--line); padding: 12px 10px 2px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.side-foot .linkish { align-self: flex-start; font-size: 12px; }
.usage { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.usage b { font-size: 13px; }
.usage .bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.usage .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.usage .bar.low i { background: var(--danger); }
.scrim { display: none; }

.main { grid-row: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px 10px; min-height: 64px; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; font-size: 18px; font-weight: 650; letter-spacing: -.01em; overflow: hidden; }
.crumbs a, .crumbs span.cur, .crumbs .ell { padding: 4px 8px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; border: 1.5px solid transparent; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 260px; }
.crumbs a { flex-shrink: 1; }
.crumbs a:hover { background: var(--hover); color: var(--fg); }
.crumbs span.cur { color: var(--fg); flex-shrink: 0; max-width: 100%; }
.crumbs a[data-back] { display: grid; padding: 4px; }
.crumbs .sep { color: var(--muted); opacity: .55; display: grid; flex: none; }
.crumbs .sep svg { width: 16px; height: 16px; }
.tb-actions { display: flex; gap: 8px; flex: none; }
.selbar { position: absolute; top: 12px; left: 20px; right: 20px; z-index: 15; min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; flex-wrap: wrap; box-shadow: 0 0 0 1px var(--sel-line), 0 6px 20px rgba(0, 0, 0, .12); }
@media (prefers-color-scheme: dark) { .selbar { background: #1b2748; } }
.selbar .count { margin-right: auto; }
.selbar .btn { background: var(--panel); border-color: transparent; color: var(--fg); }
.selbar .btn.danger { background: var(--panel); color: var(--danger); border-color: transparent; }

/* ---------- item list (shared by list + grid) ---------- */
.list { flex: 1; overflow: auto; padding: 0 12px 140px; outline: none; }
.ficon { position: relative; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--k-file); background: color-mix(in srgb, currentColor 13%, transparent); flex: none; overflow: hidden; }
.ficon svg { width: 19px; height: 19px; }
.ficon.k-dir { color: var(--k-dir); } .ficon.k-video { color: var(--k-video); } .ficon.k-audio { color: var(--k-audio); }
.ficon.k-image { color: var(--k-image); } .ficon.k-pdf { color: var(--k-pdf); }
.ficon.thumb { background: #000; }
.ficon.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon em { position: absolute; right: 3px; bottom: 3px; font-style: normal; font-size: 10px; font-weight: 700; line-height: 1.3; color: #fff; background: rgba(0, 0, 0, .72); padding: 0 4px; border-radius: 4px; display: none; }
.it { position: relative; border: 1.5px solid transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.it.sel { background: var(--sel); border-color: var(--sel-line); }
.it.dragging { opacity: .4; }
.it.drop-hi, .trow.drop-hi, .crumbs a.drop-hi, .nav-item.drop-hi { background: var(--accent-soft) !important; border-color: var(--accent) !important; border-style: dashed !important; }
.chk { appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 1.8px solid var(--muted); background: var(--panel); display: grid; place-items: center; cursor: pointer; opacity: 0; padding: 0; color: #fff; flex: none; }
.chk svg { width: 13px; height: 13px; stroke-width: 3; opacity: 0; }
.it:hover .chk, .it.sel .chk, .selecting .chk { opacity: 1; }
.it.sel .chk { background: var(--accent); border-color: var(--accent); }
.it.sel .chk svg { opacity: 1; }
.nm { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.nm .line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nm .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.it.dir .nm .n { cursor: pointer; }
.it.dir .nm .n:hover { text-decoration: underline; text-underline-offset: 2px; }
.nm .badge { color: var(--accent); display: grid; flex: none; }
.nm .badge svg { width: 15px; height: 15px; }
.nm .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm .sub.m, .nm .sub.d { display: none; }
.list.rows .nm .sub.d { display: block; }
.nm .where { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nm .where svg { width: 13px; height: 13px; }
.sz, .dt { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; justify-content: flex-end; gap: 2px; }
.act { appearance: none; height: 32px; min-width: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; }
.act:hover { background: var(--line); color: var(--fg); }
.act.share { color: var(--accent); }
.act.share:hover { background: var(--accent-soft); color: var(--accent); }
.act.share, .act.dlb { opacity: 0; }
.it:hover .act.share, .it.sel .act.share, .it:hover .act.dlb, .it.sel .act.dlb { opacity: 1; }

/* list layout */
.list.rows .lhead, .list.rows .it { display: grid; grid-template-columns: 30px 44px minmax(0, 1fr) 110px 120px 158px; align-items: center; gap: 4px; }
.list.rows .lhead { position: sticky; top: 0; z-index: 2; background: var(--bg); height: 36px; border-bottom: 1px solid var(--line); margin: 0 8px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lhead button, .ghead button { background: none; border: 0; text-align: left; padding: 0; cursor: pointer; color: inherit; font-weight: inherit; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.lhead button svg, .ghead button svg { width: 14px; height: 14px; }
.lhead button.on, .ghead button.on { color: var(--fg); }
.lhead .c-name { grid-column: 2 / 4; padding-left: 2px; }
.list.rows .it { height: 54px; margin: 1px 8px 0; border-radius: 10px; }
.list.rows .it:hover:not(.sel) { background: var(--hover); }
.list.rows .chk { margin-left: 6px; }
.list.rows .ficon.thumb { width: 44px; height: 30px; border-radius: 6px; }
.list.rows .acts { padding-right: 6px; }

/* grid layout */
.list.grid .ghead { display: flex; gap: 16px; padding: 4px 10px 10px; color: var(--muted); font-weight: 600; }
.list.grid .items { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; padding: 0 8px; }
.list.grid .it { display: flex; flex-direction: column; border-radius: 14px; background: var(--panel); border-color: var(--line); overflow: hidden; }
.list.grid .it:hover:not(.sel) { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.list.grid .it.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--sel-line); }
.list.grid .ficon { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
.list.grid .ficon svg { width: 38px; height: 38px; stroke-width: 1.5; }
.list.grid .ficon em { display: block; font-size: 11px; padding: 1px 6px; right: 6px; bottom: 6px; }
.list.grid .nm { padding: 9px 12px 11px; }
.list.grid .nm .sub.m { display: block; }
.list.grid .sz, .list.grid .dt { display: none; }
.list.grid .chk { position: absolute; top: 8px; left: 8px; z-index: 2; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.list.grid .acts { position: absolute; top: 6px; right: 6px; z-index: 2; gap: 4px; }
.list.grid .act { background: rgba(255, 255, 255, .92); color: #111; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); opacity: 0; height: 30px; min-width: 30px; padding: 0 7px; }
.list.grid .act .lbl { display: none; }
.list.grid .it:hover .act, .list.grid .it.sel .act { opacity: 1; }
.list.rows .ficon em { display: none; }

.empty { margin: 48px auto; max-width: 440px; text-align: center; padding: 48px 24px; border: 2px dashed var(--line); border-radius: 18px; color: var(--muted); }
.empty .big { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .big svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; color: var(--fg); font-size: 16px; }
.empty p { margin: 0 0 18px; }
.drag-ghost { position: fixed; top: -200px; left: 0; padding: 8px 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shares view ---------- */
.shares { flex: 1; overflow: auto; padding: 0 20px 140px; }
.share-row { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 10px; }
.share-row .ficon { width: 64px; height: 40px; border-radius: 8px; }
.share-row .n { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .url { font-size: 12px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0; }
.share-row .btns { display: flex; gap: 6px; flex: none; }
.share-row.missing { opacity: .6; }

/* ---------- drop overlay ---------- */
.drop-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 50; border: 3px dashed var(--accent); border-radius: 16px; margin: 6px; background: color-mix(in srgb, var(--accent) 5%, transparent); }
.drop-label { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
.drop-label span:first-child { display: grid; }

/* ---------- uploads panel ---------- */
.uploads { position: fixed; right: 20px; bottom: 20px; width: 420px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; display: flex; flex-direction: column; max-height: min(64vh, 560px); }
.uhead { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); min-height: 46px; }
.uhead strong { margin-right: auto; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads.collapsed .ulist { display: none; }
.uploads.collapsed .uhead { border-bottom: 0; }
.uploads.collapsed #ucollapse svg { transform: rotate(180deg); }
.ulist { overflow: auto; }
.usum { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.usum .ubar { height: 6px; margin-top: 8px; }
.usum-t { display: block; }
.uhint { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 8px; }
.uitem { display: flex; gap: 12px; align-items: center; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.uitem:last-child { border-bottom: 0; }
.uitem .ficon { width: 32px; height: 32px; border-radius: 9px; }
.uitem .ficon svg { width: 16px; height: 16px; }
.umid { flex: 1; min-width: 0; }
.uitem .un { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.uitem .us { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; display: flex; align-items: center; gap: 4px; }
.uitem .us svg { width: 14px; height: 14px; }
.uitem .us.err { color: var(--danger); white-space: normal; }
.uitem .us.ok { color: var(--ok); }
.uitem .us.warn { color: var(--warn); white-space: normal; }
.ubar { height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.ubar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s linear; }
.uitem.paused .ubar i, .uitem.orphan .ubar i { background: var(--muted); }
.ub { display: flex; gap: 2px; align-items: center; flex: none; }
.umore { padding: 10px 16px; font-size: 12px; color: var(--muted); }

/* ---------- context menu / sheet ---------- */
.ctx { position: fixed; z-index: 60; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ctx button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; }
.ctx button:hover { background: var(--hover); }
.ctx button svg { color: var(--muted); }
.ctx button.danger, .ctx button.danger svg { color: var(--danger); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.ctx.sheet { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; border-radius: 18px; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); animation: up .16s ease-out; }
.ctx.sheet button { padding: 14px 12px; font-size: 16px; }
body.sheet-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 59; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* ---------- modals ---------- */
.mback { position: fixed; inset: 0; background: rgba(8, 10, 15, .5); z-index: 70; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal:focus { outline: none; }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: pop .14s; }
.modal.wide { width: min(1080px, 100%); }
.mhead { display: flex; align-items: center; gap: 8px; padding: 16px 12px 8px 20px; }
.mhead h2 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbody { padding: 6px 20px 16px; }
.mbody input[type=text] { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); padding: 0 12px; font-size: 15px; outline: none; }
.mbody input[type=text]:focus { border-color: var(--accent); }
.mfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 20px 18px; flex-wrap: wrap; }
.linkbox { display: flex; gap: 8px; margin: 16px 0 8px; }
.linkbox input { flex: 1; min-width: 0; font-size: 13px !important; }
.share-head { display: flex; gap: 12px; align-items: center; }
.share-head .ficon { width: 64px; height: 40px; border-radius: 8px; }
.share-head .n { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-note { font-size: 13px; color: var(--muted); margin: 4px 0 14px; display: flex; gap: 6px; align-items: center; }
.share-note svg { width: 16px; height: 16px; flex: none; }
.share-note.ok { color: var(--ok); }
.share-note.warn { color: var(--warn); align-items: flex-start; }
.share-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btns .btn { flex: 1; }
.share-stop { margin-top: 16px; text-align: center; }
.share-stop button { color: var(--danger); font-size: 13px; }
.pv { background: #000; border-radius: 12px; overflow: hidden; display: grid; place-items: center; min-height: 220px; }
.pv video, .pv img { max-width: 100%; max-height: 70vh; display: block; }
.pv audio { width: 90%; margin: 48px 0; }
.pv-none { padding: 56px 20px; text-align: center; color: var(--muted); background: var(--panel-2); width: 100%; display: grid; justify-items: center; gap: 4px; }
.pv-none svg { width: 40px; height: 40px; }
.pv-meta { margin: 10px 2px 0; font-size: 13px; }
.picker { border: 1px solid var(--line); border-radius: 12px; max-height: 50vh; min-height: 200px; overflow: auto; padding: 6px; }
.picker .trow.pick { background: var(--accent); color: #fff; }
.picker .trow.pick .ticon, .picker .trow.pick .twist { color: #fff; }
.picker .trow.disabled { opacity: .4; pointer-events: none; }
.picker-new { margin-top: 8px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-radius: 12px; background: #1b1f2a; color: #fff; box-shadow: var(--shadow); font-weight: 550; animation: pop .15s; max-width: 100%; }
.toast.error { background: var(--danger); }
.toast button { background: none; border: 0; color: #9db6ff; font-weight: 700; cursor: pointer; padding: 0; flex: none; }
.toast.error button { color: #fff; text-decoration: underline; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.only-mobile { display: none; }

/* ---------- phones & small tablets ---------- */
@media (max-width: 860px) {
  :root { --top: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar { min-height: 56px; gap: 8px; padding: env(safe-area-inset-top) 10px 0; }
  .only-mobile { display: grid; }
  .brand { width: auto; }
  .brand-name { display: none; }
  .search { max-width: none; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); z-index: 45; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); visibility: hidden; }
  .app.side-open .sidebar { transform: none; visibility: visible; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 44; }
  .toolbar { padding: 10px 12px 8px; flex-wrap: wrap; min-height: 0; gap: 8px; }
  .crumbs { font-size: 17px; flex-basis: 100%; }
  .crumbs a, .crumbs span.cur { max-width: 50vw; }
  .tb-actions { width: 100%; }
  .tb-actions .btn { flex: 1; height: 40px; }
  .tb-actions .btn.icon-only { flex: 0 0 40px; }
  .hide-sm { display: none; }
  .list { padding: 0 4px 160px; }
  .list.rows .lhead { display: none; }
  .list.rows .it { grid-template-columns: 0 48px minmax(0, 1fr) auto; height: 62px; margin: 0 4px; gap: 8px; }
  .list.rows.selecting .it { grid-template-columns: 30px 48px minmax(0, 1fr) auto; }
  .list.rows .chk { opacity: 0; width: 0; margin: 0; overflow: hidden; border-width: 0; }
  .list.rows.selecting .chk { opacity: 1; width: 22px; margin-left: 6px; border-width: 1.8px; }
  .list.rows .ficon { width: 44px; height: 44px; }
  .list.rows .ficon.thumb { width: 48px; height: 36px; }
  .list.rows .sz, .list.rows .dt { display: none; }
  .nm .sub.m { display: block; }
  .list.rows .nm .sub.d { display: none; }
  .act.share, .act.dlb { display: none; }
  .act { width: 40px; height: 40px; }
  .act .lbl { display: none; }
  .list.rows .it:hover:not(.sel) { background: transparent; }
  .list.grid .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 6px; }
  .list.grid .act { opacity: 1; }
  .list.grid .act.share, .list.grid .act.dlb { display: none; }
  .list.grid .chk { opacity: 0; }
  .list.grid.selecting .chk, .list.grid .it.sel .chk { opacity: 1; }
  .selbar { top: 8px; left: 8px; right: 8px; padding-left: 12px; }
  .selbar .btn .lbl { display: none; }
  .selbar .btn { width: 38px; padding: 0; }
  .shares { padding: 0 10px 140px; }
  .share-row { flex-wrap: wrap; }
  .share-row .btns { width: 100%; }
  .share-row .btns .btn { flex: 1; }
  .uploads { right: 8px; left: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-width: none; }
  .mback { align-items: end; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .mfoot .btn { flex: 1; height: 46px; }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
  /* iOS zooms the page when a focused field is under 16px */
  .search input, .mbody input[type=text], .linkbox input { font-size: 16px !important; }
  /* hidden checkboxes must not steal taps on the thumbnail */
  .list.grid:not(.selecting) .it:not(.sel) .chk { pointer-events: none; }
}
