/* Connect wizard, invitation acceptance and the invitation controls in
   settings.

   Owned by the connect workstream. Every colour is a custom property from
   app.css so light and dark mode both work; nothing here is hard-coded. All
   new class names are prefixed `cw-` so they cannot collide with the shared
   design system or another workstream's stylesheet.

   The invitation styles live here rather than in a file of their own because
   this is the only stylesheet this workstream owns and index.html already
   links it. */

/* ---------- shared bits ---------- */

.cw-pill-neutral {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line-strong);
}

.cw-mono {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

/* An honest aside: something the reader needs to know before choosing, not a
   warning and not an error. */
.cw-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.cw-facts {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.cw-facts > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.cw-facts dt {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.cw-facts dd {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  word-break: break-word;
}

.cw-copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- dialog ---------- */

.cw-dialog { width: min(640px, 100%); }

.cw-heading { display: grid; gap: 3px; }

.cw-body { display: block; }

.cw-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.cw-progress-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}

.cw-progress-step b {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
}

.cw-progress-step.done b {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.cw-progress-step.on {
  color: var(--ink);
  font-weight: 650;
}

.cw-progress-step.on b {
  border-color: var(--accent);
  background: var(--accent);
  /* --bg is light in light mode and dark in dark mode, so the numeral stays
     readable on the accent in both. */
  color: var(--bg);
}

/* ---------- provider choice ---------- */

.cw-choices {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cw-choice {
  display: grid;
  gap: 6px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 14px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.cw-choice:hover { border-color: var(--accent); }
.cw-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cw-choice.on { border-color: var(--accent); background: var(--accent-soft); }

.cw-choice-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cw-choice-head strong { font-size: 14px; }
.cw-choice p { line-height: 1.5; }

/* ---------- access mode ---------- */

.cw-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cw-fieldset legend { padding: 0; margin-bottom: 4px; }

.cw-mode {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  cursor: pointer;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.cw-mode:hover { border-color: var(--accent); }
.cw-mode:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.cw-mode input {
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.cw-mode-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cw-mode-title strong { font-size: 13px; }
.cw-mode p { line-height: 1.5; margin-top: 3px; }

/* ---------- details ---------- */

.cw-form { margin-top: 14px; }

.cw-regions {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-2);
}

.cw-region-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px 12px;
}

.cw-region {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-2);
}

.cw-region input {
  margin: 0;
  accent-color: var(--accent);
}

.cw-region-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.cw-region-add input { flex: 1; }
.cw-region-add .btn { flex: none; }

/* ---------- role setup ---------- */

.cw-value-block {
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.cw-value-block .cw-mono {
  display: block;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
}

.cw-code {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  margin: 9px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  overflow-x: auto;
  white-space: pre;
}

.cw-steps { margin: 18px 0 0; }

/* ---------- test results ---------- */

.cw-test-result:not(:empty) {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cw-test-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.cw-checks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.cw-check {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.cw-check .pill { justify-self: start; }
.cw-check strong { font-size: 13px; }
.cw-check p { line-height: 1.5; margin-top: 2px; }

/* ---------- invitations (settings) ---------- */

.cw-invites { margin-top: 4px; }

.cw-invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
}

.cw-invite-list {
  display: grid;
  gap: 10px;
}

.cw-invite {
  display: grid;
  gap: 9px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.cw-invite-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.cw-invite-head strong { font-size: 13px; }

.cw-invite-link {
  flex: 1;
  min-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-2);
}

/* ---------- accept invitation ---------- */

.cw-accept {
  width: min(520px, 100%);
  margin: 48px auto;
}

.cw-accept h1 { margin: 4px 0 8px; }

.cw-accept-form { margin-top: 20px; }

.cw-accept-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- narrow screens ---------- */

@media (max-width: 620px) {
  .cw-invite-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cw-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cw-check { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .cw-accept { margin: 24px auto; }
}
