@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrumentsans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --paper: #f3f1ec;
  --surface: #fff;
  --ink: #1f1e1c;
  --muted: #4f5359;
  --line: #dad6cd;
  --stone: #efebe2;
  --primary: #3a4fd1;
  --primary-hover: #3245ac;
  --tint: #e4ebfe;
  --tint-border: #b9c8f4;
  --info: #4c93c9;
  --info-light: #b5ddff;
  --accent: #e2664b;
  --warning: #e0a23a;
  --warning-bg: #fff5e8;
  --warning-ink: #6f4a03;
  --success: #6e8a6a;
  --success-bg: #def2db;
  --success-ink: #445941;
  --danger: #c23b3b;
  --danger-tint: #fbe9e6;
  --danger-tint-border: #edb7b1;
  --font-ui: "Instrument Sans", system-ui, sans-serif;
  --caption: .8125rem;
  --label: .875rem;
  --body: 1rem;
  --section: 1.125rem;
  --metric: 1.625rem;
  --title: clamp(2.5rem, 5.5vw, 4.5rem);
  font-family: var(--font-ui);
  font-size: var(--body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
a { color: var(--primary); text-underline-offset: .2em; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--ink);
  font-size: var(--label); font-weight: 700; text-decoration: none; cursor: pointer;
}
button:where(:not(:disabled)):hover, .button:hover {
  background: var(--tint);
  border-color: var(--tint-border);
}
.primary { color: white; background: var(--primary); border-color: var(--primary); }
.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.quiet { background: transparent; border-color: transparent; }
.danger { color: var(--danger); }
:is(button, .button):is(.danger, .closing-button):hover:where(:not(:disabled)) {
  background: var(--danger-tint);
  border-color: var(--danger-tint-border);
}
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
aside {
  display: flex; flex-direction: column; gap: 46px; padding: 30px 18px 20px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px; width: fit-content; text-decoration: none; }
