/* account area styles, app 10x pass, 20 Nov 2026. Owned by the account agent.
   Agents, tokens, settings, plan and paywall. Uses the shared tokens in app.css and adds none. */

/* ---------- light code blocks: sunk ground, 1px line, ink text (items 122, 126) ---------- */
.acct-code { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; color: var(--ink); }
.acct-code + .acct-code { margin-top: 12px; }
.acct-code-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); background: var(--surface); font-family: var(--mono); font-size: var(--t-1); color: var(--muted); }
.acct-code-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acct-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: var(--t-2); line-height: 1.7; }
.acct-code code { font-family: inherit; white-space: pre; }
.acct-code.is-wrap code { white-space: pre-wrap; overflow-wrap: anywhere; }
.acct-code pre:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* ---------- Agents: one step, then the tabs ---------- */
.acct-agents .block > .sec + * { margin-top: 12px; }
.acct-mk { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); flex-wrap: wrap; }
.acct-mk-l { min-width: 0; flex: 1 1 320px; }
.acct-mk-l h3 { font-size: var(--t-3); font-weight: 600; color: var(--ink); }
.acct-mk-l p { margin-top: 2px; font-size: var(--t-3); color: var(--muted); max-width: 52ch; text-wrap: pretty; }
.acct-test { display: flex; align-items: center; gap: 8px 12px; margin-top: 10px; flex-wrap: wrap; }
.acct-test-msg { font-size: var(--t-3); color: var(--muted); min-height: 1.4em; }
.acct-test-msg.ok { color: var(--green); font-weight: 500; }
.acct-test-msg.bad { color: var(--red); font-weight: 500; }

.acct-tabs { display: flex; gap: 2px; margin-top: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.acct-tabs::-webkit-scrollbar { display: none; }
.acct-tabs button { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: var(--t-3); font-weight: 500; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 9px 12px; min-height: 40px; cursor: pointer; white-space: nowrap; transition: color var(--dur-1), border-color var(--dur-1); }
.acct-tabs button:hover { color: var(--ink); }
.acct-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); }
.acct-tabs button:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.acct-tabs img { width: 14px; height: 14px; opacity: .78; }
.acct-tabs button[aria-selected="true"] img { opacity: 1; }
.acct-tabs .mono { font-family: var(--mono); font-size: var(--t-2); }
.acct-panel { padding-top: 14px; }
.acct-where { font-size: var(--t-3); color: var(--muted); margin-bottom: 10px; max-width: 60ch; text-wrap: pretty; }
.acct-where code { font-family: var(--mono); font-size: var(--t-2); color: var(--ink); background: var(--sunk); border-radius: var(--r-xs); padding: 1px 5px; }

.acct-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.acct-sec-h a { font-size: var(--t-3); color: var(--blue-deep); }

/* ---------- the one-time token box (item 128) ---------- */
.acct-fresh { margin: 0 0 12px; border-radius: var(--r-md); padding: 14px 16px; gap: 10px; scroll-margin: 96px; }
.acct-fresh:focus { outline: none; }
.acct-fresh:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.acct-fresh-h { display: flex; gap: 4px 10px; align-items: baseline; flex-wrap: wrap; font-size: var(--t-3); }
.acct-fresh-h span { color: var(--blue-ink); }
.acct-fresh .tok-val { font-size: var(--t-3); letter-spacing: .01em; }
.acct-agents .acct-fresh { margin: 0; }

