:root {
  --ink: #17211b;
  --muted: #647068;
  --line: #dfe6e2;
  --paper: #f6f8f4;
  --panel: #ffffff;
  --brand: #0f6b57;
  --brand-dark: #0a473b;
  --gold: #b98a2f;
  --danger: #b14343;
  --shadow: 0 18px 40px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
.primary-action,
.secondary-action {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
}

.primary-action {
  background: var(--brand);
  color: white;
}

.secondary-action {
  background: #eef4f1;
  color: var(--brand-dark);
}

.danger-action,
.danger-link-action {
  background: #f8e7e7;
  border: 1px solid #e3bcbc;
  border-radius: 6px;
  color: var(--danger);
  cursor: pointer;
  display: inline-block;
  font: inherit;
  padding: 9px 13px;
}

.delete-link {
  color: var(--danger);
  margin-left: 10px;
}

.delete-confirm-panel {
  background: var(--panel);
  border: 1px solid #e3bcbc;
  border-radius: 8px;
  max-width: 680px;
  padding: 24px;
}

.delete-confirm-panel h1 {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.delete-confirm-panel > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
  margin: 14px 0 22px;
}

.delete-confirm-panel form {
  display: flex;
  gap: 10px;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #10231c;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: #e6c575;
  border-radius: 6px;
  color: #10231c;
  display: inline-flex;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #b9c8bf;
  font-size: 13px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 32px;
}

.nav a {
  border-radius: 6px;
  color: #dce7e0;
  padding: 11px 12px;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav a.active {
  background: #e6c575;
  color: #10231c;
  font-weight: 700;
}

.user-box {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: auto;
  padding-top: 18px;
}

.user-box form {
  margin-top: 10px;
}

.user-box button {
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
}

.admin-link {
  color: #c8d6ce;
  display: block;
  font-size: 13px;
  margin-top: 10px;
}

.content {
  padding: 32px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  background: #e4f5ea;
  border: 1px solid #b9dfc7;
  border-radius: 8px;
  color: #166338;
  padding: 10px 12px;
}

.page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.compact-head {
  margin-bottom: 18px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 6px;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0;
}

h2 {
  font-size: 18px;
  margin: 0;
}

h3 {
  color: var(--muted);
  font-size: 14px;
  margin: 18px 0 10px;
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.metric-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  margin-bottom: 10px;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.2;
  word-break: break-word;
}

.quick-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.quick-link {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  gap: 10px;
  min-height: 94px;
  padding: 18px;
}

.quick-link:hover {
  border-color: #9fc4b8;
}

.quick-link strong {
  font-size: 18px;
}

.quick-link span {
  color: var(--muted);
  font-size: 14px;
}

.focus-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 20px;
}

.focus-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid #9fc4b8;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  min-height: 82px;
  padding: 14px;
}

.focus-item span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}

.focus-item strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.focus-item.urgent {
  border-left-color: var(--danger);
}

.focus-item.warn {
  border-left-color: var(--gold);
}

.todo-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.count-pill {
  background: #eef4f1;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 9px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.task-item.critical {
  border-color: #e1b7b7;
  background: #fff8f8;
}

.task-item span,
.summary-list span,
.progress-panel span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.task-item strong,
.task-item small {
  display: block;
  overflow-wrap: anywhere;
}

.task-item small {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.task-item > a {
  background: #eef4f1;
  border-radius: 6px;
  color: var(--brand-dark);
  padding: 8px 10px;
}

.summary-band {
  background: #112720;
  border-radius: 8px;
  color: white;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 20px;
  overflow: hidden;
}

.summary-band div {
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 8px;
  padding: 16px;
}

.summary-band span {
  color: #b9c8bf;
  font-size: 13px;
}

.summary-band strong {
  font-size: 18px;
  line-height: 1.3;
  word-break: break-word;
}

.summary-band a {
  color: #e6c575;
}

.summary-band small {
  color: #b9c8bf;
  font-size: 12px;
}

.supplier-filter {
  border-bottom: 0;
}

.supplier-table {
  min-width: 1180px;
}

.supplier-table td:nth-child(2),
.supplier-table td:nth-child(3) {
  min-width: 180px;
}

.bank-account {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bank-account-large {
  font-size: 16px;
  font-weight: 700;
}

.progress-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
}

.progress-panel strong {
  display: block;
  font-size: 20px;
}

.progress-track {
  background: #e8eee9;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--brand), #58a778);
  display: block;
  height: 100%;
}

.split {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.list-table th,
.list-table td {
  white-space: nowrap;
}

.list-table td:nth-child(4) {
  min-width: 260px;
  white-space: normal;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  padding: 18px 10px;
}

.reminder-list {
  display: grid;
}

.reminder {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  padding: 10px 12px;
}

.reminder span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.reminder small {
  color: var(--muted);
  line-height: 1.4;
}

.reminder.overdue span {
  color: var(--danger);
}

.tag {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  padding: 4px 8px;
}

.tag.warn {
  background: #fff2d6;
  color: #805800;
}

.tag.ok {
  background: #e4f5ea;
  color: #166338;
}

.tag.neutral {
  background: #eef4f1;
  color: var(--brand-dark);
}

.library-strip {
  margin-top: 20px;
}

.search-bar {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-bottom: 18px;
}

.search-bar input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-tabs a {
  align-items: center;
  background: #eef4f1;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--brand-dark);
  display: inline-flex;
  gap: 8px;
  padding: 8px 12px;
}

.filter-tabs a.active {
  background: var(--brand);
  color: white;
}

.filter-tabs span {
  background: rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  padding: 2px 6px;
  text-align: center;
}

.document-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 280px minmax(0, 1fr);
}

.folder-pane {
  align-self: start;
  position: sticky;
  top: 20px;
}

.folder-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.folder-link,
.folder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 4px;
  padding: 12px;
}

