:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --text: #e6e8ec; --muted: #8b93a3; --accent: #e1306c; --accent2: #f77737;
  --ok: #2ecc71; --warn: #f1c40f; --err: #ff5c5c; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.error { color: var(--err); margin: 6px 0; }

header { display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
header .logo { font-weight: 700; font-size: 16px;
  background: linear-gradient(90deg, var(--accent2), var(--accent)); -webkit-background-clip: text; color: transparent; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
nav button.active, nav button:hover { background: var(--panel2); color: var(--text); }
header .spacer { flex: 1; }
.pill { padding: 3px 10px; border-radius: 99px; background: var(--panel2); font-size: 12px; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.err { color: var(--err); }

main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: linear-gradient(90deg, var(--accent2), var(--accent)); border: 0; color: #fff; font-weight: 600; }
.btn.danger { color: var(--err); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font: inherit; max-width: 100%; }
textarea { width: 100%; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

pre.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 0;
  max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 Consolas, monospace; }
.shot { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; background: #000; min-height: 120px; }

/* settings */
.settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; }
.sections { position: sticky; top: 70px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.sections button { text-align: left; background: none; border: 0; color: var(--muted); padding: 7px 10px;
  border-radius: 8px; cursor: pointer; font: inherit; }
.sections button.active, .sections button:hover { background: var(--panel2); color: var(--text); }
.field { display: grid; grid-template-columns: minmax(180px, 38%) 1fr; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); align-items: center; }
.field:last-child { border-bottom: 0; }
.field label.name { color: var(--text); }
.field .ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.field .ctl input[type=text] { flex: 1; min-width: 160px; }
.field.hidden-cond { opacity: .45; }
.radios { display: flex; flex-direction: column; gap: 4px; }
.savebar { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line);
  padding: 10px 16px; margin: 16px -16px -16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  border-radius: 0 0 var(--radius) var(--radius); }

/* files */
.crumbs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.crumbs a { cursor: pointer; text-decoration: none; }
table.files { width: 100%; border-collapse: collapse; }
table.files td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
table.files tr:hover td { background: var(--panel2); }
table.files td.name { cursor: pointer; word-break: break-word; }
table.files td.num { text-align: right; color: var(--muted); white-space: nowrap; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); margin-top: 12px; }
.drop.over { border-color: var(--accent); color: var(--text); }
progress { width: 100%; }

.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 8px; z-index: 50; max-width: calc(100vw - 32px); }
.toast.err { border-color: var(--err); }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px;
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; background: linear-gradient(90deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; color: transparent; }
.login-card p { margin: 0 0 6px; }

@media (max-width: 760px) {
  main { padding: 12px; }
  header { padding: 10px 12px; gap: 8px; }
  .settings-layout { grid-template-columns: 1fr; }
  .sections { position: static; flex-direction: row; overflow-x: auto; }
  .sections button { white-space: nowrap; }
  .field { grid-template-columns: 1fr; gap: 6px; }
  .grid { grid-template-columns: 1fr; }
}
