/* Setup wizard — premium look, independent of app.css */
:root {
  --s-ink: #0b1324;
  --s-ink-2: #334155;
  --s-muted: #64748b;
  --s-line: #e6eaf2;
  --s-line-2: #d5dbe7;
  --s-bg: #f5f7fb;
  --s-card: #ffffff;
  --s-primary: #0b74d1;
  --s-primary-2: #2563eb;
  --s-primary-soft: #eaf3ff;
  --s-green: #10b981;
  --s-green-soft: #e9fbf3;
  --s-amber: #d97706;
  --s-amber-soft: #fff7e8;
  --s-red: #e11d48;
  --s-red-soft: #fff1f3;
  --s-radius: 20px;
  --s-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.setup {
  font-family: var(--s-font); color: var(--s-ink); font-size: 14px; line-height: 1.55; min-height: 100vh;
  background:
    radial-gradient(900px 500px at -10% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(14, 165, 233, .12), transparent 60%),
    radial-gradient(700px 400px at 50% 120%, rgba(16, 185, 129, .08), transparent 60%),
    var(--s-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--s-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: #f1f5f9; border: 1px solid var(--s-line); padding: 1px 6px; border-radius: 6px; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
.hidden { display: none !important; }

/* Shell */
.s-shell { max-width: 1180px; margin: 0 auto; padding: 40px 24px; }
.s-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.s-top .brand-logo img { height: 38px; }
.s-top .brand-logo { font-size: 20px; }
.s-top .s-secure { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--s-muted); background: rgba(255,255,255,.7); border: 1px solid var(--s-line); padding: 7px 12px; border-radius: 999px; backdrop-filter: blur(6px); }
.s-top .s-secure svg { width: 15px; height: 15px; color: var(--s-green); }
.s-card { display: grid; grid-template-columns: 300px 1fr; background: var(--s-card); border-radius: var(--s-radius); border: 1px solid rgba(15, 23, 42, .06); box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 12px 32px -8px rgba(15,23,42,.12), 0 40px 80px -20px rgba(37,99,235,.15); overflow: hidden; min-height: 640px; }

/* Rail */
.s-rail { background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fc 100%); border-right: 1px solid var(--s-line); padding: 28px 22px; display: flex; flex-direction: column; }
.s-rail h2 { font-size: 15px; margin: 0 0 4px; letter-spacing: -.01em; }
.s-rail .sub { font-size: 12.5px; color: var(--s-muted); margin: 0 0 18px; }
.s-meter { height: 6px; background: #e8edf5; border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.s-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--s-primary), #22d3ee); border-radius: 999px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.s-meter-label { font-size: 11.5px; color: var(--s-muted); margin-bottom: 22px; font-weight: 600; }
.s-steps { list-style: none; margin: 0; padding: 0; flex: 1; }
.s-steps li { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 12px; position: relative; color: var(--s-muted); transition: background .2s, color .2s; margin-bottom: 2px; }
.s-steps li .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #fff; border: 1px solid var(--s-line-2); color: var(--s-muted); transition: all .25s; flex-shrink: 0; }
.s-steps li .ic svg { width: 17px; height: 17px; }
.s-steps li .t { font-weight: 600; font-size: 13.5px; color: var(--s-ink-2); }
.s-steps li .d { font-size: 11.5px; }
.s-steps li.active { background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.06); }
.s-steps li.active .ic { background: linear-gradient(135deg, var(--s-primary), var(--s-primary-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -4px rgba(37,99,235,.55); }
.s-steps li.active .t { color: var(--s-ink); }
.s-steps li.done .ic { background: var(--s-green-soft); border-color: #bdf0d9; color: var(--s-green); }
.s-steps li.done { cursor: pointer; }
.s-steps li.done:hover { background: rgba(255,255,255,.7); }
.s-help { margin-top: 18px; background: #fff; border: 1px solid var(--s-line); border-radius: 14px; padding: 14px; font-size: 12.5px; color: var(--s-muted); display: flex; gap: 10px; }
.s-help svg { color: var(--s-primary); margin-top: 1px; }
.s-help strong { color: var(--s-ink); display: block; font-size: 13px; margin-bottom: 2px; }

/* Main panel */
.s-main { display: flex; flex-direction: column; min-width: 0; }
.s-body { padding: 40px 48px 28px; flex: 1; }
.s-step { display: none; }
.s-step.active { display: block; animation: sIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes sIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.s-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 28px; }
.s-head .badge-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--s-primary), var(--s-primary-2)); box-shadow: 0 10px 22px -8px rgba(37,99,235,.6); flex-shrink: 0; }
.s-head .badge-ic svg { width: 24px; height: 24px; }
.s-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--s-primary); }
.s-head h1 { font-size: 27px; line-height: 1.2; letter-spacing: -.025em; margin: 4px 0 6px; font-weight: 750; }
.s-head p { margin: 0; color: var(--s-ink-2); font-size: 14.5px; max-width: 560px; }

