/* ---------- Токены */
:root {
  color-scheme: light;
  --bg: #f4f5fa; --panel: #ffffff; --panel-2: #f9fafc; --soft: #eef0f7; --hover: #f1f2f8;
  --line: #e4e7f0; --line-2: #d5d9e5;
  --text: #131726; --muted: #5d6882; --faint: #98a1b6;
  --accent: #6a5cff; --accent-2: #3b82f6; --accent-ink: #ffffff;
  --accent-soft: rgba(106, 92, 255, .10); --accent-line: rgba(106, 92, 255, .38);
  --ok: #129a4c; --ok-soft: rgba(18, 154, 76, .10);
  --warn: #b86e00; --warn-soft: rgba(219, 137, 0, .12);
  --danger: #df3f45; --danger-soft: rgba(223, 63, 69, .10);
  --shadow-sm: 0 1px 2px rgba(19, 23, 38, .06);
  --shadow: 0 1px 2px rgba(19, 23, 38, .05), 0 12px 32px -14px rgba(19, 23, 38, .20);
  --shadow-lg: 0 32px 90px -24px rgba(12, 14, 34, .5);
  --scrim: rgba(12, 14, 26, .55);
  --r-lg: 18px; --r: 12px; --r-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --k-folder: #e89a12; --k-image: #129a4c; --k-rawimage: #129a4c; --k-video: #e5484d; --k-audio: #d9480f;
  --k-pdf: #dc2626; --k-code: #0891b2; --k-text: #64748b; --k-archive: #b45309; --k-doc: #2563eb;
  --k-sheet: #15803d; --k-slides: #ea580c; --k-app: #7c3aed; --k-font: #db2777; --k-file: #64748b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0f16; --panel: #141924; --panel-2: #171d29; --soft: #1c2331; --hover: #1a2130;
    --line: #232b3b; --line-2: #2e374c;
    --text: #e8ebf3; --muted: #9ba6bd; --faint: #6a758d;
    --accent: #8b7fff; --accent-2: #60a5fa; --accent-soft: rgba(139, 127, 255, .15); --accent-line: rgba(139, 127, 255, .45);
    --ok: #3ccf7d; --ok-soft: rgba(60, 207, 125, .13); --warn: #f2b33d; --warn-soft: rgba(242, 179, 61, .13);
    --danger: #ff6b70; --danger-soft: rgba(255, 107, 112, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 32px 90px -24px rgba(0, 0, 0, .85); --scrim: rgba(4, 6, 12, .72);
    --k-folder: #fbbf24; --k-image: #34d399; --k-rawimage: #34d399; --k-video: #fb7185; --k-audio: #fb923c;
    --k-pdf: #f87171; --k-code: #22d3ee; --k-text: #94a3b8; --k-archive: #f59e0b; --k-doc: #60a5fa;
    --k-sheet: #4ade80; --k-slides: #fb923c; --k-app: #a78bfa; --k-font: #f472b6; --k-file: #94a3b8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0f16; --panel: #141924; --panel-2: #171d29; --soft: #1c2331; --hover: #1a2130;
  --line: #232b3b; --line-2: #2e374c;
  --text: #e8ebf3; --muted: #9ba6bd; --faint: #6a758d;
  --accent: #8b7fff; --accent-2: #60a5fa; --accent-soft: rgba(139, 127, 255, .15); --accent-line: rgba(139, 127, 255, .45);
  --ok: #3ccf7d; --ok-soft: rgba(60, 207, 125, .13); --warn: #f2b33d; --warn-soft: rgba(242, 179, 61, .13);
  --danger: #ff6b70; --danger-soft: rgba(255, 107, 112, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 32px 90px -24px rgba(0, 0, 0, .85); --scrim: rgba(4, 6, 12, .72);
  --k-folder: #fbbf24; --k-image: #34d399; --k-rawimage: #34d399; --k-video: #fb7185; --k-audio: #fb923c;
  --k-pdf: #f87171; --k-code: #22d3ee; --k-text: #94a3b8; --k-archive: #f59e0b; --k-doc: #60a5fa;
  --k-sheet: #4ade80; --k-slides: #fb923c; --k-app: #a78bfa; --k-font: #f472b6; --k-file: #94a3b8;
}

