/* ldu/pages-account.css: spend, billing, settings and the agent page in the LDU look (slice 5).

   main's own markup, restyled: the page sections carry an extra `ldu-page` class token, so the page frame, buttons,
   fields, cards, notice bar and empty state of ldu/pages-work.css (slice 3) already apply (`.page.ldu-page`). Every rule
   below keys on that token together with the page's own class or data-testid, so the Leads, Projects and Agreement pages
   that share names like .spend__h and .eng__form are untouched, and so is the A2A form in the Rooms popup (it is not
   inside [data-testid="agent-page"]). The spend tables are .ldu-table, the stats components/ldu/_stat, the empty states components/ldu/_empty. Nothing is removed or renamed and the visual order is the DOM order.

   Source: ui-cleanup/milan's ldu/pages.css and components.css (stat card, kv list, trend, setting card, field, badge,
   empty state). Colours are all var() of fraction-ds tokens; hover moves colour, a border step or a wash in 150ms and
   never lifts or casts a shadow. Spacing the LDU scale holds back (--s3, --s5, --s6) is written as px. */

/* the way back is the DS ghost button (shared/_back_link); it lines up with the text under it */

/* ── Spend: three stats (components/ldu/_stat), then the six-month trend ────────────
   The three sit in one row once the content well is wide enough; the balance is the one that matters (size :lg). */
