:root {
  --bg: #0b0d12; --panel: #141821; --panel2: #1b2130; --line: #273041;
  --fg: #e7ecf3; --muted: #8893a7; --accent: #6ea8fe; --accent2: #3d6fd6;
  --ok: #4ade80; --warn: #fbbf24; --err: #f87171; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #16203a 0%, var(--bg) 60%);
  color: var(--fg); font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; }
header.top { display: flex; align-items: center; gap: 12px; padding: 16px; max-width: 1000px; margin: 0 auto; }
header.top .brand { font-weight: 700; letter-spacing: .3px; font-size: 18px; }
header.top .brand span { color: var(--accent); }
header.top .spacer { flex: 1; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.card h2 { margin: 0 0 14px; font-size: 16px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; padding: 10px 12px; font: inherit;
}
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent2); }
.checks { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--fg); margin: 0; }
.checks input { width: auto; }

button, .btn {
  background: var(--accent2); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { background: var(--accent); }
button.secondary { background: var(--panel2); border: 1px solid var(--line); color: var(--fg); }
button.danger { background: #3a2026; border: 1px solid #5b2a33; color: var(--err); }
button.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.err { background: #2a1619; border: 1px solid #5b2a33; color: var(--err); }
.msg.ok { background: #13241a; border: 1px solid #1f5137; color: var(--ok); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td code, code.inline { background: var(--panel2); padding: 2px 6px; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.pill.on { color: var(--ok); border-color: #1f5137; }
.pill.off { color: var(--muted); }
.pill.lvl { color: var(--accent); border-color: var(--accent2); }

.login-wrap { max-width: 380px; margin: 10vh auto 0; }
.login-wrap .brand { text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.login-wrap .brand span { color: var(--accent); }
.login-wrap .sub { text-align: center; color: var(--muted); margin-bottom: 20px; font-size: 13px; }

pre.report { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12px; max-height: 260px; }
.docs h3 { margin-top: 28px; }
.docs code.inline, .docs pre { font-size: 13px; }
.docs pre { background: var(--panel2); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow: auto; }
.tag { display:inline-block; font-size:11px; color:var(--warn); margin-left:6px;}

/* ---------- animations & loading ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.card { animation: fadeUp .35s ease both; }
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }

#loader {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(900px 500px at 50% 30%, #16203a 0%, var(--bg) 70%);
  transition: opacity .4s ease; 
}
#loader.hide { opacity: 0; pointer-events: none; }
#loader .logo { font-size: 30px; font-weight: 800; letter-spacing: .5px; animation: pulse 1.6s ease-in-out infinite; }
#loader .logo span { color: var(--accent); }
.spinner { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; display: inline-block; vertical-align: middle; }

/* nav */
nav.tabs { display: flex; gap: 6px; }
nav.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
nav.tabs button:hover { color: var(--fg); background: var(--panel2); }
nav.tabs button.active { color: var(--fg); background: var(--panel2); border-color: var(--line); }
.view { display: none; }
.view.active { display: block; animation: fadeIn .3s ease both; }

/* script cards */
.scard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; animation: fadeUp .3s ease both; }
.scard .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scard .title { font-weight: 700; font-size: 15px; }
.scard .meta { color: var(--muted); font-size: 12px; }
.scard .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.loaderbox { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.loaderbox code { flex: 1; min-width: 0; overflow-x: auto; white-space: pre; }

/* drawer */
#drawer { position: fixed; inset: 0; z-index: 900; display: none; }
#drawer.open { display: block; }
#drawer .scrim { position: absolute; inset: 0; background: rgba(0,0,0,.55); animation: fadeIn .2s ease both; }
#drawer .panel-r { position: absolute; top: 0; right: 0; height: 100%; width: min(640px, 100%); background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; padding: 20px; animation: slideIn .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideIn { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
#drawer h2 { margin-top: 0; }
.drawer-close { position: sticky; top: 0; float: right; }

/* skeleton */
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel2) 25%, #222a3a 37%, var(--panel2) 63%); background-size: 800px 100%; animation: shimmer 1.3s infinite linear; margin: 8px 0; }

/* wizard */
.steps { counter-reset: step; }
.step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .num { counter-increment: step; flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); }
.step .num::before { content: counter(step); }
.step .body { flex: 1; }
.step .body h4 { margin: 4px 0 6px; }
.codecopy { display: inline-flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: 1px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); display: inline-block; vertical-align: middle; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; z-index: 1100; animation: fadeUp .25s ease both; }

/* ---------- busy overlay (obfuscation progress) ---------- */
.busy { position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(11,13,18,.82); backdrop-filter: blur(3px); animation: fadeIn .2s ease both; }
.busy .lbl { font-weight: 700; font-size: 16px; }
.busy .eta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.busy .bar { width: 260px; height: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.busy .bar > i { display: block; height: 100%; width: 35%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 999px; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
