/* hyperdrako panel. Flat and neutral: Tailwind's zinc scale, 1px borders, small shadows, one solid primary colour.
   Light by default; dark follows the system (or [data-theme="dark"]). */
:root {
  --bg: #fafafa;                 /* zinc-50 */
  --surface: #ffffff;
  --surface-2: #f4f4f5;          /* zinc-100 */
  --surface-3: #e4e4e7;          /* zinc-200 */
  --border: #e4e4e7;             /* zinc-200 */
  --border-strong: #d4d4d8;      /* zinc-300 */
  --text: #18181b;               /* zinc-900 */
  --muted: #71717a;              /* zinc-500 */
  --faint: #a1a1aa;              /* zinc-400 */
  --primary: #18181b;            /* zinc-900 */
  --primary-hover: #27272a;      /* zinc-800 */
  --on-primary: #fafafa;
  --ring: #a1a1aa;               /* zinc-400 */
  --ok: #16a34a;                 /* green-600 */
  --ok-bg: #f0fdf4;  --ok-border: #bbf7d0;
  --warn: #b45309;               /* amber-700 */
  --warn-bg: #fffbeb; --warn-border: #fde68a;
  --err: #dc2626;                /* red-600 */
  --err-bg: #fef2f2;  --err-border: #fecaca;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b; --surface: #0f0f12; --surface-2: #18181b; --surface-3: #27272a;
    --border: #27272a; --border-strong: #3f3f46; --text: #fafafa; --muted: #a1a1aa; --faint: #71717a;
    --primary: #fafafa; --primary-hover: #e4e4e7; --on-primary: #18181b; --ring: #52525b;
    --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .08); --ok-border: rgba(34, 197, 94, .25);
    --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .08); --warn-border: rgba(245, 158, 11, .25);
    --err: #f87171; --err-bg: rgba(239, 68, 68, .08); --err-border: rgba(239, 68, 68, .25);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 25px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090b; --surface: #0f0f12; --surface-2: #18181b; --surface-3: #27272a;
  --border: #27272a; --border-strong: #3f3f46; --text: #fafafa; --muted: #a1a1aa; --faint: #71717a;
  --primary: #fafafa; --primary-hover: #e4e4e7; --on-primary: #18181b; --ring: #52525b;
  --ok: #4ade80; --ok-bg: rgba(34, 197, 94, .08); --ok-border: rgba(34, 197, 94, .25);
  --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .08); --warn-border: rgba(245, 158, 11, .25);
  --err: #f87171; --err-bg: rgba(239, 68, 68, .08); --err-border: rgba(239, 68, 68, .25);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 25px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
code, .mono { font-family: var(--mono); font-size: .9em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 12px 24px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-mark { width: 20px; height: 20px; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand-name b { font-weight: 600; }
.conn { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); white-space: nowrap; color: var(--muted); font-size: 12.5px;
}
.pill strong { color: var(--text); font-weight: 500; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.battery { display: inline-block; width: 16px; height: 8px; border: 1px solid currentColor; border-radius: 2px; position: relative; color: var(--muted); }
.battery::after { content: ""; position: absolute; right: -3px; top: 2px; width: 1.5px; height: 2px; background: currentColor; }
.battery i { position: absolute; inset: 1px; right: auto; border-radius: 1px; background: var(--muted); }
.battery.low i { background: var(--err); }

.profiles { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.tabs { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; margin-top: 8px; }
.tabs a { position: relative; padding: 8px 8px 11px; color: var(--muted); font-weight: 500; font-size: 13.5px; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-selected="true"] { color: var(--text); }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--text); }

.demo-banner {
  max-width: 912px; margin: 16px auto 0; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); width: calc(100% - 48px);
}

