/* Account pages on top of steps.app's style.css (static/steps/style.css, vendored unchanged - see `make sync-style`).
   Only uses the site's variables (--accent, --text, --card-background, ...) so the look follows the website. */

body {
  min-height: 100vh;
}
/* style.css colors only its own components, so links in our prose would be the browser's blue/purple. */
.account-main a:not(.nav-link):not(.btn):not(.row-link):not(.signin-official),
.account-narrow a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 2px;
}
.account-main a:hover,
.account-narrow a:hover {
  text-decoration-color: var(--accent);
}
/* Browsers don't let form controls inherit the font by default. */
button,
input {
  font-family: inherit;
}

/* ---------- navbar: logo · feature links · sign out ---------- */
.account-nav {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-link:hover {
  color: var(--text);
  background: var(--card-background);
}
.nav-link.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.navbar__right form {
  margin: 0;
}
@media (max-width: 1000px) {
  /* style.css switches to a burger menu here; we keep the few links inline in a second row instead. */
  .navbar__inner {
    grid-template-columns: 1fr auto;
    row-gap: 8px;
  }
  .account-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }
}

/* ---------- layout ---------- */
.account-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  gap: 20px;
}
@media (max-width: 768px) {
  .account-main {
    padding: 20px 16px 60px;
  }
}
.account-narrow {
  width: 100%;
  max-width: 440px;
  margin: 4vh auto 0;
  display: grid;
  gap: 20px;
}
.account-main h1 {
  max-width: none;
}

/* ---------- cards (same surface as the website's cards) ---------- */
.card {
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
}
.card p,
.account-main p {
  max-width: none;
  font-size: 1rem;
}
.note {
  color: var(--muted);
  font-size: 0.9rem !important;
  margin: 0;
}
.card .note {
  margin-top: 18px;
}
.muted {
  color: var(--muted);
}

