/* UI-2 phase 2: account detail, Accounts list + Partner gauge, Partner / Terms / term edit / statement (screen), sign-in.
   Sample D "Ember + Ink". Tokens come from adsngin.css; nothing here redefines a token. Everything is scoped under
   .an-p2 (pages) or .an-p2-login so the shared classes other pages use are never touched. Long-table pages use the
   flat white .an-card (sample C); only summary tiles and the gauge hero are glass. */

.an-p2 { padding-top: 8px; }

/* page head: crumb, title, chips, actions */
.an-p2-crumb { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin: 0 0 6px; color: var(--an-muted); font-size: 14px; font-weight: 500; }
.an-p2-crumb:hover { color: var(--an-ink); text-decoration: none; }
.an-p2-crumb .an-ic { width: 16px; height: 16px; }
.an-p2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.an-p2-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; overflow-wrap: anywhere; }
.an-p2-sub { margin: 4px 0 0; color: var(--an-muted); font-size: 14px; }
.an-p2-titlerow { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-width: 0; }
.an-p2-titlerow .an-chips { flex-wrap: wrap; overflow: visible; max-width: 100%; }
.an-p2-actions { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.an-p2 .an-btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }

/* two-column body: the work on the left, the client and the forms on the right */
.an-p2-grid { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: start; }
.an-p2-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.an-p2-col > .an-card, .an-p2-col > .an-proposals { margin-bottom: 0; }
.an-p2-col > .an-proposals { gap: 16px; }
.an-p2-col > .an-proposals-more { margin: 0; }

/* stat tiles (glass: a summary, not a table) */
.an-p2-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.an-p2-stat { padding: 16px 18px; min-width: 0; }
.an-p2-stat .an-label { display: block; margin-bottom: 8px; }
.an-p2-n { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.an-p2-n .an-cur { font-size: 12px; letter-spacing: 0.04em; font-weight: 500; }
.an-p2-n small { font-size: 13px; font-weight: 600; letter-spacing: 0; }
.an-p2-stat .an-p2-note { display: block; margin-top: 6px; font-size: 12.5px; color: var(--an-muted); line-height: 1.35; }

/* 8-week charts: ink bars; the weeks behind are hatched, this week is solid (sample D) */
.an-p2-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 16px; }
.an-p2-chart .an-label { display: block; margin-bottom: 10px; }
.an-p2-bars { display: flex; align-items: flex-end; gap: 6px; height: 76px; }
.an-p2-bars > i { display: block; flex: 1; min-height: 2px; border-radius: 4px 4px 0 0; background: repeating-linear-gradient(-45deg, var(--an-hatch) 0 2px, var(--an-hatch-bg) 2px 4px); }
.an-p2-bars > i.now { background: var(--an-chart); }
.an-p2-bars > i.empty { height: 2px; min-height: 2px; border-radius: 0; background: var(--an-faint); opacity: 0.55; }
.an-p2-chart .an-chart-labels { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; }
.an-p2-chart .an-chart-labels span { flex: 1; text-align: left; font-size: 11.5px; color: var(--an-muted); }
.an-p2-chart .an-chart-labels span:last-child { text-align: right; }

