/*
 * Component styles for the revamped dashboard.
 *
 * Every colour, radius and type size comes from tokens.css. Nothing here
 * hard-codes a hex -- if a value is missing from the token set, add it
 * there rather than inlining it, so the design stays traceable to Figma.
 *
 * Layout is flex/grid throughout. The Figma frames are absolutely
 * positioned because that is how Figma works; none of that survives here.
 */

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------------ type */
.t-display   { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 600; }
.t-h2        { font-size: var(--fs-h2);      line-height: var(--lh-h2);      font-weight: 600; }
.t-h3        { font-size: var(--fs-h3);      line-height: var(--lh-h3);      font-weight: 600; }
.t-h4        { font-size: var(--fs-h4);      line-height: var(--lh-h4);      font-weight: 600; }
.t-base      { font-size: var(--fs-base);    line-height: var(--lh-base); }
.t-sm        { font-size: var(--fs-sm);      line-height: var(--lh-sm); }
.t-label     {
  font-size: var(--fs-xs); line-height: var(--lh-xs);
  font-weight: 500; letter-spacing: var(--ls-xs); text-transform: uppercase;
  color: var(--text-muted);
}
.t-muted     { color: var(--text-muted); }
.t-secondary { color: var(--text-secondary); }
.t-num       { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
               line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }

/* Deltas. Direction is not goodness -- ACOS falling is good, spend falling
   may not be -- so the caller picks the class, never the sign. */
.delta-up   { color: var(--accent); }
.delta-down { color: var(--danger-text); }
.delta-flat { color: var(--text-secondary); }

/* ---------------------------------------------------------------- button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: none; color: inherit;
  font-family: inherit; font-size: var(--fs-base); line-height: var(--lh-base);
  cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover:not(:disabled)   { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text-secondary);
                 border-color: var(--border-soft); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-tint); }

.btn-ghost     { color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled)     { background: var(--accent-tint); }

.btn-danger    { background: var(--danger-bg); color: var(--danger-text); }

.btn-block     { width: 100%; height: 42px; font-size: var(--fs-h4); font-weight: 600; }

.btn[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent);
                            border-color: var(--accent-chip); }

/* ----------------------------------------------------------------- input */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: var(--fs-xs); line-height: var(--lh-xs);
  font-weight: 500; color: var(--text-muted);
}
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-family: inherit; font-size: var(--fs-base); line-height: var(--lh-base);
}
.textarea { height: auto; padding: 9px 12px; resize: vertical; }
.select { appearance: none; padding-right: 30px;
          background-image: linear-gradient(transparent, transparent); }
.input::placeholder { color: var(--text-secondary); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.input[aria-invalid="true"] { border-color: var(--danger-text); }

.field-error { color: var(--danger-text); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.field-hint  { color: var(--text-secondary); font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* Password strength: four segments, filled left to right. */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: 4px; }
.strength > i { background: var(--surface-sunk); border-radius: var(--radius-pill); }
.strength > i.on-weak   { background: var(--danger-text); }
.strength > i.on-fair   { background: var(--warn-text); }
.strength > i.on-strong { background: var(--accent); }

.reqs { display: flex; flex-direction: column; gap: 4px;
        font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-secondary); }
.reqs > li { list-style: none; }
.reqs > li.met { color: var(--accent); }
.reqs { margin: 0; padding: 0; }

/* ------------------------------------------------------------------ pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500;
  letter-spacing: var(--ls-xs); white-space: nowrap;
}
.pill-ok     { background: var(--ok-bg);     color: var(--ok-text); }
.pill-warn   { background: var(--warn-bg);   color: var(--warn-text); }
.pill-danger { background: var(--danger-bg); color: var(--danger-text); }
.pill-info   { background: var(--info-bg);   color: var(--info-text); }
.pill-neutral{ background: var(--surface-sunk); color: var(--text-muted); }

.count {
  display: inline-flex; padding: 1px 7px; border-radius: var(--radius-pill);
  background: var(--surface-sunk); color: var(--text-muted);
  font-size: var(--fs-xs); line-height: var(--lh-xs);
  font-weight: 500; letter-spacing: var(--ls-xs);
}
.count-danger { background: var(--danger-text); color: var(--accent-on); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none;
       background: currentColor; display: inline-block; }

/* ------------------------------------------------------------------ card */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}
.card-pad  { padding: 16px 18px; }
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 18px 0; }
.card-body { padding: 14px 18px 18px; }

