:root {
  --bg: #101113; --panel: #141518; --side: #121316; --field: #191B1F;
  --line: #23252A; --line2: #1B1D21; --line3: #2B2E34;
  --text: #E3E5E8; --dim: #8E939B; --dim2: #A9AEB6; --off: #5B6068;
  --acc: #6C9BFF; --acc-ink: #0D1220; --danger: #FF9B8A; --ok: #9BD7A8;
  --sel: color-mix(in srgb, var(--acc) 15%, var(--bg));
  --sel-line: color-mix(in srgb, var(--acc) 40%, var(--bg));
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: color-mix(in srgb, var(--acc) 75%, white); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- common controls */
.btn { height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line3); background: #16171B; color: var(--text); white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--acc) 50%, var(--line3)); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { border: 0; background: var(--acc); color: var(--acc-ink); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--dim2); }
.btn.sm { height: 30px; padding: 0 11px; border-radius: 6px; }
.field { height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line3); background: var(--field); color: var(--text); outline: none; min-width: 0; }
.field:focus { border-color: var(--acc); }
.switch { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; border: 0; padding: 0; background: var(--line3); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--acc); }
.switch[aria-checked="true"]::after { left: 23px; background: var(--acc-ink); }
.switch:disabled { opacity: .5; cursor: default; }
.muted { color: var(--dim); }
.small { font-size: 12px; }

/* ---------- login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.login .logo { font-size: 20px; margin-bottom: 8px; }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--dim2); }
.login .err { color: var(--danger); min-height: 18px; }
.login .btn { height: 40px; }

/* ---------- layout */
.app { min-height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 30; }
.logo { font-weight: 700; font-size: 16px; color: var(--acc); text-decoration: none; white-space: nowrap; }
.top .logo { min-width: 220px; }
.burger { display: none; }
.search { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: 8px; background: var(--field); border: 1px solid var(--line3); color: var(--dim); max-width: 720px; }
.search:focus-within { border-color: var(--acc); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); }
.top .spacer { flex: 1; }
.userbtn { color: var(--dim2); }
.body { flex: 1; display: flex; min-height: 0; }
.side { width: 260px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--side); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; position: sticky; top: 59px; height: calc(100vh - 59px); }
.side .nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 7px; color: var(--dim2); text-decoration: none; border: 0; background: transparent; text-align: left; width: 100%; }
.side .nav:hover { background: #17191E; }
.side .nav.on { background: var(--sel); color: var(--text); font-weight: 600; }
.side .nav .count { color: var(--dim); font-weight: 400; }
.side .nav.soon { color: var(--off); }
.side h4 { margin: 18px 12px 6px; display: flex; justify-content: space-between; align-items: center; color: var(--dim); font-size: 11px; font-weight: 400; letter-spacing: .08em; }
.side h4 a { font-size: 11px; color: var(--dim); letter-spacing: 0; }
.tnode { display: flex; align-items: center; gap: 4px; width: 100%; padding: 0; border: 0; background: transparent; color: var(--dim2); text-align: left; border-radius: 6px; }
.tnode:hover { background: #17191E; }
.tnode.on { background: var(--sel); color: var(--text); font-weight: 600; }
.tnode .caret { flex: none; width: 22px; height: 28px; display: flex; align-items: center; justify-content: center; color: #6B7079; border-radius: 4px; }
.tnode .caret:hover { color: var(--text); }
.tnode .tname { flex: 1; min-width: 0; padding: 5px 6px 5px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tnode.drop { outline: 1px dashed var(--acc); }
.sidebottom { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.storage { padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 8px; color: var(--dim); font-size: 12px; }
.storage .bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.storage .bar div { height: 100%; background: var(--acc); }
main.main { flex: 1; min-width: 0; padding: 16px 24px 80px; display: flex; flex-direction: column; gap: 12px; position: relative; }

/* ---------- files */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.crumbs a { color: var(--dim); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: #4F535B; }
.crumbs .cur { font-weight: 600; }
.headrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.headrow .tools { display: flex; gap: 8px; flex-wrap: wrap; }
.actbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 46px; padding: 7px 12px; border-radius: 9px; border: 1px solid #1E2025; }
.actbar.on { background: color-mix(in srgb, var(--acc) 12%, var(--bg)); border-color: var(--sel-line); }
.actbar .grow { flex: 1; }
.actbar .btn { border-color: color-mix(in srgb, var(--acc) 30%, var(--line3)); background: transparent; }
.actbar .btn.primary { background: var(--acc); }
.table { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; background: var(--side); }
.thead, .trow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 110px 160px; align-items: center; padding: 0 12px; min-width: 620px; }
.table.withpath .thead, .table.withpath .trow { grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) 100px 150px; min-width: 820px; }
.table.trash .thead, .table.trash .trow { grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) 150px 110px 100px; min-width: 900px; }
.thead { height: 38px; border-bottom: 1px solid var(--line); }
.thead button { padding: 0; border: 0; background: transparent; color: var(--dim); font-size: 12px; text-align: left; }
.thead button.on { color: var(--text); }
.thead button .arr { color: var(--acc); }
.thead .r, .trow .r { text-align: right; padding-right: 18px; }
.trow { min-height: 42px; padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line2); user-select: none; cursor: default; }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: #16181D; }
.trow.sel { background: var(--sel); box-shadow: inset 2px 0 0 var(--acc); }
.trow.cut { opacity: .5; }
.trow .nm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.trow .nm span.n { overflow-wrap: anywhere; }
.trow .d { color: var(--dim2); }
.trow .p { color: var(--dim); overflow-wrap: anywhere; padding-right: 12px; }
.trow .p a { color: var(--dim); text-decoration: none; }
.trow .p a:hover { color: var(--text); }
.tag { flex: none; width: 36px; font-size: 11px; font-weight: 700; }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--acc); margin: 0; cursor: pointer; }
.empty { padding: 40px 20px; text-align: center; color: var(--dim); }
.hint { color: var(--dim); font-size: 12px; }
.loading { opacity: .55; pointer-events: none; }

