:root {
  color-scheme: light;
  --canvas: #eef3f2;
  --panel: #ffffff;
  --wash: #f2f7f6;
  --wash-hover: #e4f1ee;
  --ink: #142d2c;
  --muted: #4d6462;
  --line: #d3e1de;
  --primary: #086753;
  --primary-hover: #065342;
  --on-primary: #ffffff;
  --accent-soft: #dbf2eb;
  --warm-ink: #815105;
  --warm-soft: #fcf1d9;
  --danger-ink: #92291f;
  --danger-soft: #fdefed;
  --grid: #dce8e5;
  --shadow: 0 13px 40px rgba(27, 69, 61, .06);
  --header: rgba(255, 255, 255, .96);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --canvas: #101c1c;
    --panel: #182725;
    --wash: #20332f;
    --wash-hover: #293f3a;
    --ink: #edf7f4;
    --muted: #acc1bb;
    --line: #384f4a;
    --primary: #8de0c5;
    --primary-hover: #aaf1da;
    --on-primary: #112921;
    --accent-soft: #23443a;
    --warm-ink: #ffda8f;
    --warm-soft: #443920;
    --danger-ink: #ffb0a6;
    --danger-soft: #492c28;
    --grid: #2c433d;
    --shadow: 0 13px 40px rgba(0, 0, 0, .14);
    --header: rgba(24, 39, 37, .96);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101c1c;
  --panel: #182725;
  --wash: #20332f;
  --wash-hover: #293f3a;
  --ink: #edf7f4;
  --muted: #acc1bb;
  --line: #384f4a;
  --primary: #8de0c5;
  --primary-hover: #aaf1da;
  --on-primary: #112921;
  --accent-soft: #23443a;
  --warm-ink: #ffda8f;
  --warm-soft: #443920;
  --danger-ink: #ffb0a6;
  --danger-soft: #492c28;
  --grid: #2c433d;
  --shadow: 0 13px 40px rgba(0, 0, 0, .14);
  --header: rgba(24, 39, 37, .96);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
  min-width: 280px;
}

a { color: var(--primary); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { -webkit-appearance: none; }
img { max-width: 100%; }
h1, h2, h3, p, ul, ol, dl { margin: 0; }
h1, h2, h3 { line-height: 1.24; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 4vw, 3rem); letter-spacing: -.04em; }
h2 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
h3 { font-size: 1.02rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }

.skip-link {
  background: var(--panel);
  border: 2px solid var(--primary);
  border-radius: .5rem;
  left: 1rem;
  padding: .65rem 1rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-200%);
  z-index: 9;
}
.skip-link:focus { transform: none; }

