@charset "UTF-8";
/* Base layer: element defaults and the shared primitives every page uses.
   Colours come from tokens.css only. Loads after tokens.css, before pages.css. */

* {
  box-sizing:border-box;
}
body {
  margin:0;
  font-family:Inter,'Segoe UI',Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
  font-size:var(--text-base);
  line-height:1.5;
}
a {
  color:var(--teal);
  text-decoration:none;
}
a:hover {
  text-decoration:none;
  color:var(--link-hover);
}
button,input,select,textarea {
  font:inherit;
}
button,a,input,select,textarea {
  touch-action:manipulation;
}
button {
  cursor:pointer;
}
button:disabled {
  opacity:.55;
  cursor:wait;
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline:3px solid var(--focus);
  outline-offset:3px;
}
h1,h2,h3,p {
  margin-top:0;
}
h1 {
  font-size:var(--text-2xl);
  letter-spacing:-.8px;
  line-height:1.25;
  margin-bottom:9px;
  font-weight:650;
}
h2 {
  font-size:var(--text-xl);
  letter-spacing:-.3px;
  font-weight:650;
  margin-bottom:6px;
}
h3 {
  font-size:var(--text-lg);
  font-weight:650;
  margin-bottom:10px;
}
p {
  margin-bottom:16px;
}
.muted {
  color:var(--muted);
}
.tiny {
  font-size:var(--text-xs);
  letter-spacing:.7px;
}
.eyebrow {
  display:block;
  font-size:var(--text-xs);
  font-weight:700;
  letter-spacing:1.8px;
  color:var(--teal);
  margin-bottom:10px;
}
.light {
  color:var(--accent);
}
.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-link {
  position:fixed;
  left:15px;
  top:-60px;
  z-index:100;
  background:var(--surface);
  padding:12px;
}
.skip-link:focus {
  top:10px;
}
.brand {
  height:88px;
  display:flex;
  align-items:center;
  padding:0 16px 9px;
}
.brand img {
  width:184px;
  max-height:89px;
  object-fit:contain;
}
nav {
  display:flex;
  flex-direction:column;
  gap:4px;
}
nav a {
  display:flex;
  align-items:center;
  gap:12px;
  color:var(--ink);
  font-size:var(--text-md);
  border-radius:var(--radius-sm);
  padding:10px 14px;
  position:relative;
  min-height:42px;
}
svg.icon {
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.6;
  stroke-linecap:round;
  stroke-linejoin:round;
  display:block;
  flex:none;
}
.profile {
  display:flex;
  align-items:center;
  gap:10px;
  border-top:1px solid var(--line);
  padding:17px 9px 3px;
}
.avatar {
  background:var(--surface-raised);
  color:var(--ink);
  width:34px;
  height:34px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-weight:600;
  flex:none;
}
.profile>div {
  flex:1;
  min-width:0;
}
.profile strong {
  display:block;
  color:var(--ink);
  font-size:var(--text-sm);
  overflow:hidden;
  text-overflow:ellipsis;
}
.profile div>span {
  display:block;
  font-size:var(--text-xs);
  color:var(--muted);
}
.icon-button {
  border:0;
  color:inherit;
  background:transparent;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px;
  border-radius:var(--radius-sm);
  min-width:32px;
  min-height:32px;
}
.icon-button:hover {
  background:color-mix(in srgb, var(--muted) 12%, transparent);
}
.app-area {
  margin-left:240px;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
.topbar {
  height:73px;
  background:white;
  border-bottom:1px solid var(--line);
  padding:0 35px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}
.breadcrumb {
  display:flex;
  align-items:center;
  gap:13px;
  font-size:var(--text-xs);
  white-space:nowrap;
}
.breadcrumb strong {
  font-weight:550;
}
.crumb-separator {
  color:var(--muted);
}
.topbar-right {
  display:flex;
  align-items:center;
  gap:20px;
}
#global-search {
  display:flex;
  align-items:center;
  gap:9px;
  color:var(--muted);
}
#global-search input {
  border:0;
  background:transparent;
  padding:7px 0;
  font-size:var(--text-xs);
  width:215px;
  min-height:30px;
}
kbd {
  font-family:inherit;
  padding:0 5px;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  font-size:var(--text-xs);
  color:var(--muted);
}
.environment {
  border:1px solid var(--line);
  background:var(--surface-subtle);
  color:var(--muted);
  font-size:var(--text-xs);
  font-weight:650;
  letter-spacing:.9px;
  border-radius:var(--radius-sm);
  padding:5px 8px;
}
.help-link {
  border:1px solid var(--line);
  border-radius:50%;
  width:22px;
  height:22px;
  display:grid;
  place-items:center;
  color:var(--muted);
  font-size:var(--text-sm);
}
main {
  padding:34px 36px 30px;
  flex:1;
  max-width:1800px;
  width:100%;
  margin:0 auto;
  outline:none;
}
.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  margin-bottom:25px;
}
.page-heading p {
  font-size:var(--text-sm);
  color:var(--muted);
  margin:0;
}
.page-actions {
  display:flex;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
}
.btn {
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:9px 15px;
  border-radius:var(--radius-sm);
  background:white;
  color:var(--ink);
  border:1px solid var(--line);
  font-size:var(--text-xs);
  font-weight:600;
  white-space:nowrap;
}
.btn svg.icon {
  width:15px;
  height:15px;
}
.btn:hover {
  background:var(--surface-raised);
  color:var(--ink);
  border-color:var(--muted);
}
.btn.primary {
  background:var(--teal);
  color:white;
  border-color:var(--teal);
  box-shadow:none;
}
.btn.primary:hover {
  background:var(--primary-hover);
}
.btn.danger {
  color:var(--danger);
  border-color:color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn.small {
  font-size:var(--text-xs);
  padding:5px 10px;
  min-height:29px;
}
.btn.ghost {
  border-color:transparent;
  background:transparent;
}
.btn.full {
  width:100%;
}
.btn.soft {
  background:var(--teal-light);
  border-color:var(--line);
  color:var(--teal);
}
.card {
  background:white;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card.pad {
  padding:22px;
}
.card-head {
  padding:21px 23px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
}
.card-head h2 {
  font-size:var(--text-base);
  margin-bottom:4px;
}
.card-head p {
  margin:0;
  color:var(--muted);
  font-size:var(--text-xs);
}
.card-head a {
  font-size:var(--text-xs);
  font-weight:600;
}
.stats {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:17px;
  margin-bottom:23px;
}
.stat {
  padding:21px 20px 18px;
  position:relative;
}
.stat-top {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:16px;
}
.stat-top span {
  font-size:var(--text-xs);
  color:var(--muted);
}
.stat-number {
  font-size:var(--text-2xl);
  letter-spacing:-.7px;
  font-weight:650;
  line-height:1.2;
  white-space:nowrap;
}
.stat-number small {
  font-size:var(--text-sm);
  font-weight:450;
  color:var(--muted);
  letter-spacing:0;
  margin-left:4px;
}
.stat-bottom {
  font-size:var(--text-xs);
  color:var(--muted);
  margin-top:9px;
}
.stat-bottom .good {
  color:var(--success-text);
}
.chart-card {
  height:286px;
}
.chart-legend {
  display:flex;
  gap:15px;
  font-size:var(--text-xs);
  color:var(--muted);
}
.chart-legend span {
  display:flex;
  gap:5px;
  align-items:center;
}
.dot {
  display:inline-block;
  width:6px;
  height:6px;
  border-radius:2px;
  background:var(--chart-issued);
}
.dot.teal {
  background:var(--chart-received);
}
.chart {
  height:182px;
  padding:13px 25px 0 46px;
  position:relative;
}
.chart-grid {
  position:absolute;
  left:46px;
  right:25px;
  top:14px;
  bottom:24px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  pointer-events:none;
}
.chart-grid i {
  border-top:1px dashed var(--chart-grid);
  width:100%;
}
.chart-bars {
  height:100%;
  display:flex;
  justify-content:space-between;
  gap:8px;
  position:relative;
}
.chart-month {
  flex:1;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  min-width:0;
}
.bar-pair {
  height:calc(100% - 24px);
  width:100%;
  display:flex;
  justify-content:center;
  align-items:flex-end;
  gap:3px;
}
.bar-pair i {
  width:11px;
  max-width:40%;
  background:var(--chart-issued);
  border-radius:3px 3px 0 0;
  min-height:1px;
}
.bar-pair i:last-child {
  background:var(--chart-received);
}
.chart-month>span {
  font-size:var(--text-xs);
  color:var(--muted);
  height:24px;
  padding-top:8px;
}
.chart-empty {
  position:absolute;
  inset:58px 15px auto;
  text-align:center;
  font-size:var(--text-xs);
  color:var(--muted);
}
.attention-list {
  padding:0 21px 12px;
}
.attention-item {
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 0;
  border-bottom:1px solid var(--line);
}
.attention-item:last-child {
  border-bottom:0;
}
.attention-item strong {
  display:block;
  font-size:var(--text-xs);
  font-weight:600;
}
.attention-item p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin:3px 0 0;
}
.attention-item>a {
  margin-left:auto;
  color:var(--muted);
}
.ai-banner {
  grid-column:1/-1;
  display:flex;
  align-items:center;
  gap:21px;
  background:linear-gradient(115deg,var(--navy),var(--navy2));
  color:white;
  border-radius:var(--radius-sm);
  padding:22px 27px;
  position:relative;
  overflow:hidden;
}
.ai-banner img {
  width:52px;
  height:52px;
  object-fit:contain;
}
.ai-banner h2 {
  font-size:var(--text-lg);
  letter-spacing:-.3px;
  margin-bottom:5px;
}
.ai-banner p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin:0;
}
.ai-banner .btn {
  margin-left:auto;
  background:transparent;
  border-color:var(--line);
  color:var(--ink);
}
.ai-banner .ai-tag {
  font-size:var(--text-xs);
  font-weight:500;
  background:var(--accent-soft);
  color:var(--accent-text);
  letter-spacing:.8px;
  padding:2px 5px;
  border-radius:3px;
  margin-left:8px;
  vertical-align:middle;
}
.full-grid {
  grid-column:1/-1;
}
.table-wrap {
  overflow:auto;
}
table {
  width:100%;
  border-collapse:collapse;
  text-align:left;
  font-size:var(--text-xs);
}
th {
  background:var(--surface-subtle);
  color:var(--muted);
  font-weight:500;
  font-size:var(--text-xs);
  letter-spacing:.4px;
  padding:12px 21px;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}