.wordmark { font-size: 2rem; line-height: 1; font-weight: 700; letter-spacing: -.09em; color: var(--primary); }
.wordmark span { color: var(--accent); }
.mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; color: white; background: var(--primary); border-radius: 7px;
}
.mark img { display: block; width: 22px; height: auto; }
nav { display: grid; gap: 4px; }
nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 10px;
  border-radius: 6px; color: var(--muted); text-decoration: none;
  font-size: var(--label); font-weight: 500;
}
nav a:hover, nav a[aria-current] { background: var(--tint); color: var(--primary); }
nav a[aria-current] { font-weight: 700; }
svg { width: 18px; height: 18px; flex: none; }
.sidefoot { margin-top: auto; padding: 12px 10px 6px; color: var(--muted); font-size: var(--caption); }
header {
  height: 65px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 54px); background: var(--paper); border-bottom: 1px solid var(--line);
}
.workspace-label { color: var(--muted); font-size: var(--label); font-weight: 500; }
.profile { padding: 4px 8px; border: 0; background: transparent; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; min-width: 32px; height: 32px; border-radius: 50%; color: var(--primary); background: var(--tint); }
main { max-width: 1320px; margin: 0 auto; padding: 34px clamp(20px, 4vw, 54px) 36px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 28px; }
h1, h2, p { margin: 0; }
h1 { font: 400 var(--title)/1.04 var(--font-ui); letter-spacing: -.065em; }
h2 { font-size: var(--section); line-height: 1.35; font-weight: 700; letter-spacing: -.025em; }
.sub { color: var(--muted); margin-top: 8px; }
.overview { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(0,1fr); gap: 16px; }
.overview-side { display: grid; align-content: start; gap: 12px; }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.statement { display: flex; flex-direction: column; padding: 24px; }
.statement-top, .statement-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.statement-top > span, .statement-foot { color: var(--muted); font-size: var(--label); }
.statement-amount {
  font-size: clamp(1.85rem, 4vw, 3.4rem); line-height: 1.15; letter-spacing: -.065em;
  margin: 10px 0 18px; font-weight: 500; overflow-wrap: anywhere;
}
.statement-amount, .statement-foot strong, .metric strong, .rows .actions strong { font-variant-numeric: tabular-nums; }
.month-chart {
  display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: clamp(2px, .6vw, 8px);
  list-style: none; margin: auto 0 18px; padding: 0;
}
.month-chart li { display: grid; gap: 8px; text-align: center; color: var(--muted); font-size: var(--caption); }
.bar-track {
  position: relative; display: block; height: clamp(100px, 14vw, 176px); border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent calc(33.333% - 1px), var(--line) calc(33.333% - 1px), var(--line) 33.333%);
}
.bar-track i { position: absolute; bottom: 0; left: 16%; width: 68%; height: var(--bar); background: var(--info); border-radius: 3px 3px 0 0; }
.current-month .bar-track { background-color: var(--tint); border-color: var(--primary); }
.current-month .bar-track i { background: var(--primary); }
.month-chart .current-month { color: var(--primary); font-weight: 700; }
.statement-foot { border-top: 1px solid var(--line); padding-top: 15px; }
.statement-foot strong { margin-left: 6px; color: var(--ink); }
.hero { padding: 21px; border-radius: 9px; background: var(--ink); color: white; }
.hero-label { font-size: var(--label); color: var(--info-light); font-weight: 700; }
.hero h2 { margin-top: 4px; font: 400 clamp(1.9rem, 3.4vw, 2.7rem)/1.08 var(--font-ui); letter-spacing: -.06em; }
.hero p { margin: 6px 0 14px; color: var(--line); font-size: var(--label); }
.hero button { color: white; background: var(--primary); border-color: var(--primary); }
.hero button:hover { background: var(--primary-hover); }
.hero button:focus-visible { outline-color: var(--info-light); }
.shortcuts { padding: 16px 20px 8px; }
.shortcuts h2 { margin-bottom: 6px; }
.recent { margin-top: 16px; }
.grid, .tools { display: grid; gap: 16px; margin-bottom: 16px; }
.grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
.tools p { color: var(--muted); margin: 8px 0 15px; }
.chip { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-bottom: 10px; border-radius: 6px; background: var(--tint); color: var(--primary); }
.metric strong { display: block; margin: 4px 0; font-size: var(--metric); line-height: 1.2; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric p, .detail, .empty { color: var(--muted); font-size: var(--label); }
.section-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-top a, .rows a { font-size: var(--label); font-weight: 700; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 10px 0; }
.rows li:first-child { border-top: 0; }
.rows strong, .rows span { overflow-wrap: anywhere; }
.rows strong { font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.pill { background: var(--stone); color: var(--muted); font-size: var(--label); padding: 4px 8px; border-radius: 4px; }
.paid { color: var(--success-ink); background: var(--success-bg); box-shadow: inset 2px 0 var(--success); }
.pending { color: var(--warning-ink); background: var(--warning-bg); box-shadow: inset 2px 0 var(--warning); }
.empty { padding: 10px 0; }
label { display: grid; gap: 5px; margin: 12px 0; font-size: var(--label); font-weight: 700; }
input, select { width: 100%; min-height: 42px; border: 1px solid var(--muted); border-radius: 6px; padding: 8px 10px; background: white; color: var(--ink); font-size: var(--body); font-weight: 400; }
.filter { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.filter label { margin: 0; }
.select-field { display: grid; position: relative; align-items: center; }
.select-field select {
  appearance: none; min-height: 44px; min-width: 6.25rem;
  padding: 8px 36px 8px 12px; border-color: var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer;
}
.select-field::after {
  content: ""; position: absolute; inset-inline-end: 14px;
  width: 8px; height: 8px; color: var(--muted);
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg); pointer-events: none;
}
.select-field select:hover { background: var(--paper); border-color: var(--muted); }
.select-field select:focus-visible { border-color: var(--primary); outline-offset: 2px; }
.select-field:focus-within::after { color: var(--primary); }
@media (prefers-reduced-motion: no-preference) {
  .select-field::after { transition: color 150ms ease; }
}
@media (forced-colors: active) {
  .select-field select { appearance: auto; padding-inline-end: 12px; }
  .select-field::after { content: none; }
}
dialog { width: min(470px,calc(100% - 24px)); border: 1px solid var(--line); border-radius: 10px; padding: 22px; color: var(--ink); }
dialog::backdrop { background: #1f1e1cb3; }
.dialog-title, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }
.icon-btn { padding: 0 10px; font-size: 1.3rem; }
#error { color: var(--danger); font-size: var(--label); }
#notice { position: fixed; bottom: 18px; right: 18px; z-index: 2; max-width: calc(100% - 36px); padding: 10px 15px; border-radius: 6px; background: var(--primary); color: white; }
#notice:empty { display: none; }
.data-note { margin-top: 16px; color: var(--muted); font-size: var(--caption); }
.sr-only { position: absolute; height: 1px; width: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  aside { padding: 14px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  nav { display: flex; overflow-x: auto; }
  nav a { white-space: nowrap; }
  .sidefoot { display: none; }
  header { height: 52px; }
}
@media (max-width: 640px) {
  main { padding-top: 24px; }
  .overview, .tools { grid-template-columns: minmax(0,1fr); }
  .page-head { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .grid .metric:first-child { grid-column: 1/-1; }
  .card { padding: 14px; }
  .month-chart li { font-size: .75rem; }
  .section-top, .rows li { flex-wrap: wrap; }
  .actions { justify-content: flex-start; }
}

.skip-link {
  position: fixed; z-index: 5; top: 10px; left: 10px;
  padding: 10px 14px; background: var(--surface); border-radius: 6px;
  transform: translateY(calc(-100% - 20px));
}
.skip-link:focus { transform: translateY(0); }
.header-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.welcome {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-bottom: 16px; background: var(--tint);
}
.welcome > div { flex: 1 1 260px; }
.welcome p, .dialog-copy { margin-top: 6px; color: var(--muted); }
.guide-progress { margin-bottom: 8px; font-size: var(--label); color: var(--muted); }
.guide-choices { display: grid; gap: 8px; margin-top: 16px; }
.guide-choices button { justify-content: start; text-align: left; }
.portal-host { margin-top: 8px; overflow-wrap: anywhere; font-weight: 700; }
.dialog-actions { flex-wrap: wrap; }
@media (max-width: 480px) {
  header { justify-content: flex-end; }
  .workspace-label { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .button, nav a { transition: background-color 140ms ease, color 140ms ease, transform 100ms ease; }
  button:active, .button:active { transform: scale(.98); }
  #notice:not(:empty) { animation: appear 150ms ease-out; }
  @keyframes appear { from { opacity: 0; transform: translateY(4px); } }
}

.guide-intro { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.guide-intro .guide-progress { margin: 0; }
.ponto {
  --ponto-size: 3rem;
  display: inline-block; position: relative; flex: none;
  width: calc(var(--ponto-size) * 1.4); height: calc(var(--ponto-size) * 1.22);
  color: var(--accent); font-size: var(--ponto-size);
}
.ponto-body, .ponto-arm, .ponto-foot { position: absolute; background: currentColor; }
.ponto-body {
  left: .18em; top: .08em; width: 1em; aspect-ratio: 1; border-radius: .14em;
  background-image: radial-gradient(rgb(31 30 28 / 11%) .55px, transparent .7px);
  background-size: 3px 3px;
}
.ponto-arm { top: .55em; width: .32em; height: .13em; border-radius: 1em; }
.ponto-rest { left: .01em; transform: rotate(-38deg); }
.ponto-wave { right: .02em; transform: rotate(-48deg); transform-origin: left center; }
.ponto-foot { bottom: .01em; width: .19em; height: .25em; border-radius: .04em .04em .085em .085em; }
.ponto-foot:nth-of-type(3) { left: .39em; }
.ponto-foot:nth-of-type(4) { right: .43em; }
.ponto-eyes { position: absolute; display: flex; gap: .075em; top: .34em; left: 50%; transform: translateX(-50%); }
.ponto-eyes::before, .ponto-eyes::after {
  content: ""; width: .19em; height: .23em; border-radius: 50%;
  background: radial-gradient(ellipse .048em .058em at 52% 54%, var(--ink) 96%, transparent 100%), white;
}
.ponto-smile {
  position: absolute; top: .61em; left: 50%; width: .16em; height: .08em;
  border-bottom: .028em solid var(--ink); border-radius: 50%; transform: translateX(-50%);
}
@media (max-width: 480px) {
  .welcome > div { flex-basis: 150px; }
}
@media (prefers-reduced-motion: no-preference) {
  .guide-intro .ponto-wave { animation: ponto-wave 480ms 100ms ease-in-out both; }
  .guide-intro .ponto-eyes { animation: ponto-blink 550ms 150ms ease-in-out both; }
  @keyframes ponto-wave {
    0%, 100% { transform: rotate(-48deg); }
    30%, 75% { transform: rotate(-76deg); }
    55% { transform: rotate(-40deg); }
  }
  @keyframes ponto-blink {
    0%, 58%, 82%, 100% { transform: translateX(-50%) scaleY(1); }
    70% { transform: translateX(-50%) scaleY(.12); }
  }
}

.dot-mei-logo {
  display: inline-flex;
  align-items: baseline;
  gap: .13em;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: -.065em;
}
.dot-mei-logo .dot-mei-name { color: inherit; }
.dot-mei-logo b { margin-inline-start: .085em; font-weight: 700; }
.dot-mei-marker {
  width: .22em;
  height: .22em;
  border-radius: .035em;
  background: var(--accent);
}

.mei-actions { justify-content: flex-start; }
.mei-form { display: grid; gap: 10px; margin-top: 16px; }
.mei-form button { justify-self: start; }
.mei-check {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 14px;
}
.mei-check input { width: auto; }

#company-card { align-self: start; overflow-wrap: anywhere; }
.company-display { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.company-edit label, .occupation-search label { margin-top: 0; }
.occupation-field { position: relative; display: grid; align-items: center; }
.occupation-field svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.occupation-field input { padding-inline-start: 38px; }
.occupation-results { display: grid; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; }
.occupation-results button {
  width: 100%; display: grid; justify-items: start; gap: 2px; text-align: left;
  padding: 9px 10px; min-height: 44px; border-color: transparent; background: transparent;
  overflow-wrap: anywhere;
}
.occupation-results button:is(:hover, :focus-visible) { background: var(--tint); color: var(--primary); }
.occupation-results span { color: var(--muted); font-size: var(--caption); }
.occupation-selected { display: grid; justify-items: start; gap: 5px; padding: 14px; background: var(--tint); border-radius: 8px; }
.occupation-source { display: inline-block; margin-top: 12px; }
.annual-year { margin-bottom: 20px; }
.year-control {
  display: flex; width: 100%; overflow-x: auto;
  margin-top: 4px;
}
.year-control button {
  flex: 1 0 48px; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 9px;
  padding: 9px 0 0; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent; color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.875rem); font-weight: 400;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.year-control button:hover { color: var(--primary); background: transparent; border-color: var(--line); }
.year-control button:active { transform: none; }
.year-control button:focus-visible { outline-offset: -3px; }
.year-control .year-number { display: block; }
.year-control button[aria-pressed="true"] { border-bottom-color: var(--ink); }
.year-control button[aria-pressed="true"] .year-number {
  color: var(--primary); transform: scale(1.22);
}
.year-control .year-ticks {
  width: 100%; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end; height: 21px;
}
.year-ticks i { height: 5px; border-inline-start: 1px solid color-mix(in srgb, var(--muted) 40%, var(--line)); transform-origin: bottom; }
.year-ticks i:nth-child(3n+1) { height: 9px; }
.year-ticks i:first-child { height: 14px; }
.year-control button[aria-pressed="true"] .year-ticks i {
  border-inline-start-color: var(--ink); transform: scaleY(1.5);
}

@media (prefers-reduced-motion: no-preference) {
  .year-number { transition: color 160ms ease, transform 200ms cubic-bezier(.22, 1, .36, 1); }
  .year-ticks i { transition: border-color 160ms ease, transform 220ms cubic-bezier(.22, 1, .36, 1); }
  .year-control button[aria-pressed="true"] .year-ticks i:nth-child(3n+2) { transition-delay: 18ms; }
  .year-control button[aria-pressed="true"] .year-ticks i:nth-child(3n+3) { transition-delay: 36ms; }
  .company-edit, .company-display, .occupation-search, .occupation-selected { animation: appear 180ms ease-out both; }
}

.year-sheet-trigger { display: none; }
.year-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.year-sheet[open] {
  display: flex; flex-direction: column;
  width: min(100%, 520px); max-width: 100%; height: 82dvh; max-height: 92dvh;
  inset: auto 0 0; margin: 0 auto; border-radius: 20px 20px 0 0;
  padding: 20px 24px max(18px, env(safe-area-inset-bottom));
  background: var(--paper);
}
body:has(.year-sheet[open]) { overflow: hidden; }
.year-sheet .year-control { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.year-sheet .year-control button {
  flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 24px;
  justify-items: stretch; gap: 0; min-height: 92px; padding: 0;
  font-size: clamp(1.75rem, 7vw, 2.5rem); border: 0;
}
.year-sheet .year-ticks {
  height: 100%; grid-template-columns: 1fr; grid-template-rows: repeat(12, minmax(0, 1fr));
  align-items: start; justify-items: end; border-inline-end: 1px solid var(--line);
}
.year-sheet .year-ticks i { width: 5px; height: 0; border: 0; border-top: 1px solid var(--line); transform-origin: right; }
.year-sheet .year-ticks i:nth-child(3n+1) { width: 9px; }
.year-sheet .year-ticks i:first-child { width: 14px; }
.year-sheet button[aria-pressed="true"] .year-ticks { border-inline-end-color: var(--ink); }
.year-sheet button[aria-pressed="true"] .year-ticks i { border-top-color: var(--ink); transform: scaleX(1.5); }
.revenue-analysis { margin-top: 16px; }
.revenue-analysis summary { font-weight: 700; cursor: pointer; }
.revenue-analysis-body { padding-top: 16px; }
.revenue-analysis h2 + p { margin-top: 4px; }
.revenue-comparison { display: grid; grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); gap: 10px; margin: 12px 0 20px; }
.revenue-comparison div { padding: 10px 12px; background: var(--paper); border-radius: 8px; }
.revenue-comparison dt { color: var(--muted); font-size: var(--label); }
.revenue-comparison dd { margin: 3px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.revenue-analysis .month-chart { grid-template-columns: repeat(12,minmax(26px,1fr)); overflow-x: auto; }

@media (max-width: 640px) {
  .annual-year > .year-control { display: none; }
  .year-sheet-trigger {
    display: flex; justify-content: space-between; width: 100%; margin-top: 6px;
    min-height: 52px; font-size: 1.4rem; font-weight: 400; color: var(--primary);
  }
  .year-sheet-chevron { width: 9px; height: 9px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .year-sheet[open] { animation: year-sheet-enter 240ms cubic-bezier(.22,1,.36,1) both; }
  @keyframes year-sheet-enter { from { transform: translateY(18px); opacity: 0; } }
  .revenue-analysis[open] .revenue-analysis-body { animation: appear 200ms ease-out both; }
}

.revenue-analysis summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.revenue-analysis summary::-webkit-details-marker { display: none; }
.revenue-analysis summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-inline-end: 4px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.revenue-analysis[open] summary::after { transform: rotate(225deg); }
.revenue-analysis summary:hover { color: var(--primary); }
@media (prefers-reduced-motion: no-preference) {
  .revenue-analysis summary::after { transition: transform 180ms ease; }
}

#dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
#editor #fields { display: grid; gap: 14px; margin-top: 18px; }
#editor #fields label { margin: 0; }
.revenue-amount-field {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  border: 1px solid var(--muted); border-radius: 8px; background: var(--surface); color: var(--primary);
  font-size: var(--section);
}
.revenue-amount-field input {
  min-width: 0; padding-inline: 0; border: 0; background: transparent;
  font-size: 1.75rem; font-variant-numeric: tabular-nums;
}
.revenue-amount-field:focus-within { outline: 2px solid var(--primary); }
.revenue-amount-field input:focus { outline: none; }
.revenue-kind { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.revenue-kind legend { margin-bottom: 5px; font-size: var(--label); font-weight: 700; }
.revenue-kind label {
  display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-height: 44px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.revenue-kind label:has(:checked) { border-color: var(--primary); background: var(--tint); color: var(--primary); }
.revenue-kind input {
  appearance: none; display: grid; place-items: center; flex: 0 0 20px;
  width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0;
  border: 1px solid var(--muted); border-radius: 50%; background: var(--surface);
  cursor: pointer;
}
.revenue-kind input::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); transform: scale(0);
}
.revenue-kind input:checked { border-color: var(--primary); }
.revenue-kind input:checked::before { transform: scale(1); }
@media (prefers-reduced-motion: no-preference) {
  .revenue-kind input::before { transition: transform 160ms cubic-bezier(.22, 1, .36, 1); }
}
@media (forced-colors: active) {
  .revenue-kind input { appearance: auto; }
  .revenue-kind input::before { content: none; }
}
.revenue-table-scroll { max-width: 100%; overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; }
.revenue-table { width: 100%; min-width: 580px; border-collapse: collapse; font-size: var(--label); }
.revenue-table :is(th, td) { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.revenue-table thead { background: color-mix(in srgb, var(--stone) 44%, var(--surface)); color: var(--muted); }
.revenue-table tbody tr:last-child > * { border-bottom: 0; }
.revenue-table tbody tr:focus-within { background: color-mix(in srgb, var(--paper) 42%, var(--surface)); }
.revenue-table tbody th { overflow-wrap: anywhere; }
.revenue-table .revenue-cell-value { text-align: right; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.revenue-table thead th:nth-child(4) { text-align: right; }
.revenue-table .actions { justify-content: flex-start; flex-wrap: nowrap; gap: 0; }
.revenue-table .actions button { padding-inline: 8px; }
@media (hover: hover) { .revenue-table tbody tr:hover { background: color-mix(in srgb, var(--paper) 42%, var(--surface)); } }


.action-icon { display: block; flex: none; }
.primary .action-icon { filter: invert(1); }
.revenue-table .revenue-cell-actions { width: 108px; text-align: right; }
.revenue-table .actions { justify-content: flex-end; gap: 4px; }
.revenue-table .revenue-icon-button { width: 44px; min-height: 44px; padding: 0; border-radius: 8px; }
.revenue-icon-button.danger:hover .action-icon { filter: invert(20%) sepia(60%) saturate(2200%) hue-rotate(335deg); }

.mei-check { align-items: flex-start; gap: 10px; cursor: pointer; }
.mei-check input {
  appearance: none;
  flex: 0 0 20px;
  width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--muted); border-radius: 6px;
  background: var(--surface); color: white; cursor: pointer;
}
.mei-check input::before {
  content: ""; width: 9px; height: 5px;
  border: solid currentColor; border-width: 0 0 2px 2px;
  opacity: 0; transform: translateY(-1px) rotate(-45deg) scale(.65);
}
.mei-check input:checked { background: var(--primary); border-color: var(--primary); }
.mei-check input:checked::before { opacity: 1; transform: translateY(-1px) rotate(-45deg) scale(1); }
@media (prefers-reduced-motion: no-preference) {
  .mei-check input { transition: background-color 140ms ease, border-color 140ms ease; }
  .mei-check input::before { transition: opacity 120ms ease, transform 160ms ease; }
}
@media (forced-colors: active) {
  .mei-check input { appearance: auto; }
  .mei-check input::before { content: none; }
}

.page-head:has(.tip-wrap) { position: relative; z-index: 1; }
.page-title { display: flex; align-items: center; gap: 6px; }
.tip-wrap { position: relative; display: inline-flex; }
.tip-trigger {
  width: 44px; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--primary);
}
.tip-trigger:is(:hover, [aria-expanded="true"]) { background: transparent; border-color: transparent; }
.tip-trigger > span {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
}
.tip-trigger:is(:hover, [aria-expanded="true"]) > span {
  border-color: var(--primary); background: var(--primary); color: white;
}
.tip-trigger[aria-expanded="true"] > span { transform: scale(1.08); }
.tip-content {
  position: absolute; z-index: 4; inset-block-start: 100%; inset-inline-start: var(--tip-offset, 0px);
  width: min(310px, calc(100vw - 32px)); padding: 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--muted); box-shadow: 0 12px 32px #1f1e1c22; font-size: var(--label);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-6px) scale(.96); transform-origin: var(--tip-anchor, 22px) top;
}
.tip-content::before {
  content: ""; position: absolute; top: -5px; left: calc(var(--tip-anchor, 22px) - 5px);
  width: 9px; height: 9px; border: solid var(--line); border-width: 1px 0 0 1px;
  background: var(--surface); transform: rotate(45deg);
}
.tip-content[aria-hidden="false"] { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.tip-content strong { display: block; margin-bottom: 5px; color: var(--ink); }
.tip-step { display: block; margin-top: 10px; padding: 8px 10px; background: var(--tint); border-radius: 7px; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .tip-trigger > span { transition: transform 180ms ease, background-color 150ms ease, color 150ms ease; }
  .tip-content { transition: opacity 150ms ease, transform 180ms cubic-bezier(.22,1,.36,1), visibility 0s linear 180ms; }
  .tip-content[aria-hidden="false"] { transition-delay: 0s; }
}

@media (prefers-reduced-motion: no-preference) {
  #view > [data-route-entry] { animation: appear 180ms ease-out backwards; }
  input, select, .revenue-amount-field, .revenue-kind label, .revenue-table tbody tr {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  }
  dialog:not(.year-sheet)[open] { animation: appear 170ms ease-out both; }

  @supports (transition-behavior: allow-discrete) {
    dialog {
      opacity: 0;
      transform: translateY(6px) scale(.985);
      transition: opacity 170ms ease, transform 200ms ease, display 200ms allow-discrete, overlay 200ms allow-discrete;
    }
    dialog[open]:not(.year-sheet), .year-sheet[open] { opacity: 1; transform: none; animation: none; }
    dialog.year-sheet { transform: translateY(24px); }
    dialog::backdrop {
      opacity: 0;
      transition: opacity 180ms ease, display 200ms allow-discrete, overlay 200ms allow-discrete;
    }
    dialog[open]::backdrop { opacity: 1; }
    @starting-style {
      dialog[open]:not(.year-sheet) { opacity: 0; transform: translateY(6px) scale(.985); }
      .year-sheet[open] { opacity: 0; transform: translateY(24px); }
      dialog[open]::backdrop { opacity: 0; }
    }
  }
}

.ripple-anchor { position: relative; }
.click-ripple {
  position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none;
}
.click-ripple i {
  position: absolute; left: var(--ripple-x); top: var(--ripple-y);
  width: var(--ripple-diameter); aspect-ratio: 1; border-radius: 50%;
  background: currentColor; transform: translate(-50%, -50%) scale(0); opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .click-ripple i { animation: click-ripple 380ms cubic-bezier(.2,.65,.35,1) both; }
  @keyframes click-ripple {
    from { transform: translate(-50%, -50%) scale(0); opacity: .18; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
  }
}

.receipt-date { display: grid; gap: 5px; font-size: var(--label); font-weight: 700; }
.receipt-date-trigger {
  justify-content: flex-start; min-height: 44px; padding-inline: 12px;
  border-color: var(--line); border-radius: 8px; font-weight: 500;
}
.receipt-date-trigger svg { color: var(--primary); }
.receipt-date-trigger i {
  width: 8px; height: 8px; margin-inline: auto 3px;
  border: solid var(--muted); border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}
.receipt-date-trigger[aria-expanded="true"] i { transform: translateY(2px) rotate(225deg); }
#receipt-calendar:not([hidden]) { padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.receipt-calendar-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.receipt-calendar-head label:first-child { flex: 1; }
.receipt-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; text-align: center; }
.receipt-calendar-grid > span { align-self: center; font-size: var(--caption); color: var(--muted); }
.receipt-calendar-grid button { min-width: 0; min-height: 38px; padding: 0; border: 0; border-radius: 8px; font-weight: 500; }
.receipt-calendar-grid button[aria-pressed="true"] { color: white; background: var(--primary); }
.receipt-calendar-grid button:disabled { opacity: .4; cursor: default; background: transparent; }
@media (prefers-reduced-motion: no-preference) {
  .receipt-date-trigger i { transition: transform 170ms ease; }
  #receipt-calendar:not([hidden]) { animation: appear 180ms ease-out both; }
}

.revenue-table { min-width: 720px; }
.receipt-invoice { display: grid; justify-items: start; gap: 4px; }
.receipt-invoice-action { min-height: 34px; padding: 4px 8px; }
.receipt-invoice-details { border-top: 1px solid var(--line); padding-top: 8px; }
.receipt-invoice-details summary { cursor: pointer; padding-block: 6px; color: var(--primary); font-weight: 600; }
.receipt-invoice-details label { padding-block: 6px; }

.das-reminders { margin-block: 16px; }
.das-reminders .pill { white-space: normal; }

.closing-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: #fff6f4; }
.closing-zone h2, .closing-confirm h2 { color: var(--danger); }
.closing-button { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 38%, var(--line)); background: var(--surface); }
.closing-button:disabled { opacity: .5; cursor: not-allowed; }
.closing-confirm label strong { display: inline; color: var(--danger); }
.closing-confirm .dialog-actions { flex-wrap: wrap; }

.revenue-visibility { flex: none; width: 44px; min-height: 44px; padding: 0; border-radius: 8px; }
.revenue-visibility[aria-pressed="true"] { background: var(--tint); }
.revenue-chart-hidden { margin-block: 12px; }

.company-tools > .card { display: flex; flex-direction: column; align-items: flex-start; }
.company-tools #company-card { align-self: stretch; align-items: stretch; }
.company-tools > .card > :is(.actions, .button) { margin-top: auto; }
.das-feature {
  margin-bottom: 24px;
  border-color: color-mix(in srgb, var(--primary) 24%, var(--line));
  background: color-mix(in srgb, var(--tint) 55%, var(--surface));
}
.das-feature-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}
.das-feature-icon {
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 1;
  border-radius: 10px;
  color: var(--primary);
  background: var(--surface);
}
.das-feature-icon svg { width: 24px; height: 24px; }
.das-eyebrow { margin: 0 0 4px; color: var(--primary-hover); font-size: var(--label); font-weight: 700; }
.das-feature h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.1; letter-spacing: -.045em; }
.das-feature h2::first-letter, .das-month::first-letter { text-transform: uppercase; }
.das-feature .detail, .das-history-head p { margin: 6px 0 0; }
.das-feature-action { display: grid; justify-items: end; gap: 8px; }
.das-history-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px; }
.das-history-list { list-style: none; margin: 16px 0 0; padding: 0; }
.das-history-list > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, .75fr) minmax(15rem, auto);
  align-items: start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.das-history-list > li > :not(.das-actions) { padding-top: 8px; }
.das-actions { display: flex; align-items: start; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.das-actions button { white-space: normal; }
.das-correction { position: relative; flex: 0 1 auto; }
.das-correction[open] { z-index: 2; }
.das-correction summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--primary-hover);
  cursor: pointer;
  font-size: var(--label);
  font-weight: 600;
  list-style: none;
}
.das-correction summary::-webkit-details-marker { display: none; }
.das-correction summary:hover, .das-correction[open] summary { background: var(--tint); }
.das-correction summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.das-correction[open] summary::after { transform: rotate(225deg); }
.das-options {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: var(--das-menu-shift, 0px);
  display: grid;
  gap: 4px;
  width: min(16rem, calc(100vw - 24px));
  max-height: var(--das-menu-height, 60dvh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px #1f1e1c22;
}
.das-correction[data-side="above"] .das-options {
  inset-block: auto calc(100% + 6px);
}
.das-options button { justify-content: flex-start; text-align: start; }
.das-options .detail { max-width: 16rem; margin: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .das-correction summary, .das-correction summary::after { transition: background-color 160ms ease, transform 160ms ease; }
  .das-correction[open] .das-options { animation: appear 180ms ease-out both; }
}
@media (max-width: 860px) {
  .das-feature-body { grid-template-columns: auto minmax(0, 1fr); }
  .das-feature-action { grid-column: 2; justify-items: start; }
  .das-actions { justify-content: flex-start; }
  .das-history-list > li { grid-template-columns: minmax(0, 1fr) auto; }
  .das-history-list .das-actions { grid-column: 1 / -1; }
}

.confirm-dialog .dialog-title h2 { margin: 0; font-size: var(--metric); line-height: 1.15; }
.confirm-dialog p { margin: 12px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.confirm-dialog .dialog-actions { flex-wrap: wrap; }
.confirm-danger { background: var(--danger-tint); border-color: var(--danger-tint-border); }
.confirm-dialog .confirm-danger:hover { background: #f6d8d3; border-color: #df9b93; }
@media (prefers-reduced-motion: no-preference) {
  .confirm-dialog::backdrop { animation: confirm-backdrop 180ms ease-out; }
  @keyframes confirm-backdrop { from { opacity: 0; } }
}

.confirm-dialog .delete-error { color: var(--danger); }

/* Panel motion: scoped to the authenticated interface. */
body[data-account] #nav { position: relative; isolation: isolate; }
body[data-account] #nav a { position: relative; }
body[data-account] #nav .nav-selection { position: absolute; top: 0; left: 0; z-index: -1; border-radius: 8px; background: var(--tint); pointer-events: none; }
body[data-account] #nav a[aria-current] { background: transparent; }
body[data-account] .bar-track i { transform-origin: bottom; }
body[data-account] #notice { z-index: 100; border-radius: 12px; box-shadow: 0 8px 28px rgb(31 30 28 / .14); max-width: min(28rem, calc(100% - 36px)); }
body[data-account] #notice:not(:empty) { animation: none; }
@media (prefers-reduced-motion: no-preference) {
  body[data-account] #nav.motion-ready .nav-selection { transition: transform 360ms cubic-bezier(.22,1,.36,1), width 300ms ease, height 300ms ease; }
  body[data-account] #nav a svg { transition: transform 300ms cubic-bezier(.34,1.4,.4,1); }
  body[data-account] #nav a[aria-current] svg { transform: scale(1.08); }
  body[data-account] :is(button, .button) { transition: background-color 180ms ease, border-color 180ms ease, box-shadow 200ms ease, transform 180ms cubic-bezier(.22,1,.36,1); }
  body[data-account] :is(button, .button):active:not(:disabled) { transform: scale(.97); }
  body[data-account] :is(input, select, textarea) { transition: border-color 180ms ease, box-shadow 220ms ease; }
  body[data-account] :is(input, select, textarea):focus-visible { box-shadow: 0 0 0 4px var(--tint); }
  body[data-account] .bar-track { transition: background-color 180ms ease; }
  body[data-account] .month-chart li:hover .bar-track { background-color: var(--tint); }
  body[data-account] dialog:not(.year-sheet) { transition-duration: 240ms, 320ms, 320ms, 320ms; transition-timing-function: ease, cubic-bezier(.22,1,.36,1), ease, ease; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  body[data-account] .primary:hover:not(:disabled) { box-shadow: 0 4px 12px rgb(58 79 209 / .18); }
  body[data-account] #nav a:hover svg { transform: translateY(-1px) scale(1.08); }
}
