:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1d232c; --line: #2a313c;
  --text: #e6e9ee; --muted: #8b95a3; --accent: #4f8cff; --accent2: #3a73e0;
  --ok: #3fb97c; --bad: #f0616d; --warn: #e8b04b; --r: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.pad { padding: 24px 4px; }

.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.brand.small { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.logo { color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 26px; width: 100%; }
.login { max-width: 360px; display: grid; gap: 12px; }
.login p { margin: -4px 0 6px; }

input[type=password], input[type=search], input[type=text] {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; font: inherit; outline: none;
}
input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 16px; font: inherit; font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { border-color: #3b4452; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); background: transparent; }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; margin: 18px 0 6px; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0 4px; }

.alert { background: #3a1d22; border: 1px solid #6b2b33; color: #ffd0d4; padding: 11px 14px; border-radius: 9px; margin: 0 0 14px; }
.alert.soft { background: var(--panel2); border-color: var(--line); color: var(--text); }

/* Admin layout */
.top { display: flex; align-items: center; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.top .stats { color: var(--muted); font-size: 13px; }
.top nav { margin-left: auto; display: flex; gap: 18px; }
.top nav a { color: var(--muted); }
.wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.wrap.narrow { max-width: 720px; }
h2 { font-size: 16px; margin: 26px 0 12px; }

.drop {
  display: block; text-align: center; cursor: pointer; padding: 38px 16px; border-radius: var(--r);
  border: 2px dashed #34404f; background: var(--panel); transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #17202d; }
.drop-icon { font-size: 30px; color: var(--accent); }
.drop-title { font-weight: 600; font-size: 16px; margin: 4px 0; }

.queue { display: grid; gap: 10px; margin-top: 14px; }
.qrow { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.qtop, .qmeta { display: flex; justify-content: space-between; gap: 12px; }
.qname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qsize, .qmeta { color: var(--muted); font-size: 13px; }
.qmeta { flex-wrap: wrap; }
.qstate { min-width: 0; overflow-wrap: anywhere; }
.bar { height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; margin: 9px 0 7px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.qrow.done .bar i { background: var(--ok); width: 100% !important; }
.qrow.error .bar i { background: var(--bad); }
.qrow.error .qstate { color: var(--bad); }
.qrow.done .qstate { color: var(--text); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 26px; }
.list-head h2 { margin: 0; }
.list-head input { max-width: 240px; }
.files { display: grid; gap: 8px; margin-top: 12px; }
.file {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.file.partial { border-style: dashed; }
.ficon { width: 40px; height: 40px; border-radius: 9px; background: var(--panel2); display: grid; place-items: center; color: var(--accent); font-size: 17px; }
.fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta { color: var(--muted); font-size: 13px; }
.fsha { color: var(--muted); font-size: 11.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsha code { font-size: 11px; }
.fwarn { color: var(--warn); font-size: 13px; }
.factions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 640px) {
  .top { padding: 12px 16px; gap: 10px; }
  .file { grid-template-columns: 36px minmax(0, 1fr); }
  .ficon { width: 36px; height: 36px; }
  .factions { grid-column: 1 / -1; justify-content: flex-start; }
  .list-head input { max-width: 150px; }
}

/* Setup */
.checks { display: grid; gap: 6px; }
.check { display: grid; grid-template-columns: 22px 190px minmax(0, 1fr); gap: 10px; align-items: baseline; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
.check span { font-weight: 700; }
.check.ok span { color: var(--ok); }
.check.bad span, .check.bad em { color: var(--bad); }
.check em { font-style: normal; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tools { display: grid; gap: 12px; }
.tools form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tools p { margin: 8px 0 0; font-size: 13px; }
.sel { user-select: all; }
@media (max-width: 640px) { .check { grid-template-columns: 22px minmax(0, 1fr); } .check em { grid-column: 2; } }

/* Share page */
.share { max-width: 560px; }
.share h1 { font-size: 20px; margin: 4px 0 8px; overflow-wrap: anywhere; }
.media { width: 100%; max-height: 60vh; border-radius: 10px; background: #000; margin-bottom: 16px; display: block; }
audio.media { background: none; }
.sfacts { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.verify { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.vlabel { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.vsha { display: block; user-select: all; }
.verify details { margin-top: 10px; font-size: 13px; }
.verify summary { cursor: pointer; color: var(--accent); }
.verify pre { background: var(--panel); padding: 8px 10px; border-radius: 7px; overflow-x: auto; margin: 4px 0; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 9px; transition: .2s; max-width: calc(100% - 32px); z-index: 9; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); color: #ffd0d4; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.panel p { font-size: 13px; margin: 8px 0; }
.autodel { display: grid; gap: 14px; margin-bottom: 12px; }
.autodel label { display: grid; gap: 6px; font-weight: 600; }
.autodel .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 400; }
.autodel input[type=number], .autodel select {
  width: 90px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.autodel select { width: auto; }
.autodel textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 13px ui-monospace, Consolas, monospace; font-weight: 400; }
.autodel small { font-weight: 400; }
.autodel .btn { justify-self: start; }
.status-line { margin: 0 !important; }
code.block { display: block; background: var(--bg); padding: 8px 10px; border-radius: 7px; margin: 4px 0; }
.fexp { color: var(--warn); }
.fkept { color: var(--ok); }
.btn.on { border-color: var(--ok); color: var(--ok); }
.dlbox { margin: 4px 0 10px; }
.dlbox .bar { margin-top: 4px; }
.dlbox.done .bar i { background: var(--ok); width: 100% !important; }
.dlbox.error #dlstate { color: var(--bad); }
.btn.busy { opacity: .6; pointer-events: none; }
