/* Uploader — дизайн v2. Editorial/Swiss, но с глубиной и единой типографикой.
   Один шрифт везде (без mono-разнобоя), SVG-иконки, чипы, тактильные ховеры,
   понятные кнопки с подписями, полноценная мобильная вёрстка. */

:root {
  --bg: #ffffff;
  --surface: #f6f5f1;
  --surface-2: #eeece5;
  --ink: #15120d;
  --muted: #6c665d;
  --faint: #a09a90;
  --line: #e7e3da;
  --line-2: #d9d4c9;
  --ink-line: #15120d;
  --accent: #e5341a;
  --accent-ink: #ffffff;
  --accent-wash: #fdecea;
  --ok: #1f7a3d;
  --ok-wash: #e9f6ee;
  --font: -apple-system, "Helvetica Neue", Helvetica, Arial, "Segoe UI", Roboto, system-ui, sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 10, .06);
  --shadow: 0 6px 22px rgba(20, 16, 10, .09);
  --shadow-lg: 0 18px 50px rgba(20, 16, 10, .22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* иконки */
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.18em; }

/* раскладка */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); }

/* ---------- Топбар ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -0.04em; }
.logo .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.logo .mark .ic { width: 17px; height: 17px; }
.logo .tail { color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 6px; }
.topnav .who { font-size: 13px; color: var(--muted); margin-right: 6px; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav .who b { color: var(--ink); font-weight: 600; }
.navbtn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; }
.navbtn:hover { background: var(--surface); color: var(--ink); }
.navbtn.accent { color: var(--accent); }
.inline { display: inline; margin: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: var(--ink); color: #fff; border: 1px solid var(--ink);
  padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-sm); transition: transform .06s, background .14s, border-color .14s, color .14s; min-height: 42px;
}
.btn:hover { background: #2a241c; }
.btn:active { transform: translateY(1px); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: #c92c14; }
.btn.secondary { background: var(--bg); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--ink); background: var(--surface); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn .ic { width: 18px; height: 18px; }

/* действие-кнопка в строках: иконка + подпись */
.action { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 1px solid transparent; cursor: pointer; min-height: 38px; }
.action:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.action.danger:hover { background: var(--accent-wash); color: var(--accent); border-color: var(--accent-wash); }
.action .ic { width: 17px; height: 17px; }

/* ---------- Поля ---------- */
.field { display: block; margin: 16px 0; }
.field > span { display: block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 15px; font-family: inherit; min-height: 44px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; }
.check input { width: auto; min-height: 0; }