/* flat cards that hold a table edge to edge */
.an-card.an-p2-flush { padding: 0; overflow: hidden; }
.an-card.an-p2-flush.an-table-scroll { overflow-x: auto; }
.an-p2-flush > .an-card-head { margin: 0; }
.an-p2-flush > .an-card-head .an-npill { margin-left: 2px; }
.an-p2-flush table.an-table { border: 0; border-radius: 0; width: 100%; }
.an-p2-flush .an-table th { background: transparent; border-bottom: 1px solid var(--an-line); padding: 10px 16px; }
.an-p2-flush .an-table td { padding: 12px 16px; border-bottom: 1px solid var(--an-line); }
.an-p2-flush .an-table tr:last-child td { border-bottom: 0; }
.an-p2-flush .an-table th:first-child, .an-p2-flush .an-table td:first-child { padding-left: 20px; }
.an-p2-flush .an-table th:last-child, .an-p2-flush .an-table td:last-child { padding-right: 20px; }
.an-p2-flush .an-table td a { font-weight: 500; }
.an-p2-flush .an-table td a:not(.an-btn):hover { text-decoration: underline; }
.an-p2-flush > p { margin: 0; padding: 12px 20px; }
.an-p2 .an-card-head { font-weight: 600; font-size: 15px; flex-wrap: wrap; height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.an-p2 .an-card-head > .an-muted:last-child { margin-left: auto; font-weight: 400; font-size: 13px; }

/* the card-head "n" count pill, mirrors the Board's */
.an-p2 .an-npill { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: var(--an-r-ctl); background: var(--an-sunk); font-size: 12.5px; font-weight: 600; color: var(--an-muted); }

/* client card facts */
.an-p2-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.an-p2-fact { min-width: 0; padding: 12px 14px; border-radius: 14px; background: var(--an-sunk); }
.an-p2-fact .an-label { display: block; margin-bottom: 4px; }
.an-p2-fact .an-p2-n { font-size: 22px; }
.an-p2-fact .an-p2-note { display: block; margin-top: 2px; font-size: 12.5px; color: var(--an-muted); }
.an-p2 .an-client .an-kv { font-size: 14px; row-gap: 8px; }
.an-p2 .an-kv dt { white-space: nowrap; }
.an-p2 .an-sources ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.an-p2 .an-sources summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }

/* forms: roomy pill-adjacent inputs, ink focus */
.an-p2 .an-card input:not([type=checkbox]):not([type=radio]), .an-p2 .an-card select, .an-p2 .an-card textarea { border-radius: 12px; height: 42px; padding: 0 12px; background: var(--an-pane); }
.an-p2 .an-card textarea { height: auto; min-height: 76px; padding: 10px 12px; }
.an-p2 .an-card input:focus, .an-p2 .an-card select:focus, .an-p2 .an-card textarea:focus { outline: 0; border-color: var(--an-accent); box-shadow: 0 0 0 3px var(--an-accent-soft); }
.an-p2 .an-contract-form .an-fieldset-title { margin: 14px 0 8px; padding-top: 14px; border-top: 1px solid var(--an-line); }
.an-p2 .an-contract-form .an-fieldset-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.an-p2 .an-contract-form label { color: var(--an-muted); font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.an-p2 .an-contract-form > .an-btn, .an-p2 .an-partner-form > .an-btn { margin-top: 4px; }
.an-p2-formgrid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; align-items: start; }
.an-p2-formgrid > div:has(textarea) { grid-column: 1 / -1; }
.an-p2-formgrid > div:has(textarea) textarea { min-height: 76px; max-width: 640px; }
.an-p2-formgrid > .an-btn { justify-self: start; }
.an-p2-formgrid > .errorlist { grid-column: 1 / -1; }
.an-p2 .an-card input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--an-accent); vertical-align: -3px; margin-right: 6px; }
.an-p2 .an-conversion-line { padding: 0; }
.an-p2 #ad-copy .an-form-buttons { flex-wrap: wrap; }
.an-p2 #ad-copy select { flex: 1 1 220px; width: auto; min-width: 0; }
.an-p2 .an-lq-form input[type=text] { flex: 1 1 100%; }
.an-p2 .an-lq-form select, .an-p2 .an-lq-form input[type=text] { width: auto; }
.an-p2 .an-lq-form details label { margin-top: 10px; }
.an-p2 .an-lq-questions summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }

