:root {
  --bg: #f4f4f5; --panel: #ffffff; --line: #e6e6e8; --line2: #efeff1;
  --text: #26262a; --muted: #77777f; --accent: #8e1818; --accent-dark: #7a1414; --accent-soft: #f6ebeb;
  --ok: #3f8f4f; --warn: #c9822b; --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 18px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* вход */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px 26px; text-align: center; }
.login-card img { width: 64px; height: auto; }
.login-card h1 { margin: 14px 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.field { display: block; text-align: left; margin-bottom: 12px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(142,24,24,.12); }
.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn:hover { background: #fafafa; border-color: #d8d8dc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: #b3261e; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: #b3261e; font-size: 13.5px; min-height: 20px; margin: 4px 0 8px; }

/* каркас */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; text-decoration: none; color: var(--text); }
.brand img { height: 30px; width: auto; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 999px; background: #f7f7f8; outline: none; }
.search input:focus { background: #fff; border-color: var(--accent); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.spacer { flex: 1; }
.pc { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #bbb; display: inline-block; }
.dot.on { background: var(--ok); } .dot.off { background: #c0392b; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; z-index: 30; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 7px; text-decoration: none; color: var(--text); gap: 8px; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--accent-soft); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line2); margin: 5px 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 18px 90px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 14.5px; margin-bottom: 10px; }
.crumbs button { border: 0; background: none; padding: 4px 7px; border-radius: 6px; color: var(--muted); }
.crumbs button:hover { background: #ececee; color: var(--text); }
.crumbs button.cur { color: var(--text); font-weight: 600; }
.crumbs .sep { color: #bbb; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 10px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.sel-bar { background: var(--accent-soft); border: 1px solid #ead2d2; border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.files { width: 100%; border-collapse: collapse; }
table.files th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
table.files td { padding: 8px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.files tr:last-child td { border-bottom: 0; }
table.files tbody tr:hover { background: #fbfafa; }
table.files tr.sel { background: var(--accent-soft); }
.chk { width: 18px; height: 18px; accent-color: var(--accent); }
.nm { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.nm span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm .sub { color: var(--muted); font-size: 12.5px; }
.ico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 7px; background: #f0f0f2; color: #666; font-size: 11px; font-weight: 700; }
.ico.dir { background: #f3e3e3; color: var(--accent); }
.ico.img { background: #e9f1ea; color: #3f7a4a; } .ico.vid { background: #efe9f5; color: #6b4a96; } .ico.doc { background: #e8eef7; color: #3a5f9a; } .ico.aud { background: #f6efe2; color: #9a6a1f; }
.ico svg { width: 17px; height: 17px; }
td.num, th.num { text-align: right; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
td.act { width: 40px; text-align: right; }
.kebab { border: 0; background: none; padding: 4px 8px; border-radius: 6px; color: var(--muted); font-size: 18px; line-height: 1; }
.kebab:hover { background: #ececee; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 12px; }
.tile { border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; position: relative; }
.tile:hover { border-color: #d9c4c4; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.tile.sel { outline: 2px solid var(--accent); }
.tile .pic { aspect-ratio: 4/3; background: #f3f3f5; display: grid; place-items: center; overflow: hidden; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.tile .pic .ico { width: 46px; height: 46px; font-size: 14px; border-radius: 12px; }
.tile .pic .ico svg { width: 24px; height: 24px; }
.tile .cap { padding: 8px 10px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tchk { position: absolute; left: 7px; top: 7px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.drop { position: fixed; inset: 0; background: rgba(142,24,24,.12); border: 3px dashed var(--accent); z-index: 80; display: grid; place-items: center; font-size: 22px; color: var(--accent); font-weight: 600; pointer-events: none; }
.banner { background: #fff6e8; border: 1px solid #f0d9ae; color: #7a5410; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }

/* окна */
.modal-bg { position: fixed; inset: 0; background: rgba(20,12,12,.45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; }
.modal.wide { max-width: 760px; }
.modal h3 { margin: 0; padding: 18px 20px 6px; font-size: 18px; }
.modal .body { padding: 8px 20px 4px; }
.modal .foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .note { color: var(--muted); font-size: 13.5px; margin: 6px 0 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td, .tbl th { padding: 8px 6px; border-bottom: 1px solid var(--line2); text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8f8f9; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pill { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13.5px; }
.pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* просмотр */
.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(14,10,10,.94); display: flex; flex-direction: column; color: #fff; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(0,0,0,.35); }
.viewer header .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.viewer .btn:hover { background: rgba(255,255,255,.2); }
.viewer .stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; padding: 8px; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100%; object-fit: contain; background: #000; }
.viewer .stage iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.viewer .stage audio { width: min(560px, 90%); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 26px; }
.viewer .nav:hover { background: rgba(255,255,255,.25); }
.viewer .nav.l { left: 10px; } .viewer .nav.r { right: 10px; }
.viewer textarea { width: min(960px, 100%); height: 100%; background: #1c1717; color: #eee; border: 1px solid #3a3030; border-radius: 8px; padding: 12px; font: 14px/1.5 ui-monospace, Consolas, monospace; resize: none; }
.vbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(0,0,0,.45); flex-wrap: wrap; }
.vbar input[type=range] { flex: 1; min-width: 120px; accent-color: #d45c5c; }
.vbar .time { font-variant-numeric: tabular-nums; font-size: 13.5px; min-width: 110px; text-align: center; }
.vbar select { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 8px; padding: 6px 8px; }
.vbar select option { color: #000; }
.vmsg { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,.65); padding: 12px 18px; border-radius: 10px; text-align: center; max-width: 80%; }
.vnote { font-size: 12.5px; color: #cfc4c4; padding: 0 14px 10px; background: rgba(0,0,0,.45); }

/* загрузки */
.uploads { position: fixed; right: 16px; bottom: 16px; width: 340px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 50; overflow: hidden; }
.uploads header { padding: 10px 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line2); }
.uploads .list { max-height: 220px; overflow: auto; }
.up { padding: 8px 14px; font-size: 13.5px; }
.up .bar { height: 5px; background: #eee; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.up .bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.up.done .bar i { background: var(--ok); } .up.fail .bar i { background: #c0392b; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #2d2626; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 90; font-size: 14px; max-width: 90vw; }
.toast.err { background: #a52a2a; }

@media (max-width: 720px) {
  .top { padding: 8px 10px; gap: 8px; } .brand span { display: none; } .pc span.txt { display: none; }
  .wrap { padding: 10px 8px 90px; }
  table.files .hide-s { display: none; }
  .toolbar .btn .lbl { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 8px; }
}
#app { min-height: 100%; }
table.files th.num { text-align: right; }
a.btn { text-decoration: none; color: var(--text); }
a.btn.primary { color: #fff; }
.dragging { opacity: .45; }
.dropt { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }
.crumbs button.dropt { border-radius: 6px; }

/* ───── новая раскладка: левое меню + содержимое ───── */
.layout { display: flex; min-height: calc(100vh - 54px); }
.side { width: 250px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 12px 10px 14px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 54px; height: calc(100vh - 54px); overflow-y: auto; }
.side .grow { flex: 1; min-height: 12px; }
.sitem { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--text); text-decoration: none; cursor: pointer; font-size: 14.5px; user-select: none; }
.sitem:hover { background: #f4f1f1; }
.sitem.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sitem .i { width: 19px; height: 19px; flex: none; }
.sitem.sub { padding-left: 42px; font-size: 14px; }
.sitem.sub.add { color: var(--muted); }
.sitem.sub.muted { color: var(--muted); cursor: default; }
.sitem .cnt { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.sitem .chev { margin-left: auto; display: grid; place-items: center; transition: transform .15s; }
.sitem .chev .i { width: 15px; height: 15px; }
.sitem .chev.open { transform: rotate(90deg); }
.tagdot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.usage { padding: 8px 12px 10px; border-top: 1px solid var(--line2); margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.usage .ul { margin-top: 8px; color: var(--text); font-size: 13px; }
.usage .bar { height: 5px; background: #ececee; border-radius: 3px; overflow: hidden; margin: 5px 0 3px; }
.usage .bar i { display: block; height: 100%; background: var(--accent); }
.usage .us { font-size: 12.5px; }
.content { flex: 1; min-width: 0; padding: 14px 20px 90px; max-width: 1280px; }
.burger { display: none; border: 0; background: none; font-size: 22px; padding: 4px 8px; }
.side-bg { display: none; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; margin-bottom: 8px; }
.head .hleft { flex: 1; min-width: 0; }
.head .hright { display: flex; align-items: center; gap: 8px; }
.head .htitle { font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.head .crumbs { margin: 0; }
.head.selmode { background: var(--accent-soft); border: 1px solid #ead2d2; border-radius: 10px; padding: 0 12px; }
.selinfo { display: flex; align-items: center; gap: 10px; }
.selacts { display: flex; gap: 8px; flex-wrap: wrap; }
.selacts .btn .i { width: 15px; height: 15px; }
.btn.danger-fill { background: #b3261e; border-color: #b3261e; color: #fff; }
table.files th.cb, table.files td.cb { width: 40px; padding-right: 0; }
.nm .favmark { color: #d9a21b; display: inline-grid; margin-left: 2px; }
.nm .favmark .i { width: 14px; height: 14px; }
.chip { font-size: 11.5px; color: #fff; padding: 1px 8px; border-radius: 999px; white-space: nowrap; margin-left: 4px; }
.ico.ext { background: #e6eef7; color: #2f6fb3; }
.ico.ext svg { width: 17px; height: 17px; }
.tile .tfav { position: absolute; right: 8px; top: 8px; color: #d9a21b; }
.tile .tfav .i { width: 15px; height: 15px; }
.tile .tkeb { position: absolute; right: 4px; bottom: 30px; background: rgba(255,255,255,.85); }
.menu-pop button .i, .menu-pop a .i { width: 16px; height: 16px; }
.menu-pop button.danger { color: #b3261e; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--line2); border-radius: 9px; margin-bottom: 6px; cursor: pointer; }
.setrow small { display: block; color: var(--muted); font-size: 12px; }
.settings h4 { margin: 14px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
input.switch { appearance: none; width: 38px; height: 22px; background: #cfcfd4; border-radius: 999px; position: relative; cursor: pointer; flex: none; transition: background .15s; }
input.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { left: 19px; }
.tagrow { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line2); }
.tagrow span:nth-of-type(2) { flex: 1; }
.swatches { display: flex; gap: 8px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; }
.sw.on { border-color: #222; box-shadow: 0 0 0 2px #fff inset; }
.details td.k, .keys td.k { color: var(--muted); width: 38%; white-space: nowrap; }
kbd { background: #f1f1f3; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 7px; font: 12.5px ui-monospace, Consolas, monospace; }
.menu-pop.ctx { z-index: 95; }
.crumbs button.dropt, .sitem.dropt { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }

@media (max-width: 900px) {
  .burger { display: inline-block; }
  .side { position: fixed; left: 0; top: 54px; bottom: 0; height: auto; z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); width: 270px; }
  .side.open { transform: none; }
  .side.open ~ .side-bg, .layout:has(.side.open) ~ .side-bg { display: block; position: fixed; inset: 54px 0 0 0; background: rgba(0,0,0,.3); z-index: 35; }
  .content { padding: 10px 8px 90px; }
  .head .btn .lbl { display: none; }
}
.menu-pop button, .menu-pop a { white-space: nowrap; }
.menu-pop { min-width: 250px; }
