:root {
    --bg: #0b0d17;
    --card: rgba(22, 25, 42, .78);
    --card2: rgba(30, 34, 56, .9);
    --line: rgba(255, 255, 255, .1);
    --line2: rgba(255, 255, 255, .18);
    --text: #eef0fb;
    --muted: #9aa0bd;
    --accent: #7c5cff;
    --accent2: #22d3ee;
    --ok: #34d399;
    --warn: #fbbf24;
    --bad: #f87171;
    --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.bg .b1 { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: radial-gradient(circle, var(--accent), transparent 65%); }
.bg .b2 { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -25vmax; background: radial-gradient(circle, var(--accent2), transparent 65%); opacity: .22; }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 13, 23, .78); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.35rem; letter-spacing: -.01em; }
.logo svg { width: 34px; height: 34px; }
.space { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.space-bar { width: 140px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.space-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .6s ease, background .3s; }
.space.full .space-bar i { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.acct { display: flex; align-items: center; gap: 8px; }
.who { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.who i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: rgba(251, 191, 36, .16); color: var(--warn); border: 1px solid rgba(251, 191, 36, .4); }

/* кнопки */
.btn { appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 11px;
    border: 1px solid var(--line2); background: rgba(255, 255, 255, .06); font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--text); transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); }
.btn:active { transform: translateY(1px); }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; box-shadow: 0 6px 20px rgba(124, 92, 255, .35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger:hover { background: rgba(248, 113, 113, .16); border-color: var(--bad); color: #ffd0d0; }
.btn.sm { height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 9px; }
.btn.wide { width: 100%; height: 44px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { appearance: none; border: 0; padding: 0; background: none; color: var(--accent2); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* вкладки */
.tabs { display: flex; gap: 6px; margin: 22px 0 16px; padding: 5px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { appearance: none; cursor: pointer; flex: 1 0 auto; border: 0; background: none; padding: 10px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.tabs button.active { color: #fff; background: linear-gradient(135deg, rgba(124, 92, 255, .9), rgba(91, 140, 255, .9)); }
.tabs b { font-size: .75rem; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 255, 255, .16); }
.tabs b:empty { display: none; }

.panel { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* зона загрузки */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 210px; padding: 28px 16px; text-align: center; cursor: pointer;
    border-radius: 20px; border: 2px dashed rgba(124, 92, 255, .55); background: linear-gradient(160deg, rgba(124, 92, 255, .1), rgba(34, 211, 238, .05)); transition: border-color .2s, background .2s, transform .2s; }
.drop svg { width: 54px; height: 54px; color: var(--accent2); margin-bottom: 6px; transition: transform .25s; }
.drop strong { font-size: 1.2rem; }
.drop span { color: var(--muted); }
.drop u { color: var(--accent2); text-underline-offset: 3px; }
.drop:hover, .drop.over { border-color: var(--accent2); background: linear-gradient(160deg, rgba(124, 92, 255, .18), rgba(34, 211, 238, .1)); }
.drop.over { transform: scale(1.01); }
.drop:hover svg, .drop.over svg { transform: translateY(-4px); }

.opts { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: flex-end; margin: 18px 0; }
.opt-t { font-size: .8rem; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { appearance: none; cursor: pointer; border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.seg-wide { display: flex; margin-bottom: 16px; }
.seg-wide button { flex: 1; }
.anon-note { flex: 1 1 100%; margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(34, 211, 238, .07); border: 1px solid rgba(34, 211, 238, .25); color: var(--muted); font-size: .9rem; }
.anon-note b { color: var(--text); }

/* очередь загрузок */
.queue { display: grid; gap: 8px; }
.q { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.q-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.q-info { grid-column: 1; font-size: .82rem; color: var(--muted); }
.q-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s linear; }
.q.done .q-bar i { background: var(--ok); }
.q.err .q-bar i { background: var(--bad); width: 100% !important; }
.q.err .q-info { color: var(--bad); }
.q.done .q-info { color: var(--ok); }
.q .btn { grid-row: 1 / 3; grid-column: 2; }

/* списки файлов */
.list { display: grid; gap: 8px; }
.f { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); transition: border-color .2s, background .2s; }
.f:hover { border-color: var(--line2); background: var(--card2); }
.f.new { animation: flash 1.4s ease; }
@keyframes flash { 0% { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(34, 211, 238, .25); } }
.f-ic { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: .7rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
    background: hsl(var(--h, 255) 60% 50% / .2); color: hsl(var(--h, 255) 90% 78%); border: 1px solid hsl(var(--h, 255) 70% 60% / .4); overflow: hidden; }
.f-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.f-meta { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .82rem; color: var(--muted); }
.f-meta .tag { padding: 1px 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); }
.f-meta .tag.pub { color: var(--accent2); border-color: rgba(34, 211, 238, .35); }
.f-meta .tag.up { color: var(--warn); border-color: rgba(251, 191, 36, .4); }
.left { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.left i { display: block; width: 54px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.left i::after { content: ""; display: block; height: 100%; width: var(--p, 100%); background: var(--ok); border-radius: inherit; }
.left.soon { color: var(--warn); }
.left.soon i::after { background: var(--warn); }
.left.last { color: var(--bad); }
.left.last i::after { background: var(--bad); }
.f-act { grid-row: 1 / 3; grid-column: 3; display: flex; gap: 6px; }
.empty { padding: 44px 16px; text-align: center; color: var(--muted); border-radius: var(--r); border: 1px dashed var(--line2); }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

/* админка */
.admin-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.admin-bar select { height: 38px; padding: 0 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line2); }
.admin-bar select option { background: #161a2c; }
.h3 { margin: 28px 0 10px; font-size: 1.05rem; }
.users { display: grid; gap: 6px; }
.u { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 9px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: .9rem; }
.u span { color: var(--muted); white-space: nowrap; }
.u b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* окно входа */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 12, .7); backdrop-filter: blur(6px); animation: fade .2s ease; }
.dialog { position: relative; width: 100%; max-width: 380px; padding: 24px; border-radius: 20px; background: #141729; border: 1px solid var(--line2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.dialog label { display: grid; gap: 6px; margin-bottom: 12px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.dialog input { height: 44px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .05); outline: none; font-size: 1rem; }
.dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .25); }
.dialog .err { min-height: 20px; margin-bottom: 8px; color: var(--bad); font-size: .87rem; }
.x { position: absolute; right: 10px; top: 8px; appearance: none; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 4px 8px; }
.x:hover { color: #fff; }

/* уведомления */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: #1d2138; border: 1px solid var(--line2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: fade .2s ease; }
.toast.bad { border-color: rgba(248, 113, 113, .6); }
.toast.ok { border-color: rgba(52, 211, 153, .6); }

.foot { padding-top: 40px; padding-bottom: 28px; color: var(--muted); font-size: .82rem; text-align: center; }

@media (max-width: 640px) {
    .top-in { gap: 10px; height: 58px; }
    .logo span { display: none; }
    .space { margin-left: 0; flex: 1; min-width: 0; }
    .space-bar { flex: 1; width: auto; min-width: 40px; }
    .who span { display: none; }
    .tabs { margin-top: 14px; }
    .tabs { gap: 2px; padding: 4px; }
    .tabs button { padding: 9px 8px; gap: 5px; font-size: .86rem; }
    .tabs b { min-width: 18px; padding: 1px 5px; }
    .drop { min-height: 170px; }
    .opts { gap: 14px; }
    .opt, .seg { width: 100%; }
    .seg button { flex: 1; padding: 8px 6px; }
    .f { grid-template-columns: 40px minmax(0, 1fr); }
    .f-ic { width: 40px; height: 40px; }
    .f-act { grid-row: auto; grid-column: 1 / -1; }
    .f-act .btn { flex: 1; }
    .u { grid-template-columns: minmax(0, 1fr) auto; }
}