/* ---------- token form: scope radio cards (item 129) ---------- */
.acct-tok-form { display: grid; gap: 14px; }
.acct-tok-form .field { max-width: 360px; }
.scope-cards { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.scope-cards legend { font-size: var(--t-3); font-weight: 550; padding: 0; margin-bottom: 6px; }
.scope-card { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; row-gap: 1px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1); }
.scope-card:hover { border-color: var(--line-strong); }
.scope-card input { grid-row: 1 / span 2; margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--blue); }
.scope-card input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.scope-card:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.scope-t { font-size: var(--t-3); font-weight: 550; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scope-d { font-size: var(--t-2); color: var(--muted); text-wrap: pretty; }
.scope-card:has(input:checked) .tag { background: var(--surface); }
.acct-tok-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.acct-tok-foot .form-msg { margin-right: auto; min-height: 0; }
.acct-tok-foot .form-msg:empty { display: none; }
.acct-empty { margin-top: 14px; }

/* token list, shared by Settings and Agents (item 125) */
.acct-tokens { list-style: none; margin: 16px 0 0; padding: 0; }
.acct-tokens li { display: flex; align-items: center; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.acct-tok-l { display: grid; gap: 1px; min-width: 0; flex: 1 1 240px; }
.acct-tok-l .t { font-size: var(--t-3); font-weight: 550; overflow-wrap: anywhere; }
.acct-tok-l .d { font-size: var(--t-2); color: var(--muted); }
.acct-used { font-size: var(--t-2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.acct-used::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.acct-used.is-on { color: var(--ink); }
.acct-used.is-on::before { background: var(--green); }
.acct-tokens-plain { margin-top: 8px; border-bottom: 1px solid var(--line); }

/* ---------- More ways in: compact rows (item 127) ---------- */
.acct-ints { overflow: hidden; }
.acct-int + .acct-int { border-top: 1px solid var(--line); }
.acct-int-row { display: flex; align-items: center; gap: 8px 16px; padding: 14px 16px; flex-wrap: wrap; }
.acct-int-l { flex: 1 1 260px; min-width: 0; }
.acct-int-l h3 { font-size: var(--t-3); font-weight: 600; }
.acct-int-l p { margin-top: 1px; font-size: var(--t-3); color: var(--muted); text-wrap: pretty; }
.acct-int-act { display: flex; gap: 8px; }
.acct-int-form { padding: 0 16px 14px; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.acct-int-form .field { flex: 1 1 260px; max-width: 360px; }
.acct-int-form .hint { font-size: var(--t-2); }
.acct-int-form .hint a { color: var(--blue-deep); }
.acct-int-msg { padding: 0 16px; min-height: 0; }
.acct-int-msg:empty { display: none; }
.acct-int-msg:not(:empty) { padding-bottom: 12px; }
.status-pill.is-on { background: var(--green-soft); color: var(--green); }

/* ---------- Settings ---------- */
.acct-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; }
.acct-saved { order: -1; font-size: var(--t-2); color: var(--muted); min-width: 56px; justify-content: flex-end; display: inline-flex; align-items: center; gap: 4px; }
.acct-saved:empty { visibility: hidden; }
.acct-saved.is-ok { color: var(--green); font-weight: 500; }
.acct-saved.is-bad { color: var(--red); font-weight: 500; }
.acct-saved .ico { width: 13px; height: 13px; }
.acct-ctl > select.input { width: 220px; }
.acct-ctl > .input-num { width: 88px; font-variant-numeric: tabular-nums; }
.acct-next { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--foot); border-radius: 0 0 var(--r-md) var(--r-md); font-size: var(--t-3); color: var(--ink); font-variant-numeric: tabular-nums; }
.prow-l .acct-rule { font-size: var(--t-2); color: var(--faint); margin-top: 4px; max-width: 52ch; }
.acct-rules { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--foot); border-radius: 0 0 var(--r-md) var(--r-md); display: grid; gap: 2px; }
.acct-rules p { font-size: var(--t-2); color: var(--muted); }
.acct-warn { display: inline-flex; align-items: center; gap: 5px; color: var(--red); }
.acct-warn .ico { width: 13px; height: 13px; }
.acct-del-act { display: flex; gap: 8px; flex: none; }
.acct-del-warn { font-size: var(--t-3); font-weight: 500; color: var(--red); }

/* the phone section strip fades at the right edge until the user reaches the end (item 133) */
@media (max-width: 960px) {
  .acct-nav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }
  .acct-nav.is-end { -webkit-mask-image: none; mask-image: none; }
  .acct-nav button { min-height: 36px; }
}
@media (max-width: 640px) {
  .acct-ctl { width: 100%; }
  .acct-ctl > select.input, .acct-ctl > .input-num { flex: 1 1 auto; width: auto; }
  .acct-mk .btn, .acct-del-act .btn { flex: 1 1 auto; }
  .acct-del-act { width: 100%; flex-wrap: wrap; }
  .acct-int-act { width: 100%; }
}

/* ---------- Plan section (items 135, 140) ---------- */
.plan-top { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 16px 18px; flex-wrap: wrap; }
.plan-name h3 { font-size: var(--t-4); font-weight: 600; }
.plan-name p { margin-top: 1px; font-size: var(--t-3); color: var(--muted); }
.plan-act { display: flex; align-items: center; }
.plan-meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.plan-meter { display: grid; gap: 8px; min-width: 0; }
.plan-meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: var(--t-2); color: var(--muted); }
.plan-n { color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.plan-full { font-size: var(--t-2); font-weight: 500; color: var(--muted); margin-top: -2px; }
.plan-n.is-pro { font-weight: 600; }
.pw-unit { text-align: center; }
.plan-col .plan-n { display: inline-block; min-width: 1.6em; }
.plan-meter .meter { width: 100%; }
.plan-more { border-top: 1px solid var(--line); }
.plan-more summary { list-style: none; cursor: pointer; padding: 12px 18px; font-size: var(--t-3); font-weight: 500; color: var(--blue-deep); border-radius: 0 0 var(--r-md) var(--r-md); } /* the chevron comes from the shared details rule in app.css */
.plan-more summary::-webkit-details-marker { display: none; }
.plan-more summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.plan-more .plan-cmp { margin: 0 18px 18px; }
.plan-ref { padding: 16px 18px; display: grid; gap: 12px; }
.plan-ref-h h3 { font-size: var(--t-3); font-weight: 600; }
.plan-ref-h p { margin-top: 1px; font-size: var(--t-3); color: var(--muted); }
.plan-ref .plan-meter { max-width: 520px; }
@media (max-width: 640px) {
  .plan-meters { grid-template-columns: minmax(0, 1fr); }
  .plan-act, .plan-act .btn { width: 100%; }
  .ref-row { flex-wrap: wrap; }
  .ref-row .btn { flex: 1 1 auto; }
}

/* ---------- paywall: "Tell me when Pro opens" and its confirmation (item 138) ---------- */
.pw-main { display: contents; }
.pw-listed { display: flex; align-items: flex-start; gap: 8px; font-size: var(--t-3); color: var(--green); font-weight: 500; text-wrap: pretty; }
.pw-listed .ico { width: 15px; height: 15px; margin-top: 3px; flex: none; }
.pw-actions .pw-listed { flex: 1 1 240px; order: -1; margin: 0; }
@media (max-width: 560px) { .pw-actions .pw-listed { order: 1; flex: none; } }
@media (prefers-reduced-motion: reduce) {
  .acct-tabs button, .scope-card { transition: none; }
}

/* the settings column never grows past the screen; a long control wraps inside its row instead */
.settings-page .set-main { grid-template-columns: minmax(0, 1fr); }

/* settings section headings sit one step above row titles, so the page scans */
.settings-page .sset-h h2 { font-size: var(--t-5); }
/* Readwise: the field and its button share one line, the hint sits under both */
.acct-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-inline .input { flex: 1 1 220px; min-width: 0; }
.acct-int-form .field { max-width: 520px; }
@media (max-width: 640px) {
  .acct-fresh .tok-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acct-fresh .tok-val { grid-column: 1 / -1; }
  .acct-fresh .tok-row .btn { justify-content: center; padding-inline: 8px; }
  .acct-test .btn { width: 100%; justify-content: center; }
  .acct-inline .btn { width: 100%; }
}

/* ---------- four-plan system, pricing pass 20 Nov 2026 (pricing-ui). Prices come from /api/billing/plans. ---------- */
.meter.is-open i { background: var(--line-strong); }
/* a full meter reads as a limit, not as done: the bar goes quiet and the count says "at limit" */
.plan-meter.is-at .meter i { background: var(--line-strong); }
.plan-meter.is-at .plan-n { color: var(--ink); font-weight: 600; }

/* plan picker in Settings: one row per plan, the current plan marked, one filled button */
.plan-panel + .plan-pick { margin-top: 12px; }
.plan-pick { padding: 16px 18px 14px; display: grid; gap: 12px; }
.pp-h { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.pp-h h3 { font-size: var(--t-4); font-weight: 600; margin-right: auto; }
.pp-toggle { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--sunk); }
.pp-toggle button { font: inherit; font-size: var(--t-2); font-weight: 500; min-height: 30px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer; transition: background var(--dur-1), color var(--dur-1); }
.pp-toggle button:hover { color: var(--ink); }
.pp-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.pp-toggle button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.pp-save { font-size: var(--t-1); font-weight: 600; color: var(--blue-ink); background: var(--blue-soft); border-radius: var(--r-pill); padding: 3px 9px; }
.pp-save:empty { display: none; }
.pp-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pp-row { display: grid; grid-template-columns: minmax(96px, .55fr) minmax(0, 2.2fr) auto; grid-template-areas: "name price act" "name lim act"; column-gap: 20px; row-gap: 2px; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.pp-row.is-rec { background: var(--blue-soft); border-radius: var(--r-sm); border-bottom-color: transparent; }
.pp-name { grid-area: name; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.pp-n { font-size: var(--t-3); font-weight: 600; color: var(--ink); }
.pp-rec { font-size: var(--t-1); font-weight: 600; color: var(--blue-ink); }
.pp-price { grid-area: price; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pp-amt { font-size: var(--t-4); font-weight: 600; color: var(--ink); }
.pp-per { font-size: var(--t-2); color: var(--muted); }
.pp-lim { grid-area: lim; font-size: var(--t-2); color: var(--muted); }
.pp-act { grid-area: act; display: flex; justify-content: flex-end; min-width: 112px; }
.pp-act .btn { min-width: 112px; }
.pp-act .pw-listed { font-size: var(--t-2); max-width: 220px; }
.pp-cur { white-space: nowrap; }
.pp-foot { font-size: var(--t-2); color: var(--muted); }
.pp-foot a { color: var(--blue-deep); display: inline-flex; align-items: center; gap: 4px; }
.pp-foot .ico { width: 12px; height: 12px; }
@media (max-width: 640px) {
  .pp-h h3 { flex: 1 0 100%; }
  .pp-name { flex-direction: row; align-items: center; gap: 8px; }
  .pp-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "price" "lim" "act"; row-gap: 4px; }
  .pp-act { justify-content: stretch; margin-top: 6px; }
  .pp-act .btn { width: 100%; }
  .pp-act:empty { display: none; }
}

/* the quiet notes-cap line on Home and in the queue header. A note, never a blocker. */
.plan-cap { margin-top: 6px; font-size: var(--t-2); color: var(--muted); text-wrap: pretty; }
.plan-cap a { color: var(--blue-deep); text-underline-offset: 3px; }
.q-page > .plan-cap { margin: -4px 0 12px; }

/* paywall: the limit, what you got, Starter first and Pro second, then "Maybe later" */
.pw { width: min(520px, 100%); gap: 16px; }
.pw > p.pw-got { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-3); color: var(--ink); padding: 10px 12px; border-radius: var(--r-md); background: var(--sunk); }
.pw-got .ico { width: 15px; height: 15px; margin-top: 3px; color: var(--green); flex: none; }
.pw-offers { display: grid; gap: 8px; }
.pw-offer { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); flex-wrap: wrap; }
.pw-offer.is-lead { background: var(--blue-soft); border-color: transparent; }
.pw-offer-t { min-width: 0; flex: 1 1 200px; display: grid; gap: 2px; }
.pw-offer h3 { font-size: var(--t-4); font-weight: 600; color: var(--ink); }
.pw-cost { font-size: var(--t-3); color: var(--ink); font-variant-numeric: tabular-nums; }
.pw-offer:not(.is-lead) .pw-cost { color: var(--muted); }
.pw-fact { font-size: var(--t-2); color: var(--muted); }
.pw-offer-a { display: flex; }
.pw-offer-a:empty { display: none; }
.pw-actions { justify-content: space-between; margin-top: 2px; }
.pw-actions .btn-text { margin-left: -6px; }
.pw-all { font-size: var(--t-3); color: var(--blue-deep); text-underline-offset: 3px; }
.pw .pw-fine { margin-top: -8px; }
@media (max-width: 560px) {
  .pw-actions { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 0 -20px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .pw { max-height: 85dvh; }
  .pw-offer-a, .pw-offer-a .btn { width: 100%; }
  /* the second plan reads as a link on phones, so one filled button sits in reach */
  .pw-offer:not(.is-lead) { padding: 10px 16px; }
  .pw-offer:not(.is-lead) .pw-offer-a .btn { min-height: 36px; border-color: transparent; background: none; color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; justify-content: flex-start; padding: 0; width: auto; }
  .pw-offer-a .btn { min-height: 44px; }
  .pw-actions { flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .pp-toggle button { transition: none; } }
