.profile-page { padding: 32px 28px; }

.profile-content {
  max-width: 720px;
  margin: 0 auto;
}

.profile-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text);
  margin-bottom: 4px;
}

.profile-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.profile-section { margin-bottom: 40px; }

.profile-section-label {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.profile-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
/* Mid-section save button between the company fields and the Carriers list.
   A hairline above separates it from the fields it saves without reading as a
   new section. */
.profile-save-row--inline {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Profile photo upload ── */

.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed);
}

.photo-upload-area:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.photo-avatar-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--wood-soft);
  color: var(--gold);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
}

.photo-upload-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Website Verification Link ── */

/* The label row is the popover anchor — the label itself is the trigger
   button, so the wrapper needs position:relative for the absolute popover. */
.verify-agent-label-row {
  position: relative;
  display: inline-block;
  margin-bottom: 6px;
}

/* Reset native <button> chrome so the label-as-button looks identical to
   the surrounding .form-label text but stays semantically a button. */
.verify-agent-label-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  /* Subtle dotted underline cues that this header is interactive without
     looking like a link. */
  border-bottom: 1px dotted var(--text-muted);
}

.verify-agent-label-btn:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.verify-agent-label-btn:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

.verify-agent-info-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(var(--shadow-rgb),0.14);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 50;
}

.verify-agent-info-popover.hidden { display: none; }

.verify-agent-info-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.verify-agent-info-popover p {
  margin: 0 0 8px;
  line-height: 1.4;
}

.verify-agent-info-popover a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.verify-agent-info-popover a:hover { text-decoration: underline; }

.verify-agent-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.verify-agent-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

.verify-agent-preview {
  margin-top: 10px;
  display: none;
}

.verify-agent-preview.is-visible { display: block; }

.verify-agent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--speed), background var(--speed);
}

.verify-agent-card:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.verify-agent-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  padding: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.verify-agent-card-text {
  flex: 1 1 auto;
  min-width: 0;
}

.verify-agent-card-host {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.verify-agent-card-href {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verify-agent-card-arrow {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Phone input (country select + national number) ── */

.phone-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.phone-country-select {
  /* Fixed width so the select stays compact and the number input gets the
     remaining space. Without this the browser sizes the closed select to the
     widest option (flag + dial code + arrow padding can balloon to 110+px
     with no upper bound), squeezing the number field. */
  flex: 0 0 96px;
  width: 96px;
  padding: 8px 6px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.phone-country-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

.phone-number-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.phone-number-input.is-invalid {
  border-color: var(--red, #c0392b);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.12);
}

.phone-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--red, #c0392b);
}

.phone-error.hidden { display: none; }

/* ── Licensed states tag section ── */

.states-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ── Profile password row ── */

.profile-password-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Carrier + state rows (name + per-item number + remove) ── */

.profile-row-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 12px;
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.profile-row-name {
  flex: 0 0 auto;
  min-width: 140px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font-body);
}

/* State abbreviations are only 2 chars — tighter min-width keeps the input
   field as wide as possible. */
.profile-row-state {
  min-width: 44px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.profile-row-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.profile-row-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

/* Legacy: kept for any older render path still emitting these classes. */
.carrier-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-bottom: 6px;
}

.carrier-name-display {
  font-size: 14px;
  color: var(--text);
}

/* ── Carrier combobox ── */

.carrier-combobox { position: relative; }

.carrier-add-input {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  /* Reads as a button, not a text field: hide the blinking text caret. Typing
     still filters the dropdown — the input just doesn't show an insertion cursor. */
  caret-color: transparent;
  transition: border-color var(--speed), color var(--speed);
}

.carrier-add-input:focus {
  border-color: var(--gold);
  color: var(--text);
  outline: none;
}

.carrier-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb),0.10);
  z-index: 700;
  max-height: 220px;
  overflow-y: auto;
}

.carrier-option {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-body);
}

.carrier-option:hover { background: var(--gold-soft); color: var(--gold); }

/* ── Mobile / narrow viewports ──────────────────────────────────────────────
   The profile page shipped with no responsive rules, so on a phone the fixed
   two-column form grid, the 96px phone-country select and the 140px carrier /
   state row names overflowed the narrow content pane and pushed the fields off
   the right edge — the page read as blank. Collapse everything to a single
   fluid column and let the rows wrap so nothing exceeds the viewport. */
@media (max-width: 640px) {
  .profile-page { padding: 20px 16px; }

  /* The 720px cap already yields to the pane above this width; below it, take
     the full pane so the reduced padding isn't fighting a centered column. */
  .profile-content { max-width: 100%; }

  .profile-title { font-size: 24px; }
  .profile-subtitle { margin-bottom: 24px; }
  .profile-section { margin-bottom: 28px; }

  /* Stack paired fields (Full Name / DOB, Agency / NPN, …) into one column. */
  .form-grid-2 { grid-template-columns: 1fr; gap: 14px; }

  /* Carrier rows: drop the fixed 140px name column. Let a long carrier name sit
     on its own line, with the writing-number input and the × remove button
     sharing the line below, instead of overflowing the pane. */
  .profile-row { flex-wrap: wrap; }
  .profile-row-name { min-width: 0; flex: 1 1 100%; }
  /* State rows are just a 2-char abbreviation — keep it inline with its license
     input rather than stranding it on its own full-width line. */
  .profile-row-state { flex: 0 0 auto; }

  /* Give the country select a little less fixed width so the number field keeps
     usable space in a phone-width pane. */
  .phone-country-select { flex-basis: 84px; width: 84px; }

  /* The verify-URL popover is a fixed 260px; clamp it so it can't overflow the
     viewport on a small screen. */
  .verify-agent-info-popover { width: min(260px, calc(100vw - 40px)); }
}

/* The Upline field is read-only and only the Agency page can change it, so it
   behaves as a link into that page rather than an input you can type in
   (profile.js binds the click). Styled to say so — a text cursor on a field
   that cannot take text is the thing that made it look broken. */
#p-upline.is-linked {
  cursor: pointer;
}

#p-upline.is-linked:hover {
  border-color: var(--gold);
  color: var(--gold);
}
