/* Settings pages (rules, tokens, invitations, health, cards, problems,
   agent access, approvals). Append-only. Do not add these rules to styles.css. */

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.settings-stack > * {
  min-width: 0;
  max-width: 100%;
}

.agent-access-add,
.agent-access-open-approval,
.approval-plan,
.approval-checklist,
.approval-facts,
.approval-action,
.approval-reveal,
.card-add,
.change-inbox {
  min-width: 0;
  max-width: 100%;
}

.agent-identity,
.card-row,
.change-inbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--row-line);
  min-width: 0;
}

.agent-identity-main,
.rule-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  flex: 1 1 12rem;
  overflow-wrap: anywhere;
}

.agent-identity.revoked {
  opacity: 0.55;
}

.card-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.card-tick {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.cards-list,
.cards-changes,
.change-inbox {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cards-changes li,
.review-summary li {
  overflow-wrap: anywhere;
}

.character-set {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  min-width: min(100%, 16rem);
  max-width: 100%;
}

.radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
}

.review-summary {
  list-style: none;
  padding: 0;
  margin: 0;
}

.review-summary li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--row-line);
}

.fleet-table {
  width: 100%;
}

tr.focused-company {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.match-input,
.account-input,
.location-input,
.coa-open-account,
.coa-close-account,
.map-account {
  width: 100%;
  max-width: 100%;
}

.card-add input,
.agent-access-add input,
.agent-access-add select,
.agent-access-open-approval input {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 480px) {
  .settings-stack .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-stack .form-row > * {
    width: 100%;
    max-width: 100%;
  }

  .agent-identity,
  .card-row,
  .change-inbox-row,
  .rule-row,
  .token-row,
  .invite-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------------------------------------------------------------------------
   rd Y2 — control sizes and the Open-account form.

   The global rule gives every input a 44px min-height and a border so text
   fields are tappable. A checkbox inherits it and becomes a large empty box,
   which is what the Add-a-card and Access-keys tick boxes looked like. These
   keep the tick the size a tick should be, everywhere in Settings.
   --------------------------------------------------------------------------- */

.settings-stack input[type="checkbox"],
.settings-stack input[type="radio"],
.card-add input[type="checkbox"],
.group-check input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border-radius: 3px;
  flex: 0 0 auto;
}

/* The company tick beside a card: the words wrap only when they must, and the
   tick keeps its own column instead of squeezing the name to three lines. */
.card-tick {
  flex: 0 1 auto;
  max-width: 100%;
}

.card-tick > input[type="checkbox"] {
  order: -1;
}

/* Open account: each kind of account sits beside its own words, and the group
   takes the free width of the row instead of leaving a dead column. */
.settings-stack .form-row > .character-set {
  flex: 1 1 18rem;
  min-width: min(100%, 16rem);
}

/* `.form-row label` stacks its children in a column (right for a field label,
   wrong for a tick beside its own words), so the row direction is set here. */
.character-set .radio,
.form-row .character-set label.radio {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  min-height: 0;
  padding: var(--space-1) 0;
}

.character-set .radio-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.character-set .radio-help {
  font-size: 0.875rem;
  line-height: 1.3;
}

@media (max-width: 480px) {
  .settings-stack .form-row > .character-set {
    min-width: 0;
  }
}

/* A field in a settings row shares the row's width. Before, each label sized
   itself to its input's intrinsic width, so "Liabilities:Bank:Loans:Term-Note"
   and "For example, SYNTHETIC VENDOR" were cut off mid-word with the row's
   spare width sitting unused beside them. */
.settings-stack .form-row > label {
  flex: 1 1 10rem;
  min-width: 0;
}

.settings-stack .form-row > label > input,
.settings-stack .form-row > label > .chart-chooser {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 480px) {
  /* The row is a column here: a growing flex child would stretch every field
     to fill the page height, leaving large gaps between them. */
  .settings-stack .form-row > label,
  .settings-stack .form-row > .character-set {
    flex: 0 0 auto;
  }
}

/* The request line is a live status region that is always present (so it can
   announce); when it has nothing to say it is empty and takes no room. */
.chart-request-slot:empty {
  display: none;
}
