/* MF Big Box: cyan on dark grey, with mono and light themes */
:root {
  --bg: #16181d; --bg2: #1d2027; --bg3: #242830; --bg4: #2c313b;
  --line: #2e333d; --line2: #3a404c;
  --fg: #e6e9ef; --fg2: #a7adba; --fg3: #6b7280;
  --acc: #22d3ee; --acc2: #06b6d4; --acc-dim: rgba(34,211,238,.14); --acc-fg: #06202a;
  --ok: #34d399; --warn: #fbbf24; --err: #f87171;
  --radius: 10px; --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
}
[data-theme="mono"] { --acc: #f4f4f5; --acc2: #d4d4d8; --acc-dim: rgba(244,244,245,.12); --acc-fg: #111; }
[data-theme="light"] {
  --bg: #f4f5f7; --bg2: #ffffff; --bg3: #eceef2; --bg4: #e2e5ea; --line: #dfe2e8; --line2: #cfd3db;
  --fg: #171a21; --fg2: #4b5563; --fg3: #8a919e; --acc: #0891b2; --acc2: #0e7490; --acc-dim: rgba(8,145,178,.12); --acc-fg: #fff;
  --shadow: 0 12px 40px rgba(20,30,50,.18);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--acc); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--acc-dim); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 2px solid var(--bg); }
