/* ==========================================================================
   Display name: the post-sign-in prompt and the settings surface.

   Two related surfaces, one stylesheet:

   1. A prompt shown once, right after sign-in or registration, when the account
      has no name yet. It is a step in a flow, not a modal to dismiss — but it IS
      skippable, because blocking a paying customer behind a cosmetic field would
      be indefensible.

   2. A settings panel where the name can be changed later.

   Reuses the account panel's glass and control sizing rather than introducing a
   third visual language: same 48px primary control, same recessed input wells,
   same indigo accent.
   ========================================================================== */

/* ---------- the name step ---------- */

.name-step {
  display: grid;
  gap: 14px;
}

.name-step-head {
  display: grid;
  gap: 5px;
}

.name-step-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
  margin: 0;
}

.name-step-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  margin: 0;
}

/* The field itself. Sized to the same 48px as the primary action so the two read
   as one pair rather than a small input under a big button. */
.name-field {
  display: grid;
  gap: 7px;
}

.name-field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-4);
}

.name-input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: rgba(9, 10, 12, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  -webkit-appearance: none;
  appearance: none;
}

.name-input::placeholder { color: rgba(255, 255, 255, 0.26); }

.name-input:focus {
  border-color: rgba(113, 112, 255, 0.62);
  background: rgba(9, 10, 12, 0.72);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.18);
}

/* Invalid state is driven by JS after a rejected submit, not by :invalid — the
   rules the server enforces (script tags, zero-width characters) cannot be
   expressed in an HTML pattern, and a mismatch between the two would show a green
   field for a name the server refuses. */
.name-input.is-bad {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.13);
}

/* Live character count. Reassurance rather than a warning, so it stays quiet
   until the limit is close. */
.name-count {
  justify-self: end;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  opacity: .0;
  transition: opacity .2s ease, color .2s ease;
}
.name-count.is-shown { opacity: .9; }
.name-count.is-near { color: #fbbf24; }
.name-count.is-over { color: #fca5a5; }

/* ---------- suggestion chips ----------
   Offered so a user can finish the step with one tap. The brief said "choose or
   enter", and typing a name on a phone keyboard is the slowest possible way to
   get past a cosmetic field. */

.name-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.name-chip {
  min-height: 36px;
  padding: 8px 13px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

@media (hover: hover) {
  .name-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
  }
}
.name-chip:active { transform: scale(.97); }
.name-chip.is-picked {
  border-color: rgba(113, 112, 255, 0.6);
  background: rgba(94, 106, 210, 0.2);
  color: #fff;
}

/* ---------- actions ----------
   Save is primary and full width; skipping is a quiet text link underneath. The
   hierarchy is deliberate: the step should be easy to complete and possible to
   leave, without the two options competing. */

.name-actions {
  display: grid;
  gap: 9px;
  margin-top: 2px;
}

.name-save {
  width: 100%;
  min-height: 48px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 560;
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease, opacity .15s ease;
}
@media (hover: hover) { .name-save:hover { background: var(--accent-hi); } }
.name-save:active { transform: scale(.985); }
.name-save[disabled] { opacity: .55; cursor: default; }

.name-skip {
  justify-self: center;
  min-height: 40px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-4);
  background: none;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s ease;
}
@media (hover: hover) { .name-skip:hover { color: var(--ink-2); } }

/* ---------- settings: the identity row ----------
   The account panel already lists identity facts. The name joins that list as an
   editable row rather than opening a separate settings page: one surface for
   "who am I and what do I have" is easier to reason about than two. */

.set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.set-row:last-child { border-bottom: 0; }

.set-label {
  flex: 0 0 auto;
  min-width: 74px;
  font-size: 12px;
  color: var(--ink-4);
}

.set-value {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shown when no name is set yet, so the row does not read as an empty bug. */
.set-value.is-empty { color: var(--ink-4); font-style: normal; }

.set-edit {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
@media (hover: hover) {
  .set-edit:hover {
    background: rgba(255, 255, 255, 0.11);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

/* The inline editor replaces the row in place, so the surrounding context (plan,
   billing) stays visible while renaming. */
.set-editing {
  display: grid;
  gap: 10px;
  padding: 12px 0 4px;
}

.set-editing-actions {
  display: flex;
  gap: 8px;
}

.set-editing-actions button {
  flex: 1 1 0;
  min-height: 44px;
  font-family: inherit;
  font-size: 14px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.set-editing-actions .is-primary {
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 560;
}
.set-editing-actions .is-quiet {
  color: var(--ink-3);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.set-editing-actions button:active { transform: scale(.985); }

/* ---------- feedback ---------- */

.name-msg {
  margin: 0;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  border-radius: 10px;
  display: none;
}
.name-msg.is-shown { display: block; }
.name-msg.is-bad {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.24);
  border: 1px solid rgba(248, 113, 113, 0.26);
}
.name-msg.is-good {
  color: #86efac;
  background: rgba(20, 83, 45, 0.24);
  border: 1px solid rgba(134, 239, 172, 0.24);
}

/* Mobile: the step and the editor are the only things on screen that matter, so
   give them the full width and keep every control thumb-sized. */
@media (max-width: 480px) {
  .name-step { gap: 12px; }
  .name-step-title { font-size: 16px; }
  .set-row { flex-wrap: wrap; }
  .set-label { flex-basis: 100%; min-width: 0; }
  .set-editing-actions button { min-height: 46px; }
}
