:root {
  --chart-spend: #557d37;
  --chart-credit: #87a9db;
}
:root[data-theme="dark"] {
  --chart-spend: #c7ff48;
  --chart-credit: #84a9ea;
}
.topbar { position:sticky; top:0; z-index:4; }
.header-balance {
  display:flex; align-items:center; gap:7px; white-space:nowrap; color:var(--muted);
  padding:7px 11px; border:1px solid var(--line); border-radius:9px; background:var(--surface-inset);
  font-size:12px; font-weight:620; font-variant-numeric:tabular-nums;
}
.header-balance strong { color:var(--accent); font-size:13px; }
.header-balance strong.delta-bad { color:var(--danger); }
.header-balance i { width:16px; height:16px; color:var(--accent); }
.top-avatar { background:var(--accent-soft); color:var(--accent); font-size:15px; border:1px solid var(--line); }
.top-avatar:hover,.top-avatar[aria-expanded="true"] { border-color:var(--accent); }
.portal-hero {
  position:relative; display:flex; justify-content:space-between; align-items:center; gap:12px;
  padding:23px 28px; border-radius:18px; background:var(--brand-navy); color:white; overflow:hidden;
  min-height:155px; border:1px solid #253147;
}
.portal-hero h1 { font-size:clamp(29px,3.1vw,44px); letter-spacing:-.053em; line-height:1.1; }
.portal-hero p { margin-top:8px; color:#c3ceda; font-size:13px; line-height:1.5; }
.portal-hero img { width:min(41%,420px); height:auto; margin:-52px 0; mix-blend-mode:lighten; }
.portal-card { margin-top:16px; }
.portal-toolbar { align-items:center; padding:16px 18px; }
.portal-toolbar .search { width:min(100%,330px); background:var(--surface-inset); }
.portal-count { margin-left:auto; color:var(--muted); font-size:12px; }
.portal-table { min-width:870px; }
.portal-table th { padding-block:12px; font-size:11px; }
.portal-table td { padding-block:14px; vertical-align:top; }
.portal-table td:not(.portal-name) { padding-top:19px; }
.portal-table td.portal-actions { padding-top:12px; }
.portal-name { width:26%; }
.portal-account-name { display:flex; align-items:center; gap:8px; }
.portal-account-name strong { overflow-wrap:anywhere; }
.portal-account-name .record-sub { white-space:nowrap; }
.unassigned-portal { border-top:1px solid var(--line); }
.portal-card [tabindex="0"]:focus-visible { outline:2px solid var(--focus); outline-offset:-2px; }
.account-type { color:var(--muted); white-space:nowrap; }
.portal-balance { color:var(--accent); }
.portal-actions .actions { flex-wrap:nowrap; }
.portal-actions .button { min-height:34px; font-size:11px; gap:5px; padding-inline:9px; }
.portal-actions .button i { width:14px; height:14px; }
.transaction-table th:last-child,.transaction-table td:last-child { text-align:right; }
.report-switch { display:flex; padding:4px; border:1px solid var(--line); border-radius:10px; background:var(--surface-inset); }
.report-switch a { min-width:72px; padding:7px 11px; color:var(--muted); border-radius:6px; text-align:center; font-size:13px; font-weight:650; }
.report-switch a[aria-current] { background:var(--accent-soft); color:var(--accent); }
.report-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
.report-legend { display:flex; gap:14px; color:var(--muted); font-size:12px; }
.report-legend span { display:flex; align-items:center; gap:6px; }
.report-legend span::before { content:""; width:8px; height:8px; border-radius:2px; background:var(--chart-spend); }
.report-legend span+span::before { background:var(--chart-credit); }
.report-chart { overflow:visible; }
.report-bars { display:flex; justify-content:center; align-items:end; gap:clamp(4px,2vw,20px); min-height:180px; padding:12px 16px 15px; }
.report-column { position:relative; display:grid; gap:7px; justify-items:center; flex:1; min-width:0; max-width:110px; padding:0; border:0; border-radius:5px; background:transparent; cursor:pointer; }
.bar-pair { position:relative; height:138px; width:100%; }
.bar-pair::before { content:""; position:absolute; inset-inline:0; bottom:var(--chart-zero); border-bottom:1px solid var(--line); }
.chart-bar { position:absolute; bottom:var(--chart-zero); width:min(44%,34px); height:var(--bar-height); border-radius:4px 4px 0 0; transform-origin:bottom; animation:grow-report-bar .45s ease-out both; }
.chart-bar.spend { right:calc(50% + 1px); background:var(--chart-spend); }
.chart-bar.credited { left:calc(50% + 1px); background:var(--chart-credit); }
.chart-bar.negative { top:calc(100% - var(--chart-zero)); bottom:auto; border-radius:0 0 4px 4px; transform-origin:top; }
.report-tooltip { display:none; position:absolute; z-index:4; top:0; left:50%; transform:translate(-50%,-75%); min-width:132px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); text-align:left; font-size:11px; white-space:nowrap; box-shadow:0 6px 20px #09121f30; pointer-events:none; }
.report-tooltip > span { display:flex; justify-content:space-between; gap:10px; }
.report-tooltip strong { display:block; margin-bottom:4px; }
.report-column:is(:hover,:focus-visible,[aria-pressed="true"]) .report-tooltip { display:grid; gap:2px; }
.report-column:nth-child(-n+3) .report-tooltip { left:0; transform:translateY(-75%); }
.report-column:nth-last-child(-n+3):nth-child(n+4) .report-tooltip { left:auto; right:0; transform:translateY(-75%); }
@keyframes grow-report-bar { from { transform:scaleY(0); } to { transform:scaleY(1); } }
@media (prefers-reduced-motion:reduce) { .chart-bar { animation:none; } }
.bar-date { color:var(--muted); font-size:11px; }
.ad-request-quantity { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ad-request-quantity output { min-width:24px; text-align:center; font-weight:700; }
.ad-request-quantity .button { min-width:36px; justify-content:center; }
.ad-request-groups,.ad-request-fields,.ad-request-fan-pages { display:grid; gap:12px; }
.ad-request-fields { margin:0; min-width:0; border:1px solid var(--line); border-radius:10px; padding:12px; }
.ad-request-fields legend { padding-inline:6px; font-weight:700; }
.ad-request-fields textarea { min-height:64px; }
.ad-request-field-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.button.cancel-ad-request { color:var(--danger); }
.balance-accounts { display:grid; gap:8px; }
.form .balance-account { grid-template-columns:minmax(0,1fr) minmax(96px,140px); align-items:center; gap:12px; padding:10px; border:1px solid var(--line); border-radius:10px; }
.balance-account span { min-width:0; overflow-wrap:anywhere; }
.balance-account span:last-child { display:grid; gap:4px; }
.balance-account input { width:100%; min-width:0; }
.balance-label { display:inline-flex; align-items:center; gap:.45em; }
i:is([data-icon="topup"],[data-icon="withdrawal"]) {
  width:1.35em; height:1.35em; flex:none; padding:.15em; border-radius:4px;
}
i[data-icon="topup"] { color:#116635; background:#d9f5e1; }
i[data-icon="withdrawal"] { color:#a3182d; background:#ffe6ea; }
.activity-icon:has(> i[data-icon="topup"]) { background:var(--good-soft); }
.activity-icon:has(> i[data-icon="withdrawal"]) { background:var(--danger-soft); }
.balance-select { display:block; position:relative; min-width:0; }
.balance-select > i { display:none; position:absolute; top:50%; left:9px; transform:translateY(-50%); pointer-events:none; }
.balance-select:has(option:is([value="credit"],[value$="-topup"]):checked) > i[data-icon="topup"],
.balance-select:has(option:is([value="debit"],[value$="-withdrawal"]):checked) > i[data-icon="withdrawal"] { display:block; }
.balance-select:has(option:is([value="credit"],[value="debit"],[value$="-topup"],[value$="-withdrawal"]):checked) select { padding-left:31px; }
.form .balance-select select { width:100%; }
#transaction-type { min-width:min(220px,100%); }
@media (max-width:620px) {
  .portal-hero { padding:17px; min-height:140px; }
  .portal-hero img { width:34%; }
  .portal-toolbar { padding-inline:12px; }
  .portal-count { margin-left:0; }
  .header-balance { padding:7px; gap:4px; }
  .header-balance i,.breadcrumb-root + i { display:none; }
  .report-bars { gap:4px; }
  .ad-request-field-grid { grid-template-columns:1fr; }
  .header-actions { gap:6px; }
}

.header-profile {
  display:flex; align-items:center; gap:9px; min-width:0; padding:0;
  border:0; border-radius:9px; background:none; color:var(--ink); text-align:left;
}
.header-profile[aria-expanded="true"] .top-avatar,.header-profile:hover .top-avatar { border-color:var(--accent); }
.header-profile-text { display:grid; gap:3px; }
.header-profile-text strong,.header-profile-text small { line-height:1.16; white-space:nowrap; }
.header-profile-text strong { font-size:12px; font-weight:720; }
.header-profile-text small { color:var(--muted); font-size:11px; }
.header-profile .profile-chevron { width:12px; height:12px; transform:rotate(90deg); color:var(--muted); }
.header-profile[aria-expanded="true"] .profile-chevron { transform:rotate(-90deg); }
.dashboard-hero .hero-banner { mix-blend-mode:lighten; }
.dashboard-metrics .metric { padding:20px 17px; gap:13px; min-height:105px; }
.dashboard-metrics .metric-number { font-size:clamp(21px,2.15vw,32px); margin:5px 0 6px; }
.dashboard-metrics .metric-icon.spend { color:#315e9c; background:#e6efff; }
:root[data-theme="dark"] .dashboard-metrics .metric-icon.spend { color:#a8c6fa; background:#243850; }
.dashboard-metrics .metric:nth-child(2) .metric-number { color:var(--accent); }
@media (max-width:620px) {
  .header-profile .profile-chevron { display:none; }
  .header-profile { gap:5px; }
}
@media (max-width:400px) {
  .topbar .breadcrumb #breadcrumb-name { display:none; }
  .topbar .breadcrumb { flex:none; }
  .dashboard-metrics .metric { padding:9px 7px; gap:6px; }
  .dashboard-metrics .metric-number { font-size:18px; }
}
