:root {
  --ink: var(--mds-color-gray-12);
  --muted: var(--mds-color-gray-11);
  --green: var(--mds-color-primary-11);
  --green-deep: var(--mds-color-primary-12);
  --accent: var(--mds-color-primary-9);
  --accent-soft: var(--mds-color-primary-3);
  --paper: var(--mds-color-gray-0);
  --canvas: var(--mds-color-gray-0);
  --soft: var(--mds-color-gray-2);
  --line: var(--mds-color-gray-5);
  --line-light: var(--mds-color-gray-4);
  --warning-bg: var(--mds-color-warning-3);
  --warning-line: var(--mds-color-warning-4);
  --warning: var(--mds-color-warning-11);
  --error: var(--mds-color-error-11);
  --radius: var(--mds-radius-surface);
  --workspace-nav-width: 202px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box }
body { margin: 0; -webkit-font-smoothing: antialiased }
[hidden] { display: none !important }
button, input, select, textarea { font: inherit }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent }
:where(button, a, input, select, summary):focus-visible { outline: 2px solid var(--mds-color-primary-8); outline-offset: 3px }
.skip-link { position: absolute; left: 12px; top: -70px; z-index: 110; padding: 12px; background: var(--paper); color: var(--ink) }
.skip-link:focus { top: 8px }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--line-light); background: var(--paper) }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 650; letter-spacing: -.02em }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #b1c69c; border-radius: 8px; background: #c3d9a9; color: #1f432f; font: italic 700 25px/1 Georgia,serif }
.workspace-menu, #workspace-scrim { display: none }
body.workspace-signed-in:not(.motion-report-shell) > .topbar { position: fixed; inset: 0 auto 0 0; width: var(--workspace-nav-width); flex-direction: column; align-items: stretch; padding: 18px 12px 12px; border: 0; border-right: 1px solid var(--line-light); background: var(--soft); z-index: 25 }
.workspace-signed-in:not(.motion-report-shell) > .topbar .brand { padding-inline: 4px }
.workspace-signed-in:not(.motion-report-shell) > #main { margin-left: var(--workspace-nav-width); padding: 34px clamp(24px,3.5vw,56px) 48px; min-height: calc(100dvh - 58px) }
.workspace-signed-in:not(.motion-report-shell) > footer { margin-left: var(--workspace-nav-width) }
#workspace-nav { position: fixed; top: 75px; left: 9px; width: calc(var(--workspace-nav-width) - 19px); max-height: calc(100dvh - 143px); display: grid; align-content: start; gap: 12px; overflow-y: auto; overscroll-behavior: contain; z-index: 26 }
.nav-group { display: grid; gap: 2px }
.nav-group + .nav-group { padding-top: 12px; border-top: 1px solid var(--line-light) }
#workspace-nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 10px; border-radius: var(--mds-radius-8); font-weight: 500; color: var(--muted); text-decoration: none; line-height: 20px }
#workspace-nav a svg { flex: none }
#workspace-nav a:hover, #workspace-nav a[aria-current=page] { background: var(--mds-color-gray-4); color: var(--ink) }
#workspace-nav a[aria-current=page] { font-weight: 600 }
#identity { min-width: 0 }
.profile-menu { position: relative }
.profile-menu summary { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px; border-radius: 8px; cursor: pointer; list-style: none }
.profile-menu summary::-webkit-details-marker { display: none }
.profile-menu summary:hover { background: var(--line-light) }
.profile-initial { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: #bde3e7; color: var(--ink); font-size: 12px; font-weight: 600 }
.profile-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px }
.profile-popover { position: absolute; bottom: calc(100% + 8px); left: 0; width: 225px; padding: 12px; border: 1px solid var(--line-light); background: var(--paper); border-radius: 12px; box-shadow: var(--mds-shadow-popover); z-index: 30 }
.profile-popover p { margin: 0 0 8px; overflow-wrap: anywhere; font-size: 13px }
.profile-popover button { width: 100% }
.workspace-signed-in:not(.motion-report-shell) > footer, body:not(.workspace-signed-in) > footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line-light); padding: 16px clamp(16px,3.5vw,56px); color: var(--muted); font-size: 12px }
body:not(.workspace-signed-in) #main { min-height: calc(100dvh - 125px); display: flow-root }
.login, #session-recovery { width: min(100% - 32px, 390px); margin: clamp(56px,14vh,150px) auto 56px; padding: 24px; border: 1px solid var(--line-light); border-radius: 16px; background: var(--paper) }
.login h1, #session-recovery h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.25; letter-spacing: var(--mds-typography-letter-spacing-h2) }
.login p, #session-recovery p { line-height: 1.5; color: var(--muted) }
.login .primary { width: 100%; margin: 14px 0 0 }
.login .muted { margin: 12px 0 0; font-size: 12px }
#session-recovery { margin: auto; pointer-events: auto }
#session-recovery::backdrop { background: var(--mds-color-gray-a-8) }
#session-recovery #session-error, #error { color: var(--error) }
#switch-session { margin-top: 8px }
.claude-connection-actions{display:flex;flex-wrap:wrap;gap:8px}.claude-connection-actions button{width:auto;flex:1 1 auto}.claude-signin-steps{margin:6px 0;padding-left:20px;font-size:13px;line-height:1.5}.claude-code-form{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}.claude-code-form input{flex:1 1 14rem;min-width:0}.claude-code-form button{width:auto;flex:0 0 auto}
#report-startup { max-width: 420px; margin: 12vh auto; padding: 24px; color: var(--muted) }
#report-startup a { color: var(--ink) }
#report-startup p { margin: 0 0 12px }
:where(.primary,.secondary,.workspace-menu) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--mds-radius-control-compact); background: var(--paper); color: var(--ink); font-weight: 500; line-height: 20px; cursor: pointer }
:where(.primary,.secondary):disabled { opacity: .5; cursor: not-allowed }
.secondary:hover:not(:disabled) { background: var(--soft) }
.primary { background: var(--accent); border-color: var(--accent); color: var(--mds-color-gray-12) }
.primary:hover:not(:disabled) { background: var(--mds-color-primary-10) }
#overview { scroll-margin-top: 34px }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px }
.page-heading h1 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: var(--mds-typography-letter-spacing-h1); font-weight: 600 }
.page-heading p { margin: 4px 0 0 }
#refresh-dashboard { flex: none }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(248px,30%); grid-template-areas: 'reports system' 'hours system'; align-items: start; gap: 20px }
.reporting { grid-area: reports }
.system-column { grid-area: system; min-width: 0 }
.hours-panel { grid-area: hours }
.dashboard-grid .panel { min-width: 0; background: var(--paper); border: 1px solid var(--line-light); border-radius: var(--mds-radius-surface); padding: 20px }
.dashboard-grid h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: var(--mds-typography-letter-spacing-h3) }
.dashboard-grid h3 { margin: 0; color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 600 }
.dashboard-grid p, .notice p { margin: 0; line-height: 1.5 }
.panel-heading, .chart-heading, .connection-title, .progress-headline { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.panel-heading { margin-bottom: 16px }
.panel-heading h2 + p { margin-top: 4px }
.dashboard-grid .muted, .page-heading .muted, .label, .fine-print, .unit, .section-intro, .status-freshness, .report-note, .usage-observation p, .usage-policy, .connection-detail { color: var(--muted); font-size: 13px; line-height: 1.5 }
.unit { white-space: nowrap; font-size: 12px }
.dashboard-grid .section-intro { margin: -8px 0 16px }
.dashboard-grid .fine-print, .dashboard-grid .report-note, .status-freshness { margin-top: 12px; font-size: 12px }
.dashboard-grid label { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted) }
.dashboard-grid :is(input,select) { min-height: 36px; min-width: 0; width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--mds-radius-control-compact); background: var(--paper); color: var(--ink); font-size: 14px }
.date-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 8px }
.date-controls label { min-width: 125px; flex: 1 1 125px }
.date-controls .preset-label { flex: 1.3 1 135px }
.metric-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 18px 0; margin: 18px 0; border-block: 1px solid var(--line-light) }
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 0 }
.metric strong { font-size: clamp(19px,1.8vw,28px); font-weight: 600; letter-spacing: -.025em; overflow-wrap: anywhere }
.metric .muted { font-size: 12px }
.metric strong, .dashboard-grid :is(td,.progress-headline,.sync-counters,dd,.usage-count-row,.usage-budget) { font-variant-numeric: tabular-nums }
.chart-heading { margin-bottom: 10px }
.chart { min-height: 160px; display: grid; align-items: center; overflow: hidden }
.chart svg { width: 100%; display: block; max-height: 250px }
.gridline { stroke: var(--line-light) }
.axis-label { font: 11px Inter,sans-serif; fill: var(--muted) }
.data-bar { fill: var(--mds-color-purple-9) }
.data-point:hover .data-bar, .data-point:focus .data-bar { fill: var(--mds-color-gray-11) }
.missing-mark { stroke: var(--line) }
.notice { display: flex; align-items: start; gap: 10px; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line-light); background: var(--soft) }
.notice > div { flex: 1; min-width: 0 }
.notice p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere }
.notice-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; margin-top: 5px; background: var(--mds-color-warning-9) }
.notice a, .overview-sync-link { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); font-weight: 500; font-size: 13px; text-underline-offset: 3px }
.notice .notice-progress { margin-top: 4px }
.badge,.connection-state { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; background: var(--mds-color-gray-3); color: var(--ink); font-size: 12px; font-weight: 500; line-height: 17px; border-radius: var(--mds-radius-6) }
.badge.completed,.connection-state.available,.history-ready { background: var(--mds-color-success-3); color: var(--mds-color-success-11) }
.badge:is(.waiting,.blocked),.connection-state:is(.expiring,.expired,.revoked),.queue-notice.delayed,.usage-origin { background: var(--warning-bg); color: var(--warning) }
.badge.running, .badge.queued { background: var(--accent-soft); color: var(--green-deep) }
.progress-headline { margin: 16px 0 7px; align-items: baseline; flex-wrap: wrap }
.progress-headline strong, .sync-counters strong, .usage-budget strong { font-size: 20px; font-weight: 600; letter-spacing: -.02em }
.progress-headline > span { color: var(--muted); font-size: 12px }
#progress { display: block; width: 100%; height: 6px; appearance: none; border: 0; border-radius: 999px; background: var(--line-light); overflow: hidden }
#progress::-webkit-progress-bar { background: var(--line-light) }
#progress::-webkit-progress-value { background: var(--accent); border-radius: 999px }
#progress::-moz-progress-bar { background: var(--accent) }
.sync-counters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 0 }
.sync-counters > div, .usage-budget, .current-report, .usage-origin { display: grid; gap: 4px }
.sync-counters span, .progress-breakdown > div, .sync-facts, .queue-notice p, .usage-observation details { font-size: 13px; line-height: 1.5 }
.sync-counters span, .progress-breakdown > div, .sync-facts dt { color: var(--muted) }
.progress-breakdown > div, .sync-facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line-light) }
.progress-breakdown strong, .sync-facts dd { margin: 0; color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere }
.sync-facts { margin: 16px 0 }
.current-report,.queue-notice,.usage-budget,.usage-origin,.history-ready { padding: 12px; border-radius: 8px; margin: 12px 0; overflow-wrap: anywhere }
.current-report,.queue-notice,.usage-budget { background: var(--soft) }
.usage-origin { background: var(--warning-bg) }
.retry-countdown { display: block; color: var(--warning) }
.inventory { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 }
.inventory span { padding: 3px 7px; border-radius: 6px; background: var(--soft); font-size: 12px }
.full-width { width: 100% }
.hour-refresh { margin: 16px 0 }
.hour-refresh form, .source-settings { display: grid; gap: 8px; margin-top: 12px }
.dashboard-grid summary { cursor: pointer; font-weight: 500; font-size: 13px }
.source-settings { padding-top: 16px; border-top: 1px solid var(--line-light) }
.source-picker { display: flex; gap: 8px }
.connection-row { position: relative; padding: 16px 0; border-top: 1px solid var(--line-light) }
.connection-title { justify-content: flex-start; flex-wrap: wrap; margin-bottom: 6px; font-weight: 600 }
.connection-row .connection-detail { margin: 4px 0; overflow-wrap: anywhere }
.connection-row button { margin-top: 8px }
.usage-count-row { display: grid; grid-template-columns: minmax(0,1fr) 80px 80px; align-items: center; gap: 8px; padding: 10px 8px; border-bottom: 1px solid var(--line-light); font-size: 13px }
.usage-count-row > span:not(:first-child) { text-align: right }
.usage-count-head { color: var(--muted); background: var(--soft); font-weight: 500 }
.usage-panel .usage-policy, .usage-panel .usage-cause, .usage-panel .usage-observation { padding: 12px 0; border-bottom: 1px solid var(--line-light) }
.usage-panel .usage-subtitle { margin: 16px 0 4px }
.usage-observation p { margin-top: 4px; overflow-wrap: anywhere }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line-light); border-radius: 10px }
.hours-panel table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px }
.hours-panel th, .hours-panel td { padding: 10px 12px; border-bottom: 1px solid var(--line-light); white-space: nowrap }
.hours-panel th { background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 500 }
.hours-panel tr:last-child td { border-bottom: 0 }
.hours-panel .empty-row td { white-space: normal; color: var(--muted) }
.hours-panel .number, .cell-spend, .cell-impressions, .cell-clicks { text-align: right }
.cell-source, .hour-end { color: var(--muted) }
.overview-sync-link { margin-top: 12px }
.dashboard-grid .system-column > .panel:not(:where(#sync)), .dashboard-grid #sync > :is(.sync-facts,.inventory,.queue-notice,.hour-refresh,.fine-print,.status-freshness,.full-width) { display: none }
:is(.workspace-show-sync,.workspace-show-connections,.workspace-show-account-changes,.workspace-show-meta-usage) .dashboard-grid { display: block; max-width: 850px }
:is(.workspace-show-sync,.workspace-show-connections,.workspace-show-account-changes,.workspace-show-meta-usage) .dashboard-grid > .panel,
:is(.workspace-show-connections,.workspace-show-account-changes,.workspace-show-meta-usage) #sync,.workspace-show-sync .overview-sync-link { display: none }
.workspace-show-sync .dashboard-grid #sync > :is(.sync-facts,.queue-notice,.hour-refresh,.fine-print,.status-freshness,.full-width) { display: block }
.workspace-show-sync .dashboard-grid #sync > .inventory { display: flex }
.workspace-show-connections .system-column > :is(#connections,#claude-connections), .workspace-show-account-changes .system-column > #account-changes, .workspace-show-meta-usage .system-column > #meta-usage { display: block }
/* The Connections page stacks Meta's and Claude's panels outside the grid, so they get its gap themselves. */
.workspace-show-connections .system-column > #claude-connections { margin-top: 20px }
.ads-manager-shell .dashboard-grid, .ads-manager-shell .page-heading, .ads-manager-shell #notice, .ads-manager-shell #connection-notice { display: none !important }
@media (max-width: 1100px) {
  :root { --workspace-nav-width: 180px }
  .dashboard-grid { grid-template-columns: minmax(0,1fr) minmax(217px,29%); gap: 14px }
  .dashboard-grid .panel { padding: 16px }
}
@media (max-width: 930px) {
  .dashboard-grid { grid-template-columns: minmax(0,1fr); grid-template-areas: 'reports' 'hours' 'system' }
}
@media (max-width: 800px) {
  body.workspace-signed-in:not(.motion-report-shell) > .topbar { position: sticky; inset: 0 0 auto; width: auto; height: 52px; flex-direction: row; align-items: center; justify-content: start; padding: 6px 14px; border: 0; border-bottom: 1px solid var(--line-light); background: var(--paper) }
  .workspace-signed-in:not(.motion-report-shell) > .topbar .brand { order: 1 }
  #workspace-menu:not([hidden]) { display: grid; place-items: center; width: 36px; height: 36px; padding: 4px; border: 0; background: transparent }
  .workspace-signed-in .topbar #identity { order: 2; margin-left: auto }
  .profile-label { display: none }
  .profile-popover { top: calc(100% + 7px); right: 0; left: auto; bottom: auto; max-width: calc(100vw - 28px) }
  .workspace-signed-in:not(.motion-report-shell) > #main { margin: 0; padding: 20px 14px 32px }
  .workspace-signed-in:not(.motion-report-shell) > footer { margin-left: 0 }
  #workspace-nav { display: none; inset: 52px auto 0 0; margin: 0; padding: 12px 8px; width: min(258px,82vw); height: auto; max-height: none; border-right: 1px solid var(--line); background: var(--soft) }
  .workspace-menu-open #workspace-nav { display: grid }
  #workspace-nav a { min-height: 44px }
  .workspace-menu-open #workspace-scrim { display: block; position: fixed; inset: 52px 0 0; border: 0; background: var(--mds-color-gray-a-8); z-index: 24 }
  .workspace-menu-open { overflow: hidden }
  #overview { scroll-margin-top: 72px }
  .page-heading h1 { font-size: 24px }
  .page-heading { margin-bottom: 18px }
  .notice { flex-wrap: wrap }
  .notice a { margin-left: 18px }
  .notice > div { flex-basis: calc(100% - 28px) }
  .dashboard-grid :is(input,select) { font-size: 16px }
}
@media (max-width: 540px) {
  .date-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)) }
  .date-controls .preset-label { grid-column: 1 }
  #load-report { grid-row: 1; grid-column: 2; align-self: end }
  .metric-strip { gap: 8px }
  .chart-heading { align-items: start; flex-direction: column; gap: 3px }
  .chart { min-height: 140px }
  .page-heading { align-items: start }
  .usage-count-row { grid-template-columns:minmax(0,1fr) 60px 60px }
}
@media (max-width: 540px) {
  .hours-panel table, .hours-panel tbody { display: block }
  .hours-panel thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%) }
  .hours-panel tbody tr { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-areas: 'day day spend' 'hour hour spend' 'impressions clicks source'; gap: 4px 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-light) }
  .hours-panel tbody tr:last-child { border-bottom: 0 }
  .hours-panel tbody td { display: block; border: 0; padding: 0; text-align: left; white-space: normal }
  .cell-day { grid-area: day; font-weight: 500 }
  .cell-hour { grid-area: hour; font-size: 12px; color: var(--muted) }
  .hours-panel .cell-spend { grid-area: spend; text-align: right; font-weight: 600 }
  .cell-impressions { grid-area: impressions }
  .cell-clicks { grid-area: clicks }
  .cell-source { grid-area: source }
  .cell-impressions::before,.cell-clicks::before,.cell-source::before { display: block; content: attr(data-label); padding-top: 6px; color: var(--muted); font-size: 11px }
  .hours-panel tbody .empty-row { display: block }
}