/* ---------- forms ---------- */
.form {
  display: grid;
  gap: 6px;
}
.form label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 550;
  margin-top: 10px;
}
.form input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Full-width pill buttons; <button> takes its colors from style.css, links get the same look. */
.btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
a.btn:hover {
  transform: translateY(-1px);
}
/* Official Apple / Google sign-in buttons (images, see auth/templates.py), same size, centered. */
.signin-providers {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 16px;
}
.signin-official {
  display: block;
  line-height: 0;
  border-radius: 999px;
  transition: transform 0.2s ease;
}
.signin-official:hover {
  transform: translateY(-1px);
}
.signin-official:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.signin-official img {
  width: 180px;
  height: 40px;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 22px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--card-border);
}
.alert {
  background: color-mix(in srgb, #ff3b30 18%, transparent);
  border: 1px solid color-mix(in srgb, #ff3b30 45%, transparent);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* ---------- overview ---------- */
.account-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.tile {
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.tile p {
  margin: 6px 0 0;
}

/* ---------- lists ---------- */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rows li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--card-border);
}
.rows li:first-child {
  padding-top: 0;
}
.rows li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.rows li > div {
  display: grid;
  gap: 2px;
}
.rows .row-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
/* A long name must wrap rather than widen the row: body has overflow-x: hidden, so anything past the
   viewport is cut off for good instead of scrollable. */
.rows li > div {
  min-width: 0;
}
.rows strong {
  overflow-wrap: anywhere;
}
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}

/* ---------- challenge admin (bd #846) ---------- */
.form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.form input:disabled,
.form textarea:disabled {
  opacity: 0.6;
}
.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.search-row input {
  flex: 1;
  min-width: 0;
}
.search-row--inline {
  margin: 12px 0 18px;
}
.btn-inline,
.btn-small {
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}
.btn-inline {
  padding: 13px 22px;
  font-size: 1rem;
}
.btn-small {
  padding: 7px 14px;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-small:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  color: var(--text);
  transform: none;
}
.btn-small--danger {
  background: transparent;
  border-color: color-mix(in srgb, #ff3b30 45%, transparent);
  color: #ff8178;
}
.btn-small--danger:hover {
  background: color-mix(in srgb, #ff3b30 26%, transparent);
  border-color: color-mix(in srgb, #ff3b30 75%, transparent);
  color: var(--text);
}
form.inline {
  display: inline;
  margin: 0;
}
.row-link {
  display: grid;
  gap: 2px;
  color: inherit;
  text-decoration: none;
}
.row-link:hover strong {
  color: var(--accent);
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.badge--accent {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}
.pill--finalized,
.pill--archived,
.pill--canceled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.pill--pending,
.pill--draft {
  background: color-mix(in srgb, #ffcc00 18%, transparent);
  color: #ffd84d;
}
.ok {
  background: color-mix(in srgb, #34c759 16%, transparent);
  border: 1px solid color-mix(in srgb, #34c759 45%, transparent);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
}
.crumbs {
  margin: 0;
}
.crumbs a,
.pager a {
  color: var(--text-secondary);
  text-decoration: none;
}
.crumbs a:hover,
.pager a:hover {
  color: var(--accent);
}
.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}
.card--danger {
  border-color: color-mix(in srgb, #ff3b30 35%, var(--card-border));
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0 16px;
  color: var(--text-secondary);
}
.check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.check span {
  min-width: 0;
}
.card h3 {
  margin-top: 0;
}

/* ---------- section headings: title left, count right, room before the rows ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}
.section-head .muted {
  font-size: 1rem;
  font-weight: 600;
}
.section-head h3 {
  margin: 0;
}
.account-main > .section-head {
  margin: 10px 2px -6px;
}
.note--top {
  margin: -6px 0 14px;
}

/* ---------- challenge rows ---------- */
.group-title {
  margin: 20px 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card > .group-title:first-child {
  margin-top: 0;
}
/* The last row of a group loses its bottom padding, so the next group title brings its own. */
.rows + .group-title {
  margin-top: 26px;
}
.rows li .row-link {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}
.row-link strong {
  transition: color 0.15s ease;
}
.rows li:has(> .row-link):hover {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 12px;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 7%, transparent);
}
.row-count {
  white-space: nowrap;
}

/* ---------- overview: the numbers at the top ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  padding: 20px 24px;
}
.stat {
  display: grid;
  gap: 2px;
}
.stat__number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat__label {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- facts: the Admins line takes the whole width instead of one ragged cell ---------- */
.facts-wide {
  grid-column: 1 / -1;
}

/* ---------- cards with one action on the right (export) ---------- */
.row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.row-card h3 {
  margin: 0 0 6px;
}
.row-card .note {
  margin: 0;
}

/* ---------- the collapsed name/description editor ---------- */
details.editor {
  padding: 0;
}
details.editor > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  cursor: pointer;
  list-style: none;
  border-radius: 24px;
}
details.editor > summary::-webkit-details-marker {
  display: none;
}
.editor__title {
  font-size: 1.15rem;
  font-weight: 650;
}
.editor__hint {
  color: var(--muted);
  font-size: 0.9rem;
}
.editor__hint::after {
  content: " ▾";
}
details.editor[open] .editor__hint::after {
  content: " ▴";
}
details.editor[open] > summary {
  border-bottom: 1px solid var(--card-border);
  border-radius: 24px 24px 0 0;
}
details.editor > summary:hover .editor__hint {
  color: var(--accent);
}
details.editor .form {
  padding: 4px 24px 24px;
}

/* ---------- two-step action (no JavaScript): the button opens the real one ---------- */
details.confirm {
  position: relative;
  display: inline-block;
}
details.confirm > summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}
details.confirm > summary::-webkit-details-marker {
  display: none;
}
.confirm__body {
  position: absolute;
  right: 0;
  z-index: 2;
  width: min(280px, calc(100vw - 48px));
  margin-top: 8px;
  padding: 14px 16px;
  text-align: left;
  background: #10181c;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.confirm__body .note {
  margin: 0 0 12px;
}
details.confirm[open] > summary {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  color: var(--text);
}
/* An open danger confirmation keeps its own colour instead of turning accent. */
details.confirm[open] > summary.btn-small--danger {
  background: color-mix(in srgb, #ff3b30 26%, transparent);
  border-color: color-mix(in srgb, #ff3b30 75%, transparent);
}

/* ---------- empty states ---------- */
.empty p {
  margin: 0;
}
.empty .note {
  margin-top: 8px;
}
.clear-search {
  white-space: nowrap;
  font-size: 0.9rem;
}
.search-card label {
  margin-top: 0;
}

/* ---------- phones: the actions sit under the name instead of squeezing it ---------- */
@media (max-width: 560px) {
  .rows li {
    align-items: flex-start;
  }
  .rows .row-end {
    width: 100%;
    justify-content: flex-start;
  }
  /* A challenge row too: the name gets the full width, the pill and the count sit under it. */
  .rows li .row-link {
    flex: 1 1 100%;
    padding-right: 0;
  }
  /* No room to float a panel next to a button on a phone: it sits under the row instead, where it
     cannot be cut off by the page's hidden horizontal overflow. */
  .rows .row-end details.confirm {
    width: 100%;
  }
  .confirm__body {
    position: static;
    width: auto;
    margin-top: 10px;
    box-shadow: none;
  }
  details.editor > summary,
  .stats {
    padding: 18px;
  }
  .card {
    padding: 18px;
  }
}

/* ---------- invite link: the link on the left, its QR on the right ---------- */
.invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.invite-card__text {
  min-width: 0;
  flex: 1 1 260px;
}
.invite-card h3 {
  margin: 0 0 6px;
}
.invite-url {
  display: inline-block;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.invite-url.is-off {
  color: var(--muted);
  text-decoration: line-through;
}
.invite-card__qr {
  flex: none;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  line-height: 0;
}
.qr {
  display: block;
}

/* ---------- a choice of radio buttons (who can post in the chat) ---------- */
.choice {
  margin: 14px 0 4px;
  padding: 0;
  border: 0;
}
.choice legend {
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 550;
}
.choice .check {
  margin: 8px 0 0;
  align-items: center;
}
.choice input[type="radio"] {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.form input[type="number"] {
  max-width: 220px;
}
/* A switch under a set of radios is about them, not one more of them. */
.check--sep {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
}

/* A team heading carries its own member count; the dot keeps "MARKETING 6" from reading as one word. */
.group-title .muted {
  margin-left: 7px;
  letter-spacing: normal;
  font-weight: 600;
}
.group-title .muted::before {
  content: "· ";
}