td {
  padding:16px 21px;
  border-bottom:1px solid var(--line);
  color:var(--ink);
  vertical-align:middle;
}
tr:last-child td {
  border-bottom:0;
}
td strong {
  font-weight:600;
  color:var(--ink);
}
tbody tr:hover {
  background:var(--surface-subtle);
}
.table-primary {
  display:flex;
  align-items:center;
  gap:10px;
}
.file-icon {
  width:29px;
  height:33px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  color:var(--muted);
}
.file-icon svg.icon {
  width:15px;
  height:15px;
}
.table-sub {
  display:block;
  font-size:var(--text-xs);
  color:var(--muted);
  margin-top:3px;
}
.num {
  text-align:right;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
.nowrap {
  white-space:nowrap;
}
.badge {
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:3px 8px;
  border-radius:var(--radius-sm);
  font-size:var(--text-xs);
  font-weight:550;
  white-space:nowrap;
  background:var(--state-draft-bg);
  color:var(--state-draft-text);
}
.badge:before {
  content:'';
  width:4px;
  height:4px;
  background:currentColor;
  border-radius:50%;
}
.badge.green {
  background:var(--state-paid-bg);
  color:var(--state-paid-text);
}
.badge.red {
  background:var(--state-overdue-bg);
  color:var(--state-overdue-text);
}
.badge.amber {
  background:var(--state-open-bg);
  color:var(--state-open-text);
}
.badge.blue {
  background:var(--state-unsent-bg);
  color:var(--state-unsent-text);
}
.badge.teal {
  background:var(--state-advance-bg);
  color:var(--state-advance-text);
}
.table-footer {
  padding:14px 21px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-top:1px solid var(--line);
  font-size:var(--text-xs);
  color:var(--muted);
}
.filters {
  display:flex;
  gap:12px;
  align-items:center;
  padding:15px 21px;
  border-bottom:1px solid var(--line);
  flex-wrap:wrap;
}
.filters input {
  max-width:270px;
  flex:1;
}
.filters select {
  width:auto;
  max-width:190px;
}
.tabs {
  display:flex;
  gap:25px;
  margin-bottom:22px;
  border-bottom:1px solid var(--line);
}
.tabs a {
  padding:8px 0 12px;
  color:var(--muted);
  font-size:var(--text-sm);
}
.tabs a.active {
  border-bottom:2px solid var(--teal);
  color:var(--teal);
  font-weight:600;
}
.empty {
  padding:50px 25px;
  text-align:center;
  color:var(--muted);
}
.empty .empty-icon {
  width:57px;
  height:57px;
  border-radius:var(--radius-md);
  display:grid;
  place-items:center;
  background:var(--info-bg);
  color:var(--info-text);
  margin:0 auto 16px;
}
.empty h3 {
  color:var(--ink);
  font-size:var(--text-lg);
  margin-bottom:7px;
}
.empty p {
  font-size:var(--text-sm);
  max-width:390px;
  margin:0 auto 17px;
}
.empty.compact {
  padding:28px 15px;
}
.loading {
  min-height:200px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  color:var(--muted);
}
.spinner {
  width:19px;
  height:19px;
  border:2px solid var(--line);
  border-top-color:var(--teal);
  border-radius:50%;
  animation:spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform:rotate(360deg);
  }
}
.alert {
  border:1px solid var(--line);
  background:var(--info-bg);
  border-radius:var(--radius-sm);
  padding:12px 15px;
  font-size:var(--text-sm);
  margin-bottom:20px;
  color:var(--info-text);
}
.alert.warning {
  background:var(--warning-bg);
  border-color:var(--line);
  color:var(--warning-text);
}
.alert.error {
  background:var(--error-bg);
  border-color:var(--line);
  color:var(--error-text);
}
.alert.success {
  background:var(--success-bg);
  border-color:var(--line);
  color:var(--success-text);
}
.alert p:last-child {
  margin-bottom:0;
}
.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}
.form-grid.three {
  grid-template-columns:repeat(3,1fr);
}
.form-group {
  min-width:0;
}
.form-group.full {
  grid-column:1/-1;
}
label {
  display:block;
  font-size:var(--text-xs);
  font-weight:600;
  color:var(--ink);
  margin-bottom:6px;
}
input,select,textarea {
  width:100%;
  padding:10px 11px;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  background:white;
  color:var(--ink);
  min-height:39px;
  font-size:var(--text-sm);
}
input::placeholder,textarea::placeholder {
  color:var(--muted);
}
textarea {
  resize:vertical;
  min-height:85px;
}
.field-help {
  font-size:var(--text-xs);
  color:var(--muted);
  margin-top:5px;
}
input[type=checkbox] {
  width:16px;
  min-height:16px;
  margin-right:6px;
  vertical-align:middle;
}
.checkbox-label {
  display:flex;
  align-items:center;
  gap:6px;
}
.form-section {
  margin-bottom:22px;
}
.form-section h3 {
  font-size:var(--text-sm);
  border-bottom:1px solid var(--line);
  padding-bottom:11px;
  margin:0 0 17px;
}
.form-step {
  font-size:var(--text-xs);
  display:inline-grid;
  place-items:center;
  width:20px;
  height:20px;
  background:var(--teal-light);
  color:var(--teal);
  border-radius:50%;
  margin-right:7px;
}
.form-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  border-top:1px solid var(--line);
  padding-top:18px;
  margin-top:24px;
}
.editor-grid {
  display:grid;
  grid-template-columns:minmax(0,1fr) 265px;
  gap:22px;
  align-items:start;
}
.line-editor {
  min-width:680px;
}
.line-editor th {
  padding:8px 6px;
}
.line-editor td {
  padding:8px 5px;
}
.line-editor th:first-child {
  width:34%;
}
.line-editor input,.line-editor select {
  font-size:var(--text-xs);
  padding:8px 7px;
  min-width:60px;
}
.line-editor input[name=description] {
  min-width:160px;
}
.summary-note {
  padding:17px;
  background:var(--surface-subtle);
  border-radius:var(--radius-sm);
  font-size:var(--text-xs);
  color:var(--muted);
}
.summary-list>div {
  display:flex;
  justify-content:space-between;
  font-size:var(--text-sm);
  padding:8px 0;
}
.summary-list .total {
  margin-top:8px;
  padding:15px 0 5px;
  border-top:1px solid var(--line);
  font-size:var(--text-xl);
  font-weight:650;
}
.detail-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 300px;
  gap:23px;
  align-items:start;
}
.document-preview {
  padding:30px;
}
.document-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  padding-bottom:25px;
  border-bottom:1px solid var(--line);
}
.document-brand {
  background:var(--navy);
  padding:7px 12px;
  border-radius:var(--radius-sm);
  width:158px;
}
.document-brand img {
  width:100%;
  display:block;
}
.document-title {
  text-align:right;
}
.document-title h2 {
  font-size:var(--text-xl);
  margin-bottom:6px;
}
.parties {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:25px;
  padding:25px 0;
}
.parties h3 {
  font-size:var(--text-xs);
  letter-spacing:1px;
  text-transform:uppercase;
  color:var(--muted);
}
.parties strong {
  display:block;
  font-size:var(--text-base);
  margin-bottom:7px;
}
.parties p {
  white-space:pre-line;
  font-size:var(--text-xs);
  color:var(--muted);
  margin-bottom:7px;
  overflow-wrap:anywhere;
}
.dates-row {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:15px;
  padding:16px;
  background:var(--surface-subtle);
  border-radius:var(--radius-sm);
  margin-bottom:25px;
}
.dates-row span {
  font-size:var(--text-xs);
  color:var(--muted);
  display:block;
  margin-bottom:4px;
}
.dates-row strong {
  font-size:var(--text-xs);
}
.document-preview table th,.document-preview table td {
  padding:12px 8px;
}
.document-preview table td:first-child {
  max-width:270px;
  overflow-wrap:anywhere;
}
.document-totals {
  width:55%;
  margin:20px 0 0 auto;
}
.document-totals>div {
  display:flex;
  justify-content:space-between;
  padding:7px;
  font-size:var(--text-sm);
}
.document-totals .total {
  font-size:var(--text-xl);
  font-weight:650;
  color:var(--teal);
  border-top:1px solid var(--line);
  margin-top:8px;
  padding-top:13px;
}
.preline {
  white-space:pre-line;
  overflow-wrap:anywhere;
}
.side-stack {
  display:flex;
  flex-direction:column;
  gap:18px;
}
.status-list>div {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:9px 0;
  font-size:var(--text-xs);
  border-bottom:1px solid var(--line);
}
.timeline {
  padding-left:5px;
}
.timeline-item {
  padding:0 0 20px 19px;
  border-left:1px solid var(--line);
  position:relative;
  font-size:var(--text-xs);
}
.timeline-item:before {
  content:'';
  position:absolute;
  left:-4px;
  top:3px;
  width:7px;
  height:7px;
  background:var(--chart-received);
  border-radius:50%;
  box-shadow:0 0 0 4px white;
}
.timeline-item strong {
  font-size:var(--text-xs);
  font-weight:600;
  display:block;
}
.timeline-item span {
  font-size:var(--text-xs);
  color:var(--muted);
}
.timeline-item:last-child {
  padding-bottom:0;
}
.detail-meta {
  font-size:var(--text-xs);
  color:var(--muted);
  overflow-wrap:anywhere;
  margin-top:20px;
}
.cards-grid {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:19px;
}
.customer-card {
  padding:22px;
}
.customer-card h3 {
  margin:12px 0 5px;
}
.customer-card p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin-bottom:18px;
}
.customer-card footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-top:1px solid var(--line);
  padding-top:13px;
  font-size:var(--text-xs);
}
.company-avatar {
  display:grid;
  place-items:center;
  width:40px;
  height:40px;
  border-radius:var(--radius-pill);
  background:var(--teal-light);
  color:var(--teal);
  font-size:var(--text-lg);
  font-weight:600;
}
.settings-grid {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:22px;
}
.settings-grid .card {
  align-self:start;
}
.switch-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:13px 0;
  border-bottom:1px solid var(--line);
  gap:18px;
}
.switch-row strong {
  display:block;
  font-size:var(--text-sm);
}
.switch-row p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin:4px 0 0;
}
.connection-icon {
  width:42px;
  height:42px;
  background:var(--info-bg);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  display:grid;
  place-items:center;
  color:var(--info-text);
  margin-bottom:20px;
}
.connection-card {
  padding:23px;
}
.connection-card h3 {
  font-size:var(--text-base);
}
.connection-card p {
  font-size:var(--text-xs);
  color:var(--muted);
  min-height:48px;
}
.connection-card .badge {
  margin-top:4px;
}
.connection-url {
  display:flex;
  gap:9px;
  align-items:center;
  background:var(--surface-subtle);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:10px 13px;
  font-size:var(--text-xs);
  overflow-wrap:anywhere;
}
.connection-url code {
  flex:1;
  min-width:0;
  overflow-wrap:anywhere;
  font-size:var(--text-xs);
}
.code-block {
  background:var(--surface-raised);
  color:var(--ink);
  border-radius:var(--radius-sm);
  padding:18px;
  font-size:var(--text-xs);
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  max-height:320px;
  overflow:auto;
}
.steps {
  counter-reset:steps;
}
.steps>div {
  position:relative;
  padding:0 0 22px 37px;
  font-size:var(--text-sm);
}
.steps>div:before {
  counter-increment:steps;
  content:counter(steps);
  position:absolute;
  left:0;
  top:0;
  width:23px;
  height:23px;
  background:var(--teal-light);
  color:var(--teal);
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:var(--text-xs);
}
.steps strong {
  display:block;
  margin-bottom:5px;
}
.steps p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin:0;
}
.evidence {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.evidence div {
  background:var(--surface-subtle);
  border-radius:var(--radius-sm);
  padding:12px;
  font-size:var(--text-xs);
}
.evidence span {
  display:block;
  font-size:var(--text-xs);
  color:var(--muted);
  margin-bottom:3px;
}
.app-footer {
  display:flex;
  justify-content:space-between;
  padding:18px 37px 20px;
  font-size:var(--text-xs);
  color:var(--muted);
}
.app-footer>span:first-child {
  color:var(--muted);
  font-weight:600;
}
dialog {
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  box-shadow:0 25px 100px var(--shadow-overlay-color);
  max-width:780px;
  width:calc(100% - 32px);
  padding:0;
  max-height:90vh;
  color:var(--ink);
}
dialog::backdrop {
  background:var(--overlay);
  backdrop-filter:blur(3px);
}
.modal-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:21px 25px;
  border-bottom:1px solid var(--line);
  position:sticky;
  top:0;
  background:white;
  z-index:2;
}
.modal-heading h2 {
  font-size:var(--text-xl);
  margin:0;
}
.modal-heading button {
  font-size:25px;
  color:var(--muted);
}
.modal-heading+div {
  padding:24px;
  overflow:auto;
}
#toasts {
  position:fixed;
  bottom:25px;
  right:25px;
  z-index:100;
  max-width:430px;
}
.toast {
  background:var(--surface-raised);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:14px 19px;
  box-shadow:0 8px 30px var(--shadow-raised-color);
  font-size:var(--text-sm);
  margin-top:10px;
}
.toast.error {
  background:var(--error-bg);
  border-color:var(--error-text);
  color:var(--error-text);
}
details {
  border-top:1px solid var(--line);
  padding-top:15px;
  margin-top:15px;
  font-size:var(--text-sm);
}
summary {
  cursor:pointer;
  color:var(--teal);
  font-weight:600;
}
.link-button {
  padding:0;
  border:0;
  background:none;
  color:var(--teal);
  font-size:inherit;
}
.login-body {
  background:white;
}
.login-layout {
  display:grid;
  grid-template-columns:1.06fr 1fr;
  min-height:100vh;
  max-width:none;
  padding:0;
}
.login-story {
  background:radial-gradient(ellipse at 110% 70%,var(--navy2),var(--navy) 45%,var(--navy) 90%);
  color:white;
  padding:42px 9%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  min-height:100vh;
}
.login-brand img {
  width:215px;
}
.login-story h1 {
  font-size:43px;
  letter-spacing:-1.4px;
  line-height:1.3;
  margin-top:18px;
  margin-bottom:23px;
}
.login-story p {
  font-size:var(--text-base);
  color:var(--muted);
  line-height:1.9;
}
.login-story>small {
  font-size:var(--text-xs);
  color:var(--muted);
}
.login-points {
  display:flex;
  gap:22px;
  color:var(--muted);
  font-size:var(--text-xs);
  margin-top:33px;
}
.login-form-wrap {
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  padding:40px;
}
.login-card {
  max-width:420px;
  width:100%;
}
.login-icon {
  width:57px;
  height:57px;
  object-fit:contain;
  margin-bottom:27px;
}
.login-card h2 {
  font-size:var(--text-2xl);
  letter-spacing:-.6px;
  margin-bottom:10px;
}
.login-card>.muted {
  font-size:var(--text-md);
  margin-bottom:31px;
}
.login-card label {
  font-size:var(--text-xs);
  font-weight:550;
  margin-top:19px;
}
.login-card input {
  min-height:43px;
  font-size:var(--text-sm);
}
.login-card .btn {
  margin-top:25px;
  min-height:44px;
  font-size:var(--text-sm);
  justify-content:space-between;
}
.login-help {
  margin-top:23px;
  font-size:var(--text-xs);
  line-height:1.8;
  color:var(--muted);
}
.secure-caption {
  font-size:var(--text-xs);
  color:var(--muted);
  margin-top:50px;
}
.mini-list {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.mini-list>div {
  padding:12px;
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
}
.mini-list strong {
  display:block;
  font-size:var(--text-sm);
}
.mini-list p {
  font-size:var(--text-xs);
  color:var(--muted);
  margin:4px 0 0;
}
.bottom-space {
  margin-bottom:22px;
}
.right {
  text-align:right;
}
.wrap {
  flex-wrap:wrap;
}
.width-full {
  width:100%;
}
@media(min-width:1500px) {
  main {
    padding-top:40px;
  }
  .app-area {
    margin-left:255px;
  }
  .stats {
    gap:22px;
  }
  .stat {
    padding:24px;
  }
  .stat-number {
    font-size:var(--text-2xl);
  }
}
@media(max-width:1180px) {
  .topbar {
    padding:0 24px;
  }
  main {
    padding:27px 25px;
  }
  .topbar-right {
    gap:13px;
  }
  #global-search input {
    width:175px;
  }
  .stats {
    gap:11px;
  }
  .stat {
    padding:16px 15px;
  }
  .stat-number {
    font-size:var(--text-xl);
  }
  .cards-grid {
    grid-template-columns:repeat(2,1fr);
  }
  .detail-layout {
    grid-template-columns:minmax(0,1fr) 250px;
  }
  .document-preview {
    padding:23px;
  }
  .editor-grid {
    grid-template-columns:1fr;
  }
  .editor-grid>.side-stack {
    display:none;
  }
  td,th {
    padding-left:15px;
    padding-right:15px;
  }
  .app-area {
    margin-left:218px;
  }
  .brand {
    padding-left:9px;
  }
  .brand img {
    width:173px;
  }
  .topbar-right .help-link {
    display:none;
  }
}
@media(max-width:940px) {
  .app-area {
    margin-left:0;
  }
  .topbar {
    height:63px;
  }
  .breadcrumb>.muted,.crumb-separator {
    display:none;
  }
  .detail-layout {
    grid-template-columns:1fr;
  }
  .side-stack {
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .login-story {
    padding:40px 8%;
  }
  .login-story h1 {
    font-size:var(--text-2xl);
  }
  .login-points {
    flex-direction:column;
    gap:10px;
  }
  .login-form-wrap {
    padding:35px;
  }
}
@media(max-width:640px) {
  body {
    font-size:var(--text-md);
  }
  main {
    padding:24px 16px;
  }
  .topbar {
    padding:0 15px;
    gap:10px;
  }
  .topbar-right {
    gap:9px;
  }
  #global-search {
    display:none;
  }
  .environment {
    font-size:var(--text-xs);
  }
  .breadcrumb {
    gap:5px;
    font-size:var(--text-xs);
  }
  .page-heading {
    align-items:flex-start;
    gap:13px;
    flex-direction:column;
    margin-bottom:20px;
  }
  h1 {
    font-size:var(--text-2xl);
  }
  .page-heading p {
    font-size:var(--text-xs);
  }
  .page-actions {
    width:100%;
  }
  .stats {
    grid-template-columns:1fr 1fr;
    gap:10px;
  }
  .stat-number {
    font-size:var(--text-xl);
  }
  .stat-top span {
    font-size:var(--text-xs);
  }
  .stat-bottom {
    font-size:var(--text-xs);
  }
  .ai-banner {
    padding:20px;
    gap:14px;
    flex-wrap:wrap;
  }
  .ai-banner>div {
    flex:1;
    min-width:180px;
  }
  .ai-banner img {
    width:43px;
    height:43px;
  }
  .ai-banner .btn {
    margin:0 0 0 58px;
  }
  .ai-banner h2 {
    font-size:var(--text-base);
  }
  .ai-banner p {
    font-size:var(--text-xs);
  }
  .ai-tag {
    display:none;
  }
  .chart-card {
    height:270px;
  }
  .cards-grid,.settings-grid,.form-grid,.form-grid.three,.side-stack {
    grid-template-columns:1fr;
  }
  .card-head {
    padding:18px;
  }
  .card.pad {
    padding:19px;
  }
  .filters {
    padding:14px;
    gap:9px;
  }
  .filters input {
    min-width:120px;
  }
  .document-preview {
    padding:18px;
  }
  .document-title h2 {
    font-size:var(--text-lg);
  }
  .document-brand {
    width:122px;
  }
  .parties {
    gap:18px;
  }
  .parties strong {
    font-size:var(--text-sm);
  }
  .document-totals {
    width:90%;
  }
  .dates-row {
    gap:7px;
    padding:12px;
  }
  .document-totals .total {
    font-size:var(--text-lg);
  }
  .app-footer {
    padding:15px 18px;
  }
  .app-footer>span:last-child {
    display:none;
  }
  .login-layout {
    grid-template-columns:1fr;
  }
  .login-story {
    min-height:unset;
    padding:24px 25px 30px;
  }
  .login-brand img {
    width:145px;
  }
  .login-story h1 {
    font-size:var(--text-2xl);
    margin:18px 0 12px;
  }
  .login-story>div>.eyebrow,.login-story p,.login-points,.login-story>small {
    display:none;
  }
  .login-form-wrap {
    padding:35px 27px;
  }
  .login-icon {
    display:none;
  }
  .login-card h2 {
    font-size:var(--text-xl);
  }
  .secure-caption {
    margin-top:30px;
  }
  .modal-heading {
    padding:16px 20px;
  }
  .modal-heading+div {
    padding:20px;
  }
  #toasts {
    right:16px;
    left:16px;
    bottom:16px;
  }
  .tabs {
    gap:17px;
    overflow:auto;
    white-space:nowrap;
  }
  .evidence {
    grid-template-columns:1fr;
  }
  .chart-bars {
    gap:5px;
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    animation:none!important;
    transition:none!important;
  }
}
.hash-value {
  overflow-wrap:anywhere;
}
/* Visible navigation controls on every screen, with a modal mobile drawer. */
.sidebar-controls {
  flex:0 0 auto;
  display:none;
  justify-content:flex-end;
  padding-bottom:8px;
}
.menu-close span {
  font-size:25px;
  line-height:1;
}
.menu-toggle {
  display:none;
  gap:7px;
  min-height:44px;
  padding:7px 10px;
  border:1px solid var(--line);
  font-size:var(--text-sm);
}
.topbar {
  position:sticky;
  top:0;
  z-index:10;
  flex-shrink:0;
}
.menu-backdrop {
  display:none;
}
@media(max-width:940px) {
  .sidebar-controls {
    display:flex;
  }
  .menu-toggle {
    display:inline-flex;
  }
  body.menu-overlay-open {
    overflow:hidden;
  }
  .menu-backdrop:not([hidden]) {
    display:block;
    position:fixed;
    inset:0;
    background:var(--overlay);
    border:0;
    padding:0;
    z-index:19;
    cursor:pointer;
  }
}
/* The heading can wrap freely without clipping the month labels below it. */
.chart-card {
  height:auto;
  min-height:286px;
  align-self:start;
  padding-bottom:12px;
}
.chart-card .card-head {
  align-items:flex-start;
  flex-wrap:wrap;
  gap:12px;
}
.chart-legend {
  flex-shrink:0;
  flex-wrap:wrap;
  font-size:var(--text-xs);
}
.chart {
  height:206px;
  padding:13px 20px 0;
}
.chart-grid {
  left:20px;
  right:20px;
  bottom:30px;
}
.bar-pair {
  height:calc(100% - 30px);
  flex:1 1 auto;
  min-height:0;
}
.chart-month>span {
  flex:0 0 30px;
  min-height:30px;
  font-size:var(--text-xs);
  line-height:18px;
  padding-top:8px;
  white-space:nowrap;
  color:var(--muted);
}
@media(max-width:640px) {
  .chart {
    padding-left:14px;
    padding-right:14px;
  }
  .chart-grid {
    left:14px;
    right:14px;
  }
  .chart-bars {
    gap:3px;
  }
  .chart-month>span {
    font-size:var(--text-xs);
  }
}