.site-header {
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .85rem;
  margin: 0 auto;
  max-width: 101rem;
  min-height: 4.4rem;
  padding: .7rem max(1rem, env(safe-area-inset-left));
}
.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 760;
  gap: .63rem;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand-mark {
  align-items: center;
  background: #096650;
  border-radius: .78rem;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.25rem;
  justify-content: center;
  position: relative;
  width: 2.25rem;
}
.brand-mark::before,
.brand-mark::after {
  background: currentColor;
  border-radius: 99px;
  content: "";
  height: .82rem;
  position: absolute;
  width: .19rem;
}
.brand-mark::after { transform: rotate(90deg); }
.site-nav {
  display: flex;
  flex: 1 0 100%;
  gap: .28rem;
  margin: 0 -0.18rem;
  order: 3;
  overflow-x: auto;
  padding: .2rem;
  scrollbar-width: thin;
}
.site-nav a,
.header-link {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: .62rem;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .9rem;
  font-weight: 650;
  min-height: 2.75rem;
  padding: .38rem .65rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav-long { display: none; }
.site-nav a { flex: 1 0 auto; justify-content: center; }
.site-nav a:is(:hover, [aria-current="page"]), .header-link:hover {
  background: var(--accent-soft);
  color: var(--primary);
}
.header-actions {
  align-items: center;
  display: flex;
  gap: .25rem .65rem;
  margin-left: auto;
}
.header-user { color: var(--muted); display: none; font-size: .86rem; }
.theme-control {
  background-color: var(--wash);
  border: 1px solid var(--line);
  border-radius: .6rem;
  color: var(--ink);
  font-size: .82rem;
  min-height: 2.7rem;
  padding: .2rem .38rem;
}

.page {
  margin: 0 auto;
  max-width: 76rem;
  padding: 2rem 1rem max(3rem, env(safe-area-inset-bottom));
}
.page-wide { max-width: 101rem; }
.page-narrow { max-width: 66rem; }
.page-heading {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem 1.8rem;
  justify-content: space-between;
  margin-bottom: 1.45rem;
}
.page-heading p { color: var(--muted); margin-top: .48rem; }
.stack { display: grid; gap: 1rem; }
.stack-loose { display: grid; gap: 1.5rem; }
.split { display: grid; gap: 1rem; align-items: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: clamp(1rem, 2.2vw, 1.6rem);
}
.panel-head { margin-bottom: 1rem; }
.panel-head p { color: var(--muted); font-size: .92rem; margin-top: .4rem; }
.section-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.muted, .empty { color: var(--muted); }
.small { font-size: .88rem; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.refund-amount { color: var(--warm-ink); }
.status-pill {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 99px;
  color: var(--primary);
  display: inline-flex;
  font-size: .78rem;
  font-weight: 720;
  line-height: 1.45;
  padding: .24rem .57rem;
  white-space: nowrap;
}
.status-refund, .status-pending { background: var(--warm-soft); color: var(--warm-ink); }
.empty {
  background: var(--wash);
  border-radius: .72rem;
  padding: 1.12rem;
}
.alert, .messages li {
  background: var(--accent-soft);
  border-radius: .65rem;
  color: var(--primary);
  overflow-wrap: anywhere;
  padding: .72rem .95rem;
}
.alert-warning, .messages .warning { background: var(--warm-soft); color: var(--warm-ink); }
.alert-error, .messages .error { background: var(--danger-soft); color: var(--danger-ink); }
.messages {
  display: grid;
  gap: .45rem;
  list-style: none;
  margin-bottom: 1.2rem;
  padding: 0;
}

.form-grid, .form-stack { display: grid; gap: .95rem; }
.form-grid > * { min-width: 0; }
.form-field label, .form-stack > p > label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.form-field > label:has(input[type="checkbox"]) {
  align-items: center;
  display: flex;
  gap: .6rem;
  min-height: 2.75rem;
}
.required-mark { color: var(--danger-ink); font-weight: 750; }
.visually-hidden {
  block-size: 1px;
  clip-path: inset(50%);
  inline-size: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}
.form-text.date-warning { color: var(--warm-ink); margin-top: .36rem; }
.form-field input:not([type="checkbox"], [type="radio"], [type="hidden"]),
.form-field select, .form-field textarea,
.form-stack > p > input:not([type="checkbox"], [type="hidden"]) {
  background-color: var(--panel);
  border: 1px solid var(--line);
  border-radius: .6rem;
  color: var(--ink);
  display: block;
  max-width: 100%;
  min-height: 2.9rem;
  min-width: 0;
  padding: .48rem .68rem;
  width: 100%;
}
.form-field textarea { resize: vertical; }
.form-field input[readonly] { background: var(--wash); }
.form-field input[type="checkbox"], .form-field input[type="radio"] {
  accent-color: var(--primary);
  flex: 0 0 auto;
  height: 1.13rem;
  width: 1.13rem;
}
.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] { border-color: var(--danger-ink); }
.form-field .helptext, .form-stack .helptext {
  color: var(--muted);
  display: block;
  font-size: .84rem;
  margin-top: .34rem;
  overflow-wrap: anywhere;
}
.form-text { color: var(--muted); font-size: .87rem; }
.errorlist {
  color: var(--danger-ink);
  font-size: .91rem;
  margin: .32rem 0 0;
  padding-inline-start: 1.05rem;
}
.form-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .65rem; }
.button {
  align-items: center;
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: .63rem;
  color: var(--on-primary);
  cursor: pointer;
  display: inline-flex;
  font-weight: 720;
  justify-content: center;
  line-height: 1.22;
  min-height: 2.85rem;
  padding: .63rem 1rem;
  text-decoration: none;
  text-align: center;
}
.button:hover { background: var(--primary-hover); }
.button-secondary { background: var(--panel); border-color: var(--line); color: var(--primary); }
.button-secondary:hover { background: var(--wash-hover); }
.button-quiet { background: var(--wash); color: var(--primary); }
.button-quiet:hover { background: var(--wash-hover); }
.button-block { width: 100%; }
.button[disabled] { cursor: wait; opacity: .7; }

