:root {
  --bg: #f5f5f7; --card: #fff; --text: #1d1d1f; --mute: #86868b; --line: #e5e5ea;
  --accent: #0a84ff; --ok: #30a46c; --bad: #e5484d; --soft: #f0f4ff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f5f5f7; --mute: #8e8e93; --line: #2c2c2e; --soft: #0a1a33; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
main { max-width: 560px; margin: 0 auto; padding: 48px 20px; }
main.wide { max-width: 820px; }
h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.02em; }
.sub { color: var(--mute); margin: 0 0 28px; }
.card { background: var(--card); border-radius: 18px; padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 200px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; text-align: center;
  padding: 24px; transition: .15s; color: var(--mute); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft); color: var(--text); }
.drop svg { width: 40px; height: 40px; color: var(--accent); }
.drop b { color: var(--text); font-size: 18px; font-weight: 600; }
.btn { appearance: none; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600;
  background: var(--accent); color: #fff; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); padding: 8px 12px; }
.btn:disabled { opacity: .5; }
ul.files { list-style: none; margin: 0; padding: 0; }
ul.files li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
ul.files li:first-child { border-top: 0; }
.ico { flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--soft); color: var(--accent);
  display: grid; place-items: center; font-size: 17px; }
.meta { flex: 1; min-width: 0; }
.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.name a { color: inherit; text-decoration: none; }
.small { color: var(--mute); font-size: 13px; }
.bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.ok .bar i { background: var(--ok); } .err .small { color: var(--bad); }
.acts { display: flex; gap: 2px; opacity: .55; } li:hover .acts { opacity: 1; }
.acts button, .acts a { border: 0; background: none; color: var(--mute); cursor: pointer; padding: 6px 8px;
  border-radius: 8px; font-size: 16px; text-decoration: none; }
.acts button:hover, .acts a:hover { background: var(--line); color: var(--text); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs { color: var(--mute); font-size: 15px; } .crumbs a { color: var(--accent); text-decoration: none; }
.empty { padding: 36px; text-align: center; color: var(--mute); }
.space { margin-top: 14px; }
input.pw { width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); margin: 0 0 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; }
.toast.on { opacity: .92; }
foot, .foot { display: block; text-align: center; color: var(--mute); font-size: 13px; margin-top: 22px; }
.ok .ico { color: var(--ok); }
.btn span svg, .acts svg { vertical-align: -4px; }
.btn.ghost span svg { width: 18px; height: 18px; }
@media (max-width: 600px) { .top > div:last-child { width: 100%; display: flex; gap: 4px; align-items: center; }
  .top > div:last-child .btn:last-child { margin-left: auto; } .wide-only { display: none; } main { padding-top: 32px; } }
.btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 600px) { .btn.ghost { padding: 8px 6px; } .btn { padding: 10px 16px; } }
[hidden] { display: none !important; }
/* миниатюры и просмотр */
.ico.th { background: none; overflow: hidden; } .ico.th img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.viewer { position: fixed; inset: 0; z-index: 50; background: #0b0b0c; color: #f5f5f7; display: flex; flex-direction: column; }
.vbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.vname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.vcount { color: #8e8e93; font-size: 14px; white-space: nowrap; }
.vbtn { border: 0; background: rgba(255,255,255,.1); color: #fff; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.vbody { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 8px 12px 24px; -webkit-overflow-scrolling: touch; }
.v-image, .v-video { justify-content: center; padding: 0; }
.v-image img, .v-video video { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-audio { justify-content: center; gap: 24px; } .v-audio audio { width: min(520px, 92%); } .vnote { color: #0a84ff; }
.vpage { background: #fff; margin: 0 0 12px; box-shadow: 0 2px 12px rgba(0,0,0,.5); max-width: 100%; height: auto; }
.v-docx, .v-sheet, .v-text { align-items: stretch; }
.vdoc { background: #fff; color: #000; border-radius: 6px; overflow: auto; }
.vdoc .docx-wrapper { background: #e5e5ea; padding: 12px; } .vdoc .docx-wrapper > section.docx { max-width: 100%; }
.vtabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 8px; flex: none; }
.vtabs button { border: 0; border-radius: 999px; padding: 6px 14px; background: rgba(255,255,255,.1); color: #fff; font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; }
.vtabs button.on { background: #0a84ff; }
.vsheet { background: #fff; color: #000; border-radius: 8px; overflow: auto; flex: 1; }
.vsheet table { border-collapse: collapse; font-size: 14px; } .vsheet td { border: 1px solid #d1d1d6; padding: 4px 8px; white-space: nowrap; }
.vsheet tr:first-child td { background: #f2f2f7; font-weight: 600; position: sticky; top: 0; }
.vtext { background: #1c1c1e; color: #f5f5f7; border-radius: 10px; padding: 16px; margin: 0; white-space: pre-wrap; word-break: break-word; font: 14px/1.5 ui-monospace, Menlo, monospace; }
.vmsg { margin: auto; text-align: center; color: #c7c7cc; max-width: 420px; line-height: 1.5; } .vmsg .btn { margin-top: 14px; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.vprev { left: 12px; } .vnext { right: 12px; }
@media (max-width: 600px) { .vnav { display: none !important; } }
/* окно «Поделиться» */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mcard { background: var(--card); color: var(--text); border-radius: 18px; width: min(460px, 100%); max-height: 92vh; overflow: auto; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mhead b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbtn.light { background: var(--soft); color: var(--accent); width: 36px; height: 36px; font-size: 16px; }
.mlabel { color: var(--mute); font-size: 13px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.opt input { margin-top: 4px; accent-color: var(--accent); } .opt b { display: block; font-weight: 600; } .opt small { color: var(--mute); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: none; color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.oldl { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.oldl > div { flex: 1; min-width: 0; } .oldl b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .oldl small { color: var(--mute); }
.badge { color: var(--accent); white-space: nowrap; } .badge svg { width: 13px; height: 13px; vertical-align: -2px; }
/* меню «Создать» */
.menu { position: absolute; z-index: 40; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 210px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--text); font: inherit; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--soft); } .menu svg { color: var(--accent); }