/* ---------- База */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 28px; height: 28px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Шапка */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1240px; margin: 0 auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 16px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7c5cff, #3b82f6); box-shadow: 0 4px 14px -4px rgba(106, 92, 255, .6);
}
.logo .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tabs { display: flex; gap: 2px; margin-left: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 550; white-space: nowrap; transition: background .15s, color .15s;
}
.tab .ic { width: 18px; height: 18px; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 24px 48px; }
.wrap.center { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.foot { text-align: center; color: var(--faint); font-size: 13px; padding: 8px 16px 28px; }

/* ---------- Кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); font-weight: 560; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  user-select: none; text-decoration: none;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 18px -8px var(--accent);
}
.btn-primary:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 90%, #000), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-2)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 14px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 16px; border-radius: 12px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex: none;
  border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn .ic { width: 19px; height: 19px; }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel); outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.search { position: relative; flex: 1; min-width: 160px; max-width: 320px; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; pointer-events: none; }
.search .input { padding-left: 36px; height: 36px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--soft); border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 560; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.seg button .ic { width: 17px; height: 17px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

.switch { position: relative; width: 40px; height: 24px; flex: none; cursor: pointer; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .18s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 7px;
  font-size: 12.5px; font-weight: 580; background: var(--soft); color: var(--muted); white-space: nowrap;
}
.badge .ic { width: 14px; height: 14px; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.notice {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r);
  background: var(--soft); color: var(--muted); font-size: 14px; margin-bottom: 16px;
}
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--accent-soft); color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* ---------- Проводник */
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ex-title { display: flex; gap: 14px; min-width: 0; align-items: flex-start; }
.ex-title h1 { font-size: 26px; font-weight: 700; word-break: break-word; }
.ex-icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--kc, var(--k-folder)) 14%, transparent); color: var(--kc, var(--k-folder));
}
.ex-icon .ic { width: 28px; height: 28px; }
.ex-sub { margin-top: 4px; }
.ex-note { margin-top: 8px; color: var(--muted); max-width: 70ch; white-space: pre-wrap; }
.ex-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--faint); font-size: 13.5px; }
.trail .ic { width: 14px; height: 14px; }
.trail span { display: inline-flex; align-items: center; gap: 4px; }
.trail .sep { opacity: .7; }

.ex-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  position: sticky; top: 68px; z-index: 20;
}
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; flex: 1 1 260px; padding-left: 4px; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; border: 0;
  background: transparent; font-weight: 580; cursor: pointer; color: var(--muted); max-width: 260px;
}
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.cur { color: var(--text); cursor: default; }
.crumb.cur:hover { background: transparent; }
.crumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { color: var(--faint); width: 15px; height: 15px; }
.ex-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 14px; }
.tile {
  position: relative; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; overflow: hidden; box-shadow: var(--shadow-sm); outline: none;
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.tile:focus-visible { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.tile.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile-media {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--kc) 9%, var(--panel-2)); color: var(--kc);
}
.tile-media .ic { width: 44px; height: 44px; stroke-width: 1.5; }
.tile-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.tile-media.has-img img { opacity: 1; }
.tile-media.has-img .ic { opacity: 0; }
.tile-media .play {
  position: absolute; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s;
}
.tile-media.has-img .play { opacity: 1; }
.tile-media .play .ic { width: 18px; height: 18px; opacity: 1; stroke-width: 2; fill: #fff; }
.tile-info { padding: 10px 12px 12px; }
.tile-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { color: var(--faint); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .9);
  background: rgba(10, 12, 20, .28); color: transparent; display: grid; place-items: center; cursor: pointer;
  opacity: 0; transition: opacity .15s, background .15s; backdrop-filter: blur(4px); z-index: 2;
}
.tile-check .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.tile:hover .tile-check, .tile-check.on, .selecting .tile-check { opacity: 1; }
.tile-check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2; height: 22px; padding: 0 7px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650;
  background: rgba(10, 12, 20, .55); color: #fff; backdrop-filter: blur(4px);
}
.tile-badge .ic { width: 13px; height: 13px; }

