/* Structure only. Components and semantic tokens have independent owners. */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: clip;
}
body {
  font: var(--body-size)/1.5 var(--font-body);
  color: var(--text);
  background: #153d37;
}
button,
input,
textarea,
select {
  font: inherit;
}
a {
  color: inherit;
}
h1,
h2,
h3 {
  font-family: var(--font-title);
  font-weight: 650;
  letter-spacing: normal;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
}
h1 {
  font-size: 36px;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
}
p {
  margin: 0 0 var(--space-2);
}
svg {
  vertical-align: middle;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-3) 0;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 100;
  background: var(--accent);
  color: var(--ink);
  padding: var(--space-1);
}
.skip:focus {
  top: 10px;
}
.muted,
.footnote,
.small {
  color: var(--muted);
}
.small,
.footnote {
  font-size: 11px;
}
.footnote {
  margin-top: var(--space-2);
}
.eyebrow,
.nav-group {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 650;
  color: var(--muted);
}
.eyebrow {
  margin: 0 0 var(--space-1);
}
.workspace {
  position: relative;
  isolation: isolate;
  display: flex;
  width: 100%;
  height: 100dvh;
  overflow: clip;
  background:
    radial-gradient(ellipse at 90% 0, #83b99145, transparent 47%),
    linear-gradient(135deg, #0c3537, #174d43 55%, #305f45);
}
.is-debug > .workspace {
  height: calc(100dvh - 36px);
}
/* Static reliefs sit behind the transparent workspace body and glass cards.
   Crisp light/shade edges provide material for backdrop-filter to diffuse. */
.workspace:before,
.workspace:after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 45%;
  transform: rotate(-29deg);
  border: 1px solid #d5e8b912;
}
.workspace:before {
  width: 105vw;
  height: 45vw;
  min-height: 400px;
  left: 12%;
  top: 46%;
  background: linear-gradient(
    160deg,
    #b4d48614,
    #4b967629 26%,
    #123c3824 50%,
    #062e3328 72%,
    #9dbd7418
  );
  box-shadow:
    inset 0 18px 35px #d5eab717,
    inset 0 -28px 45px #042f3929,
    0 30px 65px #031f3220;
}
.workspace:after {
  width: 66vw;
  height: 90vw;
  right: -52%;
  top: -35%;
  background: linear-gradient(130deg, #c3d49329, #4f967319 35%, #07383522 75%);
  box-shadow:
    inset 15px 6px 28px #e9ffd020,
    0 0 65px #061f3518;
}
.sidebar {
  width: max-content;
  flex: 0 0 auto;
  min-width: 246px;
  interpolate-size: allow-keywords;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  --nav-padding-start: var(--space-2);
  --nav-padding-end: var(--space-1);
  padding: 0 var(--nav-padding-end) var(--space-2) var(--nav-padding-start);
  background: #0c302e4a;
  transition:
    width var(--duration-exit) var(--ease),
    flex-basis var(--duration-exit) var(--ease);
}
.brand {
  font: 750 20px var(--font-title);
  white-space: nowrap;
}
.brand svg {
  width: 30px;
  height: 30px;
}
.navigation-scroll {
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.sidebar nav {
  display: grid;
  width: max-content;
  gap: var(--space-micro);
  padding-right: var(--space-1);
}
.nav-group {
  margin: var(--space-2) var(--space-1) var(--space-micro);
}
.workspace-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--shell-header-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.topbar-title,
.account-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.topbar-title {
  font-size: 11px;
  color: var(--muted);
}
.account-tools {
  min-width: 0;
}
.menu-toggle {
  display: inline-flex;
}
.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: #d9edc324;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.page-scroll {
  min-height: 0;
  flex: 1;
}
.page-scroll > .scroll-viewport:focus { outline: 0; }
.scroll-viewport:focus-visible { background-color: #c5e79d18; }
.scroll-viewport {
  height: 100%;
  overflow: auto;
}
main {
  width: 100%;
  padding: var(--space-4) var(--space-4) var(--space-2);
  max-width: 1600px;
  margin: auto;
  outline: none;
}
.workspace-footer {
  font-size: 9px;
  color: var(--muted);
  padding: var(--space-2) var(--space-4) var(--space-3);
}
.page-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.section-heading { flex-wrap: wrap; }
.page-heading p {
  margin-bottom: 0;
}
.metrics,
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}
.metric {
  display: block;
  font: 600 32px var(--font-title);
  margin-bottom: var(--space-2);
}
.metrics .ui-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.metrics .ui-card h2 {
  overflow-wrap: anywhere;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-field) var(--space-3);
}
.ui-field:has(textarea) {
  grid-column: 1/-1;
}
.company-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--space-3);
}
.company-overview {
  padding: var(--space-3) var(--space-micro);
}
.company-monogram {
  width: 95px;
  height: 95px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 20% 0, #cefab8, #78b790 65%, #3a8277);
  color: #1a5444;
  border-radius: 22px;
  box-shadow:
    inset 0 2px #edffd5cc,
    0 15px 30px #052c2b33;
  transform: rotate(-7deg);
}
.company-monogram .mark {
  width: 48px;
  height: 48px;
  color: inherit;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--space-3);
}
.editor-summary {
  align-self: start;
  position: sticky;
  top: 0;
}
.invoice-line {
  border: 1px solid var(--line);
  padding: var(--space-2);
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: #082d251a;
}
.invoice-line legend {
  padding: 0 var(--space-1);
  color: var(--muted);
  font-size: 10px;
}
.line-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1.3fr 1fr;
  gap: var(--space-2);
  margin-bottom: 0;
}
.line-fields > .ui-field:first-child,
.line-fields > .ui-field:last-child {
  grid-column: 1/-1;
}
.editor-actions {
  margin-top: 0;
}
.list-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px);
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}
.result-count {
  font-size: 10px;
  color: var(--muted);
  margin: var(--space-2) 0;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
th {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: #0b30273d;
}
td {
  font-size: 12px;
}
th,
td {
  padding: var(--space-2) var(--space-2);
  border-bottom: 1px solid #dce9ca20;
  vertical-align: middle;
}
td strong {
  font-weight: 600;
}
tbody tr {
  transition: background var(--duration-fast);
}
tbody tr:hover {
  background: #d4f2b80c;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 10px;
}
.pagination > div {
  display: flex;
  gap: var(--space-1);
}
.empty {
  text-align: center;
  padding: var(--space-4) var(--space-2);
}
.totals {
  font-variant-numeric: tabular-nums;
}
.totals > div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-2) 0;
}
.totals dd {
  margin: 0;
  font-weight: 650;
}
.grand-total {
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
  font-size: 16px;
}
.invoice-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--module-hero-height);
  position: relative;
  margin-bottom: 18px;
  padding: 10px 18px;
}
.hero-copy {
  max-width: 55%;
}
.hero-copy h1 {
  font-size: 36px;
  font-weight: 550;
}
.hero-copy > p {
  color: var(--muted);
  max-width: 410px;
}
.login-layout {
  min-height: calc(100dvh - 155px);
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 80px;
  align-items: center;
  max-width: 950px;
  margin: auto;
}
.login-intro h1 {
  font-size: 46px;
}
.login-intro > p {
  font-size: 13px;
}
.login-orb {
  width: 192px;
  height: 165px;
  display: grid;
  place-items: center;
  border-radius: 45% 45% 45% 45% / 50% 50% 50% 50%;
  border: 1px solid #e4f4c87a;
  background: radial-gradient(
    circle at 28% 20%,
    #e5ffd3a1,
    #a4e6a36e 23%,
    #49978688 60%,
    #123f48b3
  );
  box-shadow:
    inset 0 5px 9px #eeffdc88,
    inset -12px -12px 26px #06383a66,
    0 24px 35px #092c3340;
  margin-bottom: 28px;
  transform: rotate(-14deg);
}
.login-orb svg {
  width: 60px;
  height: 60px;
}
.login-submit {
  width: 100%;
  margin-top: 0;
}
.login > .small {
  margin: var(--space-2) 0 0;
}
.parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
.address {
  white-space: pre-line;
}
.invoice {
  position: relative;
  background: #f5f6e8;
  color: #203b32;
  border-radius: 3px;
  padding: var(--space-4);
  isolation: isolate;
}
.invoice:before {
  content: attr(data-watermark);
  position: absolute;
  z-index: -1;
  top: 45%;
  left: 12%;
  font: 700 70px var(--font-title);
  color: #203b320a;
  transform: rotate(-25deg);
}
.invoice .muted,
.invoice .footnote,
.invoice .eyebrow,
.invoice th {
  color: #486155;
}
.invoice th {
  background: #dee7d7;
}
.invoice td {
  border-color: #c9d7c8;
}
.invoice .totals {
  max-width: 370px;
  margin-left: auto;
}
.scroll-area {
  position: relative;
}
.scroll-viewport {
  scrollbar-width: thin;
  scrollbar-color: #a7c697 transparent;
}
.scroll-enhanced > .scroll-viewport {
  scrollbar-width: none;
}
.scroll-enhanced > .scroll-viewport::-webkit-scrollbar {
  display: none;
}
.scroll-track {
  position: absolute;
  right: 1px;
  top: 3px;
  bottom: 3px;
  width: 12px;
  cursor: pointer;
  z-index: 3;
  border-radius: 5px;
}
.scroll-thumb {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 0;
  min-height: 32px;
  background: #a5c68c;
  border-radius: 3px;
}
.scroll-track:is(:hover, :focus-visible, .dragging) {
  background: #dcebb416;
}
.scroll-track:is(:hover, :focus-visible, .dragging) .scroll-thumb {
  left: 3px;
  right: 3px;
  background: #d1e3b1;
}
.scroll-track:focus-visible {
  outline: 0;
  background-color: var(--focus-control);
}
.table-area.scroll-enhanced {
  padding-bottom: var(--space-2);
}
.scroll-horizontal {
  left: 3px;
  right: 18px;
  top: auto;
  bottom: 1px;
  width: auto;
  height: 12px;
}
.scroll-horizontal .scroll-thumb {
  left: 0;
  right: auto;
  top: 4px;
  bottom: 4px;
  height: auto;
  min-height: 0;
  min-width: 32px;
}
.scroll-horizontal:is(:hover, :focus-visible, .dragging) .scroll-thumb {
  left: 0;
  right: auto;
  top: 3px;
  bottom: 3px;
}
@media (max-width: 1000px) {
  .company-layout {
    grid-template-columns: 1fr;
  }
  .company-overview {
    display: none;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .editor-summary {
    position: static;
  }
  .login-layout {
    gap: var(--space-4);
    grid-template-columns: 1fr 330px;
  }
  .login-intro h1 {
    font-size: 36px;
  }
  .object-scene {
    margin-right: 0 !important;
    transform: scale(0.8);
    transform-origin: right center;
  }
  .hero-copy h1 {
    font-size: 36px;
  }
}
@media (max-width: 700px) {
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 30;
    width: max-content;
    max-width: calc(100vw - 24px);
    min-width: 0;
    background: #143d35;
    transform: translateX(-100%);
    transition: transform var(--duration-exit);
  }
  .workspace.navigation-open .sidebar,
  .sidebar.is-open {
    transform: none;
  }
  .menu-toggle {
    display: inline-flex !important;
  }
  .topbar {
    padding: var(--space-1) var(--space-2);
  }
  main {
    padding: var(--space-3) var(--space-2) var(--space-2);
  }
  .workspace-footer {
    padding-left: var(--space-2);
  }
  .fields,
  .metrics,
  .module-grid,
  .list-tools,
  .parties {
    grid-template-columns: 1fr;
  }
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .login-layout {
    display: block;
    max-width: 400px;
  }
  .login-intro {
    padding: var(--space-1) 0 var(--space-3);
  }
  .login-intro h1 {
    font-size: 36px;
  }
  .login-orb {
    display: none;
  }
  .invoice-hero {
    min-height: 325px;
    align-items: flex-start;
    padding-bottom: 140px;
  }
  .hero-copy {
    max-width: 100%;
  }
  .invoice-hero .object-scene {
    position: absolute;
    right: calc(50% - 170px);
    bottom: -45px;
    transform: scale(0.5);
    transform-origin: center;
  }
  .line-fields {
    grid-template-columns: 1fr 1fr;
  }
  .ui-input {
    font-size: 16px;
  }
  .pagination {
    flex-wrap: wrap;
  }
  .invoice {
    padding: var(--space-2);
  }
  .topbar-title > span {
    display: none;
  }
}
@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: white;
    color: #203b32;
  }
  .workspace,
  .is-debug > .workspace {
    display: block;
    height: auto;
    background: white;
    overflow: visible;
  }
  .workspace:before,
  .workspace:after,
  .sidebar,
  .topbar,
  .workspace-footer,
  .no-print,
  .scroll-track {
    display: none;
  }
  .page-scroll,
  .scroll-viewport {
    overflow: visible !important;
    height: auto !important;
  }
  main {
    padding: 0;
  }
  .invoice {
    padding: var(--space-1);
    box-shadow: none;
  }
  .ui-card {
    break-inside: avoid;
  }
}
.sidebar .ui-button--navigation .ui-button__content > span {
  white-space: nowrap;
  min-width: max-content;
}
.sidebar .ui-button--navigation .ui-button__content {
  gap: var(--space-1);
}
.sidebar .ui-button--navigation small {
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-collapsed .sidebar {
  width: 80px;
  min-width: 0;
  flex-basis: auto;
  --nav-padding-start: var(--space-1);
  --nav-padding-end: var(--space-1);
}
.sidebar-collapsed
  .sidebar
  .ui-button--navigation
  .ui-button__content
  > span:not(.module-icon),
.sidebar-collapsed .sidebar .ui-button--navigation small {
  display: none;
}
.sidebar-collapsed .sidebar .brand .ui-button__content {
  font-size: 0;
  gap: 0;
  line-height: 1;
  justify-content: center;
}
.sidebar-collapsed .sidebar .brand {
  justify-content: center;
  width: 100%;
  padding: var(--space-micro);
  min-height: 44px;
}
.sidebar-collapsed .sidebar .brand-name {
  display: none;
}
.sidebar-collapsed .sidebar .ui-button--navigation {
  padding: var(--space-1);
  justify-content: center;
}
.sidebar-collapsed .sidebar .ui-button--navigation .ui-button__content {
  justify-content: center;
}
.sidebar-collapsed .sidebar nav {
  gap: var(--space-micro);
  width: 100%;
  padding: 0;
}
.navigation-scroll > .scroll-viewport {
  height: 100%;
  overflow: auto;
  scrollbar-width: none;
}
.live-status {
  font-size: 11px;
  color: var(--muted);
  padding: var(--space-1) 0;
}
.nav-group-short {
  display: none;
}
.sidebar-collapsed .nav-group {
  display: block;
  margin: var(--space-2) 0 var(--space-micro);
  text-align: center;
  font-size: 9px;
  border-top: 1px solid #d7e6c426;
  padding-top: var(--space-2);
  white-space: nowrap;
}
.sidebar-collapsed .nav-group-full {
  display: none;
}
.sidebar-collapsed .nav-group-short {
  display: inline;
}
.nav-group:focus-visible {
  outline: 0;
  background: #b4d99628;
}
.company-overview h2 {
  font-size: 23px;
}
.login-orb .mark {
  width: 71px;
  height: 71px;
}
.sidebar .brand .mark {
  width: 36px;
  height: 36px;
  padding: 6px;
  background: radial-gradient(circle at 25% 0, #d7ffab, #54b795 55%, #205a57);
  border-radius: 12px;
  color: #143c37;
  box-shadow:
    inset 0 1px 2px #fff9,
    0 4px 10px #0003;
}
.module-heading {
  position: relative;
  min-height: var(--module-hero-height);
  padding: 10px 18px;
  gap: 30px;
}
.heading-copy {
  min-width: 0;
  max-width: 650px;
}
.heading-copy > .eyebrow {
  margin: 0 0 var(--space-2);
}
.heading-copy > .muted {
  margin-top: 0;
  line-height: 1.7;
}
.page-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.page-title h1 {
  margin: 0;
}
.page-title .module-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 10px;
  border-radius: 13px;
  transform: rotate(-7deg);
  transition: transform var(--duration-enter) var(--ease);
}
.module-heading:hover .page-title .module-icon,
.module-heading:focus-within .page-title .module-icon {
  transform: rotate(-11deg);
}
.heading-actions {
  margin-top: var(--space-2);
}
.heading-actions:empty {
  display: none;
}
.module-heading--compact {
  min-height: 0;
  padding: 0;
  margin-bottom: 24px;
}
.module-heading--compact .heading-copy {
  max-width: none;
}
.module-heading--compact .page-title .module-icon {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  padding: 8px;
}
.module-heading--compact .heading-actions {
  margin-top: 10px;
}
@media (max-width: 700px) {
  .module-heading {
    min-height: 330px;
    padding: 0 0 130px;
    align-items: flex-start;
  }
  .heading-copy {
    max-width: 100%;
  }
  .page-title {
    gap: var(--space-2);
  }
  .page-title h1 {
    font-size: 30px;
  }
  .module-heading--compact {
    min-height: 0;
    padding: 0;
  }
  .module-heading .heading-actions {
    position: relative;
    z-index: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .module-heading:hover .page-title .module-icon,
  .module-heading:focus-within .page-title .module-icon {
    transform: rotate(-7deg);
  }
}
.navigation-scroll > .scroll-viewport::-webkit-scrollbar {
  display: none;
}
.user-account {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0;
}
.account-trigger {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.account-trigger .ui-button__content {
  width: 100%;
  gap: var(--space-1);
}
.account-identity {
  display: grid;
  gap: var(--space-micro);
  min-width: 0;
  flex: 1;
  white-space: normal;
  overflow-wrap: anywhere;
}
.account-identity strong {
  font-size: 12px;
  font-weight: 600;
}
.account-identity small {
  font-size: 10px;
  color: var(--muted);
}
.sidebar-collapsed .account-identity {
  display: none;
}
.sidebar-collapsed .account-trigger {
  padding: var(--space-micro);
  justify-content: center;
}
.user-account-menu {
  width: 230px;
  max-width: calc(100vw - 16px);
  padding: var(--space-1);
}
.user-account-menu .ui-button {
  width: 100%;
  justify-content: flex-start;
}
.user-account-menu form {
  margin: 0;
}
.sidebar-header {
  height: var(--shell-header-height);
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sidebar nav > .nav-group:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: var(--space-2);
}

.sidebar-collapsed .account-trigger .ui-button__content {
  justify-content: center;
}
.turbo-progress-bar {
  background: var(--accent);
  height: 2px;
}
html[aria-busy="true"] .page-scroll {
  cursor: progress;
}

.sidebar-brand-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}
.sidebar .sidebar-close {
  display: none;
}
@media (max-width: 700px) {
  .sidebar .sidebar-close {
    display: flex;
  }
}
.sidebar-header > .ui-divider {
  margin: 0;
}

/* Structured groups have one owner for vertical spacing. */
.editor-grid > div,
.company-layout > div,
#invoice-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
  min-width: 0;
}
.invoice-line > .ui-button { align-self: flex-start; }
.invoice-line > .fields, .invoice-line > .line-fields { margin: 0; }