/* --------------------------------------------------------------- KPI strip */
.kpi-strip { display: flex; gap: 12px; align-items: stretch; }
.kpi {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  overflow: hidden;
}
/* Drill-down variant: a coloured spine on the leading edge. */
.kpi-accent { border-left: 3px solid var(--accent); }
.kpi > .kpi-label { font-size: var(--fs-xs); line-height: var(--lh-xs);
                    font-weight: 500; letter-spacing: var(--ls-xs);
                    color: var(--text-muted); text-transform: uppercase; }
.kpi > .kpi-value { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; }
.kpi > .kpi-spark { height: 26px; width: 100%; }
.kpi > .kpi-delta { font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* ----------------------------------------------------------------- shell */
/*
 * There is no top nav. Everything lives in the sidebar, which is how the
 * section screens are drawn -- logo, a scope switcher, the role's items,
 * and a footer carrying data freshness and the signed-in user.
 */
.shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: var(--sidenav-w); flex: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 14px 16px;
  background: var(--surface); border-right: 1px solid var(--border-soft);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.wordmark { display: flex; align-items: center; gap: 10px;
            padding: 0 6px 14px; font-size: var(--fs-h4); font-weight: 600; }
.wordmark-logo { width: 28px; height: 28px; border-radius: 7px; flex: none;
                 background: var(--accent); color: var(--accent-on);
                 display: grid; place-items: center;
                 font-size: 14px; font-weight: 600; }

/* The scope switcher. Reads BRAND for a Brand Manager and SCOPE for a
   Director; pressing it opens the switcher screen. */
.switcher {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-tint); border: 1px solid var(--border-soft);
  border-radius: 10px; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
}
.switcher:hover { border-color: var(--accent-chip); }
.switcher-text { flex: 1 1 auto; min-width: 0; display: flex;
                 flex-direction: column; gap: 2px; }
.switcher-label { font-size: 10px; font-weight: 500; color: var(--accent);
                  letter-spacing: .04em; }
.switcher-title { font-size: 14px; font-weight: 600; color: var(--text);
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-sub { font-size: 12px; color: var(--text-muted);
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-caret { font-size: 13px; font-weight: 500; color: var(--text-muted); }

.navitem {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary);
  text-decoration: none; cursor: pointer;
}
.navitem:hover { background: var(--accent-tint); text-decoration: none; }
.navitem[aria-current="page"] { background: var(--surface-tint);
                                color: var(--accent); font-weight: 600; }
.navitem > .grow { flex: 1 1 auto; }
.navitem .badge {
  display: inline-flex; padding: 1px 7px; border-radius: 99px;
  background: var(--danger-bg); color: var(--danger-text);
  font-size: 11px; font-weight: 600;
}

.nav-divider { height: 1px; width: 100%; background: var(--border-soft);
               margin: 6px 0; }
.nav-grow { flex: 1 1 auto; min-height: 12px; }

.sidebar-foot { border-top: 1px solid var(--border-soft);
                padding: 10px 4px 0; display: flex; flex-direction: column;
                gap: 10px; }
.sidebar-foot .freshness { font-size: 11px; color: var(--text-secondary); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .avatar { width: 32px; height: 32px; border-radius: 16px; flex: none;
                        background: var(--surface-sunk); color: var(--accent);
                        display: grid; place-items: center;
                        font-size: 11px; font-weight: 600; }
.sidebar-user .who { flex: 1 1 auto; min-width: 0; display: flex;
                     flex-direction: column; gap: 1px; }
.sidebar-user .who b { font-size: var(--fs-sm); font-weight: 500;
                       color: var(--text); }
.sidebar-user .who span { font-size: var(--fs-xs); color: var(--text-muted);
                          letter-spacing: 0; text-transform: none; }
.sidebar-user button { background: none; border: 0; cursor: pointer;
                       font-family: inherit; font-size: var(--fs-xs);
                       font-weight: 500; color: var(--link); padding: 0; }

.main { flex: 1 1 auto; min-width: 0; padding: 24px 28px 40px; }

.pagehead { margin-bottom: 16px; }
.pagehead h1 { font-size: 20px; line-height: 27px; font-weight: 600; }
.pagehead-sub { margin-top: 4px; font-size: var(--fs-sm);
                color: var(--text-secondary); }

/* The toolbar: date range, ad type, then Export pushed right. */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
           flex-wrap: wrap; }
.toolbar .spacer { flex: 1 1 auto; min-width: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-family: inherit; font-size: var(--fs-sm); color: var(--text);
  cursor: pointer; white-space: nowrap; flex: none;
}
.chip:hover { background: var(--accent-tint); }

/* ----------------------------------------------------------- segmented */
.segmented { display: inline-flex; padding: 3px; gap: 2px;
             background: var(--accent-tint); border-radius: var(--radius-md); }
.segmented > button {
  border: 0; background: none; cursor: pointer;
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: var(--fs-base); color: var(--text-secondary);
}
.segmented > button[aria-pressed="true"] {
  background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: 0 1px 2px rgba(46, 49, 59, .10);
}

/* ---------------------------------------------------------------- table */
.tablewrap { overflow-x: auto; border-radius: var(--radius-lg);
             border: 1px solid var(--border-soft); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--accent-chip); color: var(--text-muted);
  font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500;
  letter-spacing: var(--ls-xs); text-transform: uppercase;
  text-align: right; padding: 10px 12px; white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.data thead th:first-child,
table.data th.left, table.data td.left { text-align: left; }
table.data th[aria-sort="ascending"]  span.caret::after { content: " ▲"; }
table.data th[aria-sort="descending"] span.caret::after { content: " ▼"; }
table.data th span.caret::after { content: " ▲"; opacity: .35; }

table.data tbody td {
  padding: 10px 12px; text-align: right; white-space: nowrap;
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm);
  font-weight: 500; font-variant-numeric: tabular-nums;
}
table.data tbody td.left {
  font-family: var(--font-sans); font-size: var(--fs-base); line-height: var(--lh-base);
  font-weight: 400;
}
table.data tbody tr:hover td { background: var(--accent-tint); }
table.data tbody tr.group > td { background: var(--surface-tint); font-weight: 600; }
table.data tbody tr.group:hover > td { background: var(--accent-chip); }

