:root {
  --bg: #0e1015; --panel: #161922; --panel2: #1d212c; --border: #272c3a;
  --text: #e6e8ee; --muted: #8b92a6; --accent: #6366f1; --accent2: #818cf8;
  --danger: #ef4444; --ok: #22c55e; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent2); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
input, select {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; width: 100%; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #6366f133; }
.btn {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: 100%; max-width: 380px; display: grid; gap: 14px; }
.card h1 { margin: 0 0 4px; font-size: 24px; }
.card .sub { color: var(--muted); margin: 0; }
.err { color: var(--danger); min-height: 1.4em; font-size: 14px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; justify-self: center; }
.link:hover { color: var(--text); }

header.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; font-size: 18px; }
header.top .project { color: var(--muted); }
header.top .spacer { flex: 1; }
main { max-width: 1000px; margin: 0 auto; padding: 20px 24px 80px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-width: 200px; }
.crumbs a, .crumbs span.cur { padding: 4px 8px; border-radius: 6px; }
.crumbs a:hover { background: var(--panel2); }
.crumbs .sep { color: var(--muted); }

.drop { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); overflow: hidden; position: relative; }
.drop.over { border-color: var(--accent); box-shadow: 0 0 0 3px #6366f133; }
.drop .hint { display: none; position: absolute; inset: 0; background: #0e1015dd; place-items: center; font-size: 18px; z-index: 2; }
.drop.over .hint { display: grid; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 9px 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel2); }
tr.dragover { background: #6366f122 !important; outline: 1px solid var(--accent); outline-offset: -1px; }
td.name { display: flex; align-items: center; gap: 10px; word-break: break-all; }
td.name a { color: var(--text); }
td.name a:hover { color: var(--accent2); }
td.num, th.num { text-align: right; color: var(--muted); white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; }
.ico { width: 20px; text-align: center; flex: none; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.row-actions { display: inline-flex; gap: 6px; opacity: 0; transition: .15s; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

.uploads { position: fixed; right: 16px; bottom: 16px; width: 300px; display: grid; gap: 8px; z-index: 10; }
.up { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.up .bar { height: 4px; background: var(--panel2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.up .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .1s; }
.up.fail .bar i { background: var(--danger); }

.modal-bg { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: 100%; max-width: 420px; display: grid; gap: 12px; max-height: 80vh; overflow: auto; }
.modal h3 { margin: 0; }
.modal .btns { display: flex; gap: 8px; justify-content: flex-end; }
.tree { display: grid; gap: 2px; }
.tree button { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.tree button:hover:not(:disabled) { background: var(--panel2); }
.tree button.sel { background: #6366f133; }
.tree button:disabled { opacity: .35; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.badge { background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
h2 { font-size: 16px; margin: 24px 0 10px; }

#toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30; display: grid; gap: 8px; }
#toast div { background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 9px 16px; border-radius: 8px; box-shadow: 0 6px 24px #0008; }
#toast div.bad { border-left-color: var(--danger); }

@media (max-width: 640px) {
  header.top, main { padding-left: 14px; padding-right: 14px; }
  .hide-sm { display: none; }
}