/* Accounts list: head toolbar */
.an-p2-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.an-p2-tally { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-p2-tally .an-chip { height: 28px; padding: 0 12px; }
.an-p2 .an-row-ended td:first-child a { color: var(--an-muted); }
.an-p2-acct { display: block; font-weight: 600; color: var(--an-ink); overflow-wrap: anywhere; }
.an-p2-flush .an-table td a.an-p2-acct { font-weight: 600; }

/* Partner gauge: the logo's arc, as a meter */
.an-p2-partner { padding: 22px 24px; margin-bottom: 20px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px 32px; align-items: center; }
.an-p2-partner h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.an-p2-gauge { position: relative; width: 240px; max-width: 100%; margin: 0 auto; }
.an-p2-gauge svg { display: block; width: 100%; height: auto; }
.an-p2-gauge .tr { stroke: var(--an-track); }
.an-p2-gauge .fl { stroke: var(--an-chart); }
.an-p2-gauge-c { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; line-height: 1.1; }
.an-p2-gauge-c b { display: block; font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.an-p2-gauge-c span { font-size: 12.5px; color: var(--an-muted); }
.an-p2-pbody { min-width: 0; }
.an-p2-pmoney { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 12px; }
.an-p2-pmoney b { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.an-p2-prow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.an-p2-prow > div { padding: 12px 14px; border-radius: 14px; background: var(--an-sunk); font-size: 14px; min-width: 0; }
.an-p2-prow .an-label { display: block; margin-bottom: 4px; }
.an-p2-prow b { font-size: 20px; font-weight: 600; }
.an-p2-prow .an-pill { margin-left: 6px; }
.an-p2-fine { margin: 0; font-size: 12.5px; color: var(--an-muted); line-height: 1.45; }

/* Partner checklist */
.an-p2-bars3 { padding: 0; }
.an-p2-bars3 .an-bar-line { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--an-line); }
.an-p2-bars3 .an-bar-line:last-child { border-bottom: 0; }
.an-p2-bars3 .an-bar-line .an-muted { flex: 1 1 260px; }
.an-p2 .an-partner-form { padding: 0; }
.an-p2 ol { padding-left: 20px; line-height: 1.6; margin: 0; }

/* breadcrumb line under a sub-page title */
.an-p2-links { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; margin: 6px 0 0; font-size: 14px; color: var(--an-muted); }
.an-p2-links a { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--an-line); }
.an-p2-links a:hover { text-decoration-color: currentColor; }
.an-p2-narrow { max-width: 880px; }

/* spend statement, screen */
.an-p2-statement { padding: 20px; }
.an-p2-statement > p { margin: 0 0 14px; color: var(--an-muted); }
.an-p2-statement h3 { margin: 22px 0 10px; }
.an-p2-statement .an-table { border: 1px solid var(--an-line); border-radius: 12px; overflow: hidden; }
.an-p2-statement .an-table th, .an-p2-statement .an-table td { border: 0; border-bottom: 1px solid var(--an-line); padding: 10px 14px; }
.an-p2-statement .an-table tr:last-child td { border-bottom: 0; }
.an-p2-statement .an-table th { background: var(--an-sunk); }
.an-p2-statement .an-table td:nth-child(n+3):not(:last-child) { font-variant-numeric: tabular-nums; }

/* sign-in */
/* the header stays in the DOM but unseen: its svg gradient is the one the card's mark uses (display:none would drop it) */
body:has(.an-p2-login) .an-top { position: absolute; visibility: hidden; height: 0; overflow: hidden; }
body:has(.an-p2-login) .an-foot { display: none; }
.an-p2-login { display: grid; place-items: center; min-height: calc(100vh - 8px); padding: 32px 20px; background: linear-gradient(160deg, var(--an-bg-warm), var(--an-bg-cool)); }
.an-mockbanner + .an-p2-login, .an-mockbanner ~ .an-p2-login { min-height: calc(100vh - 62px); }
.an-p2-signin { width: 100%; max-width: 400px; padding: 32px; border-radius: 20px; background: var(--an-glass-strong); border: 1px solid var(--an-glass-line); box-shadow: var(--an-shadow-pop); display: flex; flex-direction: column; gap: 16px; }
.an-p2-signin .an-brandrow { display: flex; align-items: center; gap: 10px; }
.an-p2-signin .an-logo { width: 44px; height: 44px; }
.an-p2-signin .an-wordmark { font-size: 24px; }
.an-p2-signin h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.an-p2-signin form { display: flex; flex-direction: column; gap: 16px; }
.an-p2-signin label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; font-weight: 600; color: var(--an-muted); }
.an-p2-signin input { width: 100%; height: auto; padding: 12px; border: 1px solid var(--an-input-line); border-radius: 12px; background: var(--an-pane); color: var(--an-ink); font: inherit; font-size: 15px; font-weight: 400; }
.an-p2-signin input:focus { outline: 0; border-color: var(--an-accent); box-shadow: 0 0 0 3px var(--an-accent-soft); }
.an-p2-signin .an-btn { width: 100%; height: 46px; font-size: 15px; }
.an-p2-signin .errorlist { margin: 0; }
.an-p2-signin .an-p2-hint { margin: 0; font-size: 13px; color: var(--an-muted); }

