/* Buttons, badges, fields, panels, tables, dialogs.
   Rule order is load-bearing: several pairs below share a specificity and rely
   on the later one winning, so keep new rules next to the block they belong to. */

.gradient-text {
  background-image: var(--gradient-ramp);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-size: var(--gradient-size);
  animation: gradient-animation var(--gradient-duration) ease infinite;
}
@keyframes gradient-animation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.field { flex: 1 1 200px; min-width: 180px; }
.field label { margin-bottom: 6px; }

.profile-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-select-row select {
  flex: 1 1 auto;
}

/* The write affordances are grouped in one element so they can appear and
   disappear together, but they must still be flex items of the row above. */
.profile-actions {
  display: contents;
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  margin: 0;
}
.checkbox input { margin: 0; }

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
}
button:hover { background: var(--accent-strong); }
button:disabled { opacity: 0.6; cursor: default; }

.status {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.status.error { color: #8a4a3c; }

.status-working {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  max-width: 100%;
}

.status-text {
  display: block;
}

.status-progress {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.summary { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  position: relative;
  user-select: none;
  overflow: visible;
}
.num { text-align: right; white-space: nowrap; width: 1%; }

tr.selected { background: var(--selected); }
tbody tr:hover { background: var(--row-hover); }

.title { font-weight: 600; }
.title a { color: var(--accent-strong); text-decoration: none; }
.title a:hover { text-decoration: underline; }
.meta, .reason { color: var(--muted); font-size: 13px; margin-top: 3px; }

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.badge.on { border-color: var(--accent); color: var(--accent-strong); }

.bar {
  display: block;
  width: min(560px, 62vw);
  min-width: 220px;
  flex: 0 0 auto;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 0;
}
.bar::after {
  content: "";
  display: block;
  width: 67%;
  height: 100%;
  background-image: var(--gradient-ramp);
  background-size: var(--gradient-size);
  animation:
    gradient-animation var(--gradient-duration) ease infinite,
    slide 2s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(167%); }
}

.body {
  margin-block: 8px 0;
  max-inline-size: 85ch;
  color: var(--ink);
  font-size: 14px;
}

.body-section {
  padding-top: 16px;
}

/* ── Results controls bar ───────────────────────────────────────────────────── */
.results-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

#results-table {
  table-layout: fixed;
}

/* Ghost / outline button ────────────────────────────────────────────────────── */
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 6px 12px;
  font-weight: 500;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  border-radius: 6px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--accent);
}

/* ── Column resize handle ───────────────────────────────────────────────────── */
.col-resize {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  z-index: 1;
  padding-left: 9px;
}
.col-resize::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--line);
  transition: background 0.15s;
}
.col-resize:hover::after {
  background: var(--accent);
}

/* ── Column picker (details/summary dropdown) ───────────────────────────────── */
#col-picker {
  position: relative;
}
#col-picker > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  background: transparent;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  user-select: none;
  font-family: inherit;
}
#col-picker > summary::-webkit-details-marker { display: none; }
#col-picker > summary::marker { display: none; }
#col-picker > summary::after {
  content: "\25BE";
  font-size: 10px;
  margin-left: 2px;
  display: inline-block;
  transition: transform 0.15s;
}
#col-picker[open] > summary::after { transform: rotate(-180deg); }
#col-picker > summary:hover {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--accent);
}

.col-picker-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 130px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Subtle row transition ─────────────────────────────────────────────────────── */
tbody tr { transition: background 0.1s; }

/* ── Settings panel ──────────────────────────────────────────────────────────── */
.settings-panel > summary,
.settings-advanced > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.settings-panel > summary::-webkit-details-marker,
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-panel > summary::marker,
.settings-advanced > summary::marker { display: none; }

.settings-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.settings-panel > summary::before {
  content: "▶";
  display: inline-block;
  font-size: 10px;
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--muted);
}
.settings-panel[open] > summary::before { transform: rotate(90deg); }

