/* crm-agent-spend-v1 */
.agent-spend-page{--as-accent-text:#2165d6;--as-accent-soft:#edf3ff;--as-success-bg:#eaf8f2;--as-success-text:#13734f;--as-warning-bg:#fff4df;--as-warning-text:#935500;font-size:12px;line-height:1.5;gap:16px;padding:20px 24px;color:var(--text-main);color-scheme:light}
body.dark-theme .agent-spend-page{--as-accent-text:#93bbff;--as-accent-soft:#182b49;--as-success-bg:#10352b;--as-success-text:#6ee7b7;--as-warning-bg:#362a18;--as-warning-text:#efb65e;color-scheme:dark}
.agent-spend-page> *{width:100%;max-width:1680px;margin-left:auto;margin-right:auto;flex-shrink:0}
.agent-spend-page [hidden]{display:none!important}
.agent-spend-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:48px;margin-bottom:0}
.agent-spend-heading .page-title{font-size:20px;letter-spacing:-.5px;font-weight:800}
.agent-spend-heading p,.agent-spend-help{color:var(--text-muted);font-size:11px;line-height:1.6;margin:3px 0 0}
.agent-spend-zone{font-size:12px;font-weight:500;color:var(--text-muted);letter-spacing:0;margin-left:4px}
.agent-spend-card{background:var(--card-bg);border:1px solid var(--border-light);border-radius:12px}
.agent-spend-controls{display:flex;align-items:flex-end;gap:12px;padding:20px;flex-wrap:wrap}
.agent-spend-controls label,.agent-spend-period-field{display:flex;flex-direction:column;gap:8px;font-weight:600;font-size:11px;color:var(--text-muted)}
.agent-spend-controls label{min-width:150px;flex:0 1 210px}
.agent-spend-controls .agent-spend-agent-field{min-width:190px;flex:1 1 220px;max-width:340px}
.agent-spend-periods{display:flex;gap:4px;border-radius:8px;background:var(--card-bg);box-shadow:inset 0 0 0 1px var(--border-light)}
.agent-spend-periods button{font:inherit;color:var(--text-muted);font-size:11px;border:0;background:transparent;border-radius:8px;min-width:105px;min-height:44px;height:44px;padding:0 13px;cursor:pointer}
.agent-spend-periods button span{display:block;font-size:10px;font-weight:400;line-height:1.25;margin-top:1px;font-variant-numeric:tabular-nums}
.agent-spend-periods button[aria-pressed=true]{color:var(--as-accent-text);background:var(--as-accent-soft)}
.agent-spend-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-left:auto;min-height:44px}
.agent-spend-button{font:inherit;font-size:12px;line-height:22px;font-weight:600;min-height:44px;padding:10px 14px;border:1px solid var(--border-light);border-radius:8px;color:var(--text-main);background:var(--card-bg);cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center}
.agent-spend-primary{background:var(--accent);border-color:var(--accent);color:#fff}
body.dark-theme .agent-spend-primary{background:#2563eb;border-color:#2563eb}
.agent-spend-button:disabled,.agent-spend-controls select:disabled,.agent-spend-periods button:disabled{opacity:.55;cursor:default}
.agent-spend-page :is(button,select,a):focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.agent-spend-help{margin:-6px auto 0;font-size:11px}
.agent-spend-alert{border:1px solid var(--border-light);border-radius:9px;background:var(--card-bg);padding:14px 16px;color:var(--text-muted);font-size:12px;line-height:1.65;overflow-wrap:anywhere}
.agent-spend-alert strong{color:var(--text-main)}
.agent-spend-alert-warning{border-left:3px solid #c78418;background:color-mix(in srgb,#c78418 7%,var(--card-bg))}
.agent-spend-alert-error{border-left:3px solid var(--danger);color:var(--text-main);background:color-mix(in srgb,var(--danger) 6%,var(--card-bg))}
.agent-spend-alert-detail{margin-top:5px}
#agent-spend-results{display:flex;flex-direction:column;gap:16px}
#agent-spend-results> *{flex-shrink:0}
.agent-spend-empty{padding:42px 24px;text-align:center}
.agent-spend-empty h2{font-size:16px;font-weight:600;margin:0 0 9px}
.agent-spend-empty p{color:var(--text-muted);font-size:12px;line-height:1.7;margin:0}
.agent-spend-summary{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(200px,.85fr) minmax(230px,.95fr);align-items:center;padding:22px 24px;gap:24px;background:var(--card-dark);color:#f8fafc;border:0;border-radius:10px}
.agent-spend-eyebrow{color:#b7c4d9;font-size:12px}
.agent-spend-amount{font-size:30px;font-weight:750;line-height:1.25;letter-spacing:-.6px;margin:8px 0;font-variant-numeric:tabular-nums}
.agent-spend-total p{margin:0;color:#b7c4d9;font-size:11px;line-height:1.6}
.agent-spend-total .agent-spend-freshness{font-size:11px;margin-top:4px}
.agent-spend-coverage{display:flex;flex-direction:column;align-items:flex-start;gap:10px;min-width:0}
.agent-spend-coverage strong{font-size:14px;font-weight:600}
.agent-spend-coverage>span:not(.agent-spend-status){font-size:12px;color:#b7c4d9}
.agent-spend-timestamps{display:grid;gap:4px;font-size:11px;color:#b7c4d9;font-variant-numeric:tabular-nums;padding-left:24px;border-left:1px solid #ffffff15}
.agent-spend-timestamps strong{font-weight:500;font-size:12px;color:#f8fafc}
.agent-spend-timestamps span:nth-of-type(2){margin-top:10px}
.agent-spend-status{display:inline-flex;align-items:center;gap:6px;min-height:24px;font-size:11px;font-weight:600;padding:3px 8px;border-radius:6px;background:#ffffff0c;border:1px solid #ffffff15;color:#b7c4d9}
.agent-spend-status::before,.agent-spend-row-status::before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor;flex:0 0 5px}
.agent-spend-status.is-complete{color:#6ee7b7}
.agent-spend-row-status.is-complete{color:#13734f}
body.dark-theme .agent-spend-status.is-complete,body.dark-theme .agent-spend-row-status.is-complete{color:#5dd5b0}
.agent-spend-status.is-running{color:#93bbff}
.agent-spend-status.is-partial{color:#efb65e}
.agent-spend-row-status.is-partial{color:#a56100}
body.dark-theme .agent-spend-status.is-partial,body.dark-theme .agent-spend-row-status.is-partial{color:#efb65e}
.agent-spend-table-card{overflow:hidden}
.agent-spend-table-heading{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;gap:15px}
.agent-spend-table-heading h2{font-size:15px;font-weight:750;letter-spacing:-.2px;margin:0}
.agent-spend-table-heading span{font-size:11px;color:var(--text-muted)}
.agent-spend-table-scroll{overflow-x:auto}
.agent-spend-table{width:100%;border-collapse:collapse;text-align:left;min-width:720px}
.agent-spend-table th{font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted);padding:12px 20px;background:var(--table-head-bg);border-top:1px solid var(--border-light);border-bottom:1px solid var(--border-light);white-space:nowrap;text-align:left}
.agent-spend-table th:nth-child(2){text-align:right}
.agent-spend-table td{padding:12px 20px;vertical-align:top;border-bottom:1px solid var(--border-light);font-size:11px;line-height:1.6}
.agent-spend-table tr:last-child td{border-bottom:0}
.agent-spend-table .agent-spend-account{width:27%;min-width:190px;max-width:300px;overflow-wrap:anywhere}
.agent-spend-account strong,.agent-spend-account span{display:block}
.agent-spend-account strong{font-weight:700}
.agent-spend-account span{color:var(--text-muted);font-size:10px;margin-top:4px}
.agent-spend-account-amount{white-space:nowrap;font-weight:600;font-variant-numeric:tabular-nums;text-align:right}
.agent-spend-table .agent-spend-fetched{color:var(--text-muted);font-size:10px;min-width:150px;font-variant-numeric:tabular-nums}
.agent-spend-account-detail{min-width:235px;max-width:500px;overflow-wrap:anywhere}
.agent-spend-row-status{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:3px 7px;border-radius:5px;font-size:11px;font-weight:500;color:var(--text-muted);background:var(--input-bg)}
.agent-spend-row-status.is-complete{color:var(--as-success-text);background:var(--as-success-bg)}
.agent-spend-row-status.is-partial{color:var(--as-warning-text);background:var(--as-warning-bg)}
.agent-spend-error-detail{font-size:11px;color:var(--text-muted);margin-top:3px}
.agent-spend-error-code{display:block;color:var(--text-muted);font-size:9px;margin-top:3px}
.agent-spend-previous{border-left:2px solid var(--border-light);padding-left:9px;margin-top:9px;font-size:10px;color:var(--text-muted)}
.agent-spend-previous strong,.agent-spend-previous span{display:block;font-weight:400}
.agent-spend-no-accounts{padding:12px 20px 24px;margin:0;font-size:12px;color:var(--text-muted);line-height:1.6}
@media(hover:hover) and (pointer:fine){.agent-spend-button:not(:disabled):hover{background:var(--hover-bg);border-color:var(--accent)}.agent-spend-primary:not(:disabled):hover{background:#2563eb}body.dark-theme .agent-spend-primary:not(:disabled):hover{background:#1d4ed8}}
@media(max-width:1050px){.agent-spend-summary{grid-template-columns:minmax(0,1fr) minmax(200px,1fr)}.agent-spend-timestamps{grid-column:1/-1;padding-left:0;padding-top:16px;border-left:0;border-top:1px solid #ffffff15;grid-template-columns:1fr 1fr}.agent-spend-timestamps span:nth-of-type(2){margin-top:0;grid-column:1}.agent-spend-timestamps strong{grid-column:2}}
@media(max-width:900px){.agent-spend-page{padding:20px 16px}.agent-spend-controls{gap:12px;padding:16px}.agent-spend-actions{margin-left:0}.agent-spend-summary{padding:22px;align-items:flex-start}.agent-spend-amount{font-size:30px}.agent-spend-table-heading span{display:none}}
@media(max-width:620px){.agent-spend-heading{align-items:flex-start}.agent-spend-controls label,.agent-spend-controls .agent-spend-agent-field{max-width:none;flex:1 1 100%}.agent-spend-summary{grid-template-columns:minmax(0,1fr);gap:20px}.agent-spend-coverage{min-width:0}.agent-spend-timestamps{grid-template-columns:minmax(0,1fr);gap:4px}.agent-spend-timestamps strong{grid-column:1}.agent-spend-timestamps span:nth-of-type(2){margin-top:10px}.agent-spend-actions{width:100%}.agent-spend-actions .agent-spend-button{flex:1}.agent-spend-table-heading{padding:16px}.agent-spend-table{min-width:0;display:block}.agent-spend-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.agent-spend-table tbody{display:block}.agent-spend-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:16px;border-bottom:1px solid var(--border-light)}.agent-spend-table tr:last-child{border-bottom:0}.agent-spend-table td{padding:0;border:0}.agent-spend-table .agent-spend-account{min-width:0;width:auto;max-width:none}.agent-spend-table .agent-spend-fetched{grid-column:1/-1;font-size:11px}.agent-spend-fetched::before{content:"Получено: "}.agent-spend-account-detail{grid-column:1/-1;min-width:0;max-width:none}.agent-spend-previous{font-size:11px}.agent-spend-account-amount{align-self:start}}
@media(prefers-reduced-motion:reduce){.agent-spend-button:not(:disabled):active{transform:none}}

/* Spend sorting is immediate, including keyboard activation. */
.agent-spend-sort{display:inline-flex;align-items:center;justify-content:flex-start;gap:7px;min-height:36px;padding:4px 0;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer}
.agent-spend-sort-arrow{display:inline-block;min-width:10px;text-align:center;font-size:13px;line-height:1}
.agent-spend-sort.is-selected{color:var(--as-accent-text)}
.agent-spend-table th:has(.agent-spend-sort){padding-top:3px;padding-bottom:3px}
.agent-spend-mobile-sort{display:none}
@media(hover:hover) and (pointer:fine){.agent-spend-sort:hover{color:var(--as-accent-text)}}
@media(max-width:620px){.agent-spend-mobile-sort{display:flex;align-items:center;flex-wrap:wrap;gap:6px 14px;padding:0 16px 12px;color:var(--text-muted);font-size:11px}.agent-spend-mobile-sort .agent-spend-sort{min-height:40px;padding:0 8px;border:1px solid var(--border-light);border-radius:7px}.agent-spend-mobile-sort .agent-spend-sort.is-selected{background:var(--as-accent-soft)}}

.agent-spend-period-field{min-width:0}
.agent-spend-periods{flex-wrap:wrap}
.agent-spend-periods button{flex:1 1 105px;white-space:nowrap}
.agent-spend-period-note{margin-top:-9px}
.agent-spend-account .agent-spend-account-period{font-size:10px;color:var(--text-muted);font-variant-numeric:tabular-nums}
@media(max-width:620px){.agent-spend-period-field{width:100%}.agent-spend-periods{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.agent-spend-periods button{min-width:0;width:100%}.agent-spend-page> *{min-width:0}.agent-spend-period-note{margin-top:-5px}}

/* Local account selection, independent of report requests and global totals. */
.agent-spend-selection{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 20px;border-top:1px solid var(--border-light);background:var(--card-bg)}
.agent-spend-selection-controls{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
.agent-spend-select-all,.agent-spend-account-choice{display:flex;align-items:center;gap:12px;min-height:44px;cursor:pointer}
.agent-spend-select-all{color:var(--text-main);font-size:12px;font-weight:600}
.agent-spend-checkbox{appearance:none;-webkit-appearance:none;position:relative;display:inline-block;flex:0 0 18px;width:18px;height:18px;min-width:18px;padding:0;margin:0;border:1.5px solid var(--text-muted);border-radius:5px;background:var(--card-bg);cursor:pointer;vertical-align:middle;transition:background-color 100ms ease,border-color 100ms ease;box-shadow:none}
.agent-spend-checkbox:checked,.agent-spend-checkbox:indeterminate{border-color:var(--accent);background-color:var(--accent);background-position:center;background-repeat:no-repeat}
.agent-spend-checkbox:checked{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4.5 9 3 3 6-6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.agent-spend-checkbox:indeterminate{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9h9' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}
.agent-spend-checkbox:focus-visible{outline:2px solid var(--accent);outline-offset:4px;transition:none}
.agent-spend-checkbox:disabled{opacity:.45;cursor:default}
.agent-spend-clear-selection{border:0;border-radius:6px;background:transparent;color:var(--as-accent-text);font:inherit;font-size:11px;min-height:44px;padding:0 6px;cursor:pointer;white-space:nowrap}
.agent-spend-selected-total{display:grid;grid-template-columns:auto auto;align-items:baseline;column-gap:14px;row-gap:3px;text-align:right;min-width:0}
.agent-spend-selected-label{font-size:12px;font-weight:600;color:var(--text-main)}
.agent-spend-selected-amount{font-size:23px;font-weight:750;letter-spacing:-.3px;font-variant-numeric:tabular-nums;color:var(--as-accent-text);line-height:1.3;overflow-wrap:anywhere}
.agent-spend-selected-detail{grid-column:1/-1;color:var(--text-muted);font-size:11px;line-height:1.5}
.agent-spend-selected-detail.is-partial{color:var(--as-warning-text)}
.agent-spend-account-text{min-width:0;overflow-wrap:anywhere}
.agent-spend-table tr.is-selected{background:var(--as-accent-soft)}
.agent-spend-page button:active,.agent-spend-page .agent-spend-checkbox:active{transform:none}
@media(hover:hover) and (pointer:fine){.agent-spend-checkbox:not(:disabled):hover{border-color:var(--accent)}.agent-spend-clear-selection:hover{background:var(--as-accent-soft)}}
@media(max-width:900px){.agent-spend-selection{align-items:flex-start;gap:12px}.agent-spend-selected-total{grid-template-columns:1fr;row-gap:2px}.agent-spend-selected-label,.agent-spend-selected-detail{grid-column:1}.agent-spend-selected-amount{font-size:21px}}
@media(max-width:620px){.agent-spend-selection{flex-direction:column;padding:12px 16px 16px;gap:8px}.agent-spend-selection-controls{width:100%;justify-content:space-between;gap:8px}.agent-spend-selected-total{width:100%;grid-template-columns:minmax(0,1fr) auto;text-align:left;column-gap:12px}.agent-spend-selected-label{grid-column:1}.agent-spend-selected-amount{grid-column:2;text-align:right}.agent-spend-selected-detail{grid-column:1/-1}.agent-spend-account-choice{align-items:flex-start;gap:10px}.agent-spend-account-choice .agent-spend-checkbox{margin-top:3px}.agent-spend-periods button:last-child{grid-column:1/-1}}
@media(prefers-reduced-motion:reduce){.agent-spend-checkbox{transition:none}}

/* Spend composition follows the current CRM palette without changing shared styles. */
body.crm-interface-v2 .agent-spend-page{--accent:var(--ui-blue,#377cff);--card-bg:var(--ui-card,#fff);--text-main:var(--ui-text,#162036);--text-muted:var(--ui-muted,#687b98);--border-light:var(--ui-line,#e4eaf2);--input-bg:var(--ui-bg,#f4f5f7);--hover-bg:var(--ui-tint,#edf3fc);--table-head-bg:var(--ui-bg,#f4f5f7);--as-accent-text:var(--ui-blue,#377cff);--as-accent-soft:var(--ui-tint,#edf3fc);--as-success-text:var(--ui-green,#138d70);--as-warning-text:var(--ui-orange,#c87409);background:var(--ui-bg,#f4f5f7);font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:13px;gap:14px;padding:18px 24px}
.agent-spend-heading{min-height:36px;gap:12px;align-items:flex-start}
.agent-spend-heading .page-title{font-size:21px;line-height:1.4;font-weight:700;margin:0}
.agent-spend-zone{font-size:12px}
.agent-spend-explanation{max-width:720px;margin-left:auto;color:var(--text-muted);font-size:12px;line-height:1.55}
.agent-spend-explanation-body{padding:10px 0 3px;max-width:680px;white-space:normal}
.agent-spend-explanation-body p{margin:0 0 8px;font-size:12px;color:var(--text-muted);line-height:1.55}
.agent-spend-controls{gap:12px;padding:14px 16px}
.agent-spend-controls label,.agent-spend-period-field{font-size:12px;gap:6px}
.agent-spend-controls .agent-spend-agent-field{flex:1 1 190px;max-width:270px;min-width:180px}
.agent-spend-periods{background:var(--input-bg);border-radius:8px;padding:3px;gap:2px;box-shadow:none}
.agent-spend-periods button{font-size:12px;min-height:42px;height:42px;min-width:105px;padding:0 11px;border-radius:6px;line-height:1.3}
.agent-spend-periods button span{font-size:10px;line-height:1.4}
.agent-spend-periods button[aria-pressed=true]{color:var(--as-accent-text);background:var(--card-bg);box-shadow:var(--ui-shadow,0 1px 2px #10244308);font-weight:600}
.agent-spend-button{font-size:12px;min-height:44px;border-radius:8px;font-weight:600;padding:9px 13px}
.agent-spend-summary{display:block;padding:0;background:var(--card-bg);color:var(--text-main);border:1px solid var(--border-light);border-radius:12px}
.agent-spend-summary-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:13px 18px;border-bottom:1px solid var(--border-light);font-size:12px;color:var(--text-muted);flex-wrap:wrap}
.agent-spend-eyebrow{font-size:12px;color:var(--text-muted);font-weight:500}
.agent-spend-updated{font-size:11px;font-variant-numeric:tabular-nums;white-space:normal}
.agent-spend-metrics{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(180px,.8fr);align-items:start;padding:18px;gap:24px}
.agent-spend-total,.agent-spend-selected-total{display:flex;flex-direction:column;align-items:flex-start;gap:5px;min-width:0;text-align:left}
.agent-spend-selected-total{padding-left:24px;border-left:1px solid var(--border-light)}
.agent-spend-metric-label,.agent-spend-selected-label{font-size:13px;line-height:1.4;color:var(--text-muted);font-weight:500}
.agent-spend-amount,.agent-spend-selected-amount{font-size:30px;line-height:1.2;font-weight:750;letter-spacing:-.5px;margin:0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.agent-spend-amount{color:var(--text-main)}
.agent-spend-selected-amount{color:var(--as-accent-text)}
.agent-spend-metric-detail,.agent-spend-selected-detail{font-size:12px;line-height:1.45;color:var(--text-muted);white-space:normal}
.agent-spend-selected-detail.is-partial{color:var(--as-warning-text)}
.agent-spend-coverage{align-items:flex-start;gap:9px;padding-left:24px;border-left:1px solid var(--border-light)}
.agent-spend-coverage>span:not(.agent-spend-status){font-size:12px;color:var(--text-muted);white-space:normal}
.agent-spend-status{font-size:12px;line-height:1.4;min-height:26px;padding:4px 8px;border:0;border-radius:6px;color:var(--text-muted);background:var(--input-bg)}
.agent-spend-status.is-complete{color:var(--as-success-text);background:var(--as-success-bg)}
.agent-spend-status.is-running{color:var(--as-accent-text);background:var(--as-accent-soft)}
.agent-spend-status.is-partial{color:var(--as-warning-text);background:var(--as-warning-bg)}
.agent-spend-summary-notice{padding:11px 18px;border-top:1px solid var(--border-light);font-size:12px;line-height:1.55;color:var(--as-warning-text);white-space:normal;overflow-wrap:anywhere}
.agent-spend-table-heading{padding:10px 16px;min-height:64px;gap:16px;flex-wrap:wrap}
.agent-spend-table-title{display:flex;align-items:center;gap:8px;min-width:0}
.agent-spend-table-heading h2{font-size:14px;font-weight:650;letter-spacing:-.1px}
.agent-spend-table-title>span{display:inline-flex!important;align-items:center;justify-content:center;min-width:24px;min-height:24px;padding:2px 6px;border-radius:6px;background:var(--input-bg);color:var(--text-muted);font-size:12px;font-weight:500}
.agent-spend-selection{padding:0;border:0;background:transparent;margin-left:auto;display:flex;align-items:center;gap:12px;flex-direction:row}
.agent-spend-selection-controls{gap:12px;flex-wrap:nowrap}
.agent-spend-select-all{font-size:12px;font-weight:500;gap:9px;white-space:nowrap}
#agent-spend-selection-count{display:inline;color:var(--text-muted);font-size:12px;font-weight:500}
.agent-spend-clear-selection{font-size:12px;padding:0 4px;min-height:44px}
.agent-spend-table th{padding:10px 16px;font-size:11px;letter-spacing:.02em}
.agent-spend-table td{padding:9px 16px;vertical-align:middle;font-size:12px}
.agent-spend-table .agent-spend-account{width:30%;min-width:190px}
.agent-spend-account strong{font-size:13px;font-weight:600;line-height:1.4}
.agent-spend-account span{font-size:11px;margin-top:2px;line-height:1.4}
.agent-spend-table .agent-spend-fetched{font-size:11px}
.agent-spend-account-amount{font-size:13px!important;font-weight:600}
.agent-spend-account-choice{gap:10px}
.agent-spend-row-status{font-size:11px;background:transparent!important;padding:0;min-height:22px;white-space:normal}
.agent-spend-table tr.is-selected{background:color-mix(in srgb,var(--as-accent-soft) 32%,var(--card-bg))}
.agent-spend-table tr.is-selected td:first-child{box-shadow:inset 2px 0 var(--accent)}
.agent-spend-error-detail{font-size:12px;white-space:normal}
.agent-spend-previous{font-size:11px;line-height:1.5;white-space:normal;max-width:100%}
.agent-spend-previous strong,.agent-spend-previous span{font-size:11px;white-space:normal}
.agent-spend-account-text{white-space:normal}
@media(max-width:1050px){.agent-spend-metrics{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px}.agent-spend-coverage{grid-column:1/-1;flex-direction:row;align-items:center;justify-content:space-between;border-left:0;border-top:1px solid var(--border-light);padding:12px 0 0;gap:8px}.agent-spend-actions{margin-left:0}.agent-spend-controls .agent-spend-agent-field{max-width:none;flex:1 1 200px}}
@media(max-width:620px){body.crm-interface-v2 .agent-spend-page{padding:16px;gap:12px}.agent-spend-heading{align-items:flex-start;flex-wrap:wrap}.agent-spend-controls{padding:12px;gap:12px}.agent-spend-controls .agent-spend-agent-field{flex-basis:100%}.agent-spend-periods button{min-width:0;font-size:12px;min-height:42px}.agent-spend-summary-heading{padding:12px 14px;gap:4px}.agent-spend-updated{font-size:11px}.agent-spend-metrics{padding:14px;gap:14px;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.agent-spend-selected-total{padding-left:14px}.agent-spend-amount,.agent-spend-selected-amount{font-size:24px}.agent-spend-metric-label,.agent-spend-selected-label{font-size:12px}.agent-spend-metric-detail,.agent-spend-selected-detail{font-size:11px}.agent-spend-coverage{flex-wrap:wrap;justify-content:flex-start;gap:8px 12px}.agent-spend-coverage>span:not(.agent-spend-status){font-size:11px}.agent-spend-status{font-size:11px}.agent-spend-table-heading{padding:10px 14px;gap:3px;min-height:0}.agent-spend-table-title{width:100%;min-height:28px}.agent-spend-selection{margin-left:0;width:100%;justify-content:space-between}.agent-spend-selection-controls{width:100%;justify-content:space-between;gap:8px}.agent-spend-mobile-sort{padding:0 14px 10px;gap:6px 10px;font-size:11px}.agent-spend-mobile-sort .agent-spend-sort{min-height:36px}.agent-spend-table tr{padding:12px 14px;gap:7px 10px}.agent-spend-table td{padding:0;font-size:12px}.agent-spend-table .agent-spend-account{min-width:0;width:auto}.agent-spend-account strong{font-size:12px}.agent-spend-account-amount{font-size:12px!important}.agent-spend-account-choice{gap:9px}.agent-spend-table tr.is-selected{box-shadow:inset 2px 0 var(--accent)}.agent-spend-table tr.is-selected td:first-child{box-shadow:none}.agent-spend-table .agent-spend-fetched{font-size:11px}.agent-spend-account-detail{white-space:normal}.agent-spend-selected-amount{grid-column:auto;text-align:left}}
/* Match the CRM's primary action contrast in both themes. */
body.crm-interface-v2 .agent-spend-page .agent-spend-primary{background:var(--ui-blue,#377cff);border-color:var(--ui-blue,#377cff);color:#fff}
body.crm-interface-v2.dark-theme .agent-spend-page .agent-spend-primary{color:#10243e}
@media(hover:hover) and (pointer:fine){body.crm-interface-v2 .agent-spend-page .agent-spend-primary:not(:disabled):hover{background:var(--ui-blue,#377cff);border-color:var(--ui-blue,#377cff);filter:brightness(.97)}}

/* Quiet currency units and high-contrast marks in the current dark CRM theme. */
.agent-spend-money-unit{font-size:.52em;font-weight:500;letter-spacing:0;white-space:nowrap}
body.crm-interface-v2.dark-theme .agent-spend-checkbox:checked{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='m4.5 9 3 3 6-6' fill='none' stroke='%2310243e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
body.crm-interface-v2.dark-theme .agent-spend-checkbox:indeterminate{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9h9' fill='none' stroke='%2310243e' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}

.agent-spend-coverage{align-self:center}

/* Spend controls: native CRM floating surfaces; no layout shift or press scaling. */
.agent-spend-controls{display:grid;grid-template-columns:minmax(180px,270px) minmax(0,1fr) auto;align-items:end;column-gap:20px}
.agent-spend-controls .agent-spend-agent-field{display:flex;flex-direction:column;gap:6px;min-width:0;max-width:none;font-size:12px;font-weight:600;color:var(--text-muted)}
.agent-spend-agent-trigger{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;height:48px;min-height:48px;padding:0 13px;border:1px solid var(--border-light);border-radius:10px;background:var(--input-bg);color:var(--text-main);font:400 13px/1.4 Inter,system-ui,sans-serif;text-align:left;cursor:pointer}
.agent-spend-agent-trigger>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.agent-spend-agent-trigger>svg{width:16px;height:16px;flex:0 0 16px;stroke:var(--text-muted);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.agent-spend-agent-trigger[aria-expanded=true]{border-color:var(--accent)}
.agent-spend-agent-trigger:disabled{opacity:.55;cursor:default}
body.crm-interface-v2 .agent-spend-agent-menu{min-width:0;overscroll-behavior:contain;scrollbar-width:thin;max-width:none;box-sizing:border-box}
body.crm-interface-v2 .agent-spend-agent-menu>button{font-size:13px;min-height:40px;gap:12px;transform:none}
.agent-spend-agent-name{min-width:0;overflow-wrap:anywhere;flex:1}
.agent-spend-agent-check{font-size:16px;line-height:1;visibility:hidden;margin-left:auto;flex:0 0 16px;text-align:center}
.agent-spend-agent-option[aria-selected=true] .agent-spend-agent-check{visibility:visible}
body.crm-interface-v2 .agent-spend-agent-menu>button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.agent-spend-period-field{justify-self:center;width:100%;max-width:650px;align-items:center}
.agent-spend-period-field>.agent-spend-field-label{text-align:center}
.agent-spend-periods{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:100%;gap:3px;padding:3px;border-radius:10px;box-sizing:border-box}
.agent-spend-periods button{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;min-width:0;width:100%;min-height:42px;height:42px;padding:3px 7px;white-space:nowrap;border-radius:7px;font-size:12px;line-height:1.4}
.agent-spend-periods button span{width:100%;text-align:center;margin-top:0;font-size:10px;line-height:1.5}
.agent-spend-periods button:last-child{grid-column:auto}
.agent-spend-actions{justify-content:flex-end;margin:0;min-height:48px;align-items:center;flex-wrap:nowrap}
.agent-spend-explanation{margin-left:auto;max-width:none;flex:none}
.agent-spend-about-trigger{display:inline-flex;align-items:center;gap:7px;min-height:36px;padding:5px 8px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--text-muted);font:500 12px/1.4 Inter,system-ui,sans-serif;cursor:pointer;white-space:nowrap}
.agent-spend-about-trigger svg{width:16px;height:16px;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.agent-spend-about-trigger[aria-expanded=true]{color:var(--as-accent-text);background:var(--as-accent-soft)}
.agent-spend-about-panel{position:fixed;inset:auto;margin:0;z-index:16000;box-sizing:border-box;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:20px;border:1px solid var(--ui-line,var(--border-light));border-radius:14px;background:var(--ui-card,var(--card-bg));box-shadow:var(--ui-pop-shadow,0 12px 36px #14243e24);color:var(--ui-text,var(--text-main));font:400 12px/1.6 Inter,system-ui,sans-serif}
.agent-spend-about-panel[popover]:not(:popover-open){display:none}
.agent-spend-about-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.agent-spend-about-header h2{margin:0;color:var(--text-main);font-size:16px;font-weight:650;line-height:1.4}
.agent-spend-about-header button{display:flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;margin:-6px -6px -6px 0;padding:6px;border:0;border-radius:7px;background:transparent;color:var(--text-muted);cursor:pointer}
.agent-spend-about-header button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.agent-spend-explanation-body{padding:0;max-width:none}
.agent-spend-explanation-body p{margin:0 0 10px;font-size:12px;line-height:1.6;color:var(--text-muted)}
.agent-spend-explanation-body p:last-child{margin-bottom:0}
#agent-spend-calculation-meta{padding-top:12px;border-top:1px solid var(--border-light)}
#agent-spend-calculation-meta:empty{display:none}
.agent-spend-agent-trigger:focus:not(:focus-visible),.agent-spend-about-trigger:focus:not(:focus-visible),.agent-spend-periods button:focus:not(:focus-visible){outline:none;box-shadow:none}
@media(hover:hover) and (pointer:fine){.agent-spend-agent-trigger:not(:disabled):hover{border-color:var(--accent)}body.crm-interface-v2 .agent-spend-agent-menu>button:hover{background:var(--ui-tint)}.agent-spend-about-trigger:hover,.agent-spend-about-header button:hover{color:var(--as-accent-text);background:var(--as-accent-soft)}}
@media(max-width:1250px){.agent-spend-controls{grid-template-columns:minmax(180px,270px) minmax(0,1fr);gap:12px 20px}.agent-spend-actions{grid-column:1/-1;justify-content:flex-end;min-height:44px}.agent-spend-period-field{max-width:650px;justify-self:end}}
@media(max-width:1050px){.agent-spend-controls{grid-template-columns:minmax(0,1fr);gap:14px}.agent-spend-controls .agent-spend-agent-field{width:100%}.agent-spend-period-field{justify-self:center;max-width:none}.agent-spend-actions{grid-column:auto}.agent-spend-periods button{font-size:11px;padding:3px 4px}}
@media(max-width:480px){.agent-spend-periods{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.agent-spend-periods button{grid-column:span 2;min-height:44px;height:44px;font-size:11px}.agent-spend-periods button:last-child{grid-column:2/span 2}.agent-spend-heading{flex-wrap:nowrap}.agent-spend-about-trigger{padding:5px 3px}.agent-spend-about-panel{padding:18px}}
@media(prefers-reduced-motion:reduce){.agent-spend-agent-menu,.agent-spend-about-panel{scroll-behavior:auto}}

/* Stable report switching and one aligned control row. */
#page-agent-spend{scrollbar-gutter:stable;overflow-anchor:none}
.agent-spend-sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.agent-spend-controls{grid-template-columns:minmax(340px,1fr) minmax(0,650px) minmax(340px,1fr);align-items:center}
.agent-spend-controls .agent-spend-agent-field{width:100%;max-width:270px}
.agent-spend-period-field{justify-self:center}
.agent-spend-actions .agent-spend-button{height:48px;min-height:48px}
#agent-spend-results{position:relative}
#agent-spend-results.is-loading>:not(.agent-spend-loading){visibility:hidden;pointer-events:none}
.agent-spend-loading{position:absolute;inset:0 0 auto;padding:32px 20px;text-align:center;color:var(--text-muted);font-size:13px}
@media(min-width:1401px) and (max-width:1550px){.agent-spend-periods button{font-size:11px;padding:3px 4px}}
@media(max-width:1400px){.agent-spend-controls{grid-template-columns:minmax(180px,1fr) minmax(0,1fr);gap:12px 20px}.agent-spend-controls .agent-spend-agent-field{grid-column:1;grid-row:1;max-width:270px}.agent-spend-period-field{grid-column:1/-1;grid-row:2;max-width:650px;justify-self:center}.agent-spend-actions{grid-column:2;grid-row:1;justify-content:flex-end}}
@media(max-width:760px){.agent-spend-controls{grid-template-columns:minmax(0,1fr);gap:12px}.agent-spend-controls .agent-spend-agent-field{max-width:none}.agent-spend-period-field{grid-column:1;grid-row:2}.agent-spend-actions{grid-column:1;grid-row:3;flex-wrap:wrap}}
@media(max-width:620px){.agent-spend-period-field{max-width:none}.agent-spend-actions .agent-spend-button{height:auto;min-height:48px}.agent-spend-loading{padding:28px 16px}}
@media(max-width:360px){body.crm-interface-v2 .agent-spend-page{padding:12px}}