/* ---------- layout */
.view { max-width: 960px; margin: 0 auto; padding: 28px 24px 40px; outline: none; }
.foot { max-width: 960px; margin: 0 auto; padding: 0 24px 40px; color: var(--faint); font-size: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 64ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px 2px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card-head .tag { margin-left: auto; }
.card-sub { padding: 0 20px 12px; margin: 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 4px 20px 18px; }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.tag.accent { color: var(--text); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.tag.err { background: var(--err-bg); color: var(--err); border-color: var(--err-border); }

/* ---------- setting rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); }
.row.wide { grid-template-columns: 1fr; }
.row-label { min-width: 0; }
.row-label .name { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-label .help { color: var(--muted); font-size: 13px; margin-top: 1px; }
.row-label .note { color: var(--faint); font-size: 12px; margin-top: 2px; font-family: var(--mono); }
.row-ctl { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
.row.wide .row-ctl { justify-content: flex-start; }
.save-state { width: 14px; height: 14px; flex: none; display: inline-grid; place-items: center; }
.save-state.saving::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--border-strong); border-top-color: var(--text); animation: spin .7s linear infinite; }
.save-state.saved::before { content: "✓"; color: var(--ok); font-weight: 600; font-size: 12px; animation: fade 2s forwards; }
.save-state.failed::before { content: "!"; color: var(--err); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- controls */
.switch {
  position: relative; width: 36px; height: 20px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; flex: none;
  background: var(--surface-3); transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--on-primary); }
.switch:disabled { opacity: .5; cursor: default; }
.field-pair { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
  padding: 4px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg.small button { padding: 3px 8px; font-size: 12.5px; }

.select, .input {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); height: 34px; padding: 0 10px; min-width: 0; box-shadow: var(--shadow-sm);
}
.select { padding-right: 30px; appearance: none; cursor: pointer; max-width: 100%;
  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='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 10px center; background-repeat: no-repeat; }
.select:focus, .input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.input.num { width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
.input.invalid { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-bg); }
.unit { color: var(--muted); font-size: 13px; }
.input-unit { display: inline-flex; align-items: center; gap: 6px; }

.range { display: inline-flex; align-items: center; gap: 12px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 170px; height: 4px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, var(--primary) 0 var(--fill, 50%), var(--surface-3) var(--fill, 50%) 100%);   /* the filled part of the track */
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--primary); box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: #fff; background: #dc2626; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.big { height: 38px; padding: 0 18px; font-size: 14px; }

/* ---------- DPI stages */
.dpi { padding: 4px 20px 18px; }
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.stage { position: relative; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 10px 12px; cursor: pointer; transition: border-color .15s; }
.stage:hover { border-color: var(--border-strong); }
.stage.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.stage .idx { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.stage.active .idx span { color: var(--text); font-size: 11px; }
.stage .val { display: flex; align-items: baseline; gap: 4px; margin-top: 2px; }
.stage input {
  width: 6.5ch; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 20px; font-weight: 600;
  letter-spacing: -.02em; padding: 0; font-variant-numeric: tabular-nums; border-bottom: 1px dashed transparent;
}
.stage input:hover { border-bottom-color: var(--border-strong); }
.stage input:focus { outline: none; border-bottom-color: var(--text); }
.stage input.invalid { color: var(--err); }
.stage .xy { display: grid; grid-template-columns: auto 1fr; gap: 0 6px; align-items: baseline; justify-content: start; }
.stage .xy span { font-size: 11px; color: var(--muted); font-weight: 500; }
.stage .xy input { font-size: 16px; width: 6.5ch; }
.stage .rm { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.stage .rm:hover { color: var(--err); background: var(--err-bg); }
.stage.add { display: grid; place-items: center; color: var(--muted); border-style: dashed; min-height: 64px; font: inherit; font-weight: 500; font-size: 13px; background: transparent; }
.stage.add:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.dpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }

/* ---------- multi (debounce) */
.multi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: 100%; }
.multi label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.multi .input { width: 100%; text-align: left; }
.multi-foot { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }

/* ---------- collapsible advanced */
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 14px 20px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary:hover { background: var(--surface-2); }
details.card > summary h2 { margin: 0; font-size: 15px; font-weight: 600; }
details.card > summary .chev { margin-left: auto; transition: transform .2s; color: var(--muted); display: inline-flex; }
details.card[open] > summary .chev { transform: rotate(90deg); }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
details.card .rows .row:first-child { border-top: 0; }

/* ---------- empty / connection states */
.empty { text-align: center; padding: 48px 24px; }
.empty .glyph { width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.empty .glyph svg { width: 22px; height: 22px; }
.empty h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 52ch; }
.skeleton { height: 44px; margin: 0 20px 10px; border-radius: 6px; background: var(--surface-2); animation: pulse 1.4s ease-in-out infinite; }

.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); margin-bottom: 16px; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.callout.err { background: var(--err-bg); border-color: var(--err-border); }
.callout.ok { background: var(--ok-bg); border-color: var(--ok-border); }
.callout .grow { flex: 1; min-width: 0; }
.callout b { display: block; margin-bottom: 2px; font-weight: 600; }
.callout p { margin: 0; color: var(--muted); }