.settings-body {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.setting-label {
  flex: 0 0 190px;
  font-size: 13px;
  color: var(--muted);
}

/* Numeric stepper */
.num-ctl {
  display: flex;
  align-items: center;
  gap: 4px;
}

.num-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  padding: 1px 7px;
  line-height: 1.6;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.num-btn:hover { background: var(--bg); color: var(--ink); border-color: var(--accent); }

.num-val {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  cursor: text;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: border-color 0.12s, background 0.12s;
}
.num-val:hover { border-color: var(--line); background: #fff; }

.num-inline {
  width: 58px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  text-align: center;
}

/* Text inputs for email / API keys */
.setting-text {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  flex: 1 1 auto;
  max-width: 300px;
}
.setting-text:focus { outline: 2px solid rgba(92, 107, 115, 0.25); border-color: var(--accent); }

/* Sources toggles */
.sources-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Advanced nested panel */
.settings-advanced {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.settings-advanced > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding-right: 128px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0;
}
.settings-panel > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding-right: 128px;
}
.settings-summary-label {
  flex: 1 1 auto;
  min-width: 0;
}
.settings-advanced > summary::before {
  content: "▶";
  display: inline-block;
  font-size: 9px;
  margin-right: 6px;
  transition: transform 0.15s;
}
.settings-advanced[open] > summary::before { transform: rotate(90deg); }
.settings-advanced > .settings-group { margin-top: 12px; }

.settings-summary-actions {
  display: none;
  align-items: center;
  gap: 8px;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  flex: 0 0 auto;
}
.settings-panel[open] > summary .settings-summary-actions,
.settings-advanced[open] > summary .settings-summary-actions {
  display: inline-flex;
}

/* Small button modifier — pairs with .btn-ghost */
.btn-small {
  font-size: 10px;
  padding: 3px 8px;
}

/* ── Profile modal/editor ──────────────────────────────────────────────────── */
.profile-modal {
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 22px 54px rgba(46, 44, 40, 0.16);
}

.profile-modal::backdrop {
  background: rgba(39, 37, 35, 0.48);
  backdrop-filter: blur(2px);
}

.profile-form {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  max-height: calc(100vh - 48px);
}

.profile-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.profile-modal-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 64ch;
}

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

.profile-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.98));
}

/* Auto-fit rather than a fixed count: a concept row has three controls and a
   bucket row has six, and both have to stay readable without their own rule. */
.profile-item-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
  align-items: start;
}

.profile-subfield {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.profile-subfield-wide {
  grid-column: span 2;
}

.profile-item-input {
  width: 100%;
}

.profile-item-remove {
  align-self: start;
  /* WCAG 2.5.8: 24×24 is the floor for a pointer target. */
  min-block-size: 24px;
  white-space: nowrap;
}

.profile-advanced-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
}

.profile-advanced-panel > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.profile-advanced-panel > summary::-webkit-details-marker { display: none; }
.profile-advanced-panel > summary::marker { display: none; }

.profile-advanced-panel > summary::before {
  content: "▶";
  display: inline-block;
  font-size: 9px;
  margin-right: 6px;
  transition: transform 0.15s;
}

.profile-advanced-panel[open] > summary::before {
  transform: rotate(90deg);
}

.profile-advanced-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.profile-ai-modal {
  width: min(760px, calc(100vw - 32px));
}

.profile-ai-modal textarea {
  min-height: 140px;
}

/* ── Auth and account forms ─────────────────────────────────────────────────── */
/* Logical properties and tokens throughout: the U0 pass converts the physical
   properties above and must find nothing to undo here. */

.auth-panel,
.account-panel {
  /* A sign-in form is read in one column; measured in `ch` so the line length
     holds when a user scales the text up rather than the window. */
  max-inline-size: 52ch;
  margin-inline: auto;
  inline-size: 100%;
}

.auth-intro {
  margin-block: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-block-start: 18px;
}