.folder-link {
  grid-template-columns: 38px minmax(0, 1fr);
}

.folder-link.active,
.folder-link:hover,
.folder-card:hover {
  background: #f8fbf9;
  border-color: #9fc4b8;
}

.folder-link small {
  color: var(--muted);
  grid-column: 2;
}

.folder-icon {
  align-items: center;
  background: #fff2d6;
  border-radius: 6px;
  color: #805800;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.folder-create {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.folder-create input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
}

.folder-create button {
  background: var(--brand);
  color: white;
}

.breadcrumb-bar {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.folder-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-bottom: 16px;
}

.folder-card {
  grid-template-columns: 38px minmax(0, 1fr);
}

.folder-card small {
  color: var(--muted);
  grid-column: 2;
}

.compact-empty {
  padding: 8px 0;
}

.import-strip {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  margin-bottom: 18px;
}

.import-strip span,
.status-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.import-strip strong,
.status-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.status-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.status-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 16px;
}

.status-card strong {
  font-size: 24px;
}

.review-table td {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.status-badge.imported {
  background: #e4f5ea;
  color: #166338;
}

.status-badge.duplicate_hash {
  background: #eef4f1;
  color: var(--brand-dark);
}

.status-badge.skipped {
  background: #fff2d6;
  color: #805800;
}

.status-badge.unsupported {
  background: #f4e3e3;
  color: var(--danger);
}

.file-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-tile,
.file-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
}

.file-row {
  align-items: center;
  grid-template-columns: 46px minmax(0, 1fr);
}

.file-row small {
  grid-column: 2;
}

.file-tile:hover,
.file-row:hover {
  border-color: #9fc4b8;
  background: #f8fbf9;
}

.file-icon {
  align-items: center;
  background: #eef4f1;
  border-radius: 6px;
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 42px;
}

.file-tile strong,
.file-row strong {
  overflow-wrap: anywhere;
}

.file-tile small,
.file-row small {
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 60vh;
  padding: 18px;
}

.image-preview {
  display: block;
  max-height: 72vh;
  max-width: 100%;
  object-fit: contain;
}

.pdf-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 72vh;
  width: 100%;
}

.preview-meta {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.preview-meta span {
  color: var(--muted);
  font-size: 13px;
}

.document-table {
  max-height: 72vh;
  overflow: auto;
}

.document-table td {
  white-space: nowrap;
}

.mini-progress {
  background: #e8eee9;
  border-radius: 999px;
  height: 7px;
  margin-bottom: 4px;
  min-width: 96px;
  overflow: hidden;
}

.mini-progress span {
  background: var(--brand);
  display: block;
  height: 100%;
}

.payment-status-cell {
  min-width: 118px;
  white-space: nowrap;
}

.payment-status-cell strong {
  color: #365347;
  font-size: 12px;
}

.doc-preview {
  line-height: 1.75;
  margin: 0 auto;
  max-width: 860px;
}

.text-preview {
  background: #f6f8f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.55;
  margin: 0;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

.unsupported {
  align-content: center;
  color: var(--muted);
  display: grid;
  min-height: 40vh;
  text-align: center;
}

.form-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 0.55fr);
}

.summary-list {
  display: grid;
  gap: 14px;
}

.summary-list strong {
  display: block;
  overflow-wrap: anywhere;
}

.data-form {
  display: grid;
  gap: 16px;
}

.narrow-form {
  max-width: 720px;
}

.data-form label {
  display: grid;
  gap: 7px;
}

.data-form label > span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.data-form input,
.data-form select,
.data-form textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-width: 0;
  padding: 10px 12px;
  width: 100%;
}

.data-form ul.errorlist {
  color: var(--danger);
  list-style: none;
  margin: 0;
  padding: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-body {
  align-items: center;
  background: #10231c;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-brand {
  margin-bottom: 24px;
}

.login-brand small {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  gap: 7px;
}

.login-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 11px 12px;
}