.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.lrow {
  display: grid; grid-template-columns: 34px 40px minmax(0, 1fr) 110px 170px 44px; align-items: center; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; outline: none;
}
.lrow:first-child { border-top: 0; }
.lrow:hover { background: var(--hover); }
.lrow:focus-visible { background: var(--accent-soft); }
.lrow.selected { background: var(--accent-soft); }
.lrow.head { cursor: default; background: var(--panel-2); color: var(--faint); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.lrow.head:hover { background: var(--panel-2); }
.lrow .l-ic {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; position: relative;
  background: color-mix(in srgb, var(--kc) 12%, transparent); color: var(--kc);
}
.lrow .l-ic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lrow .l-name { min-width: 0; }
.lrow .l-name b { display: block; font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .l-name small { display: block; color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .l-size, .lrow .l-date { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.lrow .l-size { text-align: right; }
.lcheck {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2); background: var(--panel);
  display: grid; place-items: center; color: transparent; cursor: pointer; padding: 0;
}
.lcheck .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.lcheck.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lcheck.part { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.empty {
  text-align: center; padding: 64px 20px; color: var(--muted);
  border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--panel-2);
}
.empty .big-ic {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.empty .big-ic .ic { width: 30px; height: 30px; }
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto; }
.loading { display: grid; place-items: center; padding: 70px 0; }
.more-note { text-align: center; color: var(--faint); font-size: 13px; margin-top: 14px; }

.selbar {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translate(-50%, calc(100% + 40px));
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 16px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px);
  visibility: hidden; transition: transform .22s cubic-bezier(.2, .9, .3, 1.2), visibility 0s .22s;
}
.selbar.show { transform: translate(-50%, 0); visibility: visible; transition: transform .22s cubic-bezier(.2, .9, .3, 1.2); }
.selbar .sel-txt { font-weight: 600; white-space: nowrap; }
.selbar .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 25%, transparent); box-shadow: none; }
.selbar .btn:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); }
.selbar .btn-primary { background: var(--accent); border-color: transparent; color: #fff; }

/* ---------- Страница одного файла */
.filepage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.fp-preview {
  border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden; min-height: 360px; display: grid; place-items: center;
}
.fp-preview > img { max-width: 100%; max-height: 74vh; display: block; box-shadow: none; border-radius: 0; }
.fp-preview > video { width: 100%; max-height: 74vh; background: #000; display: block; }
.fp-preview > iframe { width: 100%; height: 76vh; border: 0; display: block; background: #fff; }
.fp-preview .pv-text, .fp-preview .pv-zip { width: 100%; max-height: 74vh; }
.fp-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.fp-name { font-size: 22px; font-weight: 700; word-break: break-word; }
.fp-meta { color: var(--muted); }
.fp-note { white-space: pre-wrap; color: var(--muted); padding: 12px 14px; border-radius: var(--r); background: var(--soft); }
.fp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-actions .btn-lg { flex: 1 1 100%; }
.big-file { display: grid; place-items: center; gap: 12px; padding: 40px; text-align: center; color: var(--muted); }
.big-file .bf-ic {
  width: 96px; height: 96px; border-radius: 26px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--kc) 14%, transparent); color: var(--kc);
}
.big-file .bf-ic .ic { width: 48px; height: 48px; stroke-width: 1.4; }
.big-file b { color: var(--text); font-size: 17px; word-break: break-word; }

/* ---------- Предпросмотр (оверлей) */
.pv {
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto 1fr;
  background: rgba(6, 8, 14, .92); color: #fff; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.pv-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; }
.pv-top .pv-title { min-width: 0; flex: 1; }
.pv-top .pv-title b { display: block; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-top .pv-title small { color: rgba(255, 255, 255, .6); font-size: 13px; }
.pv-top .icon-btn, .pv-top .btn { color: rgba(255, 255, 255, .85); }
.pv-top .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.pv-top .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); box-shadow: none; }
.pv-top .btn:hover { background: rgba(255, 255, 255, .16); }
.pv-stage { position: relative; display: grid; place-items: center; padding: 0 72px 24px; min-height: 0; overflow: hidden; }
.pv-stage > * { max-width: 100%; max-height: 100%; }
.pv-img { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.pv-video { width: min(100%, 1400px); max-height: calc(100vh - 100px); border-radius: 8px; background: #000; }
.pv-frame { width: min(100%, 1100px); height: calc(100vh - 100px); border: 0; border-radius: 8px; background: #fff; }
.pv-audio { display: grid; justify-items: center; gap: 18px; width: min(100%, 460px); }
.pv-audio-art {
  width: 180px; height: 180px; border-radius: 36px; display: grid; place-items: center;
  background: linear-gradient(135deg, #7c5cff, #f97316); box-shadow: 0 30px 80px -20px rgba(124, 92, 255, .6);
}
.pv-audio-art .ic { width: 72px; height: 72px; stroke: #fff; stroke-width: 1.4; }
.pv-audio audio { width: 100%; }
.pv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.pv-nav:hover { background: rgba(255, 255, 255, .2); }
.pv-nav:disabled { opacity: .25; cursor: default; }
.pv-nav .ic { width: 24px; height: 24px; }
.pv-prev { left: 14px; }
.pv-next { right: 14px; }
.pv .big-file { color: rgba(255, 255, 255, .7); }
.pv .big-file b { color: #fff; }
.pv .pv-text, .pv .pv-zip { width: min(100%, 1100px); height: calc(100vh - 110px); }

.pv-text, .pv-zip {
  background: var(--panel); color: var(--text); border-radius: 10px; overflow: auto; text-align: left;
  display: flex; flex-direction: column;
}
.code-wrap { display: flex; min-width: max-content; flex: 1; }
.code-wrap pre { margin: 0; padding: 14px 16px; font: 13px/1.6 var(--mono); tab-size: 4; }
.code-wrap .gutter { color: var(--faint); text-align: right; user-select: none; border-right: 1px solid var(--line); background: var(--panel-2); position: sticky; left: 0; }
.code-wrap .code { white-space: pre; }
.pv-text .notice, .pv-zip .notice { margin: 10px; }
.pv-zip table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pv-zip th, .pv-zip td { padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.pv-zip th { position: sticky; top: 0; background: var(--panel-2); color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.pv-zip td:last-child, .pv-zip th:last-child { text-align: right; white-space: nowrap; color: var(--muted); }
.pv-zip .zip-head { padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }

/* ---------- Модальные окна */
.modal-ov {
  position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: grid; place-items: center; padding: 16px;
  opacity: 0; transition: opacity .16s;
}
.modal-ov.in { opacity: 1; }
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.98); transition: transform .18s;
}
.modal-ov.in .modal { transform: none; }
.modal.wide { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px 22px; }
.modal-head h2 { font-size: 18px; flex: 1; }
.modal-body { padding: 8px 22px 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lbl { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--faint); font-size: 13px; }
.field .inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prefix-input { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--panel); }
.prefix-input:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.prefix-input span { padding: 0 4px 0 12px; display: flex; align-items: center; color: var(--faint); white-space: nowrap; font-size: 14px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.prefix-input input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 60px; height: 38px; padding: 0 12px 0 2px; }
.toggle-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle-row:first-child { border-top: 0; }
.toggle-row .t-txt { flex: 1; min-width: 0; }
.toggle-row .t-txt b { display: block; font-weight: 600; }
.toggle-row .t-txt small { color: var(--faint); font-size: 13px; }
.form-err { color: var(--danger); font-size: 14px; min-height: 20px; }

.qr { display: grid; place-items: center; }
.qr svg { width: 260px; height: 260px; background: #fff; border-radius: 16px; padding: 6px; }
.qr-name { text-align: center; font-weight: 600; }
.qr-url { text-align: center; color: var(--muted); font-size: 13.5px; word-break: break-all; }

/* ---------- Центрированные карточки (пароль, ошибки, вход) */
.center-card {
  width: min(420px, 100%); padding: 32px 28px; text-align: center; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.center-card h1 { font-size: 22px; }
.center-card .big-ic {
  width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.center-card .big-ic .ic { width: 30px; height: 30px; }
.center-card .big-ic.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Главная */
.hero { margin: 8px 0 24px; }
.hero h1 { font-size: 30px; font-weight: 750; }
.hero p { margin-top: 6px; }

/* ---------- Админка */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 720; }
.page-head p { margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat .s-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.stat .s-ic.ok { background: var(--ok-soft); color: var(--ok); }
.stat .s-ic.warn { background: var(--warn-soft); color: var(--warn); }
.stat b { display: block; font-size: 22px; font-family: var(--font-display); line-height: 1.1; }
.stat small { color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--muted); font-weight: 560; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip i { font-style: normal; font-size: 12px; opacity: .75; }

.shares { display: flex; flex-direction: column; gap: 10px; }
.share {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 12px 14px 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); transition: border-color .14s, box-shadow .14s;
}
.share:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.share.off { opacity: .62; }
.share-ic {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; overflow: hidden; position: relative;
  background: color-mix(in srgb, var(--kc) 13%, transparent); color: var(--kc);
}
.share-ic .ic { width: 24px; height: 24px; }
.share-ic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.share-ic.has-img img { opacity: 1; }
.share-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.share-name { font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-name:hover { color: var(--accent); }
.share-path { color: var(--faint); font-size: 13px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.share-path bdi { direction: ltr; unicode-bidi: isolate; }
.share-meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share .badges { margin-top: 4px; }
.share-nums { display: flex; gap: 14px; color: var(--muted); font-size: 13.5px; }
.share-nums span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.share-nums .ic { width: 16px; height: 16px; color: var(--faint); }
.share-act { display: flex; align-items: center; gap: 2px; }
.share-act .switch { margin-left: 8px; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; background: var(--panel-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.nowrap { white-space: nowrap; }
.table td .faint { font-size: 13px; }
.kind { display: inline-flex; align-items: center; gap: 6px; font-weight: 580; white-space: nowrap; }
.kind .ic { width: 16px; height: 16px; }
.kind.download { color: var(--ok); }
.kind.zip { color: var(--k-archive); }
.kind.open { color: var(--muted); }

.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.set-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.set-card h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.set-card h2 .ic { color: var(--accent); }
.set-card .toggle-row:first-of-type { border-top: 0; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 99px; border: 0;
  background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.status-pill.paused { background: var(--warn-soft); color: var(--warn); }
.status-pill.off { background: var(--danger-soft); color: var(--danger); }
.status-pill.local { background: var(--soft); color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--soft); font-weight: 560; }
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.status-line.ok { background: var(--ok-soft); color: var(--ok); } .status-line.ok .dot { background: var(--ok); }
.status-line.warn { background: var(--warn-soft); color: var(--warn); } .status-line.warn .dot { background: var(--warn); }
.status-line.bad { background: var(--danger-soft); color: var(--danger); } .status-line.bad .dot { background: var(--danger); }
.status-line small { display: block; font-weight: 400; opacity: .85; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none;
  background: linear-gradient(135deg, #7c5cff, #3b82f6); }
tr.blocked td { opacity: .55; }
.receiver { margin-bottom: 18px; }
.upload-zone {
  border: 2px dashed var(--accent-line); border-radius: var(--r-lg); background: var(--accent-soft); padding: 26px 18px; text-align: center;
  color: var(--accent); cursor: pointer; transition: background .15s, border-color .15s; outline: none;
}
.upload-zone:hover, .upload-zone:focus-visible { border-color: var(--accent); }
.upload-zone.drag { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.upload-zone b { display: block; font-size: 16px; margin-top: 8px; color: var(--text); }
.upload-zone small { display: block; color: var(--muted); margin-top: 2px; }
.upload-zone .uz-hint { margin-top: 6px; font-size: 13px; }
.uz-ic {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7c5cff, #3b82f6); box-shadow: 0 10px 24px -10px rgba(106, 92, 255, .7);
}
.uz-ic .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.up-card .upload-zone { padding: 46px 18px; }
.picker-more { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.picker-more small { font-size: 13px; }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-touch { display: inline; }
  .only-mouse { display: none !important; }
}
.up-card { padding: 18px; }
.up-opts { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.up-opts .lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.up-opts .lbl .ic { width: 18px; height: 18px; color: var(--muted); }
.up-opts > small { flex-basis: 100%; font-size: 13px; }
.up-hours { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.up-hours::-webkit-scrollbar { display: none; }
.uploads { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; text-align: left; }
.uploads:empty { display: none; }
.up-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px;
}
.up-item .bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.up-item .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.up-item.done .bar i { background: var(--ok); }
.up-item.fail { color: var(--danger); }
.up-item.fail .bar i { background: var(--danger); }
.link-box { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.link-row { display: flex; align-items: center; gap: 6px; }
.link-row .input { flex: 1; min-width: 0; height: 36px; font-size: 14px; background: var(--soft); }
.link-label { flex: none; min-width: 66px; font-size: 13px; font-weight: 600; color: var(--muted); }
.link-actions { display: flex; align-items: center; gap: 6px; }
.qr-seg { display: flex; justify-content: center; margin-bottom: 12px; }
.qr-seg:empty { display: none; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Меню правой кнопки и выделение рамкой */
.ctx {
  position: fixed; z-index: 300; min-width: 230px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: ctx-in .12s ease;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; white-space: nowrap;
}
.ctx-item .ic { width: 17px; height: 17px; color: var(--muted); flex: none; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); outline: none; }
.ctx-item.danger, .ctx-item.danger .ic { color: var(--danger); }
.ctx-item:disabled { opacity: .45; cursor: default; background: transparent; }
.ctx-sep { height: 1px; margin: 5px 6px; background: var(--line); }
.ctx-title { padding: 6px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
@keyframes ctx-in { from { opacity: 0; transform: scale(.97); } }
.marquee {
  position: absolute; z-index: 150; pointer-events: none; border-radius: 3px;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
body.marqueeing { user-select: none; }
.ex-body { min-height: 220px; }
.remember { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; cursor: pointer; text-align: left; user-select: none; }
.remember input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.remember small { font-size: 12.5px; }
.tab-n { font-style: normal; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--soft); color: var(--muted); }
.tab.active .tab-n { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.small-note { font-size: 13px; margin-top: 14px; text-align: center; }

/* ---------- Тосты */
#toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 560; font-size: 14px; animation: toast-in .2s ease; max-width: calc(100vw - 32px);
}
.toast .ic { width: 18px; height: 18px; color: #3ccf7d; }
.toast.err .ic { color: #ff6b70; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Цвета типов файлов */
.k-folder { --kc: var(--k-folder); } .k-image { --kc: var(--k-image); } .k-rawimage { --kc: var(--k-rawimage); }
.k-video { --kc: var(--k-video); } .k-audio { --kc: var(--k-audio); } .k-pdf { --kc: var(--k-pdf); }
.k-code { --kc: var(--k-code); } .k-text { --kc: var(--k-text); } .k-archive { --kc: var(--k-archive); }
.k-doc { --kc: var(--k-doc); } .k-sheet { --kc: var(--k-sheet); } .k-slides { --kc: var(--k-slides); }
.k-app { --kc: var(--k-app); } .k-font { --kc: var(--k-font); } .k-file { --kc: var(--k-file); }

/* ---------- Адаптив */
@media (max-width: 1000px) {
  .filepage { grid-template-columns: 1fr; }
  .fp-side { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .share-nums { display: none; }
}
@media (max-width: 720px) {
  .topbar-in { padding: 8px 16px; flex-wrap: wrap; gap: 8px; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab span { display: inline; }
  .wrap { padding: 16px 16px 40px; }
  .ex-bar { top: 0; position: static; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .lrow { grid-template-columns: 30px 40px minmax(0, 1fr) 40px; }
  .lrow .l-size, .lrow .l-date { display: none; }
  .ex-title h1, .page-head h1 { font-size: 22px; }
  .search { max-width: none; }
  .share { grid-template-columns: 42px minmax(0, 1fr); }
  .share-act { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
  .pv-stage { padding: 0 8px 12px; }
  .fp-preview { min-height: 200px; }
  .ex-head .ex-actions { width: 100%; }
  .ex-head .ex-actions .btn-primary { flex: 1; }
  .pv-nav { display: none; }
  .settings { grid-template-columns: 1fr; }
  .tile-check { opacity: 1; }
  .home-tabs .tab { flex: 1; justify-content: center; padding: 8px 6px; }
  .selbar { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 10px; width: calc(100vw - 24px); }
  .selbar .sel-txt { width: 100%; text-align: center; }
  .hide-sm { display: none; }
  .hero { margin: 4px 0 16px; }
  .hero h1 { font-size: 24px; }
  .up-card { padding: 12px; }
  .up-card .upload-zone { padding: 34px 14px; }
  .picker-more .btn { width: 100%; height: 46px; }
  .picker-more small { width: 100%; text-align: center; }
  .link-actions .btn { flex: 1; }
  .link-label { min-width: 0; }
}
@media (hover: none) {
  .tile-check { opacity: 1; }
}
@media (max-width: 440px) {
  .home-tabs .tab { gap: 5px; padding: 8px 4px; font-size: 14px; }
  .home-tabs .tab .ic { display: none; }
}