/* ------------------------------------------------------------------
   Theme mapping (was theme.css): which element wears which token.
   ------------------------------------------------------------------ */

a:hover {
  color: var(--link-hover);
}
.card, .topbar, .modal-heading, dialog, .login-body, .skip-link {
  background: var(--surface);
}
.btn {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn:hover {
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--muted);
}
.btn.primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--on-primary);
}
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.soft, .company-avatar, .form-step, .steps>div:before {
  background: var(--teal-light);
  color: var(--teal);
  border-color: var(--line);
}
.stat-top span, .stat-number small, .stat-bottom, .chart-legend, .chart-empty, .attention-item p, .attention-item>a, .table-sub, .table-footer, .tabs a, .field-help, .parties h3, .parties p, .dates-row span, .timeline-item span, .detail-meta, .customer-card p, .app-footer, .app-footer>span:first-child, .login-help, .secure-caption, .modal-heading button, #global-search, .help-link, kbd {
  color: var(--muted);
}
.stat-bottom .good {
  color: var(--success-text);
}
.stat-icon, .empty .empty-icon, .connection-icon {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--line);
}
.stat-icon.amber, .attention-symbol {
  background: var(--warning-bg);
  color: var(--warning-text);
}
th, .summary-note, .dates-row, .connection-url, .evidence div {
  background: var(--surface-subtle);
}
th, .summary-note {
  color: var(--muted);
}
td {
  border-color: var(--line);
  color: var(--ink);
}
td strong, label, .empty h3 {
  color: var(--ink);
}
tbody tr:hover {
  background: var(--surface-raised);
}
.file-icon, .help-link, kbd, dialog {
  border-color: var(--line);
}
.file-icon {
  color: var(--muted);
}
.badge {
  background: var(--surface-raised);
  color: var(--muted);
}
.badge.green, .badge.teal, .alert.success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-text);
}
.badge.red, .alert.error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-text);
}
.badge.amber, .alert.warning, .environment {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--line);
}
.badge.blue, .alert {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--line);
}
input, select, textarea {
  background: var(--surface-subtle);
  color: var(--ink);
  border-color: var(--line);
  accent-color: var(--primary-bg);
}
input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
.timeline-item:before {
  box-shadow: 0 0 0 4px var(--surface);
}
.attention-item, .timeline-item, .status-list>div, .summary-list>div {
  border-color: var(--line);
}
.dot, .bar-pair i {
  background: var(--chart-issued);
}
.dot.teal, .bar-pair i:last-child {
  background: var(--chart-received);
}
.chart-grid i {
  border-color: var(--line);
}
.theme-toggle {
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink);
  flex-shrink: 0;
}
.theme-toggle svg {
  width: 19px;
  height: 19px;
}
.theme-label {
  font-size:var(--text-xs);
  white-space: nowrap;
}
.theme-sun {
  display: none;
}
[data-theme="light"] .theme-sun {
  display: block;
}
[data-theme="light"] .theme-moon {
  display: none;
}
.login-form-wrap {
  position: relative;
  padding-top: 90px;
}
.login-theme {
  position: absolute;
  top: 24px;
  right: 28px;
}
@media(max-width:1180px) {
  .topbar .theme-label {
    display: none;
  }
}
@media(max-width:640px) {
  .topbar-right {
    gap: 7px;
  }
  .login-theme {
    top: 18px;
    right: 20px;
  }
}