/* Hierarchy rows indent by depth; the twisty is part of the name cell. */
.twisty { display: inline-flex; width: 16px; justify-content: center;
          color: var(--text-secondary); cursor: pointer; user-select: none; }
.twisty[aria-expanded="true"]::before  { content: "▼"; }
.twisty[aria-expanded="false"]::before { content: "▶"; }
.twisty.leaf::before { content: ""; }
.name-cell { display: inline-flex; align-items: center; gap: 8px; }

.tablefoot { display: flex; align-items: center; justify-content: space-between;
             gap: 16px; padding: 12px 16px; color: var(--text-secondary);
             font-size: var(--fs-sm); }
.pager { display: flex; gap: 6px; }
.pager > button { min-width: 34px; height: 34px; padding: 0 10px;
                  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
                  background: var(--surface); color: var(--text-secondary);
                  font-family: inherit; font-size: var(--fs-sm); cursor: pointer; }
.pager > button[aria-current="true"] { background: var(--accent); color: var(--accent-on);
                                       border-color: var(--accent); }
.pager > button:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------- popover / panel */
.popover {
  position: absolute; z-index: 40; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  padding: 8px;
}
.popover-item { display: flex; align-items: center; justify-content: space-between;
                gap: 12px; padding: 8px 10px; border-radius: var(--radius-md);
                cursor: pointer; font-size: var(--fs-base); }
.popover-item:hover { background: var(--accent-tint); }
.popover-item[aria-selected="true"] { background: var(--surface-tint); color: var(--accent); }
.popover-sep { height: 1px; margin: 6px 4px; background: var(--border-soft); }

.drawer {
  position: fixed; top: var(--topnav-h); right: 0; bottom: 0; z-index: 45;
  width: 360px; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-soft);
  box-shadow: var(--shadow-panel);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between;
               padding: 16px 18px; border-bottom: 1px solid var(--border-soft); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px;
               display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 18px;
               border-top: 1px solid var(--border-soft); }
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(46, 49, 59, .28); }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer;
         font-size: var(--fs-base); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

/* --------------------------------------------------------------- alerts */
.alertlist { display: flex; flex-direction: column; }
.alertrow  { display: flex; gap: 10px; padding: 14px 18px;
             border-top: 1px solid var(--border-soft); }
.alertrow:first-child { border-top: 0; }
.alertrow-mark { flex: none; font-size: var(--fs-sm); line-height: 20px; }
.alertrow-title { font-size: var(--fs-base); line-height: var(--lh-base); font-weight: 500; }
.alertrow-note  { font-size: var(--fs-sm); line-height: var(--lh-sm);
                  color: var(--text-secondary); margin-top: 2px; }