.page.ldu-page .spend__stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@container page (min-width: 480px) { .page.ldu-page .spend__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container page (min-width: 720px) { .page.ldu-page .spend__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* the tab bar (the profile's, .pf__tabbar) and its panels: balance and spend above, the four views below */
.page.ldu-page .spend__cta { flex: none; }
.page.ldu-page .spend__pane { padding-top: 16px; }
.page.ldu-page .spend__sub { margin: 24px 0 12px; }
/* on a phone the balance takes the full row and this month and last month sit side by side, so the tabs are within reach */
@container page (max-width: 479px) {
  .page.ldu-page .spend__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .page.ldu-page .spend__stats > [data-testid="spend-balance"] { grid-column: 1 / -1; }
}
.page.ldu-page .spend__lede { margin: 0 0 12px; }

/* the trend: month, a bar (.ldu-progress) scaled to the biggest month, the amount */
.page.ldu-page .spend__trend { width: 100%; border-collapse: collapse; }
.page.ldu-page .spend__trend th { width: 1%; padding: 8px 16px 8px 0; border: 0; text-align: left; white-space: nowrap; font-size: var(--fs-ui); font-weight: 400; color: var(--ink-2); }
.page.ldu-page .spend__trend td { padding: 8px 0; border: 0; vertical-align: middle; }
.page.ldu-page .spend__trend td.num { width: 1%; padding-left: 16px; text-align: right; white-space: nowrap; font-size: var(--fs-ui); font-variant-numeric: tabular-nums; }
.page.ldu-page [data-testid="spend-none"] { margin: 12px 0 0; font-size: var(--fs-ui); color: var(--ink-2); }

/* ── By expert and Invoices: .ldu-table; Download is a small DS button at the end of the row ─────────────── */
.page.ldu-page [data-testid="spend-expert-rows"] td:first-child { font-weight: 500; }
.page.ldu-page [data-testid="spend-statements"] td:last-child { text-align: right; }
/* on a phone the month may wrap and the cells tighten, so the whole row, Download included, fits the frame */
@media (max-width: 560px) {
  .page.ldu-page .spend__table :is(th, td) { padding-left: 6px; padding-right: 6px; white-space: normal; }
  .page.ldu-page .spend__table :is(th, td):first-child { padding-left: 12px; }
  .page.ldu-page .spend__table :is(th, td):last-child { padding-right: 8px; }
  .page.ldu-page .spend__table .num { white-space: nowrap; }
}

/* ── Billing: the plan with its two ways on (DS buttons), the payment method (an empty state), the billing email ──
   The plan card holds the balance sentence on the left and Top up / Invoices on the right (under it on a phone). */
.page.ldu-page [data-testid="billing-plan"] { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 24px; align-items: center; }
.page.ldu-page [data-testid="billing-plan"] > h2 { grid-column: 1; grid-row: 1; }
.page.ldu-page [data-testid="billing-plan"] > p:first-of-type { grid-column: 1; grid-row: 2; }
.page.ldu-page [data-testid="billing-plan"] > p:first-of-type strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.page.ldu-page .billing__ways { grid-column: 1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 8px; max-width: none; margin: 16px 0 0; }
@media (min-width: 640px) {
  .page.ldu-page [data-testid="billing-plan"] { grid-template-columns: minmax(0, 1fr) auto; }
  .page.ldu-page .billing__ways { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
}
.page.ldu-page [data-testid="billing-email"] > p { overflow-wrap: anywhere; color: var(--ink); }

/* ── Settings: four cards, a name and what it is for; the control sits on the right (under it on a phone) ── */
.page.ldu-page .settings__section > h2 {
  margin: 0 0 4px;
  font-family: var(--display); font-size: var(--fs-h2); font-weight: 600; line-height: 1.4; letter-spacing: -0.01em;
}
.page.ldu-page .settings__section > p { margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.page.ldu-page .settings__section > p + p { margin-top: 0; }
.page.ldu-page [data-testid="settings-account"] > h2, .page.ldu-page [data-testid="agent-status"] > h2 { margin-bottom: 16px; }
/* a list of facts: name, value */
.page.ldu-page .settings__facts {
  display: grid; grid-template-columns: minmax(88px, max-content) minmax(0, 1fr); gap: 12px 24px; margin: 0;
  font-size: var(--fs-body);
}
.page.ldu-page .settings__facts dt { font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.page.ldu-page .settings__facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .page.ldu-page .settings__facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .page.ldu-page .settings__facts dd { margin-bottom: 12px; }
}
/* Profile: three outline buttons in a row */
.page.ldu-page [data-testid="settings-profile"] > p:last-child { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; font-size: var(--fs-body); }
/* Theme: the words on the left, the switch on the right */
.page.ldu-page [data-testid="settings-theme"] { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 24px; align-items: center; }
.page.ldu-page [data-testid="settings-theme"] > h2 { grid-column: 1; grid-row: 1; }
.page.ldu-page [data-testid="settings-theme"] > p { grid-column: 1; grid-row: 2; }
.page.ldu-page [data-testid="settings-theme"] > [data-fr-theme-switch] { grid-column: 1; grid-row: 3; margin-top: 16px; justify-self: start; align-self: center; }
@media (min-width: 640px) {
  .page.ldu-page [data-testid="settings-theme"] { grid-template-columns: minmax(0, 1fr) auto; }
  .page.ldu-page [data-testid="settings-theme"] > [data-fr-theme-switch] { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; justify-self: end; }
}

/* ── Your agent: what A2A is, the status, the form (capped, it is a true form), the tasks ──────────── */
.page.ldu-page[data-testid="agent-page"] code {
  padding: 1px 6px; border-radius: var(--r-sm);
  background: var(--ldu-wash); color: var(--ink);
  font-family: var(--mono); font-size: 0.9em;
}
.page.ldu-page[data-testid="agent-page"] .mono { font-family: var(--mono); font-size: var(--fs-ui); color: var(--ink); overflow-wrap: anywhere; }
.page.ldu-page [data-testid="agent-what"] > p.muted { font-size: var(--fs-ui); color: var(--ink-2); }
.page.ldu-page [data-testid="agent-what"] > p + p { margin-top: 12px; }
/* the status chips are DS .chip (--ok when it is listening) */
.page.ldu-page [data-testid="agent-status"] > p { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
/* the form: a label over each control */
.page.ldu-page .agentpage__form { display: grid; gap: 6px; max-width: 40rem; }
.page.ldu-page .agentpage__form .field__label { margin-top: 12px; font-size: var(--fs-ui); font-weight: 500; line-height: 1.5; color: var(--ink); }
.page.ldu-page .agentpage__form .field__label:first-of-type { margin-top: 0; }
.page.ldu-page .agentpage__form textarea.input { height: auto; min-height: 96px; padding: 8px 12px; line-height: 1.5; resize: vertical; }
.page.ldu-page .agentpage__check {
  margin-top: 12px; gap: 12px; align-items: flex-start;
  font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); cursor: pointer;
  transition: color var(--dur);
}
.page.ldu-page .agentpage__check:hover { color: var(--ink); }
.page.ldu-page .agentpage__check input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.page.ldu-page .agentpage__form input[type="submit"] { justify-self: start; margin-top: 16px; cursor: pointer; }
/* recent tasks: id, state, how many messages and when */
.page.ldu-page [data-testid="agent-tasks"] .coll__list { margin: 0; }
.page.ldu-page [data-testid="agent-tasks"] .coll__list > li { padding: 12px 0; font-size: var(--fs-ui); }
.page.ldu-page [data-testid="agent-tasks"] .coll__list > li:first-child { padding-top: 0; }
.page.ldu-page [data-testid="agent-tasks"] .coll__list > li > small { margin-left: 0; }
.page.ldu-page [data-testid="agent-tasks"] > p.muted { font-size: var(--fs-ui); }

/* ── an invoice row is one click: the Download link is stretched over the whole row (no script), the row answers the pointer ── */
.page.ldu-page .spend__statement { position: relative; }
.page.ldu-page .spend__statement .spend__download::after { content: ""; position: absolute; inset: 0; }
.page.ldu-page .spend__statement:hover { background: var(--ldu-wash); }
.page.ldu-page .spend__statement:has(.spend__download:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Password, on Settings (moved from the Profile page) */
.page.ldu-page .settings__password { display: grid; gap: 8px; max-width: 24rem; }
.page.ldu-page .settings__password > [type="submit"] { justify-self: start; margin-top: 8px; }
.page.ldu-page .settings__reset { display: inline; }

/* ── a client's Settings (portal_settings/show; Milan, 4 Nov) ────────────────────────────────
   Four cards in one column, each a title, one line and rows: the label, what is set now, then Change (a small DS button) on the right. The rows
   are a <dl> with a rule between them. On a phone the label sits over the value and Change stays on the right. The popups are the DS modal. */
.psettings__group { display: grid; gap: 4px; max-width: 52rem; }
.psettings__group > .psettings__lede { margin: 0 0 12px; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.psettings__rows { margin: 0; }
.psettings__row { display: grid; grid-template-columns: 10rem minmax(0, 1fr) auto; align-items: center; column-gap: 16px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line); }
.psettings__row > dt { font-size: var(--fs-ui); color: var(--ink-2); }
.psettings__row > dd { margin: 0; min-width: 0; font-size: var(--fs-body); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.psettings__row > dd.psettings__act { grid-column: 3; justify-self: end; }
.psettings__unset { color: var(--ink-3); }
/* a switch row (the bell's kinds): the kind is the title, its line the quiet explainer under it, the switch on the right */
.psettings__row--switch { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
.psettings__row--switch > dt { grid-column: 1; font-size: var(--fs-body); font-weight: 500; color: var(--ink); }
.psettings__row--switch > dd { grid-column: 1; font-size: var(--fs-ui); color: var(--ink-2); }
.psettings__row.psettings__row--switch > dd.psettings__act { grid-column: 2; grid-row: 1 / span 2; }
.psettings__note { display: block; margin-top: 2px; font-size: var(--fs-ui); color: var(--ink-2); }
@container page (max-width: 559px) {
  .psettings__row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .psettings__row > dt { grid-column: 1; }
  .psettings__row > dd { grid-column: 1; }
  .psettings__row > dd.psettings__act { grid-column: 2; grid-row: 1 / span 2; }
}

/* the popups: fields stacked, hints at 14px (Milan: 12px is for labels only); Remove photo sits apart on the left of the foot */
.psettings__modal { max-width: 28rem; }
.psettings__modal .ldu-modal__foot .psettings__remove { margin-right: auto; }
.psettings__fields { display: grid; gap: 16px; }
.psettings__hint { margin: 0; font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.psettings__hint--error { color: var(--danger); }
.psettings__hint--error:empty { display: none; }
.psettings__photo { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.psettings__photo .avatar--lg { flex: none; width: 64px; height: 64px; font-size: 20px; }
.psettings__link { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.psettings__link:hover { color: var(--accent); }

/* ── Notifications (shared/_notification_settings; product emails, design step 11 Nov 2026) ──────────────────────────────
   Groups of switch rows: a group head (its name, then the column names Bell and Email over 56px columns), rows of title + when + a switch per
   column. "Saved" sits under its switch without moving the row; an error is a third line of the row. "Always sent" is a closed disclosure of
   locked rows. Daniel's card is Email only (.nprefs--email-only). */
.nprefs { --nprefs-cols: 56px 56px; }
.nprefs--email-only { --nprefs-cols: 56px; }
/* the address mail goes to, on its own line beside Change email; a long one ends in "..." (its full text in the title) instead of breaking mid-word */
.nprefs__mail { display: flex; align-items: baseline; gap: 12px; min-width: 0; margin: 4px 0 0; font-size: var(--fs-ui); line-height: 1.5; }
.nprefs__address { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.nprefs__mail .psettings__link { flex: none; white-space: nowrap; }
.nprefs__head { display: grid; grid-template-columns: minmax(0, 1fr) var(--nprefs-cols); column-gap: 8px; align-items: end; padding-bottom: 8px; }
.nprefs__group { margin: 0; font-size: var(--fs-meta); font-weight: 600; line-height: 1.5; color: var(--ink); }
.nprefs__groupnote { font-weight: 400; color: var(--ink-2); }
.nprefs__col { font-size: var(--fs-meta); font-weight: 500; line-height: 1.5; color: var(--ink-2); text-align: center; }
.nprefs .psettings__row.nprefs__row { grid-template-columns: minmax(0, 1fr) var(--nprefs-cols); column-gap: 8px; }
.nprefs .psettings__row.nprefs__row > dd.nprefs__cell { position: relative; grid-row: 1 / span 2; display: flex; justify-content: center; align-items: center; min-height: 44px; }
.nprefs .psettings__row.nprefs__row > dd.nprefs__cell--bell { grid-column: 2; }
.nprefs .psettings__row.nprefs__row > dd.nprefs__cell--email { grid-column: 3; }
.nprefs--email-only .psettings__row.nprefs__row > dd.nprefs__cell--email { grid-column: 2; }
.nprefs .switch { cursor: pointer; }
.nprefs__saved { position: absolute; top: calc(50% + 14px); left: 50%; translate: -50% 0; font-size: var(--fs-meta); line-height: 1.5; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.nprefs__lock { display: inline-flex; color: var(--ink-3); }
.nprefs .psettings__row.nprefs__row > dd.nprefs__error { grid-column: 1 / -1; font-size: var(--fs-ui); color: var(--danger); }
.nprefs .psettings__row.nprefs__row > dd.nprefs__error:empty { display: none; }

/* Always sent: closed, quiet; its summary is a full-width row that answers the pointer */
.nprefs__always { margin-top: 16px; border-top: 1px solid var(--line); }
.nprefs__summary { display: grid; gap: 2px; padding: 12px 0; list-style: none; cursor: pointer; }
.nprefs__summary::-webkit-details-marker { display: none; }
.nprefs__summarytitle { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-ui); font-weight: 500; color: var(--ink); transition: color var(--dur); }
.nprefs__summarytitle .icon { flex: none; color: var(--ink-2); transition: rotate var(--dur), color var(--dur); }
.nprefs__summaryline { font-size: var(--fs-ui); line-height: 1.5; color: var(--ink-2); }
.nprefs__always[open] .nprefs__summaryline { display: none; } /* open, the rows say it */
.nprefs__summaryline { transition: color var(--dur); }
.nprefs__summary:hover .nprefs__summaryline, .nprefs__summary:hover .nprefs__summarytitle .icon { color: var(--ink); }
.nprefs__summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.nprefs__always[open] .nprefs__summarytitle .icon { rotate: 90deg; }
.nprefs .psettings__row.nprefs__row--always { grid-template-columns: minmax(0, 1fr) auto; }
.nprefs .psettings__row.nprefs__row--always > dd.nprefs__locked { grid-column: 2; grid-row: 1 / span 2; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); color: var(--ink-2); white-space: nowrap; }
.nprefs__locked .icon { color: var(--ink-3); }
@media (prefers-reduced-motion: reduce) { .nprefs__summarytitle .icon { transition: none; } }

/* the gaps: lede to the first group 16px, between groups 24px (the same on Daniel's Settings, whose card rules zero a <p>'s margin) */
.page.ldu-page .nprefs > .psettings__lede { margin: 0; }
.nprefs .nprefs__head { margin-top: 24px; }
.nprefs > .nprefs__mail + .nprefs__head { margin-top: 16px; }

/* Change email's foot: Cancel as wide as its word, so "Send confirmation link" stays on one line on a phone */
.psettings__modal--email .ldu-modal__foot > .btn:first-child { flex: none; width: auto; }

/* the address change waiting for its link, under the Email row */
.nprefs__pending[hidden] { display: none; }
.nprefs__pending strong { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; font-weight: 500; color: var(--ink); }
