/* ============ FileBox: темы и базовые элементы ============ */
:root {
  --bg: #f2f4fa;
  --surface: #ffffff;
  --surface2: #f4f6fb;
  --text: #17203a;
  --muted: #69758f;
  --border: #e2e7f1;
  --accent: #5b6cff;
  --accent-2: #a45bff;
  --danger: #e5484d;
  --ok: #2fb344;
  --grad: linear-gradient(135deg, #5b6cff, #a45bff);
  --shadow: 0 10px 30px rgba(23, 32, 58, .08);
  --r: 14px;
}
html[data-theme="dark"] {
  --bg: #0b0e15;
  --surface: #141826;
  --surface2: #1c2233;
  --text: #e9edf8;
  --muted: #8d97b0;
  --border: #262e44;
  --accent: #7d8bff;
  --accent-2: #b07dff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  transition: background .3s, color .3s;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .85rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .2s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; border: none; }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; border: none; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 9px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; font-size: 1.05rem;
  padding: 8px; border-radius: 10px; transition: background .2s;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface2); }

.input, textarea.input, select.input {
  width: 100%; padding: 10px 13px; font-size: .95rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.input.err { border-color: var(--danger); }
label.fld { display: block; margin: 14px 0 6px; font-size: .86rem; font-weight: 600; color: var(--muted); }
.hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand-badge {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); font-size: 1.1rem; box-shadow: var(--shadow);
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.userchip { display: flex; align-items: center; gap: 8px; margin-left: 6px; font-weight: 600; font-size: .9rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar-letters {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}

.container { max-width: 1100px; margin: 0 auto; padding: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 18px;
}
.card + .card { margin-top: 16px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: .95rem; }
.crumbs a { color: var(--muted); font-weight: 600; padding: 4px 7px; border-radius: 8px; }
.crumbs a:hover { background: var(--surface2); color: var(--text); }
.crumbs .sep { color: var(--muted); }

.dropzone {
  border: 2px dashed transparent; border-radius: var(--r);
  transition: border-color .2s, background .2s; padding: 6px;
}
.dropzone.dragover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px; cursor: pointer; position: relative;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.item .ico { font-size: 2.1rem; }
.item .name {
  font-weight: 600; font-size: .9rem; margin-top: 8px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word;
}
.item .meta { color: var(--muted); font-size: .75rem; margin-top: 4px; }
.item .acts {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 2px;
  opacity: 0; transition: opacity .15s; background: var(--surface);
  border-radius: 9px; padding: 2px; box-shadow: var(--shadow);
}
.item:hover .acts { opacity: 1; }
.acts .icon-btn { padding: 5px; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: .95rem; }

/* выделение элементов (чекбоксы) */
.item.selected {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.item-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }

.upload-panel {
  position: fixed; right: 20px; bottom: 20px; width: 330px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.upload-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; background: var(--surface2); font-weight: 700; font-size: .88rem;
}
.upload-item { padding: 10px 14px; border-top: 1px solid var(--border); font-size: .83rem; }
.upload-item .nm { display: flex; justify-content: space-between; gap: 8px; }
.pbar { height: 6px; border-radius: 4px; background: var(--surface2); overflow: hidden; margin-top: 7px; }
.pbar > div { height: 100%; width: 0%; background: var(--grad); border-radius: 4px; transition: width .15s; }
.pbar.done > div { background: var(--ok); }
.pbar.fail > div { background: var(--danger); width: 100%; }

.modal-back {
  position: fixed; inset: 0; background: rgba(8, 10, 20, .55);
  backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-back.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: min(94vw, 620px); max-height: 88vh; overflow: auto;
  box-shadow: 0 25px 70px rgba(0, 0, 0, .35);
  transform: translateY(8px) scale(.98); transition: transform .2s;
}
.modal-back.show .modal { transform: none; }
.modal.wide { width: min(96vw, 980px); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.preview-body { display: grid; place-items: center; background: var(--surface2); border-radius: 0 0 16px 16px; min-height: 120px; }
.preview-body img { max-width: 100%; max-height: 72vh; }
.preview-body video { max-width: 100%; max-height: 72vh; }
.preview-body iframe { width: 100%; height: 75vh; border: 0; }
.preview-body pre {
  max-height: 72vh; overflow: auto; margin: 0; padding: 18px; width: 100%;
  font-size: .83rem; white-space: pre-wrap; word-break: break-word;
}

.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: .88rem; max-width: 340px; animation: slidein .25s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; }
.tbl td { padding: 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.tbl tr.clickable:hover td { background: var(--surface2); cursor: pointer; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.badge.admin { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat { padding: 20px; }
.stat .num { font-size: 1.9rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: .85rem; margin-top: 4px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.tab { padding: 9px 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.tab.active { background: var(--grad); color: #fff; border-color: transparent; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(94vw, 400px); padding: 34px 30px; text-align: center; position: relative; }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; font-size: 1.9rem; margin: 0 auto 14px; box-shadow: var(--shadow); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.avatar-big { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); }
.avatar-wrap { position: relative; width: 92px; cursor: pointer; }
.avatar-hint { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-size: 1.3rem; opacity: 0; transition: opacity .2s; }
.avatar-wrap:hover .avatar-hint { opacity: 1; }
.usage-bar { height: 12px; border-radius: 7px; background: var(--surface2); overflow: hidden; margin-top: 8px; }
.usage-bar > div { height: 100%; background: var(--grad); border-radius: 7px; }

.share-msg { background: var(--grad); color: #fff; padding: 18px 22px; border-radius: var(--r); font-size: 1.02rem; margin-bottom: 18px; box-shadow: var(--shadow); }
.filelist-row { display: flex; align-items: center; gap: 10px; padding: 11px 6px; border-top: 1px solid var(--border); font-size: .92rem; }
.filelist-row:first-child { border-top: none; }
.filelist-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .row2 { grid-template-columns: 1fr; } }
.pwd-reveal { font-size: 1.15rem; padding: 10px 14px; background: var(--surface2); border-radius: 10px; display: inline-block; margin-top: 8px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