.sev-danger { color: var(--danger-text); }
.sev-warn   { color: var(--warn-text); }
.sev-info   { color: var(--accent); }

/* --------------------------------------------------------------- charts */
.legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
          padding-top: 12px; color: var(--text-secondary); font-size: var(--fs-sm); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none;
          border: 1px solid var(--border-soft); }

.treemap { display: flex; flex-direction: column; gap: 6px; }
.treemap-row { display: flex; gap: 6px; }
.treemap-tile {
  position: relative; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px 14px; border-radius: var(--radius-md); cursor: pointer;
}
.treemap-tile .tile-name  { font-size: var(--fs-base); line-height: var(--lh-base);
                            font-weight: 500; color: var(--accent); }
.treemap-tile .tile-value { font-family: var(--font-mono); font-size: var(--fs-base);
                            font-weight: 600; color: var(--accent); }
.treemap-tile .tile-meta  { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tile-ok     { background: var(--ok-bg); }
.tile-warn   { background: var(--warn-bg); }
.tile-warn   .tile-name, .tile-warn   .tile-value, .tile-warn   .tile-meta { color: var(--warn-text); }
.tile-danger { background: var(--danger-bg); }
.tile-danger .tile-name, .tile-danger .tile-value, .tile-danger .tile-meta { color: var(--danger-text); }

.bar-track { height: 8px; border-radius: var(--radius-pill);
             background: var(--surface-sunk); overflow: hidden; }
.bar-fill  { height: 100%; background: var(--accent); border-radius: var(--radius-pill); }

/* ------------------------------------------------------------ auth pages */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 22px;
}
.auth-card.wide { max-width: 560px; }
.auth-mark { width: 40px; height: 40px; border-radius: var(--radius-md);
             background: var(--accent); }