/* ---------- drag & drop */
.drop { position: absolute; inset: 8px; z-index: 25; border: 2px dashed var(--acc); border-radius: 18px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; pointer-events: none; }
.drop .big { font-size: 22px; font-weight: 700; }

/* ---------- menus, modals, toasts */
.menu { position: fixed; z-index: 100; width: 270px; padding: 6px; border-radius: 10px; background: #18191D; border: 1px solid #2E3138; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.menu .mt { padding: 6px 14px 8px; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button { display: flex; justify-content: space-between; width: 100%; padding: 8px 14px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: var(--text); }
.menu button:hover:not(:disabled) { background: color-mix(in srgb, var(--acc) 18%, #18191D); }
.menu button:disabled { color: var(--off); cursor: default; }
.menu button.danger { color: var(--danger); }
.menu button .k { color: var(--off); font-size: 11px; }
.menu hr { border: 0; height: 1px; margin: 4px 8px; background: #2E3138; }
.backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(5,6,8,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line3); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.modal h3 { margin: 0; font-size: 15px; }
.modal .row { display: flex; flex-direction: column; gap: 6px; }
.modal .row > span { color: var(--dim2); }
.modal .btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.modal .err { color: var(--danger); }
.modal dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.modal dt { color: var(--dim); }
.modal dd { margin: 0; overflow-wrap: anywhere; }
.picker { border: 1px solid var(--line); border-radius: 10px; max-height: 320px; overflow: auto; }
.picker button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line2); background: transparent; text-align: left; color: var(--text); }
.picker button:hover { background: #17191E; }
.picker .up { color: var(--dim); }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; max-width: calc(100% - 32px); }
.toast { padding: 11px 18px; border-radius: 10px; background: var(--acc); color: var(--acc-ink); font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.toast.err { background: #3A1F22; color: #FFD3CC; border: 1px solid #6B3036; }

/* ---------- uploads panel */
.ups { position: fixed; right: 20px; bottom: 20px; z-index: 80; width: 380px; max-width: calc(100% - 40px); border-radius: 14px; background: #17191D; border: 1px solid var(--line3); box-shadow: 0 18px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.ups .uh { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.ups .uh strong { flex: 1; }
.ups .ul { max-height: 300px; overflow: auto; padding: 0 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.ups .ui { display: flex; flex-direction: column; gap: 5px; }
.ups .ui .l { display: flex; gap: 10px; justify-content: space-between; font-size: 12px; }
.ups .ui .l .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ups .ui .l .s { flex: none; color: var(--dim); }
.ups .pb { height: 4px; border-radius: 2px; background: #262930; overflow: hidden; }
.ups .pb div { height: 100%; background: var(--acc); transition: width .3s; }
.ups .ui.done .pb div { background: var(--ok); }
.ups .ui.error .pb div { background: var(--danger); }
.ups .x { border: 0; background: transparent; color: var(--dim); padding: 0 4px; }

/* ---------- settings */
.page { display: flex; flex-direction: column; gap: 18px; max-width: 980px; }
.page h1 { margin: 0; font-size: 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--dim); text-decoration: none; }
.tabs a.on { border-color: var(--acc); color: var(--text); font-weight: 600; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.card h2 { margin: 0; font-size: 15px; }
.card .line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card .line > span { display: flex; flex-direction: column; gap: 2px; }
.card .list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.card .list > div { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line2); }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: var(--text); }
input[type=color] { width: 48px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line3); background: var(--field); cursor: pointer; }
.summary { padding: 12px 14px; border-radius: 8px; background: color-mix(in srgb, var(--acc) 9%, var(--bg)); border: 1px solid var(--sel-line); color: #C9CDD3; }
.utable { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.utable .ur { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.2fr) 150px 170px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line2); min-width: 900px; }
.utable .ur.h { color: var(--dim); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 8px; border-radius: 6px; font-size: 11px; background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); border: 1px solid var(--sel-line); }
.chip.off { background: transparent; color: var(--off); border: 1px dashed var(--line3); }
.atable .ar { display: grid; grid-template-columns: 140px 110px 130px 130px minmax(0, 1fr); gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line2); min-width: 860px; }
.atable .ar.h { color: var(--dim); font-size: 12px; }
.radio { display: flex; flex-direction: column; gap: 8px; }
.radio label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line3); cursor: pointer; }
.radio label:has(input:checked) { border-color: var(--acc); background: var(--sel); }
.radio input { accent-color: var(--acc); margin-top: 3px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }

/* ---------- mobile */
@media (max-width: 900px) {
  .burger { display: inline-flex; }
  .top { flex-wrap: wrap; padding: 10px 12px; }
  .top .logo { min-width: 0; }
  .search { order: 5; flex-basis: 100%; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.6); }
  .side.open { transform: none; }
  main.main { padding: 12px 12px 80px; }
  .hide-sm { display: none; }
  .top .spacer { display: none; }
  .top .logo { flex: 1; }
}
@media (max-width: 640px) {
  .table:not(.withpath):not(.trash) .thead, .table:not(.withpath):not(.trash) .trow { grid-template-columns: 34px minmax(0, 1fr) 78px; min-width: 0; padding: 0 8px; }
  .table:not(.withpath):not(.trash) .trow { padding-top: 8px; padding-bottom: 8px; }
  .table:not(.withpath):not(.trash) .thead > :last-child, .table:not(.withpath):not(.trash) .trow > :last-child { display: none; }
  .thead .r, .trow .r { padding-right: 4px; }
  .tag { width: 30px; }
  .actbar .hint { display: none; }
}