.ledger-filter {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) 160px 160px 160px auto;
  padding: 14px 16px;
}

.ledger-filter label {
  display: grid;
  gap: 6px;
}

.ledger-filter label > span,
.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ledger-filter input,
.ledger-filter select,
.contract-status-form select {
  background: white;
  border: 1px solid #cfd9d3;
  border-radius: 5px;
  font: inherit;
  height: 40px;
  min-width: 0;
  padding: 7px 10px;
  width: 100%;
}

.filter-actions,
.contract-status-form {
  align-items: center;
  display: flex;
  gap: 8px;
}

.contract-status-form select {
  min-width: 122px;
  width: auto;
}

.ledger-shell,
.document-table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.ledger-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 16px;
}

.ledger-head > div:first-child {
  align-items: baseline;
  display: flex;
  gap: 10px;
}

.ledger-head span {
  color: var(--muted);
  font-size: 13px;
}

.ledger-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

.payment-plan-audit {
  align-items: stretch;
  background: #f3f8f5;
  border-bottom: 1px solid #cfe1d7;
  border-left: 4px solid var(--brand);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 66px;
  padding: 10px 14px;
}

.payment-plan-audit.balanced {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-plan-audit.short,
.payment-plan-audit.over {
  background: #fff8ea;
  border-bottom-color: #ead6a7;
  border-left-color: var(--gold);
}

.payment-plan-audit > div {
  border-right: 1px solid rgba(74, 99, 87, 0.14);
  min-width: 0;
  padding: 3px 14px;
}

.payment-plan-audit > div:first-child {
  padding-left: 4px;
}

.payment-plan-audit > div:last-child {
  border-right: 0;
}

.payment-plan-audit span,
.payment-plan-audit strong {
  display: block;
}

.payment-plan-audit span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.payment-plan-audit strong {
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.payment-plan-audit.short .audit-difference strong,
.payment-plan-audit.over .audit-difference strong {
  color: #8a5b08;
}

.reimbursement-tabs {
  margin-top: 18px;
}

.reimbursement-tab-panel,
.reimbursement-invoice-pane {
  margin-top: 0;
}

.invoice-filter-bar {
  align-items: center;
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 7px 12px;
}

.invoice-filter-bar label {
  align-items: center;
  display: flex;
  gap: 8px;
}

.invoice-filter-bar label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.invoice-filter-bar select {
  background: #fff;
  border: 1px solid #cbd6d0;
  border-radius: 5px;
  color: var(--ink);
  font: inherit;
  height: 34px;
  min-width: 170px;
  padding: 5px 28px 5px 9px;
}

.invoice-filter-submit {
  min-height: 34px;
  padding: 6px 12px;
}

.reimbursement-invoice-table {
  min-width: 1080px;
}

.reimbursement-invoice-table .primary-cell {
  min-width: 230px;
}

.reimbursement-invoice-table .select-cell {
  min-width: 42px;
  text-align: center;
  width: 42px;
}

.reimbursement-invoice-table .select-cell input {
  height: 16px;
  margin: 0;
  width: 16px;
}

.batch-delete-button {
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  padding: 0;
}

.batch-delete-button:disabled {
  color: #b8bfbb;
  cursor: default;
}

.delete-item-list {
  background: #fafbfa;
  border: 1px solid var(--line);
  margin: 0 0 22px;
  max-height: 260px;
  overflow: auto;
  padding: 12px 12px 12px 38px;
}

.delete-item-list li {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.ledger-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.ledger-table-wrap {
  max-height: calc(100vh - 315px);
  min-height: 300px;
}

.ledger-table thead,
.library-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.ledger-table th,
.library-table th {
  background: #edf2ef;
  border-right: 1px solid #d7dfda;
  color: #445148;
  font-size: 13px;
  padding: 9px 10px;
}

.ledger-table td,
.library-table td {
  border-right: 1px solid #edf1ef;
  padding: 9px 10px;
  vertical-align: middle;
}

.ledger-table tbody tr:nth-child(even),
.library-table tbody tr:nth-child(even) {
  background: #fafcfb;
}

.ledger-table tbody tr:hover,
.library-table tbody tr:hover {
  background: #f1f7f4;
}

.ledger-table .title-cell {
  min-width: 220px;
  max-width: 360px;
}

.date-cell,
.code-cell,
.number-cell,
.row-action {
  white-space: nowrap;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-action {
  text-align: right;
}

.business-type,
.contract-state {
  border-radius: 4px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 7px;
  white-space: nowrap;
}

.business-type.sales {
  background: #e1f2ea;
  color: #146044;
}

.business-type.procurement {
  background: #fff0d2;
  color: #7a5311;
}

.business-type.reimbursement {
  background: #e7eef8;
  color: #355b88;
}

.business-type.expense {
  background: #f5e8e8;
  color: #8b4242;
}

.contract-state.active {
  background: #e1f2ea;
  color: #146044;
}

.contract-state.draft {
  background: #eef1f0;
  color: #56615b;
}

.contract-state.abnormal {
  background: #f7e1e1;
  color: #9b3434;
}

.contract-state.completed {
  background: #e7eef8;
  color: #355b88;
}

.pagination {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 54px;
  padding: 9px 16px;
}

.pagination > span {
  color: var(--muted);
  font-size: 13px;
}

.pagination div {
  display: flex;
  gap: 6px;
}

.pagination a {
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  font-size: 13px;
  padding: 7px 10px;
}

.pagination a:hover {
  border-color: #8eb5a8;
  color: var(--brand);
}

.document-search {
  max-width: 760px;
}

.folder-section {
  margin-bottom: 16px;
}

.section-label {
  margin-bottom: 8px;
}

.compact-tabs {
  margin-bottom: 12px;
}

.document-table-shell {
  border-radius: 8px;
}

.library-table {
  table-layout: auto;
}

.library-table .document-name {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 280px;
}

.library-table .document-name .file-icon {
  flex: 0 0 auto;
  height: 30px;
  width: 36px;
}

.library-table td:nth-child(3) {
  max-width: 330px;
}

.muted-inline {
  color: var(--muted);
}

.secondary-document-table {
  margin-top: 18px;
}

.period-picker {
  align-items: center;
  display: flex;
  gap: 8px;
}

.period-picker label {
  color: var(--muted);
  font-size: 13px;
}

.period-picker select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  padding: 9px 10px;
}

.finance-strip,
.record-finance-strip {
  background: #112720;
  border: 1px solid #203b32;
  border-radius: 6px;
  color: white;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
}

.finance-strip > div,
.record-finance-strip > div {
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 0;
  padding: 14px 15px;
}

.finance-strip > div:last-child,
.record-finance-strip > div:last-child {
  border-right: 0;
}

.finance-strip span,
.record-finance-strip span {
  color: #b9c8bf;
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.finance-strip strong,
.record-finance-strip strong {
  display: block;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.finance-strip .net {
  background: rgba(230, 197, 117, 0.1);
}

.finance-strip .net strong {
  color: #f0d58f;
}

.dashboard-summary {
  background: #112720;
  border: 1px solid #203b32;
  border-radius: 6px;
  color: white;
  display: grid;
  grid-template-columns: 1.08fr 1.08fr 0.84fr;
  margin-bottom: 14px;
  overflow: hidden;
}

.summary-group {
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  min-width: 0;
}

.summary-group:last-child {
  border-right: 0;
}

.summary-group-head {
  align-items: baseline;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 14px;
}

.summary-group-head strong {
  font-size: 13px;
}

.summary-group-head span,
.summary-values span {
  color: #b9c8bf;
  font-size: 11px;
}

.summary-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-values.two-values {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-values > div {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 0;
  padding: 13px 14px 15px;
}

.summary-values > div:last-child {
  border-right: 0;
}

.summary-values span,
.summary-values strong {
  display: block;
}

.summary-values strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.summary-values .net {
  background: rgba(230, 197, 117, 0.1);
}

.summary-values .net strong {
  color: #f0d58f;
}

.attention-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
}

.attention-item {
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 11px 14px;
}

.attention-item:last-child {
  border-right: 0;
}

.attention-item span,
.attention-item small {
  color: var(--muted);
  font-size: 12px;
}

.attention-item strong {
  font-size: 15px;
}

.attention-item small {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.attention-item.danger {
  border-left: 3px solid #b14343;
}

.attention-item.warning {
  border-left: 3px solid #c48c24;
}

.attention-item.info {
  border-left: 3px solid #36709a;
}

.dashboard-focus-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(580px, 1.25fr) minmax(360px, 0.75fr);
  margin-bottom: 18px;
}

.task-table td {
  vertical-align: middle;
}

.task-table .primary-cell {
  min-width: 200px;
}

.task-state,
.control-label {
  border-radius: 4px;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 7px;
  white-space: nowrap;
}

.task-state.overdue {
  background: #f7e1e1;
  color: #953535;
}

.task-state.upcoming {
  background: #fff0d2;
  color: #76500f;
}

.panel-count {
  color: var(--muted);
  font-size: 13px;
}

.control-alert-list {
  max-height: 390px;
  overflow: auto;
}

.control-alert {
  align-items: center;
  border-bottom: 1px solid #edf1ef;
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 11px 14px;
}

.control-alert:last-child {
  border-bottom: 0;
}

.control-alert:hover {
  background: #f8faf8;
}

.control-alert.danger .control-label {
  background: #f7e1e1;
  color: #953535;
}

.control-alert.warning .control-label {
  background: #fff0d2;
  color: #76500f;
}

.control-alert.info .control-label {
  background: #e4eef5;
  color: #315f80;
}

.control-copy,
.control-copy strong,
.control-copy small {
  display: block;
  min-width: 0;
}

.control-copy strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.control-copy small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.control-arrow {
  color: #8a9690;
  font-size: 20px;
}

.control-empty {
  padding: 38px 16px;
}

.dashboard-lower-grid {
  margin-top: 0;
}

.workspace-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 0.36fr) minmax(620px, 0.64fr);
}

.work-panel,
.data-list-shell,
.form-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.work-panel {
  overflow: hidden;
}

.work-panel-head,
.form-section-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 11px 16px;
}

.work-panel-head p,
.form-section-head p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.compact-finance-table th,
.compact-finance-table td {
  padding: 7px 12px;
}

.positive {
  color: #146044;
}

.negative {
  color: #a33e3e;
}

.recent-business-table td {
  vertical-align: middle;
}

.recent-business-table td:nth-child(3) {
  min-width: 220px;
}

.recent-business-table td small,
.primary-cell small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clickable-row {
  cursor: pointer;
}

.ledger-filter {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.ledger-filter .filter-search {
  grid-column: span 2;
}

.list-filter {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
}

.list-filter label {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.list-filter .filter-search {
  flex: 1 1 300px;
}

.list-filter label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.list-filter input,
.list-filter select {
  background: white;
  border: 1px solid #cfd9d3;
  border-radius: 5px;
  font: inherit;
  height: 40px;
  min-width: 0;
  padding: 7px 10px;
}

.data-list-shell {
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

.professional-table th {
  background: #edf2ef;
  border-right: 1px solid #d7dfda;
  color: #445148;
  font-size: 13px;
  padding: 9px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.professional-table td {
  border-right: 1px solid #edf1ef;
  padding: 10px;
  vertical-align: middle;
}

.sequence-cell {
  box-sizing: border-box;
  min-width: 58px;
  text-align: center;
  width: 58px;
}

.order-cell {
  box-sizing: border-box;
  min-width: 86px;
  text-align: center;
  width: 86px;
}

.order-controls {
  display: inline-flex;
  gap: 5px;
  justify-content: center;
}

.order-controls form {
  margin: 0;
}

.order-button {
  align-items: center;
  background: #fff;
  border: 1px solid #cbd6d0;
  border-radius: 4px;
  color: #27473a;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 16px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
}

.order-button:hover:not(:disabled) {
  background: #eaf3ee;
  border-color: #8fa99b;
}

.order-button:disabled {
  color: #bdc7c1;
  cursor: default;
}

.professional-table tbody tr:nth-child(even) {
  background: #fafcfb;
}

.professional-table tbody tr:hover {
  background: #f1f7f4;
}

.professional-table tfoot td,
.ledger-table tfoot td {
  background: #e5ede8;
  border-right: 1px solid #d2ddd6;
  border-top: 2px solid #bdccc3;
  color: #273b31;
  font-weight: 700;
  padding: 11px 10px;
}

.invoice-total-row td:first-child {
  text-align: right;
}

.invoice-total-row td:last-child {
  color: var(--muted);
  font-size: 12px;
}

.primary-cell {
  min-width: 230px;
}

.status-dot {
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  margin-right: 6px;
  width: 7px;
}

.status-dot.ok {
  background: #2d8b62;
}

.status-dot.warn {
  background: #d09b35;
}

.workflow-state {
  border-radius: 4px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 7px;
  white-space: nowrap;
}

.workflow-state.draft {
  background: #eef1f0;
  color: #56615b;
}

.workflow-state.pending {
  background: #fff0d2;
  color: #7a5311;
}

.workflow-state.approved {
  background: #e7eef8;
  color: #355b88;
}

.workflow-state.paid {
  background: #e1f2ea;
  color: #146044;
}

.workflow-state.rejected {
  background: #f7e1e1;
  color: #9b3434;
}

.back-link {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 8px;
  margin-bottom: 14px;
}

.record-head {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.record-head p {
  font-size: 16px;
  margin: 6px 0;
}

.record-head > div:first-child > span {
  color: var(--muted);
  font-size: 13px;
}

.record-title-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.record-finance-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.supplier-finance-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.supplier-info-grid {
  margin-bottom: 16px;
}

.payment-account-panel .detail-list {
  grid-template-columns: 1fr;
}

.supplier-payment-history {
  margin-top: 16px;
}

.record-tabs {
  border-bottom: 1px solid #cfd9d3;
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
}

.record-tabs a {
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 14px 9px;
}

.record-tabs a.active {
  border-bottom-color: var(--brand);
  color: var(--brand-dark);
}

.record-tabs a span {
  background: #e9efeb;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
  padding: 2px 6px;
}

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 4px 16px 16px;
}

.detail-list > div {
  border-bottom: 1px solid #edf1ef;
  min-width: 0;
  padding: 12px 4px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-list dd {
  font-size: 14px;
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-list.compact {
  grid-template-columns: 1fr;
}

.record-notes {
  border-top: 1px solid var(--line);
  margin: 0 16px 16px;
  padding-top: 12px;
}

.record-notes span {
  color: var(--muted);
  font-size: 12px;
}

.record-notes p {
  line-height: 1.6;
  margin: 6px 0 0;
}

.execution-block {
  padding: 18px 16px 8px;
}

.execution-block > div:first-child {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.business-entry-form {
  display: grid;
  gap: 16px;
  max-width: 1080px;
}

.batch-upload-form {
  max-width: 820px;
}

.batch-file-picker {
  display: grid;
  gap: 8px;
  padding: 22px 18px 18px;
}

.batch-file-picker > span {
  color: #405048;
  font-size: 13px;
  font-weight: 700;
}

.batch-file-picker input[type="file"] {
  background: #f8fbf9;
  border: 1px dashed #9eb2a7;
  border-radius: 6px;
  color: var(--muted);
  font: inherit;
  padding: 22px;
  width: 100%;
}

.batch-file-picker input[type="file"]::file-selector-button {
  background: var(--brand);
  border: 0;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  margin-right: 12px;
  padding: 9px 13px;
}

.batch-file-list {
  display: grid;
  gap: 1px;
  padding: 0 18px 18px;
}

.batch-file-list > div {
  align-items: center;
  background: #f7faf8;
  border-bottom: 1px solid #e2e9e5;
  display: grid;
  gap: 10px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  padding: 9px 10px;
}

.batch-file-list span,
.batch-file-list small {
  color: var(--muted);
  font-size: 12px;
}

.form-section {
  overflow: hidden;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field > span {
  color: #405048;
  font-size: 13px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea,
.entry-table input,
.entry-table textarea {
  background: white;
  border: 1px solid #cfd9d3;
  border-radius: 5px;
  font: inherit;
  min-width: 0;
  padding: 10px 11px;
  width: 100%;
}

.form-field select {
  height: 42px;
}

.form-field input:disabled {
  background: #eef2ef;
  color: #53645b;
  cursor: not-allowed;
}

.form-field small {
  color: var(--muted);
  font-size: 12px;
}

.field-notes {
  grid-column: 1 / -1;
}

.errorlist {
  color: var(--danger);
  font-size: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sticky-form-actions {
  align-items: center;
  background: rgba(246, 248, 244, 0.94);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 0;
  position: sticky;
  z-index: 4;
}

.app-dialog {
  background: var(--panel);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(8, 27, 20, 0.28);
  color: var(--ink);
  max-height: min(86vh, 820px);
  max-width: min(760px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.app-dialog[data-size="wide"] {
  max-width: min(920px, calc(100vw - 32px));
}

.app-dialog[data-size="full"] {
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  max-width: min(1240px, calc(100vw - 32px));
  width: calc(100vw - 32px);
}

.app-dialog[data-size="full"] .dialog-view {
  height: 100%;
  max-height: 100%;
}

.app-dialog::backdrop {
  background: rgba(9, 25, 19, 0.52);
}

.dialog-view {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 820px);
}

.dialog-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 20px;
  justify-content: space-between;
  padding: 20px 22px 16px;
}

.dialog-head h2 {
  font-size: 20px;
  line-height: 1.3;
}

.dialog-head p {
  color: var(--muted);
  font-size: 13px;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.dialog-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 34px;
  font-size: 28px;
  height: 34px;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.dialog-close:hover {
  background: #edf2ef;
  color: var(--ink);
}

.dialog-form {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 0;
}

.dialog-form-grid {
  display: grid;
  gap: 15px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dialog-form-grid .field-notes,
.dialog-form-grid .field-file,
.dialog-form-grid .field-payment_records,
.dialog-form-grid .field-payment_voucher {
  grid-column: 1 / -1;
}

.dialog-form small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.supplier-quick-add {
  background: #f4f8f5;
  border: 1px solid #b9cec1;
  border-radius: 6px;
  grid-column: 1 / -1;
  overflow: hidden;
}

.supplier-quick-add summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  list-style: none;
  padding: 12px 14px;
  user-select: none;
}

.supplier-quick-add summary::-webkit-details-marker {
  display: none;
}

.supplier-quick-add summary > span:last-child {
  display: grid;
  gap: 2px;
}

.supplier-quick-add summary strong {
  color: var(--brand);
  font-size: 15px;
}

.supplier-quick-add summary small {
  color: var(--muted);
  font-size: 12px;
}

.supplier-quick-add-icon {
  align-items: center;
  border: 1px solid var(--brand);
  border-radius: 50%;
  color: var(--brand);
  display: inline-flex;
  flex: 0 0 24px;
  font-size: 18px;
  height: 24px;
  justify-content: center;
  line-height: 1;
}

.supplier-quick-add[open] summary {
  border-bottom: 1px solid var(--line);
}

.supplier-quick-add[open] .supplier-quick-add-icon {
  transform: rotate(45deg);
}

.supplier-quick-add-body {
  padding: 14px;
}

.supplier-quick-add-body > p {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 12px;
}

.supplier-quick-add-grid {
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reimbursement-dialog-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 0;
}

.reimbursement-dialog-form > .errorlist {
  margin: 14px 22px 0;
}

.dialog-save-error {
  background: #fff0d2;
  border: 1px solid #e3bd70;
  border-radius: 6px;
  color: #6f4a0c;
  margin: 14px 22px 0;
  padding: 11px 13px;
}

.dialog-save-error strong,
.dialog-save-error p {
  display: block;
  margin: 0;
}

.dialog-save-error p {
  font-size: 12px;
  margin-top: 3px;
}

.dialog-save-error ul {
  font-size: 13px;
  margin: 8px 0 0;
  padding-left: 20px;
}

.reimbursement-dialog-section {
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.reimbursement-items-section {
  border-bottom: 0;
  flex: 1 0 auto;
  min-height: 260px;
}

.reimbursement-dialog-section-head {
  align-items: center;
  background: #f7f9f7;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 10px 22px;
}

.reimbursement-dialog-section-head h3 {
  font-size: 15px;
  margin: 0;
}

.reimbursement-dialog-section-head p {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0 0;
}

.reimbursement-info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 16px 22px 18px;
}

.reimbursement-info-grid .field-notes {
  grid-column: 1 / -1;
}

.reimbursement-entry-wrap {
  padding: 0 22px 18px;
}

.reimbursement-entry-table {
  min-width: 1080px;
  table-layout: fixed;
}

.reimbursement-entry-table th:nth-child(1),
.reimbursement-entry-table td:nth-child(1) {
  min-width: 58px;
  width: 58px;
}

.reimbursement-entry-table th:nth-child(2),
.reimbursement-entry-table td:nth-child(2) {
  min-width: 260px;
  width: 30%;
}

.reimbursement-entry-table th:nth-child(3),
.reimbursement-entry-table td:nth-child(3) {
  min-width: 130px;
  width: 130px;
}

.reimbursement-entry-table th:nth-child(4),
.reimbursement-entry-table td:nth-child(4) {
  min-width: 150px;
  width: 150px;
}

.reimbursement-entry-table th:nth-child(5),
.reimbursement-entry-table td:nth-child(5) {
  min-width: 110px;
  width: 110px;
}

.reimbursement-entry-table th:nth-child(6),
.reimbursement-entry-table td:nth-child(6) {
  min-width: 240px;
  width: 30%;
}

.reimbursement-entry-table th:nth-child(7),
.reimbursement-entry-table td:nth-child(7) {
  min-width: 64px;
  text-align: center;
  width: 64px;
}

.reimbursement-template-link {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
}

.reimbursement-template-link span {
  color: var(--muted);
}

.reimbursement-template-link a {
  font-weight: 700;
}

.reimbursement-dialog-form > .dialog-actions {
  flex: 0 0 auto;
  margin: auto 0 0;
  padding-left: 22px;
  padding-right: 22px;
}

.dialog-actions {
  align-items: center;
  background: var(--panel);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin: 20px -22px 0;
  padding: 14px 22px;
  position: sticky;
  z-index: 3;
}

.dialog-danger-action {
  margin-right: auto;
}

.dialog-warning {
  background: #fff7f7;
  border: 1px solid #e3bcbc;
  border-radius: 6px;
  color: #753636;
  line-height: 1.65;
  margin: 0;
  padding: 14px 16px;
}

.dialog-confirm-form {
  padding-top: 18px;
}

.dialog-summary {
  background: #f4f7f5;
  border-bottom: 1px solid var(--line);
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px 22px;
}

.dialog-summary > div {
  border-right: 1px solid var(--line);
  min-width: 0;
  padding: 2px 14px;
}

.dialog-summary > div:first-child {
  padding-left: 0;
}

.dialog-summary > div:last-child {
  border-right: 0;
}

.dialog-summary span,
.dialog-summary strong {
  display: block;
}

.dialog-summary span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.dialog-summary strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.dialog-loading,
.dialog-error {
  color: var(--muted);
  padding: 64px 24px;
  text-align: center;
}

.dialog-loading[hidden] {
  display: none;
}

.dialog-error strong {
  color: var(--ink);
  display: block;
  margin-bottom: 8px;
}

.dialog-error p {
  margin: 0;
}

.dialog-step-label {
  align-items: center;
  display: grid;
  gap: 2px 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  margin-bottom: 14px;
}

.dialog-step-label > span {
  align-items: center;
  background: var(--brand);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  font-size: 13px;
  grid-row: span 2;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.dialog-step-label small,
.dialog-upload-status span {
  color: var(--muted);
  font-size: 12px;
}

.dialog-upload-status {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
}

.dialog-upload-status strong {
  font-size: 13px;
}

@media (max-width: 620px) {
  .app-dialog,
  .dialog-view {
    max-height: calc(100vh - 16px);
  }

  .app-dialog {
    max-width: calc(100vw - 16px);
  }

  .app-dialog[data-size="wide"],
  .app-dialog[data-size="full"] {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
    width: 100vw;
  }

  .dialog-head,
  .dialog-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dialog-form-grid,
  .dialog-summary {
    grid-template-columns: 1fr;
  }

  .dialog-summary {
    gap: 8px;
  }

  .dialog-summary > div {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 0 8px;
  }

  .dialog-summary > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .dialog-actions {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .reimbursement-dialog-section-head {
    align-items: flex-start;
    padding-left: 16px;
    padding-right: 16px;
  }

  .reimbursement-info-grid {
    grid-template-columns: 1fr;
    padding-left: 16px;
    padding-right: 16px;
  }

  .supplier-quick-add-grid {
    grid-template-columns: 1fr;
  }

  .reimbursement-info-grid .field-notes {
    grid-column: auto;
  }

  .reimbursement-entry-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .reimbursement-dialog-form > .dialog-actions {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .dialog-upload-status {
    align-items: flex-start;
    flex-direction: column;
  }
}

.entry-table th {
  background: #edf2ef;
  font-size: 12px;
}

.entry-table td {
  vertical-align: top;
}

.entry-table td:nth-child(1) {
  min-width: 280px;
}

.entry-table td:nth-child(2),
.entry-table td:nth-child(3) {
  min-width: 130px;
}

.entry-table td:nth-child(4) {
  min-width: 220px;
}

.entry-table textarea {
  height: 42px;
  resize: vertical;
}

.delete-cell {
  text-align: center;
  width: 70px;
}

.remove-item {
  background: #f5e8e8;
  color: #8b4242;
  font-size: 20px;
  height: 38px;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.detail-spacing {
  margin-top: 16px;
}

.compact-file-list {
  padding: 12px;
}

.linked-invoices,
.linked-payments {
  min-width: 150px;
}

.linked-invoices a,
.linked-payments span {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.invoice-ledger-table td:nth-child(3) {
  min-width: 230px;
}

.invoice-ledger-table td:nth-child(4),
.invoice-ledger-table td:nth-child(6) {
  min-width: 105px;
}

.invoice-ledger-table td:nth-child(9) {
  min-width: 160px;
}

.form-field ul {
  border: 1px solid #cfd9d3;
  border-radius: 5px;
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
}

.form-field ul label {
  align-items: center;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.form-field ul input[type="checkbox"] {
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .quick-grid,
  .focus-grid,
  .document-layout,
  .summary-band,
  .todo-layout,
  .status-grid,
  .import-strip,
  .form-layout,
  .split {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-bar {
    grid-template-columns: 1fr;
  }

  .ledger-filter {
    grid-template-columns: 1fr 1fr;
  }

  .filter-search,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .ledger-head,
  .pagination {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .ledger-table-wrap {
    max-height: none;
  }

  .finance-strip,
  .record-finance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .detail-grid,
  .dashboard-focus-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-summary {
    grid-template-columns: 1fr;
  }

  .summary-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    border-right: 0;
  }

  .summary-group:last-child {
    border-bottom: 0;
  }

  .record-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-tabs {
    overflow-x: auto;
  }

  .record-tabs a {
    white-space: nowrap;
  }

  .payment-plan-audit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-plan-audit.balanced {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .payment-plan-audit > div {
    border-bottom: 1px solid rgba(74, 99, 87, 0.14);
  }

  .payment-plan-audit > div:nth-child(even) {
    border-right: 0;
  }

  .payment-plan-audit > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-notes {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .attention-strip,
  .summary-values,
  .summary-values.two-values {
    grid-template-columns: 1fr;
  }

  .attention-item,
  .attention-item:last-child {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .attention-item:last-child {
    border-bottom: 0;
  }

  .summary-values > div {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 0;
  }

  .summary-values > div:last-child {
    border-bottom: 0;
  }

  .summary-group-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-alert {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .control-arrow {
    display: none;
  }

  .payment-plan-audit,
  .payment-plan-audit.balanced {
    grid-template-columns: 1fr;
  }

  .payment-plan-audit > div,
  .payment-plan-audit > div:nth-last-child(-n + 2) {
    border-bottom: 1px solid rgba(74, 99, 87, 0.14);
    border-right: 0;
    padding: 8px 4px;
  }

  .payment-plan-audit > div:last-child {
    border-bottom: 0;
  }
}
