:root {
  --bg: #0f1216; --surface: #171b21; --surface2: #1e232b; --hover: #222831; --border: #2a313b;
  --text: #e8ecf1; --muted: #8b96a5; --accent: #2b7fff; --accent-bg: rgba(43,127,255,.16); --accent-text: #6aa5ff;
  --danger: #ef4d4d; --ok: #2fbf71; --warn: #e6a23c; --shadow: 0 8px 32px rgba(0,0,0,.45);
  --hdr: 56px; --side: 248px; --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6f9; --surface: #ffffff; --surface2: #f0f2f6; --hover: #e9edf3; --border: #dde2ea;
  --text: #1a1f27; --muted: #667085; --accent: #1f6feb; --accent-bg: rgba(31,111,235,.12); --accent-text: #1f6feb;
  --shadow: 0 8px 28px rgba(20,30,50,.18); color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f4f6f9; --surface: #ffffff; --surface2: #f0f2f6; --hover: #e9edf3; --border: #dde2ea;
    --text: #1a1f27; --muted: #667085; --accent: #1f6feb; --accent-bg: rgba(31,111,235,.12); --accent-text: #1f6feb;
    --shadow: 0 8px 28px rgba(20,30,50,.18); color-scheme: light;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
svg { display: block; flex-shrink: 0; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── buttons & inputs ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); white-space: nowrap; transition: background .12s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent-text); background: var(--accent-bg); }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); outline: none; }
.input:focus { border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ── login ── */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { margin: 12px 0 4px; font-size: 20px; text-align: center; }
.login-card p { margin: 0 0 22px; text-align: center; color: var(--muted); font-size: 13px; }
.login-card .logo { margin: 0 auto; width: 48px; height: 48px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.login-card .btn { width: 100%; height: 42px; }

/* ── app shell ── */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: var(--hdr) 1fr; grid-template-areas: "hdr hdr" "side main"; height: 100dvh; }
.hdr { grid-area: hdr; display: flex; align-items: center; gap: 10px; padding: 0 12px; padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: 1px solid var(--border); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; min-width: 0; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { flex: 1; max-width: 640px; margin: 0 auto; position: relative; }
.search input { width: 100%; height: 38px; border-radius: 19px; border: 1px solid transparent; background: var(--surface2); padding: 0 16px 0 40px; outline: none; }
.search input:focus { border-color: var(--accent); background: var(--surface); }
.search svg { position: absolute; left: 13px; top: 10px; color: var(--muted); pointer-events: none; }
.hdr-spacer { flex: 1; }
.side { grid-area: side; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 8px; color: var(--text); border: 0; background: none; text-align: left; width: 100%; }
.nav svg { color: var(--muted); }
.nav:hover { background: var(--hover); }
.nav.active { background: var(--accent-bg); color: var(--accent-text); }
.nav.active svg { color: var(--accent-text); }
.side .grow { flex: 1; }
.side .who { padding: 10px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }
.scrim { display: none; }

/* toolbar row: breadcrumbs / selection bar */
.bar { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 6px 14px; border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0; }
.crumbs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { border: 0; background: none; padding: 6px 8px; border-radius: 6px; color: var(--muted); font-size: 15px; white-space: nowrap; flex-shrink: 0; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb:last-child { color: var(--text); font-weight: 600; }
.crumb.drop { background: var(--accent-bg); color: var(--accent-text); outline: 1px dashed var(--accent); }
.crumbs .sep { color: var(--border); flex-shrink: 0; }
.selbar { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.selbar .count { font-weight: 600; margin: 0 8px 0 4px; white-space: nowrap; }
.selbar .sp { flex: 1; }

/* ── file list ── */
.content { flex: 1; overflow-y: auto; position: relative; min-height: 0; -webkit-overflow-scrolling: touch; outline: none; }
.listhead { display: grid; grid-template-columns: 40px minmax(0,1fr) 110px 170px 44px; align-items: center; height: 38px; padding: 0 14px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.listhead button { border: 0; background: none; padding: 0; text-align: left; text-transform: inherit; letter-spacing: inherit; font-size: inherit; color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.listhead button:hover { color: var(--text); }
.listhead .num { justify-content: flex-start; }
.row { display: grid; grid-template-columns: 40px minmax(0,1fr) 110px 170px 44px; align-items: center; min-height: 52px; padding: 4px 14px 4px 10px; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); cursor: default; user-select: none; -webkit-user-select: none; content-visibility: auto; contain-intrinsic-size: auto 52px; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent-bg); }
.row.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-bg); }
.row .chk { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.ico { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface2); overflow: hidden; position: relative; color: var(--muted); }
.ico.folder { color: #f0b73a; background: transparent; }
.ico img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ico.t-video { color: #b48cff; } .ico.t-audio { color: #ff8c6a; } .ico.t-image { color: #4cc38a; } .ico.t-archive { color: #e6a23c; } .ico.t-doc { color: #5ea1ff; } .ico.t-code { color: #7fd1d1; }
.cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .sub { display: none; color: var(--muted); font-size: 12px; }
.cell-name .txt { min-width: 0; display: flex; flex-direction: column; }
.row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.row .more { opacity: 0; }
.row:hover .more, .row.sel .more { opacity: 1; }
.tick { width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 5px; display: none; align-items: center; justify-content: center; color: #fff; }
.row:hover .tick, .selecting .tick { display: flex; }
.row.sel .tick { display: flex; background: var(--accent); border-color: var(--accent); }
.row .tick svg { opacity: 0; } .row.sel .tick svg { opacity: 1; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; padding: 16px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: default; user-select: none; -webkit-user-select: none; content-visibility: auto; contain-intrinsic-size: auto 190px; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card.drop { border-color: var(--accent); background: var(--accent-bg); }
.thumb { aspect-ratio: 16/10; background: var(--surface2); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; color: var(--muted); }
.thumb.folder { color: #f0b73a; background: linear-gradient(160deg, var(--surface2), var(--surface)); }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb video { pointer-events: none; }
.thumb .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.card .tick { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.45); border-color: #fff; z-index: 2; }
.card:hover .tick, .selecting .card .tick { display: flex; }
.card.sel .tick { display: flex; background: var(--accent); border-color: var(--accent); }
.card .tick svg { opacity: 0; } .card.sel .tick svg { opacity: 1; }
.card .more { position: absolute; right: 4px; top: 4px; width: 30px; height: 30px; background: rgba(0,0,0,.45); color: #fff; opacity: 0; z-index: 2; }
.card:hover .more { opacity: 1; }
.card .info { padding: 9px 11px; min-width: 0; }
.card .info .nm { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .info .sub { font-size: 12px; color: var(--muted); }

.empty { height: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 10px; text-align: center; padding: 20px; }
.empty svg { opacity: .6; }
.loading { display: flex; justify-content: center; padding: 60px; }
.spin { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { display: grid; gap: 1px; }
.skel i { display: block; height: 52px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: sh 1.3s infinite; }
@keyframes sh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.dropzone { position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 14px; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--accent-text); z-index: 20; pointer-events: none; }

/* pages (shares / settings / users) */
.page { flex: 1; overflow-y: auto; padding: 22px; }
.page h2 { margin: 0 0 16px; font-size: 18px; }
.page h3 { margin: 26px 0 12px; font-size: 15px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-width: 720px; margin-bottom: 16px; }
.tbl { width: 100%; max-width: 900px; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .act { display: flex; gap: 4px; justify-content: flex-end; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.tag.warn { color: var(--warn); } .tag.ok { color: var(--ok); }
.formrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.formrow .field { flex: 1; min-width: 150px; margin: 0; }

/* ── menu ── */
.menu { position: fixed; z-index: 200; min-width: 200px; max-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 38px; padding: 0 12px; border: 0; background: none; border-radius: 6px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.menu svg { color: var(--muted); }
.menu button.danger svg { color: var(--danger); }

/* ── modal ── */
.back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; }
.modal.wide { max-width: 560px; }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal p { color: var(--muted); margin: 0 0 14px; word-break: break-word; }
.mactions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.urlbox { display: flex; gap: 8px; margin-top: 12px; }
.urlbox input { font-family: var(--mono); font-size: 13px; }
.picker { border: 1px solid var(--border); border-radius: 8px; max-height: 320px; overflow-y: auto; background: var(--surface2); padding: 4px; }
.pk { display: flex; align-items: center; gap: 6px; height: 36px; padding-right: 8px; border-radius: 6px; cursor: pointer; }
.pk:hover { background: var(--hover); } .pk.sel { background: var(--accent-bg); color: var(--accent-text); } .pk.dis { opacity: .4; pointer-events: none; }
.pk .tw { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); border-radius: 4px; }
.pk .tw:hover { background: var(--hover); }

/* ── toasts ── */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 400; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 11px 14px; box-shadow: var(--shadow); animation: up .18s; pointer-events: auto; }
.toast.err { border-left-color: var(--danger); } .toast.ok { border-left-color: var(--ok); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }

/* ── uploads ── */
.upl { position: fixed; right: 18px; bottom: 18px; width: 340px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 120; overflow: hidden; }
.upl-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: var(--surface2); font-weight: 600; }
.upl-h .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-l { max-height: 240px; overflow-y: auto; }
.upl.min .upl-l { display: none; }
.uj { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; }
.uj .r { display: flex; gap: 8px; } .uj .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .uj .s { color: var(--muted); }
.uj.err .s { color: var(--danger); } .uj.done .s { color: var(--ok); }
.pbar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 5px; overflow: hidden; } .pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; box-shadow: var(--shadow); display: none; align-items: center; justify-content: center; z-index: 60; }

/* ── preview ── */
.pv { position: fixed; inset: 0; z-index: 300; background: rgba(6,8,11,.94); display: flex; flex-direction: column; color: #eef2f7; animation: fade .12s; }
.pv-h { display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 8px; padding-top: env(safe-area-inset-top); flex-shrink: 0; background: rgba(0,0,0,.35); }
.pv-h .t { flex: 1; min-width: 0; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pv .icon-btn { color: #c9d2de; } .pv .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.pv-b { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; touch-action: pan-y; }
.pv-b img, .pv-b video { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-b audio { width: min(520px, 90vw); }
.pv-b pre { margin: 0; align-self: stretch; width: 100%; overflow: auto; padding: 18px; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: #dbe3ee; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; background: rgba(0,0,0,.45); color: #fff; }
.pv-nav.l { left: 10px; } .pv-nav.r { right: 10px; }
.pv-msg { text-align: center; color: #b4bfcc; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* share (public) page */
.pubhead { display: flex; align-items: center; gap: 10px; }
.filecard { max-width: 460px; margin: 0 auto; text-align: center; padding: 30px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.filecard .ico { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 16px; }
.filecard h2 { word-break: break-word; margin: 0 0 4px; font-size: 18px; }
.filecard .btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.center-msg { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ═════════ tablet / mobile ═════════ */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hdr" "main"; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); z-index: 90; transform: translateX(-100%); transition: transform .2s; padding-top: calc(12px + env(safe-area-inset-top)); }
  .app.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; }
  .listhead, .row { grid-template-columns: 40px minmax(0,1fr) 90px 44px; }
  .listhead .c-mod, .row .c-mod { display: none; }
}
@media (max-width: 640px) {
  .brand span { display: none; }
  .hdr { gap: 6px; padding: 0 6px; }
  .search { margin: 0; }
  .bar { padding: 4px 8px; min-height: 48px; }
  .crumb { font-size: 14px; padding: 8px; }
  .listhead { display: none; }
  .row { grid-template-columns: minmax(0,1fr) 40px; min-height: 60px; padding: 6px 4px 6px 12px; position: relative; }
  .row .c-size, .row .c-mod { display: none; }
  .row .chk { position: absolute; left: 10px; top: 50%; margin-top: -11px; }
  .row .tick { display: none; }
  .selecting .row { padding-left: 42px; }
  .selecting .row .tick { display: flex; }
  .row .more { opacity: 1; width: 40px; height: 40px; }
  .cell-name .sub { display: block; }
  .ico { width: 40px; height: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 10px; }
  .card .more { opacity: 1; }
  .fab { display: flex; }
  .bar > .btn.primary { display: none; }
  .selecting .fab { display: none; }
  .page { padding: 14px; }
  .back { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; animation: sheet .18s; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .mactions .btn { flex: 1; height: 44px; }
  .input { height: 44px; font-size: 16px; }
  .upl { left: 8px; right: 8px; width: auto; bottom: calc(8px + env(safe-area-inset-bottom)); }
  .selecting.has-upl .fab, .fab { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .menu { min-width: 0; }
  .menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; border-radius: 16px 16px 0 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .menu.sheet button { height: 48px; font-size: 15px; }
  .selbar .lbl { display: none; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .pv-nav { display: none; }
  .kv { grid-template-columns: 90px 1fr; }
  .formrow .field { min-width: 100%; }
}
@media (hover: none) { .row .more, .card .more { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.app.noside { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hdr" "main"; }
.hdr .menu-btn { display: none; }
@media (max-width: 900px) { .hdr .menu-btn { display: inline-flex; } }
.pk .tw { flex-shrink: 0; }
.upl .icon-btn { width: 30px; height: 30px; }

/* ═════════ media players ═════════ */
.vp { position: relative; width: 100%; height: 100%; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; -webkit-user-select: none; }
.vp video { width: 100%; height: 100%; object-fit: contain; display: block; }
.vp.idle { cursor: none; }
.vc { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; transition: opacity .2s; z-index: 4; }
.vp.idle .vc, .vp.idle .bigplay.show { opacity: 0; pointer-events: none; }
.vp:not(.playing) .vc { opacity: 1; pointer-events: auto; }
.crow { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.crow .sp { flex: 1; }
.crow .icon-btn, .ap .icon-btn { color: #fff; }
.crow .icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.crow .time { font: 13px var(--mono); font-variant-numeric: tabular-nums; margin: 0 8px; white-space: nowrap; opacity: .92; }
.crow .spd { color: #fff; height: 32px; padding: 0 10px; font-weight: 600; min-width: 48px; }
.crow .spd:hover { background: rgba(255,255,255,.14); }
.volbox { display: inline-flex; align-items: center; }
.vol { -webkit-appearance: none; appearance: none; width: 80px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); outline: none; margin: 0 8px 0 0; cursor: pointer; }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
.vol::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
.seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.seek::before { content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: rgba(255,255,255,.28); transition: height .12s; }
.seek:hover::before, .seek.drag::before, .seek:focus-visible::before { height: 6px; }
.seek i { position: absolute; left: 0; height: 4px; border-radius: 2px; width: 0; transition: height .12s; pointer-events: none; }
.seek:hover i, .seek.drag i { height: 6px; }
.seek .buf { background: rgba(255,255,255,.35); }
.seek .fill { background: var(--accent); }
.seek .knob { width: 14px; height: 14px !important; border-radius: 50%; background: #fff; margin-left: -7px; transform: scale(0); transition: transform .12s; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.seek:hover .knob, .seek.drag .knob, .seek:focus-visible .knob { transform: scale(1); }
.bigplay { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); z-index: 3; transition: opacity .15s, transform .15s; }
.bigplay:hover { transform: scale(1.06); background: var(--accent); }
.vp.playing .bigplay { opacity: 0; pointer-events: none; }
.vspin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 3; }
.ripple { position: absolute; top: 50%; margin-top: -30px; width: 90px; height: 60px; border-radius: 30px; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; animation: rip .6s forwards; pointer-events: none; z-index: 5; }
.ripple.l { left: 12%; } .ripple.r { right: 12%; }
@keyframes rip { 0% { opacity: 0; transform: scale(.8); } 20% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }

.ap { width: min(460px, 92vw); display: flex; flex-direction: column; gap: 6px; color: #fff; padding: 22px 20px 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; backdrop-filter: blur(10px); }
.ap .cover { width: min(300px, 62vw); aspect-ratio: 1; margin: 0 auto 12px; border-radius: 14px; background: linear-gradient(145deg, #232b38, #151a22); display: flex; align-items: center; justify-content: center; color: #ff8c6a; position: relative; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.ap .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ap-t { font-size: 17px; font-weight: 600; text-align: center; word-break: break-word; }
.ap-s { font-size: 12px; color: #9aa6b6; text-align: center; margin-bottom: 8px; }
.ap .crow { flex-wrap: wrap; justify-content: center; }

.iv { position: relative; width: 100%; height: 100%; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: zoom-in; }
.iv.zoomed { cursor: grab; }
.iv img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; will-change: transform; opacity: 0; transition: opacity .2s; user-select: none; -webkit-user-drag: none; }
.iv.ready img { opacity: 1; }
.ztools { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px 8px; background: rgba(0,0,0,.6); border-radius: 26px; backdrop-filter: blur(6px); z-index: 5; }
.ztools .icon-btn { color: #fff; width: 36px; height: 36px; }
.ztools .zl { min-width: 46px; text-align: center; font: 12px var(--mono); color: #dbe3ee; }

@media (max-width: 640px) {
  .vc { padding: 30px 8px calc(6px + env(safe-area-inset-bottom)); }
  .volbox .vol, .crow .skip { display: none; }
  .volbox { display: none; }
  .crow .time { margin: 0 4px; font-size: 12px; }
  .bigplay { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
  .seek { height: 30px; }
  .ap { padding: 16px 12px 8px; }
  .ap .crow .skip, .ap .volbox { display: inline-flex; }
  .ap .volbox .vol { display: none; }
}
/* landscape phones: give video the whole screen */
@media (max-height: 480px) and (orientation: landscape) { .pv-h { height: 44px; } .pv-nav { display: none; } .vc { padding-top: 18px; } }

.logo.img { background: none !important; color: inherit; }
.logo.img img { width: 100%; height: 100%; display: block; }
.brand .logo.img { width: 34px; height: 34px; }
.login-card .logo.img { width: 72px; height: 72px; border-radius: 0; }
/* previews: solid backdrop; flex children must be allowed to shrink (fixes oversized video on narrow screens) */
.pv { background: #06080b; }
.pv-b > .vp, .pv-b > .iv { min-width: 0; min-height: 0; flex: 1 1 0; align-self: stretch; }
.pv-b > .vp video { min-width: 0; min-height: 0; }

html, body { max-width: 100vw; overflow-x: hidden; }

.ap .cover canvas.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.center-msg .stack { width: 100%; max-width: 460px; }
.cardbrand { justify-content: center; margin-bottom: 18px; font-size: 16px; }
.center-msg .filecard { margin: 0 auto; max-width: none; }
@media (max-width: 640px) {
  .app.noside { grid-template-rows: auto minmax(0, 1fr); }
  .app.noside .hdr { flex-wrap: wrap; padding-bottom: 8px; min-height: var(--hdr); }
  .app.noside .brand { flex: 1; min-width: 0; }
  .app.noside .brand span { display: inline; }
  .app.noside .search { order: 3; flex: 1 1 100%; max-width: none; }
  .app.noside .hdr .lbl { display: none; }
  .app.noside .hdr .btn.primary { padding: 0 12px; }
}
.filecard > svg { margin: 0 auto 14px; }

canvas.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.sr-user { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.pv-msg .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pv-msg .hint { font-size: 12px; color: #8996a8; max-width: 320px; }

/* ═════════ PDF viewer ═════════ */
.pdf { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: #1b1f26; color: #fff; }
.pdf-tools { display: flex; align-items: center; justify-content: center; gap: 2px; padding: 6px; background: rgba(0,0,0,.5); flex-shrink: 0; flex-wrap: wrap; }
.pdf-tools .icon-btn { color: #fff; width: 36px; height: 36px; }
.pdf-tools .icon-btn:hover { background: rgba(255,255,255,.14); }
.pdf-tools .pg, .pdf-tools .zl { font: 13px var(--mono); min-width: 64px; text-align: center; }
.pdf-tools .sep { width: 1px; height: 20px; background: rgba(255,255,255,.22); margin: 0 8px; }
.pdf-pages { flex: 1; min-height: 0; overflow: auto; padding: 12px 0 28px; outline: none; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.pdf-inner { display: flex; flex-direction: column; align-items: center; min-width: 100%; width: max-content; }
.pdf-page { position: relative; background: #fff; margin: 0 12px 12px; box-shadow: 0 2px 14px rgba(0,0,0,.55); flex-shrink: 0; }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pv-b > .pdf { min-width: 0; min-height: 0; flex: 1 1 0; align-self: stretch; }
@media (max-width: 640px) { .pdf-tools .sep { display: none; } .pdf-tools .icon-btn { width: 40px; height: 40px; } }