.auth-form button[type="submit"] {
  align-self: flex-start;
  min-block-size: 44px;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-block label {
  margin-block-end: 0;
}

.field-block input,
.field-block select {
  inline-size: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  /* 44px tall including the border: WCAG 2.5.8 asks for 24×24 and the pointer
     targets in a form that is typed into once should be comfortable. */
  padding-block: 11px;
  padding-inline: 12px;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.field-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.field-error[hidden] {
  display: none;
}

.field-block input[aria-invalid="true"] {
  border-color: var(--danger);
  /* Colour is never the only carrier (WCAG 1.4.1): the message under the field
     says what is wrong, and `aria-invalid` says it to assistive technology. */
  border-inline-start-width: 3px;
}

.auth-consent,
.auth-alternate,
.auth-unavailable {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-consent a,
.auth-alternate a {
  color: var(--accent-strong);
}

.auth-alternate a {
  /* An inline link is a 24×24 target too. */
  display: inline-block;
  min-block-size: 24px;
  font-weight: 600;
}

.account-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin-block: 16px 0;
  font-size: 14px;
}

.account-facts dt {
  color: var(--muted);
}

.account-facts dd {
  margin: 0;
}

/* Focus indicators for the controls added above. The global pass over every
   interactive element — including the ones that have no `:focus-visible` rule at
   all today — is U0's job (UI PRD §8, failure 1). */
.field-block input:focus-visible,
.field-block select:focus-visible,
.field-block textarea:focus-visible,
.auth-form button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* ── Home page ─────────────────────────────────────────────────────────────── */

.view-home {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-panel {
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
}

.home-hero,
.home-section {
  padding-block: 22px;
  padding-inline: clamp(16px, 3vw, 30px);
}

.home-hero {
  border-block-end: 1px solid var(--line);
  background:
    radial-gradient(circle at 5% -20%, rgba(147, 192, 164, 0.22), transparent 48%),
    radial-gradient(circle at 90% 120%, rgba(182, 196, 162, 0.22), transparent 54%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(251, 250, 248, 0.98));
}

.home-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 700;
}

.home-hero-title {
  margin: 8px 0 0;
  font-size: clamp(1.7rem, 3.3vw, 2.45rem);
  line-height: 1.14;
  max-inline-size: 22ch;
}

.home-title {
  margin: 0;
}

.home-copy {
  margin: 10px 0 0;
  max-inline-size: 72ch;
  color: var(--muted);
}

.home-brand-inline {
  display: inline-block;
  font-weight: 700;
}

.home-section + .home-section {
  border-block-start: 1px solid var(--line);
}

.home-steps {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.home-step {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 249, 247, 0.98));
}

.home-step h3 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.home-step p {
  margin: 8px 0 0;
}

.home-cta {
  background: linear-gradient(180deg, rgba(238, 241, 240, 0.5), transparent);
}

.home-cta-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-cta-button {
  display: inline-flex;
  align-items: center;
  min-block-size: 40px;
  padding-block: 10px;
  padding-inline: 18px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.home-cta-button:hover {
  background: var(--accent-strong);
}

.home-cta-button:focus-visible,
.home-cta-ghost:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .home-hero,
  .home-section {
    padding-inline: 16px;
    padding-block: 18px;
  }
}

/* ── Profile library and routed editor ──────────────────────────────────────── */
/* Logical properties and tokens only, as in the block above. */

.view-intro {
  margin-block: 8px 0;
  max-inline-size: 67ch;
  color: var(--muted);
  font-size: 14px;
}

.profiles-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin-block-start: 16px;
}

.import-field {
  flex: 1 1 22rem;
  max-inline-size: 42rem;
}

/* The native file control is kept: it is the only picker that is keyboard
   accessible, localised and understood by every assistive technology without a
   line of JavaScript. It is styled, not replaced. */
.file-input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  inline-size: 100%;
}
.file-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.profile-group:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 4px;
}