[hidden] { display: none !important; }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 232px 1fr; grid-template-rows: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--acc); color: var(--acc-fg); display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.5px; }
.brand .name { font-weight: 700; letter-spacing: .2px; }
.brand .name small { display: block; font-weight: 500; color: var(--fg3); font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
.nav button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; color: var(--fg2); border-radius: 8px; text-align: left; }
.nav button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav button:hover { background: var(--bg3); color: var(--fg); }
.nav button.on { background: var(--acc-dim); color: var(--acc); }
.side .spacer { flex: 1; }
.usage { padding: 10px; font-size: 12px; color: var(--fg3); }
.usage .bar { height: 5px; background: var(--bg4); border-radius: 4px; margin: 6px 0; overflow: hidden; } .usage .bar i { display: block; height: 100%; background: var(--acc); width: 0; }
.me { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; color: var(--fg2); border-top: 1px solid var(--line); }
.me .av { width: 26px; height: 26px; border-radius: 50%; background: var(--bg4); display: grid; place-items: center; font-weight: 700; font-size: 11px; color: var(--acc); }
.me .u { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me button { background: none; border: 0; color: var(--fg3); padding: 4px; } .me button:hover { color: var(--fg); }

.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--bg); }
.crumbs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs button { background: none; border: 0; color: var(--fg2); padding: 4px 6px; border-radius: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.crumbs button:hover { background: var(--bg3); color: var(--fg); } .crumbs button.cur { color: var(--fg); font-weight: 600; }
.crumbs .sep { color: var(--fg3); }
.search { position: relative; } .search input { width: 260px; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px 7px 32px; color: var(--fg); outline: none; }
.search input:focus { border-color: var(--acc); } .search svg { position: absolute; left: 10px; top: 9px; width: 15px; height: 15px; stroke: var(--fg3); fill: none; stroke-width: 2; }
.content { flex: 1; overflow: auto; position: relative; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 3; min-height: 50px; }
.toolbar .sel { color: var(--fg2); font-size: 13px; } .toolbar .grow { flex: 1; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg3); color: var(--fg); white-space: nowrap; }
.btn:hover { background: var(--bg4); } .btn:disabled { opacity: .45; cursor: default; }
.btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); font-weight: 600; } .btn.pri:hover { background: var(--acc2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg2); } .btn.ghost:hover { background: var(--bg3); color: var(--fg); }
.btn.danger { color: var(--err); } .btn.sm { padding: 4px 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 7px; border: 0; background: transparent; color: var(--fg2); }
.iconbtn:hover { background: var(--bg3); color: var(--fg); } .iconbtn.on { color: var(--acc); background: var(--acc-dim); }
.iconbtn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- file list ---- */
table.files { width: 100%; border-collapse: collapse; }
table.files th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--fg3); padding: 8px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 50px; background: var(--bg); z-index: 2; }
table.files td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.files tr.row { cursor: default; } table.files tr.row:hover { background: var(--bg2); } table.files tr.row.sel { background: var(--acc-dim); }
table.files tr.row.drop { outline: 2px dashed var(--acc); outline-offset: -2px; }
table.files td.chk, table.files th.chk { width: 34px; padding-right: 0; }
table.files td.nm { max-width: 0; width: 60%; } table.files td.nm .nmw { display: flex; align-items: center; gap: 10px; min-width: 0; }
table.files td.nm .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.files td.nm .fn.dir { font-weight: 500; }
table.files td.sz, table.files td.dt { color: var(--fg2); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.files td.act { text-align: right; white-space: nowrap; width: 90px; } table.files td.act .iconbtn { opacity: 0; } tr.row:hover td.act .iconbtn, tr.row.sel td.act .iconbtn { opacity: 1; }
.ico { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 6px; font-size: 9px; font-weight: 700; letter-spacing: .3px; background: var(--bg3); color: var(--fg2); }
.ico.dir { background: var(--acc-dim); color: var(--acc); } .ico svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.ico.img { background: rgba(52,211,153,.15); color: var(--ok); } .ico.vid { background: rgba(251,191,36,.14); color: var(--warn); } .ico.aud { background: rgba(167,139,250,.16); color: #a78bfa; } .ico.pdf { background: rgba(248,113,113,.14); color: var(--err); }
input[type=checkbox] { accent-color: var(--acc); width: 15px; height: 15px; }
.tag { font-size: 10px; font-weight: 600; letter-spacing: .4px; padding: 2px 6px; border-radius: 5px; background: var(--bg4); color: var(--fg2); text-transform: uppercase; } .tag.acc { background: var(--acc-dim); color: var(--acc); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; padding: 16px 18px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: default; }
.card:hover { border-color: var(--line2); } .card.sel { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.card .th { aspect-ratio: 4/3; background: var(--bg3); display: grid; place-items: center; overflow: hidden; } .card .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .th .ico { width: 44px; height: 44px; font-size: 12px; } .card .th .ico svg { width: 26px; height: 26px; }
.card .cap { padding: 8px 10px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .card .cap small { display: block; color: var(--fg3); font-size: 11px; }

.empty { text-align: center; color: var(--fg3); padding: 80px 20px; } .empty b { display: block; color: var(--fg2); font-size: 16px; margin-bottom: 6px; font-weight: 600; }
.dropzone { position: absolute; inset: 0; background: rgba(22,24,29,.85); border: 2px dashed var(--acc); margin: 12px; border-radius: 14px; display: grid; place-items: center; color: var(--acc); font-size: 18px; font-weight: 600; z-index: 20; pointer-events: none; }

/* ---- panels / pages ---- */
.page { padding: 22px 26px; max-width: 1100px; }
.page h2 { margin: 0 0 4px; font-size: 20px; } .page .sub { color: var(--fg3); margin-bottom: 18px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; } table.tbl th { text-align: left; color: var(--fg3); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; } table.tbl tr:last-child td { border-bottom: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; } .field label { font-size: 12px; color: var(--fg2); font-weight: 500; }
.inp { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--fg); outline: none; width: 100%; } .inp:focus { border-color: var(--acc); }
select.inp { appearance: none; }
.row2 { display: flex; gap: 10px; align-items: center; } .row2 > * { flex: 1; }
.hint { font-size: 12px; color: var(--fg3); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--bg3); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; font-size: 12px; }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--bg2); border: 1px solid var(--line2); border-radius: 14px; width: min(520px, 92vw); box-shadow: var(--shadow); }
.modal.wide { width: min(760px, 94vw); }
.modal .mh { padding: 16px 20px 0; font-weight: 700; font-size: 16px; display: flex; align-items: center; } .modal .mh .grow { flex: 1; }
.modal .mb { padding: 14px 20px; } .modal .mf { padding: 0 20px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.tree { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.tree div { padding: 6px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; } .tree div:hover { background: var(--bg3); } .tree div.on { background: var(--acc-dim); color: var(--acc); }

/* ---- preview ---- */
.preview { position: fixed; inset: 0; background: rgba(10,11,14,.96); z-index: 60; display: flex; flex-direction: column; }
.preview .ph { display: flex; align-items: center; gap: 10px; padding: 12px 18px; color: var(--fg2); } .preview .ph .fn { flex: 1; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview .pb { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 0 60px 20px; position: relative; }
.preview img, .preview video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.preview iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.preview pre { max-width: 100%; max-height: 100%; overflow: auto; background: var(--bg2); padding: 18px; border-radius: 8px; font-size: 12.5px; }
.preview .navb { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; background: var(--bg3); border: 1px solid var(--line2); color: var(--fg); display: grid; place-items: center; } .preview .navb.l { left: 12px; } .preview .navb.r { right: 12px; }
.preview .navb svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---- upload queue ---- */
.queue { position: fixed; right: 18px; bottom: 18px; width: 360px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; }
.queue .qh { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; } .queue .qh .grow { flex: 1; }
.queue .ql { max-height: 260px; overflow: auto; }
.queue .qi { padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; } .queue .qi:last-child { border-bottom: 0; }
.queue .qi .n { display: flex; gap: 8px; } .queue .qi .n span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .queue .qi .n small { color: var(--fg3); white-space: nowrap; }
.queue .qi .p { height: 4px; background: var(--bg4); border-radius: 3px; margin-top: 5px; overflow: hidden; } .queue .qi .p i { display: block; height: 100%; background: var(--acc); width: 0; transition: width .2s; }
.queue .qi.err .p i { background: var(--err); } .queue .qi.done .p i { background: var(--ok); }

/* ---- context menu ---- */
.ctx { position: fixed; z-index: 70; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 190px; }
.ctx button { display: flex; width: 100%; align-items: center; gap: 9px; background: none; border: 0; color: var(--fg); padding: 7px 10px; border-radius: 7px; text-align: left; }
.ctx button:hover { background: var(--bg3); } .ctx button.danger { color: var(--err); } .ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx button svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- toast ---- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--bg3); border: 1px solid var(--line2); color: var(--fg); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: up .18s ease-out; }
.toast.err { border-color: var(--err); } .toast.ok { border-color: var(--ok); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---- auth ---- */
.auth { height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, var(--acc-dim), transparent 60%), var(--bg); }
.auth .box { width: min(380px, 92vw); background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth .brand { padding: 0 0 18px; }
.auth .err { color: var(--err); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; } .side { display: none; } .search input { width: 150px; }
  table.files td.dt { display: none; } .queue { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
}
