:root {
  --bg: #07061a;
  --card: rgba(26, 20, 66, 0.55);
  --line: rgba(160, 140, 255, 0.14);
  --text: #ece8ff;
  --muted: #8f88bd;
  --violet: #9b6bff;
  --blue: #3f86ff;
  --ok: #3ee0a1;
  --bad: #ff5d7a;
  --grad: linear-gradient(90deg, #a248ff, #3f86ff);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 15% -10%, rgba(120, 60, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(40, 110, 255, 0.16), transparent 60%), var(--bg);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }
code { font: 12px ui-monospace, Consolas, monospace; background: rgba(155, 107, 255, 0.12); padding: 1px 5px; border-radius: 5px; }
b { font-weight: 700; }
h1 b, .brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { margin: 0 0 2px; font-size: 20px; font-weight: 650; }
h3 { margin: 0 0 8px; font-size: 14px; font-weight: 650; letter-spacing: 0.02em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; backdrop-filter: blur(14px); }
.card.sub { margin-top: 18px; }
.card.warn { border-color: rgba(255, 180, 90, 0.35); margin-top: 12px; }
.card.ok { border-color: rgba(62, 224, 161, 0.4); margin: 12px 0; }

.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 9px 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text); cursor: pointer; transition: 0.15s; }
.btn:hover { border-color: rgba(160, 140, 255, 0.4); }
.btn.primary { border: 0; background: var(--grad); box-shadow: 0 6px 22px rgba(120, 80, 255, 0.35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: progress; }

input[type=text], input[type=password], input[type=url], input:not([type]), textarea {
  font: inherit; color: var(--text); background: rgba(5, 4, 20, 0.6); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; width: 100%;
}
input:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(155, 107, 255, 0.15); }
textarea { resize: vertical; font: 12.5px/1.5 ui-monospace, Consolas, monospace; }
#paste { min-height: 220px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 360px; display: grid; gap: 12px; text-align: center; padding: 32px 28px; }
.login-logo { width: 84px; margin: 0 auto; filter: drop-shadow(0 10px 30px rgba(130, 70, 255, 0.5)); }
.login-card h1 { margin: 4px 0 0; font-size: 22px; font-weight: 600; }
.login-card p { margin: 0; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(7, 6, 26, 0.75); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.brand img { width: 30px; }
.brand em { font-style: normal; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
nav { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.03); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
nav button { font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; }
nav button.on { color: var(--text); background: rgba(155, 107, 255, 0.18); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--muted); }
.live-pill { display: flex; align-items: center; gap: 7px; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.rev b { color: var(--text); }

main { max-width: 1080px; margin: 0 auto; padding: 28px; }
.panel { display: none; }
.panel.on { display: block; animation: in 0.25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.panel-head p { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; }
.dirty { color: #ffc46b; font-size: 12px; font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
form.row { margin: 0 0 12px; }
form.row input[type=url] { flex: 1; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.grid .wide { grid-column: 1 / -1; }
.file-row { display: flex; align-items: center; gap: 10px; }
.file-row input[type=url] { flex: 1; }

.list { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.item.off { opacity: 0.5; }
.item .idx { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: rgba(155, 107, 255, 0.16); color: #cbb6ff; }
.item .label { background: transparent; border: 1px solid transparent; font-weight: 650; padding: 4px 6px; margin-left: -6px; }
.item .label:hover { border-color: var(--line); }
.item .meta { color: var(--muted); font: 11.5px ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 1px; }
.item .tools { display: flex; gap: 6px; align-items: center; }
.badge { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; background: rgba(63, 134, 255, 0.16); color: #9cc2ff; }
.badge.json { background: rgba(255, 196, 107, 0.15); color: #ffc46b; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; border-radius: 20px; background: rgba(255, 255, 255, 0.1); transition: 0.2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: 0.2s; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(16px); }
.empty { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }

.history { display: grid; gap: 4px; font-size: 13px; }
.history div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; border-bottom: 1px solid rgba(160, 140, 255, 0.07); }
.history .st-ok { color: var(--ok); }
.history .st-bad { color: var(--bad); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; padding: 10px 18px; border-radius: 12px; background: #1b1546; border: 1px solid var(--line); transition: 0.25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; align-items: stretch; }
}