/* SDT3 B3: the page leads with why the account is flagged and what to do; settings and lead quality fold away */
.an-whyflag .an-card-head { gap: 10px; }
.an-whyflag > .an-card-head > .an-chip { margin-left: auto; }
.an-why-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.45; }
.an-why-tags { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.an-whyflag .an-open-item { margin: 0; box-shadow: none; border: 1px solid var(--an-line); }
.an-whyflag .an-open-item + .an-open-item { margin-top: 0; }
.an-steps summary, .an-notneeded summary, .an-settings > summary .an-link, .an-lq-bar > summary .an-link { cursor: pointer; color: var(--an-ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; font-size: 14px; }
.an-steps summary, .an-notneeded summary { min-height: 32px; display: inline-flex; align-items: center; }
.an-steps p { margin: 6px 0 0; line-height: 1.5; }
.an-notneeded form { margin-top: 6px; }
.an-notneeded input[type=text] { flex: 1 1 220px; }
.an-open-item .an-form-buttons { align-items: center; flex-wrap: wrap; }
.an-lq-bar { padding: 0; margin: 0 0 16px; }
.an-lq-bar > summary { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 16px; min-height: 48px; cursor: pointer; list-style: none; }
.an-lq-bar > summary::-webkit-details-marker { display: none; }
.an-lq-bar .an-lq-body { padding: 0 16px 16px; }
.an-lq-bar .an-lq-note { overflow-wrap: anywhere; }
.an-settings { padding: 0; }
.an-settings > summary.an-card-head { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.an-settings > summary::-webkit-details-marker { display: none; }
.an-settings .an-settings-body { padding: 0 16px 16px; }
.an-history-list { list-style: none; margin: 0; padding: 0 16px 8px; }
.an-history-list li { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--an-line); line-height: 1.4; }
.an-history-list li:first-child { border-top: 0; }
.an-history .an-act-all { margin-left: auto; font-size: 13px; }

/* tablet and phone */
@media (max-width: 1100px) {
  .an-p2-grid { grid-template-columns: minmax(0, 1fr); }
  .an-p2-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .an-p2-charts { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .an-p2-partner { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .an-p2-prow { grid-template-columns: minmax(0, 1fr); }
  .an-p2-head h1 { font-size: 24px; }
}
@media (max-width: 560px) {
  .an-p2-stats { gap: 12px; }
  .an-p2-stat { padding: 14px; }
  .an-p2-n { font-size: 24px; }
  .an-p2-flush .an-cardrows { padding: 12px; }
  .an-p2-flush .an-cardrows tr { margin-bottom: 8px; }
  .an-p2-flush .an-cardrows tr:last-child { margin-bottom: 0; }
  .an-p2-flush .an-cardrows td { padding: 3px 0; border: 0; }
  .an-p2-flush .an-cardrows td:first-child { padding-left: 0; }
  .an-p2-flush .an-cardrows td:last-child { padding-right: 0; }
  .an-p2-flush .an-cardrows td::before { margin-right: auto; }
  .an-p2-statement { padding: 14px; overflow-x: auto; }
  .an-p2-statement .an-table { min-width: 520px; }
  .an-p2-signin { padding: 24px; }
  .an-p2 .an-kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .an-p2 .an-kv dt { margin-top: 8px; font-size: 12.5px; }
}

.an-whyflag { margin-bottom: 20px; }
.an-open-item .an-card-head { justify-content: flex-start; gap: 10px; }
.an-open-item .an-card-head .an-muted { margin-left: auto; }
.an-settings > summary.an-card-head { padding-left: 16px; padding-right: 16px; }
.an-whyflag, .an-open-item, .an-settings { padding: 0; }
.an-whyflag > .an-card-head, .an-open-item > .an-card-head, .an-settings > summary.an-card-head { margin: 0; padding: 0 16px; border-radius: 0; }
.an-whyflag > .an-proposal-body { padding: 16px; }
.an-whyflag .an-open-item { overflow: hidden; }
.an-whyflag .an-open-item > .an-proposal-body { padding: 12px 16px 16px; }
.an-history { padding: 0; }
.an-history > .an-card-head { margin: 0; padding: 0 16px; }
