/* SwitchSetup. Based on Homebrew SD Setup by noahc3 (MPL-2.0). */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #06b6d4;
  --brand-soft: #eef2ff;
  --brand-text: #ffffff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --code-bg: #0b1020;
  --code-text: #cbd5e1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f1a;
    --surface: #121829;
    --surface-2: #1a2236;
    --text: #e5e9f2;
    --muted: #8b95ab;
    --line: #253049;
    --brand: #818cf8;
    --brand-2: #22d3ee;
    --brand-soft: #1e2347;
    --brand-text: #0b0f1a;
    --ok: #34d399;
    --ok-soft: #0f2a22;
    --warn: #fbbf24;
    --warn-soft: #2a2212;
    --err: #f87171;
    --err-soft: #2d1515;
    --code-bg: #070a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.badge { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.topnav { display: flex; gap: 6px; }
.topnav a, .navbtn {
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 8px;
  background: none; border: 0; cursor: pointer;
}
.topnav a:hover, .navbtn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* Hero */
.hero {
  background:
    radial-gradient(900px 300px at 10% -10%, color-mix(in srgb, var(--brand-2) 22%, transparent), transparent 70%),
    radial-gradient(800px 300px at 90% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%);
  padding: 44px 0 30px;
}
.hero h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 10px; font-weight: 750; }
.hero p { margin: 0; max-width: 640px; color: var(--muted); font-size: 16.5px; }
.howto { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 22px 0 0; font-weight: 500; font-size: 14px; }
.howto li { display: flex; align-items: center; gap: 8px; }
.howto span {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; font-size: 12px; font-weight: 700;
}

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; padding-bottom: 40px; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } .side-col { order: -1; } }
.main-col { display: grid; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel h2 { font-size: 16px; margin: 0; font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sticky { position: sticky; top: 80px; display: grid; gap: 16px; }
@media (max-width: 920px) { .sticky { position: static; } }

/* Presets */
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.preset {
  text-align: left; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: inherit; cursor: pointer; font: inherit; transition: border-color .15s, background .15s;
}
.preset:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.preset strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.preset span { color: var(--muted); font-size: 13px; }
.preset[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); }
.preset.special { border-style: dashed; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.search { position: relative; flex: 1 1 220px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; font: inherit; padding: 9px 12px 9px 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: inherit; outline: none;
}
.search input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Package list */
.cat-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 2px 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.pkg {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.pkg:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.pkg.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); }
.pkg.locked { cursor: default; }
.pkg-title { font-weight: 650; font-size: 14.5px; }
.pkg-by { color: var(--muted); font-size: 12.5px; }
.pkg-desc { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; margin: 0; }
.pkg-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill a { color: inherit; }
.pill.req { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.inst { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.upd { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.pill.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Toggle */
.toggle { position: relative; width: 40px; height: 24px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.toggle span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.toggle input:checked + span { background: var(--brand); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:disabled + span { opacity: .55; }
.toggle input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }

.io-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: filter .15s, background .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--brand-2))); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-quiet { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-quiet:hover { background: var(--line); }
.btn-block { width: 100%; padding: 13px; font-size: 15.5px; }
.textbtn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--brand); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 4px; }

/* Sidebar */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 7px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }

.card-status { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.card-row { display: flex; gap: 10px; align-items: flex-start; }
.card-icon { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.card-name { font-weight: 650; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-status select {
  width: 100%; margin-top: 10px; font: inherit; font-size: 13.5px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: inherit;
}
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter div { height: 100%; background: var(--brand); }
.note { margin-top: 10px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.err { background: var(--err-soft); color: var(--err); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; animation: pulse 1.4s infinite; margin-right: 6px; }
@keyframes pulse { 50% { opacity: .3; } }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--brand); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }

.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.totals div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.totals dt { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.totals dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Dialogs */
.dlg { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(5, 8, 20, .55); backdrop-filter: blur(3px); }
.dlg-body { padding: 26px; }
.dlg h3 { margin: 0 0 12px; font-size: 20px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 14px 0 16px; }
#bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .4s; }
.phases { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 14px; }
.phases li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.phases li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.phases li.active { color: var(--text); font-weight: 600; }
.phases li.active::before { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.phases li.done { color: var(--text); }
.phases li.done::before { background: var(--ok); border-color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
pre#log { background: var(--code-bg); color: var(--code-text); border-radius: 10px; padding: 12px; max-height: 220px; overflow: auto; font-size: 12px; margin: 8px 0 0; white-space: pre-wrap; }
.result-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px; }
.result-icon.ok { background: var(--ok-soft); color: var(--ok); }
.result-icon.bad { background: var(--err-soft); color: var(--err); }
.next { padding-left: 20px; margin: 10px 0; }
.next li { margin: 6px 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.credit-list { columns: 2; padding-left: 18px; font-size: 14px; }

/* Support */
.support-btn { color: #db2777 !important; display: inline-flex; align-items: center; gap: 6px; }
.support-btn:hover { background: color-mix(in srgb, #db2777 12%, transparent) !important; }
.support-hero { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; color: #fff; background: linear-gradient(135deg, #f472b6, #db2777); }
.support-links { display: grid; gap: 8px; margin: 16px 0; }
.support-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; color: var(--text);
}
a.support-link:hover { border-color: #db2777; text-decoration: none; }
.support-link small { display: block; color: var(--muted); font-size: 12.5px; }
.support-link .go { font-weight: 600; color: #db2777; white-space: nowrap; }
.support-link.soon { opacity: .6; }
.support-link.soon .go { color: var(--muted); font-weight: 500; }
.support-nudge { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, #db2777 9%, var(--surface)); font-size: 13.5px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 24px 0 36px; color: var(--muted); font-size: 13px; }
.footer p { margin: 4px 0; }
.disclaimer { opacity: .8; font-size: 12px; margin-top: 10px !important; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Web builder additions ---- */
.pick-card { width: 100%; margin-top: 10px; }
.steps-mini { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.steps-mini li { margin: 2px 0; }
.app-promo { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.app-promo a { font-weight: 600; }
.grow { flex: 1; min-width: 0; }

/* Opt-in package warning */
.confirm-text { white-space: pre-line; }