/* ---------- presets */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.preset { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.preset h3 { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.preset .kv { display: flex; flex-wrap: wrap; gap: 6px; }
.preset .kv span { font-size: 12px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; border: 1px solid var(--border); }
.preset .kv span b { color: var(--text); font-weight: 500; }
.preset .actions { margin-top: auto; }
.save-form { display: flex; gap: 8px; flex-wrap: wrap; }
.save-form .input { flex: 1; min-width: 160px; }

.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff td { padding: 7px 0; border-top: 1px solid var(--border); vertical-align: top; }
.diff td:first-child { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-right: 14px; white-space: nowrap; }
.diff tr.change td:last-child { color: var(--text); }
.diff tr.same td:last-child, .diff tr.skip td:last-child { color: var(--faint); }
.diff tr.fail td:last-child { color: var(--err); }

/* ---------- install */
.targets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.target {
  text-align: left; font: inherit; color: var(--text); cursor: pointer; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); transition: border-color .15s;
}
.target:hover { border-color: var(--border-strong); }
.target[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.target .t-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); margin-bottom: 8px; }
.target .t-icon svg { width: 18px; height: 18px; }
.target .t-name { font-weight: 600; font-size: 14px; }
.target .t-sub { color: var(--muted); font-size: 13px; }
.target code { color: var(--faint); font-size: 11.5px; word-break: break-all; margin-top: 2px; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--border); }
.checks .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; margin-top: 1px; border: 1px solid; }
.checks .ic.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.checks .ic.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.checks .ic.err { background: var(--err-bg); color: var(--err); border-color: var(--err-border); }
.checks .t { font-weight: 500; }
.checks .grow { flex: 1; min-width: 0; }
.checks li > .btn { flex: none; align-self: center; }
.checks .s { color: var(--muted); font-size: 13px; }
.checks code.rule { display: block; margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 12px; word-break: break-all; user-select: all; }

.go { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.go .opts { display: flex; gap: 20px; flex-wrap: wrap; }
.go label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

.steps { list-style: none; margin: 0; padding: 8px 20px 16px; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: center; padding: 7px 0; color: var(--faint); }
.steps .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; background: var(--surface); border: 1px solid var(--border-strong); color: var(--muted); }
.steps li.now { color: var(--text); font-weight: 500; }
.steps li.now .n { border-color: var(--primary); color: var(--text); animation: pulse 1.4s infinite; }
.steps li.done { color: var(--muted); }
.steps li.done .n { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.steps li.bad .n { background: var(--err-bg); border-color: var(--err-border); color: var(--err); }
.bar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 4px 20px 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s; }

.log { margin: 0; padding: 12px 16px; max-height: 320px; overflow: auto; background: var(--surface-2); border-top: 1px solid var(--border); font: 12px/1.6 var(--mono); color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.log .live { color: var(--text); }
details.log-wrap > summary { cursor: pointer; padding: 10px 20px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
details.log-wrap > summary:hover { color: var(--text); }

/* ---------- dialog + toasts */
.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dialog .d-body { padding: 20px 24px 8px; max-height: 70vh; overflow: auto; }
.dialog h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.dialog p { color: var(--muted); margin: 0 0 12px; }
.dialog ul { color: var(--muted); padding-left: 18px; margin: 0 0 14px; }
.dialog li { margin: 4px 0; }
.dialog .d-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; }
.dialog .confirm-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.dialog .diff-note { margin: 12px 0 0; font-size: 13px; }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; width: min(420px, calc(100vw - 40px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); max-width: 100%; animation: rise .18s ease-out; }
.toast .dot { margin-top: 7px; }
.toast.out { opacity: 0; transform: translateY(4px); transition: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.actions.center, .center { justify-content: center; text-align: center; }

/* ---------- small screens */
@media (max-width: 720px) {
  .topbar-inner { padding: 12px 16px 0; gap: 10px; }
  .conn { order: 3; width: 100%; }
  .tabs { padding: 0 8px; }
  .view { padding: 20px 16px 32px; }
  .foot { padding: 0 16px 32px; }
  .demo-banner { width: calc(100% - 32px); }
  .row { grid-template-columns: 1fr; padding: 14px 16px; }
  .row-ctl { justify-content: flex-start; }
  .row.inline { grid-template-columns: minmax(0, 1fr) auto; }
  .seg { flex-wrap: wrap; }
  .card-head, .card-sub, .card-body, .dpi { padding-left: 16px; padding-right: 16px; }
  .targets { grid-template-columns: 1fr; }
  .multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  input[type="range"] { width: 130px; }
  .toasts { right: 16px; left: 16px; width: auto; }
}

/* ---------- install: drop zone, backups, danger zone */
.card.drop.over { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.backups { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.danger-row .t { font-weight: 500; }
.danger-row .s { color: var(--muted); font-size: 13px; }
.btn.outline-danger { color: var(--err); border-color: var(--err-border); }
.btn.outline-danger:hover { background: var(--err-bg); }
.preset .card-sub { padding: 0; margin: 0; }
