:root {
  color-scheme: light;
  --bg: #fff;
  --card-bg: #f5f5f5;
  --primary: #2C332E;
  --secondary: #3F5147;
  --surface: #fff;
  --surface-muted: #f6f6f5;
  --surface-accent: #e7ebe8;
  --text: #333333;
  --muted: #59625c;
  --line: #dbdfdb;
  --control-border: #89938c;
  --on-dark: #fff;
  --chart-first: #87978e;
  --loss: #BE2222;
  --positive: #286044;
  --negative: #873e38;
  --font: system-ui, sans-serif;
  --header-height: 64px;
  --gutter: clamp(20px, 3vw, 52px);
  --page-max: 1520px;
  --motion-curve: cubic-bezier(.75, 0, .175, 1);
  --fold-motion: 350ms var(--motion-curve);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-height) + 14px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
h1 {
  font: 600 clamp(17px, 1.4vw, 20px)/1.2 var(--font);
  letter-spacing: -.018em;
  text-transform: uppercase;
}
h2 { font-size: clamp(14px, 1.15vw, 16px); font-weight: 600; line-height: 1.25; letter-spacing: -.02em; }
h3 { font-size: 13px; font-weight: 600; }
a { color: var(--text); }
button, input, select { color: inherit; font: inherit; }
button, input, select {
  border: 1px solid var(--control-border);
  border-radius: 0;
  background: var(--surface);
  padding: 8px 12px;
}
select {
  appearance: none;
  padding-inline-end: 39px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='m.75.75 4.25 4.25L9.25.75' fill='none' stroke='%232c332e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 10px 6px;
  background-position: right 16px center;
}
@media (forced-colors: active) {
  select { appearance: auto; background-image: none; }
}
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
button, a, select { transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
button:hover:not(:disabled), select:hover { border-color: var(--secondary); }
:where(button, a, input, select, summary, [tabindex="0"]):focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}
:root[data-pointer-focus] :focus {
  outline: none;
}
.dark { background: var(--primary); color: var(--on-dark); border-color: var(--primary); }
button.dark:hover:not(:disabled) { background-color: var(--secondary); }
.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
[hidden] { display: none !important; }
.skip-link {
  position: fixed;
  z-index: 60;
  top: 10px;
  left: 10px;
  padding: 9px 15px;
  background: white;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  height: var(--header-height);
  padding-inline: var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.menu-toggle, .menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.menu-toggle { grid-column: 1; grid-row: 1; justify-self: start; gap: 11px; }
.menu-toggle svg, .menu-close svg { width: 21px; height: 21px; }
.menu-caption { font-size: 12px; font-weight: 550; }

.brand {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.brand img { display: block; width: clamp(158px, 15vw, 212px); height: auto; }
.sync {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}
#sync-label {
  min-width: 0;
  font-size: 10px;
  line-height: 1.5;
  text-align: right;
  color: var(--muted);
}
.sync button, .iconbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#data-visibility { width: 44px; min-height: 44px; flex-shrink: 0; padding: 0; background: transparent; border: 0; }
#data-visibility:hover { background: var(--surface-muted); }
#data-visibility .icon { width: 20px; height: 20px; }
.privacy-digits { display: inline-grid; vertical-align: baseline; }
.privacy-digits > .privacy-measure, .privacy-digits::after { grid-area: 1 / 1; }
.privacy-measure { visibility: hidden; user-select: none; -webkit-user-select: none; }
.privacy-digits::after { content: attr(data-privacy-mask); }
.numbers-hidden :is(.metric-comparison, .profit-margin, .sub, .datum, .chart-note) .privacy-digits::after {
  content: none;
}
.numbers-hidden :is(.metric-comparison, .profit-margin, .sub, .datum, .chart-note) .privacy-measure {
  visibility: visible;
  filter: blur(max(4px, .32em));
}
.numbers-hidden .chart text.privacy-label {
  filter: blur(3px);
}
.numbers-hidden #dialog-content :is(input[type="number"], input[inputmode="decimal"], input[type="search"]) {
  color: transparent;
  caret-color: var(--text);
}
.numbers-hidden #dialog-content label:has(> :is(input[type="number"],input[inputmode="decimal"],input[type="search"])) { position: relative; }
.numbers-hidden #dialog-content label:has(> :is(input[type="number"],input[inputmode="decimal"],input[type="search"]))::after {
  content: attr(data-privacy-mask); position: absolute; inset-inline-start: 12px; bottom: 9px; pointer-events: none;
}
#refresh { min-height: 36px; padding: 8px 12px; border: 0; font-size: 11px; font-weight: 550; white-space: nowrap; }
#refresh .icon { width: 15px; height: 15px; }
.sidebar {
  --drawer-gutter: max(24px, env(safe-area-inset-left));
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overscroll-behavior: contain;
  transform: translateX(-100%);
  visibility: hidden;
  z-index: 32;
  width: min(89vw, 400px);
  border: 0;
  overflow: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transition: transform .6s var(--motion-curve), visibility 0s linear .6s;
}
body.nav-open .sidebar { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.menu-close {
  flex: none;
  display: flex;
  align-self: flex-start;
  margin: 0 0 0 calc(var(--drawer-gutter) - 12px);
  min-height: 40px;
  padding-top: 14px;
  position: relative;
}
.menu-close::before { content: ""; position: absolute; inset: -2px 0; }
.menu-close svg { width: 14px; height: 14px; stroke-width: 1.5; stroke-linecap: butt; }
.sidebar nav {
  display: block;
  overflow-y: auto;
  flex: 1;
  padding: 0 var(--drawer-gutter) 24px;
}
.sidebar nav a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 21px 0;
  background: transparent;
  color: var(--text);
  font: 400 18px/1.2 var(--font);
  letter-spacing: -.3px;
}
.sidebar nav a .icon { width: 20px; height: 20px; flex: none; }
.sidebar nav a:not(:last-child) { border-bottom: 1px solid rgb(51 51 51 / 15%); }
.sidebar > form { border-top: 1px solid var(--line); padding: 8px var(--drawer-gutter); }
.sidebar > form button { min-height: 44px; border: 0; padding-inline: 0; }
#main-content { min-width: 0; }
body.nav-open { overflow: hidden; }
@media (min-width: 901px) {
  html { scrollbar-gutter: stable; }
}
.nav-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 31;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgb(0 0 0 / .3);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease-in-out, visibility 0s linear .6s;
}
body.nav-open .nav-backdrop { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  :root { --rail-width: 64px; --nav-width: 264px; }
  body { --nav-inset: var(--rail-width); }
  body.nav-pinned { --nav-inset: var(--nav-width); }
  .topbar {
    --logo-start: calc(var(--rail-width) + var(--gutter) + max(0px, (100% - var(--rail-width) - var(--page-max)) / 2));
    grid-template-columns: var(--logo-start) auto minmax(0,1fr);
    padding-inline: 0;
  }
  #menu-toggle { justify-self: start; margin-inline-start: calc((var(--rail-width) - 44px) / 2); }
  #menu-toggle:is(:hover,[aria-expanded="true"]) { background: var(--surface-muted); }
  #menu-toggle .menu-caption { display: none; }
  .brand { justify-self: start; }
  .brand img { width: 190px; }
  .sync { margin-inline-end: var(--gutter); }
  #main-content { margin-left: var(--nav-inset); transition: margin-left .24s cubic-bezier(.25,1,.5,1); }
  .sidebar {
    top: var(--header-height);
    z-index: 29;
    --drawer-gutter: calc((var(--rail-width) - 20px) / 2);
    width: var(--rail-width);
    visibility: visible;
    transform: none;
    border-right: 1px solid var(--line);
    transition: width .24s cubic-bezier(.25,1,.5,1);
  }
  .sidebar.rail-preview, body.nav-pinned .sidebar { width: var(--nav-width); }
  .sidebar .menu-close { display: none; }
  .sidebar nav { width: 100%; padding-inline: 0; overflow-x: hidden; }
  .sidebar nav a {
    position: relative;
    padding: 0 var(--drawer-gutter);
    min-height: 56px;
    border: 0;
    white-space: nowrap;
    font-size: 16px;
  }
  .sidebar nav a:not(:last-child) { border-bottom: 0; }
  .sidebar nav a[aria-current="page"] { background: var(--card-bg); color: var(--secondary); font-weight: 600; }
  .sidebar nav a[aria-current="page"]::before {
    content: ""; position: absolute; inset: 15px auto 15px 0; width: 3px; background: currentColor;
  }
  .sidebar nav a:focus-visible { outline-offset: -3px; }
  .sidebar .nav-label { opacity: 0; transition: opacity .16s ease; }
  .sidebar.rail-preview .nav-label, body.nav-pinned .sidebar .nav-label { opacity: 1; }
  .sidebar > form { padding-inline: 0; }
  .sidebar > form button {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px;
    padding: 0 var(--drawer-gutter);
  }
  body:not(.nav-pinned) .sidebar:not(.rail-preview) > form button { color: transparent; }
  .sidebar > form button::before {
    content: ""; flex: 0 0 20px; height: 20px;
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H4v16h6m-1-8h12m-5-5 5 5-5 5'/%3E%3C/svg%3E");
  }
}
th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.page {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: clamp(16px, 1.8vw, 30px) var(--gutter) 64px;
  container: dashboard / inline-size;
}
.page-head, .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-head { min-height: 44px; margin-bottom: clamp(12px, 1.2vw, 18px); }
.actions, #period-controls { display: flex; align-items: center; gap: 8px; }
.actions { flex-wrap: wrap; }
#period-controls { flex: none; }
#period {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding-inline: 8px; border: 0; background: transparent;
  font-size: 13px; font-weight: 550;
}
#period .icon { width: 17px; height: 17px; flex: none; }
#period-picker {
  position: fixed; inset: auto 8px auto auto; margin: 0;
  width: min(490px,calc(100vw - 16px)); max-height: calc(100dvh - 16px);
  overflow: auto; overscroll-behavior: contain; padding: 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  box-shadow: 0 8px 32px rgb(44 51 46 / 15%);
}
.period-layout { display: grid; grid-template-columns: 154px minmax(0,1fr); }
#period-presets { padding: 8px 0; border-right: 1px solid var(--line); }
#period-presets button, .calendar-head button, #calendar-days button, .period-footer button { border: 0; }
#period-presets button { width: 100%; min-height: 39px; text-align: left; padding: 8px 16px; font-size: 13px; }
#period-presets button[aria-pressed=true] { color: var(--secondary); background: var(--surface-accent); font-weight: 650; }
.period-calendar { padding: 8px 12px 14px; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.calendar-head strong { font-size: 15px; }
.calendar-head button { min-width: 40px; min-height: 40px; padding: 0; font-size: 23px; }
.calendar-week, #calendar-days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); text-align: center; }
.calendar-week { color: var(--muted); padding-block: 6px; font-size: 12px; }
#calendar-days { row-gap: 2px; }
#calendar-days button { position: relative; min-height: 36px; padding: 0; font-size: 13px; }
#calendar-days button[aria-pressed=true] { background: var(--surface-accent); }
#calendar-days button.endpoint[aria-pressed=true] { background: var(--secondary); color: white; }
#calendar-days button[aria-current=date]::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; transform: translateX(-50%); border-radius: 50%; background: currentColor; }
#calendar-days button:disabled, .calendar-head button:disabled { opacity: .38; }
#period-picker button:focus-visible { outline-offset: -2px; }
@media (hover: hover) {
  #period-picker button:not(:disabled):not(.dark):not([aria-pressed=true]):hover { background: var(--card-bg); }
}
.period-footer { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding: 10px 12px; }
#calendar-selection { flex: 1; font-size: 12px; color: var(--muted); }
.period-footer button { min-height: 38px; padding-inline: 12px; font-size: 13px; }
@media (max-width: 540px) {
  #period-picker { width: calc(100% - 16px); right: 8px !important; }
  .period-layout { grid-template-columns: minmax(0,1fr); }
  #period-presets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 6px; border: 0; border-bottom: 1px solid var(--line); }
  #period-presets button { font-size: 12px; min-height: 44px; text-align: center; padding: 4px; }
  #period-presets [data-period=custom] { grid-column: 1 / -1; }
  #calendar-days button, .calendar-head button, .period-footer button { min-height: 44px; }
  .period-calendar { padding: 4px 10px 10px; }
}
input[type=date] { margin-left: 4px; }

.profit-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2.6vw, 40px);
  border-radius: 0;
  margin-bottom: 12px;
  padding: clamp(13px, 1.2vw, 18px) clamp(18px, 2.2vw, 32px);
  background: var(--card-bg);
  color: var(--text);
}
.profit-value { min-width: 0; flex: 1 1 auto; }
.profit-trend { flex: 1 1 56%; min-width: 0; margin: 0; }
.profit-trend figcaption { color: var(--muted); font-size: 11px; font-weight: 550; margin-bottom: 5px; }
.profit-trend svg { display: block; width: 100%; height: 44px; }
.profit-plot { position: relative; }
.profit-days { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.profit-days button { min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.profit-days button:is(:hover, :focus-visible) { background: #3f514712; }
.profit-days button:is(:hover, :focus-visible)::after {
  content: attr(aria-label);
  position: absolute;
  right: 0;
  bottom: 100%;
  z-index: 1;
  pointer-events: none;
  white-space: nowrap;
  padding: 3px 7px;
  background: var(--primary);
  color: var(--on-dark);
  font-size: 12px;
}

.profit-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.profit-heading h2 {
  font: 550 clamp(14px, 1.1vw, 16px)/1.2 var(--font);
  letter-spacing: -.025em;
}
.profit-number {
  margin: 8px 0 5px;
  font: 530 clamp(36px, 3.8vw, 62px)/1.11 var(--font);
  letter-spacing: -.06em;
  overflow-wrap: anywhere;
}
.profit-margin { color: var(--muted); font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi, .box {
  min-width: 0;
  background: var(--card-bg);
  border: 0;
  border-radius: 0;
}
.kpi {
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  padding: clamp(13px, 1.5vw, 24px);
}
.k-label { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 30px; font-size: 13px; font-weight: 550; line-height: 1.45; }
.k-label .icon { width: 18px; height: 18px; flex: none; color: var(--secondary); }
.number {
  margin: 9px 0 5px;
  font-size: clamp(15px, 11.5cqi, 36px);
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: 1.14;
  overflow-wrap: anywhere;
}
.metric-values {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 4px clamp(12px, 4.5cqi, 18px);
  margin: 9px 0 6px;
}
.metric-values > .number, .metric-values > .profit-number { margin: 0; white-space: nowrap; }
.profit-value .metric-values { margin: 4px 0 2px; }
.metric-values > .number { font-size: clamp(16px, 10cqi, 36px); }
.metric-comparison {
  padding: 3px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.metric-comparison.gain { color: var(--secondary); }
.metric-comparison.loss { color: var(--loss); }

.sub, .period-note, .empty, .note { font-size: 12px; line-height: 1.55; color: var(--muted); }
.fee-composition summary { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 28px; list-style: none; font-size: 12px; font-weight: 550; color: var(--secondary); }
.fee-composition summary::-webkit-details-marker { display: none; }
.fee-composition summary::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.fee-composition[open] summary::after { transform: rotate(225deg); }
.kpi-breakdown {
  display: grid;
  gap: 3px;
  margin: 9px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.kpi-breakdown > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 7px; }
.kpi-breakdown dd { margin: 0; color: var(--secondary); white-space: nowrap; }
@container (min-width: 265px) {
  .kpi .k-label { min-height: 1.45em; }
}
@container (max-width: 133px) {
  .kpi .k-label { min-height: 4.35em; }
}

.box { padding: clamp(17px, 1.8vw, 27px); }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.box + .box.full, .full, .tablesection { margin-top: 16px; }
.card-top { flex-wrap: wrap; }
.period-note { margin-top: 5px; }
.segments { position: relative; isolation: isolate; border-radius: 0; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-self: flex-start; gap: 1px; padding: 3px; background: #e8eae8; }
.segments button { min-width: 40px; min-height: 30px; background: transparent; padding: 4px 7px; border: 0; font-size: 11px; color: var(--muted); }
.segments::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3px auto 3px 3px;
  width: calc((100% - 8px) / 3);
  background: white;
  box-shadow: 0 1px 4px #26372c24;
  transition: transform .3s var(--motion-curve);
}
.segments:has([data-group="week"].on)::before { transform: translateX(calc(100% + 1px)); }
.segments:has([data-group="month"].on)::before { transform: translateX(calc(200% + 2px)); }
.segments button.on { color: var(--text); font-weight: 650; }
.chart-picker { margin-top: 12px; font-size: 12px; }
.chart-picker summary { width: fit-content; padding: 5px 0; cursor: pointer; font-weight: 600; }
.chart-picker > .fold-body > div { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 14px; padding: 12px; margin-top: 4px; background: white; }
.chart-picker fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.chart-picker legend { font-weight: 650; padding: 0; margin-bottom: 4px; }
.chart-picker label { display: flex; align-items: center; gap: 7px; min-height: 28px; cursor: pointer; }
.chart-picker input { flex-shrink: 0; }
.chart-picker input { width: 15px; height: 15px; min-height: 0; margin: 0; padding: 0; accent-color: var(--secondary); }
.legend { display: flex; flex-wrap: wrap; gap: 5px 15px; align-items: center; font-size: 11px; color: var(--muted); margin: 20px 0 8px; }
.key { display: inline-block; width: 9px; height: 9px; border-radius: 0; margin-right: 5px; background: currentColor; }
.series-gross-margin { color: #195884; }
.series-operating-margin { color: #91520d; }
.key.rate-key { width: 17px; height: 0; background: none; border-top: 2px solid currentColor; vertical-align: .24em; }
.series-net-margin { color: #754b83; }
.key.series-net-margin { border-top-style: dotted; }
.margin-series.series-net-margin path { stroke-dasharray: 2 3; }
.series-gross-profit { color: #477d87; }
.series-net-profit { color: #465a81; }
.series-cost { color: #986746; }
.series-media { color: #94709b; }
.series-fees { color: #827235; }
.series-meta-tax { color: #80526e; }
.series-shopify { color: #4e773e; }
.series-payments { color: #307482; }
.series-refunds { color: #b26770; }
.key.series-operating-margin { border-top-style: dashed; }
.margin-series { pointer-events: none; }
.margin-series path { stroke: currentColor; stroke-width: 2; fill: none; stroke-linejoin: round; }
.margin-series.series-operating-margin path { stroke-dasharray: 5 3; }
.margin-series circle { fill: currentColor; stroke: var(--card-bg); stroke-width: .7; }
.chart-bar { fill: currentColor; }
.series-revenue { color: var(--chart-first); }
.series-profit { color: var(--secondary); }
.series-loss { color: var(--loss); }
.chart { display: block; width: 100%; height: auto; max-height: 246px; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--muted); }
.chart rect { transition: opacity .15s; }
.chart g[data-drill] { cursor: pointer; }
.chart g[data-drill]:hover rect { opacity: .72; }
.chart-note { min-height: 1.55em; }
.chart-note, .footer-note { margin-top: 8px; color: var(--muted); font-size: 11px; }
.footer-note { margin-top: 18px; }
.split-list { margin-top: 18px; }
.split + .split { margin-top: 15px; }
.split-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; }
.track { border-radius: 0; overflow: hidden; height: 5px; background: var(--surface-accent); margin-top: 7px; }
.bar { border-radius: inherit; height: 100%; background: var(--secondary); }
.datum { font-weight: 600; }
.flat { padding: 0; border: 0; background: none; font-size: 12px; cursor: pointer; }

.payment-heading { margin: 24px 0 6px; }
.payment-heading + .tablewrap th { white-space: normal; letter-spacing: .05em; }
.impact-order-count { white-space: nowrap; color: var(--muted); }
.payment-link { background: transparent; padding: 3px 0; min-height: 0; border: 0; color: var(--secondary); font: inherit; text-decoration: none; }
.payment-link:hover, .payment-link:focus-visible { color: var(--text); }
dialog:has(.payment-order-list) { width: min(820px, 95vw); }
.payment-order-list td { vertical-align: top; }
.payment-count { display: block; color: var(--muted); font-size: 11px; }
.tablewrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 10px; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.total td { background: var(--surface-accent); font-weight: 600; }
.tablesection .card-top { margin-bottom: 13px; }
.income-statement > .tablewrap > table > tbody > tr:last-child > td {
  border-top: 2px solid var(--secondary);
  background: var(--surface-accent);
  font-weight: 650;
  font-size: 14px;
}
.income-statement > .tablewrap > table > tbody > tr:last-child > td:first-child { padding-left: 9px; }
.income-statement > .tablewrap > table > tbody > tr:last-child > td:last-child { padding-right: 9px; }
.income-statement .dre-subtotal > td { background: var(--surface-accent); font-weight: 600; }
.income-statement .dre-subtotal > td:first-child { padding-left: 9px; }
.income-statement .dre-subtotal > td:last-child { padding-right: 9px; }
.income-statement .dre-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}
.dre-toggle::before {
  content: "";
  flex: none;
  align-self: center;
  width: 6px;
  height: 6px;
  margin-inline: 2px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform .23s cubic-bezier(.25,.15,.35,1);
}
.dre-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
[data-dre-row] { cursor: pointer; }
[data-dre-row]:hover, [data-dre-row]:focus-within { background: rgb(63 81 71 / .06); }
.income-statement .dre-detail > td { padding: 0; border: 0; }
.dre-detail [role="region"] { overflow: clip; }
.dre-detail-body { padding: 4px 0 16px clamp(12px, 2vw, 24px); border-bottom: 1px solid var(--line); }
.dre-detail h3 { margin: 13px 0 4px; }
.dre-detail .tablewrap { max-width: 100%; }
.income-statement > .tablewrap > table { table-layout: fixed; }
.income-statement > .actions { margin-top: 16px; }
.income-statement > .tablewrap > table > thead > tr > th:first-child { width: 48%; }
.income-statement > .tablewrap > table > thead > tr > th:last-child { width: 20%; }
.empty, .note { padding: 11px 14px; margin-top: 12px; background: var(--surface-muted); }
.rate-details { margin-top: 12px; }
.rate-details summary { color: var(--text); font-size: 12px; font-weight: 550; padding: 8px 0; }
.status { border-radius: 0; display: inline-block; padding: 3px 7px; color: var(--positive); background: #e5efe8; font-size: 11px; }
.status.wait { color: #685b41; background: #f1eadb; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.source-grid .box .actions { margin-top: 14px; }
.data-caption { color: var(--muted); font-size: 12px; margin: 8px 0; }
.source-icon { display: inline-flex; align-items: center; color: var(--secondary); }
.sources-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.sources-top .status { margin-left: auto; }
.inputrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inputrow input { max-width: 100%; }
.push { margin-left: auto; }
.pillselect { max-width: 205px; }
.compact { padding: 6px 9px; font-size: 11px; }
.box button, .actions button, .form-stack button { border: 0; }
.box button:not(.dark, .dre-toggle, .on, .metric-comparison, .payment-link):hover:not(:disabled) { background: var(--surface-accent); }
#export { background: var(--card-bg); }
.product-catalog > .period-note { margin: 2px 0 18px; }
.campaign-panel summary { display: flex; align-items: center; gap: 10px; list-style: none; font-weight: 600; }
.product-group { border-top: 1px solid var(--line); }
.product-group > summary { display: flex; align-items: center; gap: 12px; padding: 13px 0; list-style: none; }
.product-group > summary::-webkit-details-marker, .campaign-panel summary::-webkit-details-marker { display: none; }
.product-group > summary::before, .campaign-panel summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: 0 3px;
  border: solid var(--primary);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform var(--fold-motion);
}
.product-group[open] > summary::before, .campaign-panel details[open] > summary::before { transform: rotate(45deg); }
.product-identity { flex: 1; min-width: 0; }
.product-identity strong { overflow-wrap: anywhere; }
.product-sales { text-align: right; white-space: nowrap; }
.product-group small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.product-group > summary:hover { color: var(--secondary); background: var(--surface); }
.product-group[open] > summary { font-weight: 600; }
.product-pricing { border-radius: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 12px; background: var(--surface); }
.product-pricing strong { margin-right: 6px; }
.product-group .tablewrap { margin: 2px 0 14px; }
.attribution-editor { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 12px 0; }
.attribution-editor label { display: grid; gap: 3px; flex: 1 1 180px; min-width: 0; }
.attribution-editor select { width: 100%; min-width: 0; }

dialog { border-radius: 0; box-shadow: 0 20px 70px #20352826; width: min(440px, 94vw); max-height: 90dvh; padding: 26px; border: 1px solid var(--line); color: var(--text); background: var(--surface); }
dialog::backdrop { background: #2c332e99; }
.close { float: right; background: transparent; border: 0; font-size: 23px; line-height: 1; padding: 0 3px; }
.form-stack { display: grid; gap: 12px; margin-top: 16px; }
.form-stack label { display: grid; gap: 4px; font-size: 12px; }
.form-stack input, .form-stack select { width: 100%; min-width: 0; }
#toast { border-radius: 0; position: fixed; bottom: 16px; right: 18px; z-index: 40; max-width: min(440px, 90vw); padding: 12px 18px; background: var(--primary); color: white; }
.neg { color: var(--negative); }
.positive { color: var(--positive); }
.muted { color: var(--muted); }

[data-profit-sign="positive"] { --profit-color: var(--secondary); }
[data-profit-sign="negative"] { --profit-color: var(--loss); }
.profit-number,
.product-balance,
.income-statement > .tablewrap > table > tbody > tr:last-child > .num {
  color: var(--profit-color, var(--text));
}

@container dashboard (max-width: 885px) {
  .cards:has(.metric-values) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container dashboard (max-width: 470px) {
  .cards:has(.metric-values) { grid-template-columns: 1fr; }
}
@container dashboard (max-width: 765px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row { grid-template-columns: 1fr; }
  .profit-trend { flex-basis: 45%; }
}
@container dashboard (max-width: 540px) {
  .source-grid { grid-template-columns: 1fr; }
  .profit-hero { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
  .profit-number { font-size: clamp(26px, 7.4cqi, 40px); }
  .profit-value .metric-values { flex-wrap: wrap; }
  .chart text { font-size: 18px; }
  .product-group > summary { gap: 8px; }
  .product-group table { min-width: 630px; }
}
@media (max-width: 900px) {
  html { overscroll-behavior-x: none; }
  .topbar, .page { padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
  .topbar { height: calc(var(--header-height) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  #main-content { overflow-x: clip; }
  .tablewrap { min-width: 0; overscroll-behavior-x: contain; }
}
@media (max-width: 760px) {
  :root { --header-height: 82px; --gutter: clamp(13px, 4.3vw, 26px); }
  .topbar { grid-template-rows: 55px 26px; }
  .brand img { width: clamp(104px, calc(100vw - 212px), 182px); }
  .sync { display: contents; }
  #data-visibility { grid-column: 3; grid-row: 1; justify-self: end; margin-right: 44px; }
  #refresh { grid-column: 3; grid-row: 1; justify-self: end; min-width: 44px; min-height: 44px; padding: 8px; border: 0; background: white; color: var(--text); }
  #refresh:hover:not(:disabled) { background: var(--surface-muted); }
  #refresh .icon { width: 20px; height: 20px; }
  .refresh-caption { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
  #sync-label { grid-column: 1 / -1; grid-row: 2; text-align: center; font-size: 10px; line-height: 1.2; }
  .menu-caption { display: none; }
  .k-label, .sub { font-size: 12px; }
  .segments button, .fee-composition summary { min-height: 44px; }
  .kpi-breakdown { font-size: 12px; }
  .page-head { align-items: center; gap: 8px; }
  #period { font-size: 16px; }
  :is(.form-stack, .attribution-editor) :is(input:not([type=checkbox]),select),
  .actions select { min-height: 44px; font-size: 16px; }
  .actions button, .compact, dialog .close, .chart-picker summary, .rate-details summary { min-height: 44px; }
  dialog .close { min-width: 44px; }
  dialog { padding: 16px; overscroll-behavior: contain; }
  .chart-picker label { min-height: 44px; }
  #impact-by-watch .actions { width: 100%; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,152px),1fr)); }
  #impact-by-watch select { width: 100%; min-width: 0; }
  .product-group .tablewrap :is(td,th):first-child, .payment-order-list :is(td,th):first-child {
    position: sticky;
    left: 0;
    background: var(--card-bg);
  }
  .payment-order-list :is(td,th):first-child { background: var(--surface); }
  .page { padding-bottom: max(42px, env(safe-area-inset-bottom)); }
}
@container dashboard (max-width: 470px) {
  .profit-number { font-size: clamp(32px,11.5cqi,46px); }
  .profit-trend { width: 100%; }
  .profit-trend figcaption { font-size: 11px; }
  .profit-trend svg { height: 44px; }
  .kpi .metric-values { flex-wrap: wrap; }
  .income-statement > .tablewrap > table > thead > tr > th:first-child { width: 40%; }
  .income-statement > .tablewrap > table > thead > tr > th:last-child { width: 23%; }
  .income-statement > .tablewrap > table > thead th { white-space: normal; letter-spacing: .04em; }
}
@media (max-width: 410px) {
  .cards { gap: 8px; }
  .kpi { padding: 12px; }
  .page-head { flex-wrap: wrap; }
  .chart { min-height: 110px; }
}
/* Directional underline used by the storefront's text links. */
:is(.payment-link, .metric-comparison, .flat, .menu-caption, .nav-label, .actions a) {
  position: relative;
  text-decoration: none;
}
:is(.payment-link, .metric-comparison, .flat, .menu-caption, .nav-label, .actions a)::after {
  content: "";
  position: absolute;
  inset: auto 0 1px;
  height: 1px;
  background: currentColor;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s ease;
}
@media (hover: hover) and (pointer: fine) {
  :is(.payment-link, .metric-comparison, .flat, .actions a):hover::after,
  .menu-toggle:hover .menu-caption::after, .sidebar a:hover .nav-label::after {
    transform: scaleX(1);
    transform-origin: left;
  }
}
:root:not([data-pointer-focus]) :is(.payment-link, .metric-comparison, .actions a):focus-visible::after,
.flat:focus-within::after, .menu-toggle:focus-visible .menu-caption::after,
.sidebar a:focus-visible .nav-label::after { transform: scaleX(1); transform-origin: left; }

@supports selector(details::details-content) {
  details::details-content {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows var(--fold-motion), opacity var(--fold-motion),
                content-visibility var(--fold-motion) allow-discrete;
  }
  details[open]::details-content { grid-template-rows: 1fr; opacity: 1; }
  details > .fold-body { min-height: 0; min-width: 0; overflow: clip; }
}
.fee-composition summary::after { transition: transform var(--fold-motion); }
@media (prefers-reduced-motion: no-preference) {
  [data-arrive] {
    animation: section-arrival .36s cubic-bezier(.25,1,.5,1) var(--arrival-delay,0ms) backwards;
  }
  @keyframes section-arrival {
    from { opacity: .2; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
  body.nav-open .sidebar nav a { animation: drawer-link-enter .3s cubic-bezier(.25,1,.5,1) .3s backwards; }
  body.nav-open .sidebar nav a:nth-child(2) { animation-delay: .418s; }
  body.nav-open .sidebar nav a:nth-child(3) { animation-delay: .532s; }
  body.nav-open .sidebar nav a:nth-child(4) { animation-delay: .642s; }
  @keyframes drawer-link-enter { from { opacity: 0; transform: translateX(-40px); } }
  :is([data-arrive], .chart-enter) .chart[data-density="normal"] .chart-bar,
  [data-arrive] .profit-plot rect {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: bar-rise .42s cubic-bezier(.25,1,.5,1) var(--arrival-delay,0ms) backwards;
  }
  :is([data-arrive], .chart-enter) .chart[data-density="normal"] [data-direction="down"],
  [data-arrive] .profit-plot .series-loss { transform-origin: center top; }
  @keyframes bar-rise { from { transform: scaleY(0); } }
  :is([data-arrive], .chart-enter) :is(.margin-series, .chart[data-density="dense"]) {
    animation: chart-sweep .48s cubic-bezier(.215,.61,.355,1) backwards;
  }
  @keyframes chart-sweep { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
  [data-arrive] .track .bar { transform-origin: left; animation: share-grow .48s ease-out backwards; }
  @keyframes share-grow { from { transform: scaleX(0); } }
  .profit-days button:is(:hover,:focus-visible)::after { animation: feedback-enter .15s ease-out; }
  .profit-days button:active::after { animation: none; }
  button:is(.dark,.compact,.iconbtn):not(:disabled) {
    transition: background-color .2s ease, color .2s ease, transform .15s ease;
  }
  button:is(.dark,.compact,.iconbtn):not(:disabled):active { transform: translateY(1px); }
  #data-visibility .icon { animation: icon-enter .2s ease-out; }
  @keyframes icon-enter { from { opacity: .35; transform: scale(.88); } }
  #refresh[aria-busy="true"] .icon { animation: refresh-spin 1.2s linear infinite; }
  #toast:not([hidden]) { animation: feedback-enter .22s ease-out; }
  @keyframes refresh-spin { to { transform: rotate(1turn); } }
  @keyframes feedback-enter { from { opacity: 0; transform: translateY(6px); } }
  dialog {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .24s var(--motion-curve),
                display .24s allow-discrete, overlay .24s allow-discrete;
  }
  dialog[open] { opacity: 1; transform: translateY(0); }
  dialog::backdrop {
    opacity: 0;
    transition: opacity .2s ease, display .24s allow-discrete, overlay .24s allow-discrete;
  }
  dialog[open]::backdrop { opacity: 1; }
  @starting-style {
    dialog[open] { opacity: 0; transform: translateY(8px); }
    dialog[open]::backdrop { opacity: 0; }
  }
}
@media (min-width: 761px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  button.dark {
    background-image: linear-gradient(178deg, var(--primary) 10%, var(--secondary) 10%);
    background-repeat: no-repeat;
    background-size: 100% 200%;
    background-position: 100% -100%;
  }
  button.dark:not(:disabled) { transition: background-position .3s cubic-bezier(.215,.61,.355,1), transform .15s ease; }
  button.dark:not(:disabled):is(:hover,:focus-visible) { background-position: 100% 25%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation-duration: 0s !important; }
  details::details-content { transition: none !important; }
  dialog::backdrop { transition: none !important; }
}