.capture-panel {
  background: linear-gradient(155deg, var(--accent-soft), var(--panel) 80%);
  border-color: var(--line);
}
.file-input input[type="file"] {
  background: var(--panel);
  border: 1px dashed var(--primary);
  border-radius: .72rem;
  cursor: pointer;
  min-height: 3.4rem;
  padding: .52rem;
  width: 100%;
}
.file-input ::file-selector-button {
  background: var(--accent-soft);
  border: 0;
  border-radius: .45rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  margin-right: .65rem;
  padding: .38rem .58rem;
}
.receipt-selection { margin-block-start: .7rem; }
.receipt-selection-list { margin-block: 0 .65rem; padding-inline-start: 1.6rem; }
.receipt-selection-list li + li { margin-block-start: .45rem; }
.receipt-selection > .form-text { margin-block-end: .45rem; }
.receipt-selection-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .58rem;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .65rem;
  padding: .38rem .5rem;
}
.receipt-selection-row img { height: 2.6rem; object-fit: contain; width: 2rem; }
.receipt-selection-name { flex: 1 1 5rem; font-size: .83rem; overflow-wrap: anywhere; }
.receipt-selection-actions { display: flex; gap: .35rem; }
.receipt-selection-actions .button { font-size: .82rem; min-height: 2.75rem; padding-inline: .46rem; }
.receipt-selection-actions .button[disabled] { cursor: default; }
.receipt-stitch-preview { margin: .65rem 0 0; }
.receipt-stitch-preview figcaption { margin-block-end: .4rem; }
.receipt-stitch-preview .receipt-preview-image {
  background: var(--wash);
  border: 1px solid var(--line);
  max-block-size: 58vh;
  max-block-size: 58dvh;
}
.receipt-stitch-preview img { margin-inline: auto; }
.receipt {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: .85rem;
  color: var(--muted);
  cursor: zoom-in;
  display: block;
  padding: .7rem;
}
.receipt img {
  display: block;
  height: auto;
  margin: 0 auto;
  max-height: 65vh;
  max-width: 100%;
  object-fit: contain;
}
.receipt-preview {
  background: transparent;
  border: 0;
  max-inline-size: min(92vw, 80rem);
  padding: 0;
}
.receipt-preview[open] { display: grid; gap: .5rem; }
.receipt-preview::backdrop { background: rgb(7 15 19 / 85%); }
.receipt-preview > button { justify-self: end; margin: .3rem; }
.receipt-preview-image {
  border-radius: .5rem;
  max-block-size: calc(92vh - 4rem);
  max-block-size: calc(92dvh - 4rem);
  overflow: auto;
  overscroll-behavior: contain;
}
.receipt-preview-image img { display: block; height: auto; max-width: 100%; }
html:has(.receipt-preview[open]) { overflow: hidden; }
.meta-list {
  display: grid;
  gap: .7rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.meta-list dt { color: var(--muted); font-size: .81rem; }
.meta-list dd { font-weight: 650; margin: .1rem 0 0; overflow-wrap: anywhere; }
.meta-list .full { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; }
.data-table {
  border-collapse: collapse;
  text-align: left;
  width: 100%;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  padding: .72rem .65rem;
  vertical-align: top;
}
.data-table th { color: var(--muted); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.data-table td { min-width: 6.2rem; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child,
.data-table th:first-child { padding-left: 0; }
.data-table td:last-child,
.data-table th:last-child { padding-right: 0; }
.data-table .align-end { text-align: right; }
.rows { list-style: none; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.bill-row {
  align-items: start;
  display: grid;
  gap: .42rem .9rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .8rem 0;
}
.bill-row dd, .bill-row dt { overflow-wrap: anywhere; }
.bill-row-secondary { color: var(--muted); display: flex; flex-wrap: wrap; font-size: .82rem; gap: .14rem .62rem; }
.bill-row-title { align-items: center; display: flex; flex-wrap: wrap; font-weight: 720; gap: .3rem .45rem; margin-bottom: .22rem; overflow-wrap: anywhere; }
.bill-row-value { font-weight: 760; padding-top: .1rem; text-align: right; }
.bill-row .bill-row-action { grid-column: 1 / -1; }
.checkpoint-link { min-height: 2.75rem; display: inline-flex; align-items: center; }

.auth-page {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  margin: 0 auto;
  max-width: 62rem;
  padding: clamp(1.75rem, 8vw, 6rem) 1rem 4rem;
}
.auth-intro {
  background: #0c3c35;
  background-image: radial-gradient(ellipse at 92% 100%, #17755c, transparent 65%), linear-gradient(145deg, #153b3a, #0a2e2b);
  border-radius: 1.15rem;
  color: #f2fbf7;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 13rem;
  overflow: hidden;
  padding: clamp(1.45rem, 4vw, 3.8rem);
  position: relative;
}
.auth-intro::after {
  background: repeating-linear-gradient(0deg, transparent 0 33px, #d7fff324 34px 35px), repeating-linear-gradient(90deg, transparent 0 33px, #d7fff324 34px 35px);
  bottom: 0;
  content: "";
  mask-image: linear-gradient(135deg, transparent 36%, #000 100%);
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
}
.auth-intro > * { position: relative; z-index: 1; }
.auth-intro .brand-mark { background: #effcf5; color: #0f5c4a; margin-bottom: 1.1rem; }
.auth-intro h1 { font-size: clamp(1.7rem, 5vw, 3.2rem); max-width: 12ch; }
.auth-form { width: 100%; }

.auth-with-icp {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-with-icp .auth-page { width: 100%; }
.site-filing {
  font-size: .83rem;
  margin-top: auto;
  padding: .65rem 1rem calc(1rem + env(safe-area-inset-bottom));
  text-align: center;
}
.site-filing a { color: var(--muted); }
.site-filing a:hover { color: var(--primary); }

.period-switch {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: .7rem;
  display: inline-flex;
  gap: .13rem;
  padding: .17rem;
}
.period-switch a {
  align-items: center;
  border-radius: .52rem;
  color: var(--muted);
  display: inline-flex;
  font-size: .87rem;
  font-weight: 700;
  justify-content: center;
  min-height: 2.65rem;
  min-width: 4.2rem;
  padding: 0 .52rem;
  text-decoration: none;
  white-space: nowrap;
}
.period-switch a[aria-current] { background: var(--panel); color: var(--primary); box-shadow: 0 1px 4px #0001; }
.period-switch a:hover { color: var(--primary); }
.filters {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem .9rem;
}
.filters .form-field { flex: 1 1 9.5rem; max-width: 14rem; }
.filters .period-switch { margin-right: .25rem; }
.filters-panel { padding: .95rem 1.1rem; }
.stats-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card { padding: .95rem; min-height: 5.5rem; }
.stat-card dt, .stat-card .stat-label { color: var(--muted); font-size: .85rem; }
.stat-card dd, .stat-card .stat-value {
  font-size: clamp(1.14rem, 3.4vw, 1.9rem);
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: -.03em;
  line-height: 1.12;
  margin: .45rem 0 0;
  overflow-wrap: anywhere;
}

.dashboard { --display-accent: #a7edcf; }
.dashboard h1 { font-size: clamp(1.85rem, 4vw, 3.3rem); }
.dashboard-hero {
  background: #123d38;
  background-image: radial-gradient(ellipse at 92% 87%, #18755c 1%, transparent 61%), linear-gradient(135deg, #112d31, #105047);
  border: 1px solid #4e9181;
  border-radius: 1.18rem;
  box-shadow: 0 14px 34px #091c2930;
  color: #f6fffc;
  display: grid;
  gap: 1.4rem;
  overflow: hidden;
  padding: clamp(1.15rem, 4vw, 3rem);
  position: relative;
}
.dashboard-hero::after {
  background: repeating-linear-gradient(0deg, transparent 0 37px, #c9eed720 38px 39px), repeating-linear-gradient(90deg, transparent 0 37px, #c9eed720 38px 39px);
  content: "";
  inset: 0;
  mask-image: linear-gradient(135deg, transparent 30%, #000 100%);
  pointer-events: none;
  position: absolute;
}
.dashboard-hero > * { position: relative; z-index: 1; }
.hero-period { color: #b9e4da; font-size: .86rem; margin-bottom: .6rem; }
.hero-title { color: #ddf6f0; font-size: clamp(1rem, 3vw, 1.44rem); }
.hero-amount {
  font-size: clamp(2.15rem, 7vw, 5.35rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.065em;
  line-height: 1.12;
  margin: .45rem 0 .2rem;
  overflow-wrap: anywhere;
}
.hero-amount .currency { color: var(--display-accent); font-size: .59em; vertical-align: .13em; }
.hero-metrics { display: grid; gap: .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hero-metrics > div {
  background: #12302d85;
  border: 1px solid #a2e9d24d;
  border-radius: .76rem;
  min-width: 0;
  padding: .74rem .72rem;
}
.hero-metrics dt { color: #c6e8e0; font-size: clamp(.76rem, 1.2vw, .89rem); }
.hero-metrics dd {
  color: #ffffff;
  font-size: clamp(1rem, 2.3vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  line-height: 1.2;
  margin: .4rem 0 0;
  overflow-wrap: anywhere;
}
.chart-panels { display: grid; align-items: start; gap: 1rem; }

.chart {
  border: 1px solid var(--line);
  border-radius: .75rem;
  display: block;
  max-height: 22rem;
  overflow: auto;
  padding: .72rem .8rem;
  scrollbar-width: thin;
}
.chart::-webkit-scrollbar { height: .65rem; width: .65rem; }
.chart::-webkit-scrollbar-thumb { background: var(--line); border: .12rem solid var(--panel); border-radius: 99px; }
.chart-rows { display: grid; gap: .61rem; list-style: none; padding: 0; }
.chart-row { align-items: center; display: grid; gap: .42rem .7rem; grid-template-columns: minmax(3.65rem, .53fr) minmax(2rem, 1fr) minmax(4.4rem, auto); }
.chart-label { font-weight: 650; font-size: .82rem; overflow-wrap: anywhere; }
.chart-value { font-size: .83rem; font-weight: 730; text-align: right; }
.chart-track { background: var(--grid); border-radius: 99px; block-size: .5rem; inline-size: 100%; overflow: hidden; }
.chart-track > span {
  background: var(--primary);
  border-radius: inherit;
  display: block;
  block-size: 100%;
  inline-size: clamp(0%, var(--share, 0%), 100%);
}
.chart-row.is-refund .chart-track > span { background: var(--warm-ink); }
.chart-row.is-refund .chart-value { color: var(--warm-ink); }
.chart-category .chart-row { grid-template-columns: minmax(3.5rem, .8fr) minmax(2rem, 1fr) minmax(4.25rem, auto); }

.trend-plot {
  border: 1px solid var(--line);
  border-radius: .75rem;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}
.trend-columns {
  align-items: stretch;
  display: grid;
  grid-auto-columns: minmax(1.51rem, 1fr);
  grid-auto-flow: column;
  list-style: none;
  min-width: 100%;
  min-width: max(100%, calc(var(--points, 1) * 1.72rem));
  padding: .63rem .55rem .52rem;
}
.trend-column {
  align-items: center;
  display: grid;
  grid-template-rows: 4.5rem 4.5rem 1.4rem;
  justify-items: center;
  min-width: 0;
  position: relative;
}
.trend-up, .trend-down {
  align-items: end;
  background: repeating-linear-gradient(0deg, var(--grid) 0 1px, transparent 1px 25%);
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}
.trend-down { align-items: start; }
.trend-up > span, .trend-down > span {
  background: var(--primary);
  border-radius: .2rem .2rem 0 0;
  block-size: clamp(0%, var(--share, 0%), 100%);
  inline-size: min(55%, .9rem);
}
.trend-down > span { background: var(--warm-ink); border-radius: 0 0 .2rem .2rem; }
.trend-date { color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.trend-details { margin-top: .75rem; }
.trend-details summary { color: var(--primary); cursor: pointer; font-size: .88rem; font-weight: 670; padding: .45rem 0; }
.trend-details .chart { margin-top: .32rem; }

.admin-options { align-items: start; }
.admin-account { display: grid; gap: .6rem; grid-template-columns: minmax(0, 1fr) auto; padding: .8rem 0; }
.admin-account-name { overflow-wrap: anywhere; }
.form-divider { border: 0; border-top: 1px solid var(--line); margin: .38rem 0; }

@media (min-width: 36rem) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > .full { grid-column: 1 / -1; }
  .page { padding-inline: 1.6rem; }
  .header-inner { padding-inline: 1.6rem; }
  .stat-card { padding: 1.08rem; }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 48rem) {
  .site-nav { flex: 1 1 auto; order: initial; }
  .nav-long { display: inline; }
  .nav-short { display: none; }
  .site-nav a { flex: 0 0 auto; }
  .header-inner { flex-wrap: nowrap; }
  .header-actions { flex: 0 0 auto; }
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-review { grid-template-columns: minmax(13rem, 2fr) minmax(18rem, 3fr); }
  .auth-page { align-items: stretch; grid-template-columns: 1.12fr 1fr; }
  .auth-form { align-self: center; }
  .chart-panels { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .dashboard-hero { align-items: end; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

@media (min-width: 66rem) {
  .header-inner { gap: 1.5rem; }
  .header-user { display: block; }
  .site-nav { gap: .32rem; }
  .site-nav a { padding-inline: .8rem; }
  .page { padding-inline: 2.15rem; }
  .hero-metrics > div { padding: 1rem; }
  .trend-column { grid-template-rows: 5.5rem 5.5rem 1.4rem; }
}

@media print {
  .site-header, .filters-panel, .button, .skip-link { display: none; }
  body { background: #fff; color: #111; }
  .panel { box-shadow: none; break-inside: avoid; }
}

.auth-page > .messages { grid-column: 1 / -1; margin-bottom: 0; }
.auth-intro > p { color: #d8f4e9; margin-top: .65rem; }
.refund-panel {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: .95rem;
}
.refund-panel h3, .items-editor h3 { margin-bottom: .3rem; }
.items-editor { display: grid; gap: .52rem; justify-items: start; }
.items-editor [data-item-rows] { width: 100%; }
.item-row {
  align-items: end;
  display: grid;
  gap: .35rem .5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, .7fr);
}
.item-row > button { justify-self: end; }
.receipt-line-items > li {
  display: flex;
  gap: .7rem;
  justify-content: space-between;
  overflow-wrap: anywhere;
  padding: .55rem 0;
}
.settlement-action, .setting-secret { margin-top: 1rem; }
.delivery-row { overflow-wrap: anywhere; padding: .8rem 0; }
.delivery-row form { margin-top: .48rem; }
.password-panel { max-width: 31rem; }
.chart-legend {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: .82rem;
  gap: .25rem .95rem;
  margin-top: .62rem;
}
.chart-legend > span { align-items: center; display: flex; gap: .38rem; }
.chart-legend > span::before {
  background: var(--primary);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: .53rem;
  width: .53rem;
}
.chart-legend .refund-legend::before { background: var(--warm-ink); }
.trend-down { border-top: 1px solid var(--muted); }
.trend-date { margin-top: .35rem; }
@media (min-width: 36rem) {
  .item-row { grid-template-columns: minmax(0, 1fr) minmax(0, .62fr) auto; }
}

.dashboard-period-heading { margin: .12rem 0 .65rem; }
.dashboard-period-heading h2 { font-size: clamp(1.02rem, 2vw, 1.3rem); }
.dashboard-stats .stat-card { box-shadow: none; }
.dashboard-spend {
  background: linear-gradient(145deg, var(--accent-soft), var(--panel));
}
.dashboard-spend dd { color: var(--primary); }
.dashboard-insights { align-items: start; display: grid; gap: 1rem; }

.monthly-plot {
  border: 1px solid var(--line);
  border-radius: .75rem;
  direction: rtl;
  overflow-x: auto;
  padding: .37rem;
  scrollbar-width: thin;
}
.monthly-columns {
  direction: ltr;
  display: grid;
  gap: .16rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  min-width: 29rem;
  list-style: none;
  padding: 0;
}
.monthly-point {
  border-radius: .35rem;
  color: var(--muted);
  display: grid;
  gap: .3rem;
  grid-template-rows: clamp(6.75rem, 15vw, 10rem) auto;
  padding: .12rem .09rem .25rem;
  text-decoration: none;
}
.monthly-point[aria-current],
.monthly-point:hover {
  background: var(--wash);
  color: var(--primary);
}
.monthly-point:focus-visible { outline-offset: -2px; }
.monthly-bars {
  align-items: end;
  background: repeating-linear-gradient(0deg, var(--grid) 0 1px, transparent 1px 25%);
  display: flex;
  gap: .16rem;
  justify-content: center;
}
.monthly-bar {
  background: var(--primary);
  block-size: clamp(0%, var(--share, 0%), 100%);
  border-radius: .18rem .18rem 0 0;
  inline-size: clamp(.3rem, 27%, .86rem);
}
.monthly-refund { background: var(--warm-ink); }
.monthly-label {
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  text-align: center;
  white-space: nowrap;
}

.payer-panel {
  --payer-tone-1: #14886d;
  --payer-tone-2: #5b76bc;
  --payer-tone-3: #c89139;
  --payer-tone-4: #ac5e9a;
  --payer-tone-5: #3897ad;
  --payer-tone-6: #d47156;
  --payer-tone-7: #7c9752;
  --payer-tone-8: #7856ac;
  --payer-tone-9: #cb7e9b;
  --payer-tone-10: #82716a;
  container-type: inline-size;
}
.payer-composition {
  align-items: center;
  display: grid;
  gap: 1.1rem;
  padding: .45rem 0 0;
}
.payer-pie {
  aspect-ratio: 1;
  background: conic-gradient(var(--payer-slices));
  border-radius: 50%;
  box-shadow: 0 0 0 .34rem var(--wash), 0 0 0 .4rem var(--line);
  inline-size: min(100%, 12.25rem);
  justify-self: center;
  print-color-adjust: exact;
}
.payer-legend { list-style: none; padding: 0; }
.payer-legend li {
  align-items: center;
  display: grid;
  gap: .32rem .5rem;
  grid-template-columns: .62rem minmax(0, 1fr) auto minmax(3.2rem, auto);
  padding: .52rem 0;
}
.payer-legend li + li { border-top: 1px solid var(--line); }
.payer-swatch {
  background: var(--payer-tone);
  border-radius: .15rem;
  height: .62rem;
  width: .62rem;
}
.payer-name { font-size: .89rem; font-weight: 660; overflow-wrap: anywhere; }
.payer-amount, .payer-percent { font-size: .83rem; text-align: right; }
.payer-percent { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

@container (min-width: 26rem) {
  .payer-composition {
    gap: 1.35rem;
    grid-template-columns: minmax(8.65rem, 2fr) minmax(0, 3fr);
    padding: .6rem .3rem;
  }
}
@media (min-width: 56rem) {
  .dashboard-insights { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}