.alert { display: flex; gap: 9px; align-items: center; padding: 11px 14px; border-radius: var(--r-sm); font-size: 14px; margin: 14px 0; border: 1px solid; }
.alert.error { border-color: #f1b8af; background: var(--accent-wash); color: #a3260f; }
.alert.ok { border-color: #b4dcc1; background: var(--ok-wash); color: var(--ok); }

/* ---------- Карточка входа ---------- */
.card { width: 100%; max-width: 380px; }
.card .logo { font-size: 24px; margin-bottom: 18px; }
.card .lead { margin: 0 0 22px; }

/* ---------- Секции ---------- */
.section { margin: 34px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head .title { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 22px; font-weight: 800; }
.section-head .count { font-size: 13px; font-weight: 700; color: var(--faint); }
.divider { height: 2px; background: var(--ink-line); margin-bottom: 6px; }

/* ---------- Хлебные крошки ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 22px 0 6px; font-size: 14px; }
.crumbs a, .crumbs .here { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: var(--r-sm); color: var(--muted); }
.crumbs a:hover { background: var(--surface); color: var(--ink); }
.crumbs .here { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--faint); display: inline-flex; }
.crumbs .sep .ic { width: 16px; height: 16px; }
.crumbs .from { margin-left: 6px; font-size: 13px; color: var(--faint); }

/* ---------- Тулбар / загрузка ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.usage { font-size: 13px; color: var(--muted); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 30px 20px; margin-top: 16px;
  color: var(--muted); background: var(--surface); cursor: pointer; transition: border-color .14s, background .14s, color .14s;
}
.dropzone:hover { border-color: var(--ink); color: var(--ink); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
.dropzone .ic { width: 30px; height: 30px; }
.dropzone b { color: var(--ink); }
.dropzone .hint { font-size: 12.5px; color: var(--faint); }

.uplist { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.up { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px; background: var(--bg); box-shadow: var(--shadow-sm); }
.up-top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.up-cancel { display: inline-flex; padding: 4px; border-radius: 6px; border: 0; background: none; color: var(--faint); cursor: pointer; }
.up-cancel:hover { background: var(--accent-wash); color: var(--accent); }
.up-cancel .ic { width: 16px; height: 16px; }
.bar { height: 4px; background: var(--surface-2); border-radius: 99px; margin-top: 9px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
.up.done .bar > i { background: var(--ok); }
.up.err .bar > i { background: var(--accent); }
.up.err .up-pct, .up.retry .up-pct { color: var(--accent); }

/* ---------- Строки папок/файлов ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 10px; border-radius: var(--r-sm); border-bottom: 1px solid var(--line); transition: background .12s; }
.row:hover { background: var(--surface); }
.row:last-child { border-bottom: 0; }
.chip { width: 44px; height: 44px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); }
.row:hover .chip { background: #fff; }
.chip .ic { width: 22px; height: 22px; }
.chip.folder { background: var(--ink); color: #fff; }
.chip.image { color: #2563eb; } .chip.video { color: #7c3aed; }
.chip.audio { color: #c026d3; } .chip.pdf, .chip.text { color: var(--accent); }
.r-main { min-width: 0; }
.r-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
a.r-name:hover { color: var(--accent); }
.r-meta { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.r-meta .pill { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.r-meta .pill .ic { width: 14px; height: 14px; }
.r-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.access-panel { grid-column: 1 / -1; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 40px 20px; color: var(--faint); border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface); }
.empty .ic { width: 26px; height: 26px; }

/* ---------- Панель доступа ---------- */
.access-panel { margin-top: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ablock { margin-bottom: 16px; }
.ablock:last-child { margin-bottom: 0; }
.ablock h4 { margin: 0 0 9px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.share-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.share-form .field { margin: 0; }
.share-form .field > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.share-form input, .share-form select { min-height: 40px; padding: 8px 10px; font-size: 13.5px; }
.arow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.arow:last-child { border-bottom: 0; }
.arow .url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
.arow .who { flex: 1; display: inline-flex; align-items: center; gap: 7px; }
.arow .ameta { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; flex: none; }
.arow .ameta .ic { width: 14px; height: 14px; }
.inline-add { display: flex; gap: 8px; }
.inline-add input { flex: 1; }

/* ---------- Инлайн-создание/переименование ---------- */
.inline-edit { display: flex; gap: 8px; align-items: center; }
.inline-edit input { min-height: 40px; }

/* ---------- Админка ---------- */
.usertable { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.utrow { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.utrow:last-child { border-bottom: 0; }
.utrow:hover { background: var(--surface); }
.uinfo { min-width: 0; }
.uinfo .uname { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.uinfo .umeta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid; letter-spacing: .02em; }
.badge.adm { color: var(--accent); border-color: #f1b8af; background: var(--accent-wash); }
.badge.on { color: var(--ok); border-color: #b4dcc1; background: var(--ok-wash); }
.badge.off { color: var(--faint); border-color: var(--line-2); }
.uactions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; align-items: end; }

/* ---------- Публичная страница файла ---------- */
.share-wrap { max-width: 820px; margin: 0 auto; padding: 44px 24px; }
.filetitle { font-size: 30px; font-weight: 800; margin: 8px 0 4px; word-break: break-word; }
.stage { margin: 24px 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.stage img, .stage video { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }
.stage audio { display: block; width: 100%; padding: 24px; }
.stage iframe { display: block; width: 100%; height: 76vh; border: 0; background: #fff; }
.stage pre { margin: 0; padding: 18px; max-height: 62vh; overflow: auto; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Модальный предпросмотр ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 22px;
  background: rgba(18,14,9,.66); backdrop-filter: blur(3px); }
.modal.open { display: flex; }
.modal-box { background: var(--bg); border-radius: var(--r); width: 100%; max-width: 1040px; max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.modal-head .m-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .m-close { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.modal-head .m-close:hover { background: var(--surface); color: var(--accent); }
.modal-body { overflow: auto; background: var(--surface); }
.modal-body img, .modal-body video { display: block; max-width: 100%; max-height: 82vh; margin: 0 auto; }
.modal-body audio { display: block; width: 100%; padding: 30px; }
.modal-body iframe { display: block; width: 100%; height: 82vh; border: 0; background: #fff; }
.modal-body pre { margin: 0; padding: 18px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.modal-body .m-note { padding: 48px; text-align: center; color: var(--muted); }

/* ---------- Диалог подтверждения ---------- */
.dialog-box { background: var(--bg); border-radius: var(--r); width: 100%; max-width: 420px; padding: 22px; box-shadow: var(--shadow-lg); }
.dialog-box h3 { font-size: 18px; margin-bottom: 8px; }
.dialog-box p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Тосты ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 92vw; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink); color: #fff;
  box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: toastin .18s ease-out; }
.toast .ic { width: 18px; height: 18px; }
.toast.error { background: var(--accent); }
.toast.ok { background: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Мобильная вёрстка ---------- */
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 16px; }
  .topbar .wrap { height: 56px; }
  .topnav .who { display: none; }
  .navbtn span.t { display: none; }
  .navbtn { padding: 9px; }
  .share-form { grid-template-columns: 1fr 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .row { grid-template-columns: 40px 1fr; gap: 12px; }
  .chip { width: 40px; height: 40px; border-radius: 10px; }
  .r-actions { grid-column: 2 / -1; justify-content: flex-start; margin-top: 4px; }
  .utrow { grid-template-columns: 1fr; }
  .uactions { justify-content: flex-start; }
  .section-head h2 { font-size: 19px; }
  .filetitle { font-size: 24px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
}
@media (max-width: 420px) {
  .share-form { grid-template-columns: 1fr; }
  .action span.t { display: none; }
  .action { padding: 9px; min-width: 38px; justify-content: center; }
}