.auth-head { display: flex; flex-direction: column; gap: 8px; }
.auth-foot { text-align: center; color: var(--text-secondary); font-size: var(--fs-sm); }
.auth-note { padding: 10px 12px; background: var(--surface-tint);
             border-radius: var(--radius-md); color: var(--text-secondary);
             font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* --------------------------------------------------------------- syncing */
.sync-wrap { max-width: 820px; margin: 0 auto; padding: 40px 24px; }
.sync-report { display: flex; align-items: center; justify-content: space-between;
               gap: 16px; padding: 10px 0; }
.sync-report + .sync-report { border-top: 1px solid var(--border-soft); }
.sync-state { color: var(--text-secondary); font-size: var(--fs-sm); }
.dot-ready   { color: var(--accent); }
.dot-running { color: var(--warn-text); }
.dot-waiting { color: var(--text-secondary); }
.dot-failed  { color: var(--danger-text); }

/* ------------------------------------------------------------ utilities */
.empty { padding: 40px 18px; text-align: center; color: var(--text-secondary); }
.spinner { width: 16px; height: 16px; border-radius: 50%; flex: none;
           border: 2px solid var(--accent-chip); border-top-color: var(--accent);
           animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.toast-tray { position: fixed; right: 20px; bottom: 20px; z-index: 60;
              display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 14px; border-radius: var(--radius-md);
         background: var(--text); color: var(--accent-on);
         font-size: var(--fs-sm); box-shadow: var(--shadow-pop); max-width: 360px; }
.toast-error { background: var(--danger-text); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip { flex-wrap: wrap; }
  .kpi { flex-basis: calc(33.333% - 8px); }
}
@media (max-width: 760px) {
  .sidenav { display: none; }
  .main { padding: 16px; }
  .kpi { flex-basis: calc(50% - 6px); }
}

/* Treemap tiles are squarified, so they are positioned rather than flowed. */
.treemap { position: relative; }
.treemap-tile { position: absolute; }

.minibar { display: block; height: 6px; width: 100%; max-width: 160px;
           border-radius: var(--radius-pill); margin: 2px 0 4px;
           background: linear-gradient(to right,
             var(--c) 0 var(--p), rgba(255,255,255,.55) var(--p) 100%); }

/* ------------------------------------------------- screens 01 / 02 */
/* Seven KPI tiles across, wrapping rather than shrinking past legibility. */
.metrics-strip { display: grid; gap: 12px; margin-bottom: 16px;
                 grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1500px) { .metrics-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.metric {
  padding: 15px 17px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  min-width: 0;
}
.metric .label { font-size: 11px; font-weight: 500; letter-spacing: .06em;
                 text-transform: uppercase; color: var(--text-muted); }
.metric .value { margin-top: 6px; font-size: 21px; line-height: 25px;
                 font-weight: 600; overflow: hidden; text-overflow: ellipsis;
                 white-space: nowrap; }
.metric .delta { margin-top: 6px; font-size: var(--fs-xs); }

/* The row that carries Performance trend and Spend pacing. */
.trend-row { display: grid; gap: 16px; align-items: start;
             grid-template-columns: minmax(0, 1fr) 380px; margin-bottom: 16px; }
@media (max-width: 1240px) { .trend-row { grid-template-columns: minmax(0, 1fr); } }

.metric-tabs { display: inline-flex; gap: 2px; padding: 3px;
               background: var(--accent-tint); border-radius: var(--radius-md); }
.metric-tabs button { border: 0; background: none; cursor: pointer;
                      font-family: inherit; font-size: var(--fs-sm);
                      color: var(--text-secondary); padding: 4px 11px;
                      border-radius: var(--radius-sm); }
.metric-tabs button[aria-pressed="true"] { background: var(--surface);
  color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(46,49,59,.10); }

.pace-track { position: relative; height: 10px; border-radius: var(--radius-pill);
              background: var(--surface-sunk); overflow: hidden; margin: 10px 0 6px; }
.pace-fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.pace-mark { position: absolute; top: -2px; bottom: -2px; width: 2px;
             background: var(--text); }

.pace-ends { display: flex; justify-content: space-between;
             font-size: var(--fs-xs); color: var(--text-secondary); }

/* Business metrics — drawn as a dashed placeholder because Seller Central
   is not connected. The design says so on the card, and so does this. */
.coming { border: 1px dashed var(--border); border-radius: var(--radius-lg);
          padding: 16px 18px; display: grid; gap: 16px;
          grid-template-columns: 280px repeat(4, minmax(0, 1fr));
          align-items: center; }
@media (max-width: 1240px) { .coming { grid-template-columns: 1fr 1fr; } }
.coming-slot { background: var(--bg); border-radius: var(--radius-md);
               padding: 12px 14px; }
.coming-slot .label { font-size: 11px; font-weight: 500; letter-spacing: .06em;
                      text-transform: uppercase; color: var(--text-muted); }
.coming-slot .dash { margin-top: 8px; font-size: 18px; color: var(--text-secondary); }

/* Chart popups: they open over the screen and close with x or Close. */
.popup { position: fixed; z-index: 46; top: 50%; left: 50%;
         transform: translate(-50%, -50%); width: min(760px, calc(100vw - 48px));
         max-height: calc(100vh - 80px); display: flex; flex-direction: column;
         box-shadow: var(--shadow-panel); }
.popup-body { flex: 1 1 auto; overflow: auto; padding: 0 18px; }

/* ---------------------------------------------- account switcher (20/20b)
 * A popover under the sidebar card. 380px because that is the design's
 * width and the rail is 248 -- it deliberately overhangs the nav rather
 * than squeezing brand names into the rail's width.
 */
.switcher-pop {
  position: absolute; z-index: 40; width: 380px;
  max-height: min(70vh, 620px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border, var(--accent-chip));
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(33, 36, 43, .14);
}

.sw-search { padding: 0 0 2px; }
.sw-search input {
  width: 100%; padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border, var(--accent-chip));
  border-radius: 8px;
  font-family: inherit; font-size: 13px; color: var(--text);
}
.sw-search input::placeholder { color: var(--text-muted); }
.sw-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.sw-section {
  padding: 10px 10px 4px;
  font-size: 10.5px; font-weight: 500; letter-spacing: .04em;
  color: var(--text-muted);
}

.sw-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
}
.sw-row:hover,
.sw-row.is-active { background: var(--accent-tint); }
.sw-row.is-selected { background: var(--surface-tint, var(--accent-tint)); }
.sw-row.is-selected .sw-label { color: var(--accent); font-weight: 600; }

.sw-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sw-label {
  font-size: 13px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sw-sub {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sw-spacer { flex: 1 1 auto; min-width: 8px; }
.sw-meta { flex: none; font-size: 12px; color: var(--text-muted); }
.sw-selected { flex: none; font-size: 11px; font-weight: 500; color: var(--accent); }

.sw-foot {
  margin-top: 2px; padding: 10px 10px 4px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-muted);
}
.sw-empty { padding: 14px 10px; font-size: 13px; color: var(--text-muted); }