/* Fields */
.s-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.s-grid .full { grid-column: 1 / -1; }
.s-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.s-field > label { font-size: 13px; font-weight: 600; color: var(--s-ink-2); }
.s-field > label .opt { font-weight: 500; color: var(--s-muted); }
.s-field .help { font-size: 12px; color: var(--s-muted); }
.s-input { position: relative; display: flex; align-items: center; }
.s-input > svg { position: absolute; left: 13px; color: #94a3b8; width: 17px; height: 17px; pointer-events: none; }
.s-input input, .s-input select, .s-select {
  width: 100%; height: 46px; border: 1px solid var(--s-line-2); border-radius: 12px; background: #fff; padding: 0 14px 0 40px;
  font: inherit; font-size: 14.5px; color: var(--s-ink); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.s-input.no-ic input, .s-input.no-ic select { padding-left: 14px; }
.s-input select, .s-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.s-input input:hover, .s-input select:hover { border-color: #b9c3d6; }
.s-input input:focus, .s-input select:focus { outline: none; border-color: var(--s-primary); box-shadow: 0 0 0 4px rgba(11,116,209,.12); }
.s-input input.invalid { border-color: var(--s-red); box-shadow: 0 0 0 4px rgba(225,29,72,.10); }
.s-input .eye { position: absolute; right: 8px; background: none; border: 0; padding: 6px; border-radius: 8px; color: #94a3b8; cursor: pointer; display: grid; place-items: center; }
.s-input .eye:hover { color: var(--s-ink-2); background: #f1f5f9; }
.s-input.has-eye input { padding-right: 42px; }
.s-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 500; color: var(--s-ink-2); padding: 12px 14px; border: 1px solid var(--s-line); border-radius: 12px; background: #fbfcfe; }
.s-check input { width: 17px; height: 17px; accent-color: var(--s-primary); margin-top: 1px; }

/* Buttons */
.s-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--s-line-2); background: #fff; color: var(--s-ink); font: inherit; font-weight: 650; font-size: 14px; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s; white-space: nowrap; text-decoration: none !important; }
.s-btn:hover { background: #f8fafc; border-color: #b9c3d6; }
.s-btn:active { transform: translateY(1px); }
.s-btn[disabled] { opacity: .55; cursor: not-allowed; }
.s-btn svg { width: 17px; height: 17px; }
.s-btn-primary { border: 0; color: #fff; background: linear-gradient(135deg, var(--s-primary), var(--s-primary-2)); box-shadow: 0 8px 18px -6px rgba(37,99,235,.55), inset 0 1px 0 rgba(255,255,255,.18); padding: 0 22px; }
.s-btn-primary:hover { background: linear-gradient(135deg, #0a69be, #1d4ed8); box-shadow: 0 10px 22px -6px rgba(37,99,235,.6); }
.s-btn-success { border: 0; color: #fff; background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 18px -6px rgba(5,150,105,.5); padding: 0 26px; height: 48px; font-size: 15px; }
.s-btn-success:hover { background: linear-gradient(135deg, #0ea371, #047857); }
.s-btn-ghost { border-color: transparent; background: transparent; color: var(--s-muted); }
.s-btn-ghost:hover { background: #f1f5f9; color: var(--s-ink); }
.s-btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.s-foot { padding: 18px 48px; border-top: 1px solid var(--s-line); display: flex; justify-content: space-between; align-items: center; gap: 12px; background: linear-gradient(180deg, #fff, #fbfcfe); }
.s-foot .hint { font-size: 12.5px; color: var(--s-muted); text-align: center; flex: 1; }
.s-spin { width: 17px; height: 17px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sSpin .7s linear infinite; }
.s-btn:not(.s-btn-primary):not(.s-btn-success) .s-spin { border-color: #dbe4f0; border-top-color: var(--s-primary); }
@keyframes sSpin { to { transform: rotate(360deg); } }

/* Notices */
.s-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: 13.5px; margin-top: 18px; border: 1px solid; line-height: 1.5; }
.s-note svg { margin-top: 1px; }
.s-note.ok { background: var(--s-green-soft); border-color: #bdf0d9; color: #065f46; }
.s-note.warn { background: var(--s-amber-soft); border-color: #fde7b0; color: #8a4b05; }
.s-note.err { background: var(--s-red-soft); border-color: #fecdd6; color: #9f1239; }
.s-note.info { background: var(--s-primary-soft); border-color: #cfe3fb; color: #0b4f8f; }
.s-note strong { display: block; margin-bottom: 2px; }
.s-note code { background: rgba(255,255,255,.7); }
.s-note ol { margin: 6px 0 0; padding-left: 18px; }
.s-status { display: none; } .s-status.show { display: flex; }

/* Requirements */
.s-reqs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.s-req { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--s-line); border-radius: 12px; background: #fff; font-size: 13.5px; }
.s-req .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.s-req .dot svg { width: 13px; height: 13px; stroke-width: 3; }
.s-req.ok .dot { background: var(--s-green-soft); color: var(--s-green); }
.s-req.bad { border-color: #fecdd6; background: var(--s-red-soft); }
.s-req.bad .dot { background: var(--s-red); color: #fff; }
.s-req .fix { font-size: 12px; color: var(--s-red); margin-top: 3px; }
.s-hero-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.s-point { border: 1px solid var(--s-line); border-radius: 14px; padding: 14px; background: linear-gradient(180deg, #fff, #fafcff); }
.s-point svg { color: var(--s-primary); margin-bottom: 8px; width: 20px; height: 20px; }
.s-point strong { display: block; font-size: 13.5px; }
.s-point span { font-size: 12.5px; color: var(--s-muted); }
.s-section-title { font-size: 13px; font-weight: 700; color: var(--s-ink-2); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 12px; }

/* Choice cards */
.s-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.s-choice { position: relative; border: 1.5px solid var(--s-line-2); border-radius: 14px; padding: 16px; cursor: pointer; transition: all .15s; background: #fff; }
.s-choice:hover { border-color: #9fb8d9; }
.s-choice input { position: absolute; opacity: 0; }
.s-choice .ic { width: 36px; height: 36px; border-radius: 10px; background: #f1f5f9; display: grid; place-items: center; color: var(--s-muted); margin-bottom: 10px; }
.s-choice strong { display: block; font-size: 14px; }
.s-choice span { font-size: 12px; color: var(--s-muted); }
.s-choice .tick { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--s-line-2); display: grid; place-items: center; color: #fff; }
.s-choice .tick svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.s-choice.selected { border-color: var(--s-primary); background: linear-gradient(180deg, #f5faff, #fff); box-shadow: 0 0 0 4px rgba(11,116,209,.10); }
.s-choice.selected .ic { background: var(--s-primary-soft); color: var(--s-primary); }
.s-choice.selected .tick { background: var(--s-primary); border-color: var(--s-primary); }
.s-choice.selected .tick svg { opacity: 1; }
.s-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.s-chips .lbl { font-size: 12px; color: var(--s-muted); font-weight: 600; margin-right: 2px; }
.s-chips button { border: 1px solid var(--s-line-2); background: #fff; border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--s-ink-2); cursor: pointer; transition: all .15s; }
.s-chips button:hover { border-color: var(--s-primary); color: var(--s-primary); background: var(--s-primary-soft); }

/* Gateways */
.s-gw { border: 1.5px solid var(--s-line); border-radius: 16px; margin-bottom: 14px; transition: border-color .2s, box-shadow .2s; background: #fff; }
.s-gw.on { border-color: var(--s-primary); box-shadow: 0 0 0 4px rgba(11,116,209,.08); }
.s-gw-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.s-gw-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; }
.s-gw-head .txt { flex: 1; min-width: 0; }
.s-gw-head strong { display: block; font-size: 14.5px; }
.s-gw-head span { font-size: 12.5px; color: var(--s-muted); }
.s-gw-body { display: none; padding: 0 18px 18px; border-top: 1px dashed var(--s-line); padding-top: 16px; }
.s-gw.on .s-gw-body { display: block; }
.s-switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; cursor: pointer; }
.s-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.s-switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.s-switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s cubic-bezier(.2,.8,.2,1); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.s-switch input:checked + span { background: linear-gradient(135deg, var(--s-primary), var(--s-primary-2)); }
.s-switch input:checked + span::before { transform: translateX(20px); }

/* Password meter */
.s-pw { display: flex; gap: 4px; margin-top: 2px; }
.s-pw i { flex: 1; height: 4px; border-radius: 999px; background: #e8edf5; transition: background .2s; }

/* Review */
.s-review { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.s-rbox { border: 1px solid var(--s-line); border-radius: 14px; padding: 16px 18px; background: linear-gradient(180deg, #fff, #fbfcfe); }
.s-rbox .rh { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.s-rbox .rh .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--s-primary-soft); color: var(--s-primary); display: grid; place-items: center; }
.s-rbox .rh .ic svg { width: 15px; height: 15px; }
.s-rbox .rh strong { flex: 1; font-size: 13.5px; }
.s-rbox .rh a { font-size: 12.5px; font-weight: 600; cursor: pointer; }
.s-rrow { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.s-rrow span:first-child { color: var(--s-muted); }
.s-rrow span:last-child { font-weight: 600; text-align: right; word-break: break-all; }

/* Installing */
.s-progress { list-style: none; margin: 8px 0 0; padding: 0; }
.s-progress li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; font-weight: 550; color: var(--s-muted); transition: all .3s; }
.s-progress li .pi { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #f1f5f9; flex-shrink: 0; }
.s-progress li .pi svg { width: 14px; height: 14px; stroke-width: 3; }
.s-progress li.run { color: var(--s-ink); background: #f8fbff; }
.s-progress li.run .pi { background: var(--s-primary-soft); }
.s-progress li.run .pi .s-spin { width: 14px; height: 14px; border-color: #cfe3fb; border-top-color: var(--s-primary); }
.s-progress li.ok { color: var(--s-ink); }
.s-progress li.ok .pi { background: var(--s-green); color: #fff; }

/* Done */
.s-done { text-align: center; padding: 10px 0 6px; position: relative; }
.s-done .ring { width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #d1fae5 0%, #ecfdf5 60%, transparent 61%); animation: sPop .5s cubic-bezier(.2,1.4,.4,1); }
.s-done .ring span { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #10b981, #059669); color: #fff; display: grid; place-items: center; box-shadow: 0 12px 26px -8px rgba(5,150,105,.6); }
.s-done .ring svg { width: 32px; height: 32px; stroke-width: 3; }
@keyframes sPop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.s-done h1 { font-size: 30px; letter-spacing: -.025em; margin: 0 0 6px; }
.s-done p { color: var(--s-ink-2); margin: 0 auto; max-width: 460px; }
.s-confetti { position: absolute; inset: -40px 0 auto; height: 160px; pointer-events: none; overflow: hidden; }
.s-confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: sFall 1.8s ease-out forwards; }
@keyframes sFall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(170px) rotate(540deg); } }
.s-next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0 8px; }
.s-next .n { border: 1px solid var(--s-line); border-radius: 14px; padding: 14px; text-align: left; background: #fff; }
.s-next .n svg { color: var(--s-primary); width: 20px; height: 20px; margin-bottom: 6px; }
.s-next .n strong { display: block; font-size: 13.5px; }
.s-next .n span { font-size: 12px; color: var(--s-muted); }
.s-code { position: relative; background: #0b1324; color: #e2e8f0; border-radius: 12px; padding: 12px 84px 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; margin-top: 8px; text-align: left; }
.s-code button { position: absolute; right: 8px; top: 8px; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.s-code button:hover { background: rgba(255,255,255,.2); }
pre.s-code { white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 8px 0 0; }
.s-done-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
details.s-more { margin-top: 16px; font-size: 13px; color: var(--s-muted); }
details.s-more summary { cursor: pointer; font-weight: 600; color: var(--s-ink-2); }
details.s-more ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.9; }
.s-copyright { text-align: center; font-size: 12px; color: var(--s-muted); margin-top: 22px; }

/* Responsive */
@media (max-width: 980px) {
  .s-card { grid-template-columns: 1fr; min-height: 0; }
  .s-rail { border-right: 0; border-bottom: 1px solid var(--s-line); padding: 18px; }
  .s-rail h2, .s-rail .sub, .s-help, .s-steps li .d { display: none; }
  .s-meter-label { margin-bottom: 12px; }
  .s-steps { display: flex; gap: 6px; overflow-x: auto; }
  .s-steps li { padding: 4px; margin: 0; }
  .s-steps li .t { display: none; }
  .s-steps li.active .t { display: block; white-space: nowrap; padding-right: 6px; }
  .s-body { padding: 26px 20px 20px; }
  .s-foot { padding: 14px 20px; }
  .s-foot .hint { display: none; }
}
@media (max-width: 640px) {
  .s-shell { padding: 18px 12px; }
  .s-grid, .s-reqs, .s-choices, .s-review, .s-next, .s-hero-points { grid-template-columns: 1fr; }
  .s-head { flex-direction: column; gap: 12px; }
  .s-head h1 { font-size: 23px; }
  .s-top .s-secure { display: none; }
}
.s-note ol strong, .s-note li strong { display: inline; margin: 0; }
.s-note ol li { margin-bottom: 4px; }