.profile-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 14px;
  margin-block: 14px 0;
  padding: 0;
  list-style: none;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.profile-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.profile-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.profile-card-question {
  margin: 0;
  font-size: 14px;
  /* A default question is a sentence, not a title: two lines is enough to
     recognise it, and the full text is in the editor. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-card-question.is-empty {
  color: var(--muted);
  font-style: italic;
}

.profile-card-facts {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-block-start: auto;
  padding-block-start: 6px;
}

/* A link that has to read as one of a row of buttons. */
.btn-link {
  display: inline-flex;
  align-items: center;
  min-block-size: 32px;
  text-decoration: none;
}
.btn-link[hidden] {
  display: none;
}

/* Destructive, but not the loudest thing on a card. */
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line);
  font-size: 13px;
  padding-block: 6px;
  padding-inline: 12px;
  font-weight: 600;
}
.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.export-menu {
  position: relative;
}
.export-menu > summary {
  display: inline-flex;
  align-items: center;
  min-block-size: 32px;
  cursor: pointer;
  /* The default triangle points nowhere useful; the panel below says enough. */
  list-style: none;
}
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary::marker { display: none; }

.export-menu-panel {
  position: absolute;
  inset-block-start: calc(100% + 4px);
  inset-inline-start: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 10rem;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgb(0 0 0 / 8%);
}

.export-option {
  inline-size: 100%;
  min-block-size: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
}
.export-option:hover {
  background: var(--bg);
}

.profile-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-panel > .field-block + .field-block {
  margin-block-start: 16px;
}

.profile-section + .profile-section,
.profile-panel .field-block + .profile-section {
  margin-block-start: 20px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.profile-section-empty {
  margin-block: 8px 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.profile-section .profile-list {
  margin-block-start: 10px;
}

.profile-subfield label {
  margin-block-end: 0;
}

.profile-subfield input[type="text"],
.profile-subfield input[type="number"],
.profile-subfield textarea {
  inline-size: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding-block: 8px;
  padding-inline: 10px;
}
.profile-subfield input:focus-visible,
.profile-subfield textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* A checkbox needs no field width, so it does not stretch like the text ones. */
.profile-subfield-check {
  justify-content: end;
  padding-block-end: 8px;
}

.profile-editor.is-read-only .profile-subfield input,
.profile-editor.is-read-only .profile-subfield textarea,
.profile-editor.is-read-only .field-block input,
.profile-editor.is-read-only .field-block textarea {
  background: var(--bg);
  color: var(--muted);
}

.editor-back {
  margin: 0 0 8px;
  font-size: 13px;
}
.editor-back a {
  display: inline-flex;
  align-items: center;
  min-block-size: 24px;
  color: var(--accent-strong);
}

.editor-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 14px;
}
.editor-title-row h1 {
  min-inline-size: 0;
}
.editor-title-row button {
  flex: 0 0 auto;
}
.editor-title-row button[hidden] {
  display: none;
}

.editor-banner {
  margin-block-start: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.editor-banner[hidden] {
  display: none;
}
.editor-banner p {
  margin: 0;
}
.editor-banner p + p {
  margin-block-start: 8px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.editor-cancel {
  margin-inline-start: auto;
}

/* ── Undo toast ─────────────────────────────────────────────────────────────── */

.toast-region {
  position: fixed;
  inset-block-end: 16px;
  inset-inline: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* Empty and between toasts the region must not swallow clicks on the page
     under it; each toast turns pointer events back on for itself. */
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-inline-size: min(38rem, 100%);
  padding-block: 10px;
  padding-inline: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
  pointer-events: auto;
}
.toast-error {
  background: var(--danger);
}

.toast-message {
  margin: 0;
}

.toast-action {
  min-block-size: 32px;
  padding-block: 4px;
  padding-inline: 12px;
  border: 1px solid var(--surface);
  border-radius: 6px;
  background: transparent;
  color: var(--surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.toast-action:hover:not(:disabled) {
  background: var(--surface);
  color: var(--ink);
}
.toast-action:focus-visible {
  outline: 2px solid var(--surface);
  outline-offset: 2px;
}

.toast-remaining {
  color: var(--line);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-inline-size: 2.5ch;
}
