/* ==================================================================
   Installer — a single-purpose page, so it carries its own layout
   ================================================================== */

body.install {
  padding: 0;
  background:
    radial-gradient(100% 60% at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--bg);
  min-height: 100vh;
}

.install-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-4);
}
.install-head .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.install-head .brand-mark svg { width: 20px; height: 20px; }
.install-head strong { display: block; font-size: var(--text-md); letter-spacing: -0.02em; }
.install-head small {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

/* ---- Step rail ---------------------------------------------------- */
.steps {
  display: flex;
  gap: var(--s-1);
  list-style: none;
  max-width: 44rem;
  margin: 0 auto var(--s-5);
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }

.steps li {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1;
  min-width: 0;
  padding: var(--s-2) var(--s-2) var(--s-3);
  border-bottom: 2px solid var(--line);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color var(--t-base), border-color var(--t-base);
}
.steps li > span {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  transition: background var(--t-base), color var(--t-base);
}
.steps li > b { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; }

.steps li.active { color: var(--ink); border-bottom-color: var(--accent); }
.steps li.active > span { background: var(--accent); color: #fff; }

.steps li.done { color: var(--ok); border-bottom-color: var(--ok); }
.steps li.done > span { background: var(--ok); color: transparent; }
/* The tick covers the number rather than replacing it, so the circle keeps
   its size and nothing shifts as steps complete. */
.steps li.done > span::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
}

/* Five labelled steps do not fit on a phone. Collapse to circles and let
   only the step you are on carry its name. */
@media (max-width: 559px) {
  .steps { gap: var(--s-2); }
  .steps li { flex: 0 0 auto; }
  .steps li > b { display: none; }
  .steps li.active { flex: 1 1 auto; }
  .steps li.active > b { display: block; }
}

/* ---- Panels --------------------------------------------------------- */
.install-body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 var(--gutter) var(--s-16);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s-6) var(--s-5);
  box-shadow: var(--shadow-md);
  animation: panel-in var(--t-slow) var(--ease-out) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.panel h1 { font-size: var(--text-xl); margin-bottom: var(--s-2); }
.panel .lede { color: var(--ink-2); margin-bottom: var(--s-5); }
.panel code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.actions .spacer { flex: 1; }

/* On a phone the row wraps and strands the primary button off to one side.
   Give it the full width on its own line instead, and keep it at the bottom
   where a thumb already is. */
@media (max-width: 479px) {
  .actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-2);
  }
  .actions .spacer { display: none; }
  .actions > .btn.primary { grid-column: 1 / -1; }
}

.pair { display: flex; gap: var(--s-3); }

/* ---- Checklist -------------------------------------------------------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.checklist li:last-child { border-bottom: 0; }
.checklist .mark {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.checklist li.ok   .mark { background: var(--ok); }
.checklist li.bad  .mark { background: var(--bad); }
.checklist li.warn .mark { background: var(--warn); }
.checklist strong { display: block; font-size: var(--text-base); font-weight: 600; }
.checklist small { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.checklist .fix {
  margin: var(--s-2) 0 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}
.checklist li.bad .fix { background: var(--bad-soft); color: var(--bad); }

/* ---- Inline results ---------------------------------------------------- */
.result {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  animation: panel-in var(--t-base) var(--ease-out) both;
}
.result.ok   { background: var(--ok-soft);   color: var(--ok); }
.result.bad  { background: var(--bad-soft);  color: var(--bad); }
.result.warn { background: var(--warn-soft); color: var(--warn); }
.result strong { display: block; margin-bottom: 2px; }
.result .row { margin-top: var(--s-3); }

/* ---- Import progress ------------------------------------------------------ */
.progress-block { margin: var(--s-5) 0; }
.progress-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  margin-top: var(--s-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.progress-line b { font-size: var(--text-lg); color: var(--ink); }

.log {
  max-height: 11rem;
  overflow-y: auto;
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--ink-2);
}
.log div { white-space: pre-wrap; }
.log .ok { color: var(--ok); }
.log .bad { color: var(--bad); }

/* ---- Fields ---------------------------------------------------------------- */
.reveal-field { display: flex; gap: var(--s-2); align-items: stretch; }
.reveal-field .input { flex: 1; }
.reveal-field .btn { flex-shrink: 0; min-width: 4.5rem; }

.advanced {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
}
.advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--ink-2);
  list-style-position: inside;
}
.advanced[open] > summary { margin-bottom: var(--s-2); }

.switch {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  cursor: pointer;
  padding: var(--s-2) 0;
}
.switch input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.switch strong { display: block; font-size: var(--text-sm); font-weight: 600; }
.switch small { display: block; color: var(--ink-3); font-size: var(--text-xs); line-height: var(--leading-snug); }

/* Password strength shares the meter component, with its own colouring. */
#pw-bar { background: var(--bad); }
#pw-bar.fair { background: var(--warn); }
#pw-bar.good { background: var(--ok); }

/* ---- Done ------------------------------------------------------------------- */
.done { text-align: center; margin-bottom: var(--s-5); }
.done-mark {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto var(--s-4);
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  animation: pop-in 520ms var(--ease-spring) both;
}
.done-mark svg { width: 30px; height: 30px; }

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}
