:root {
  --bg: #f5f7fb;
  --ink: #1b2430;
  --muted: #687384;
  --line: #d9e0ea;
  --panel: #ffffff;
  --nav: #172033;
  --nav-soft: #26324a;
  --green: #167653;
  --red: #b23b3b;
  --blue: #2563a9;
  --gold: #9a6a10;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(31, 42, 68, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

input[readonly] {
  background: #f1f4f8;
  color: #46556a;
  cursor: not-allowed;
  font-weight: 700;
}

.status-select {
  min-height: 34px;
  min-width: 120px;
  padding: 6px 8px;
}

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

.sidebar {
  background: var(--nav);
  color: white;
  padding: 22px;
}

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

.brand-mark {
  align-items: center;
  background: #f5c04a;
  border-radius: var(--radius);
  color: #1b2430;
  display: flex;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand span,
.eyebrow,
.muted {
  color: var(--muted);
}

.brand span {
  color: #b8c2d6;
  display: block;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #dce5f5;
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
}

.nav-btn.active,
.nav-btn:hover {
  background: var(--nav-soft);
  border-color: #3c4a67;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

.topbar h1 {
  font-size: 28px;
  margin: 2px 0 0;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.topbar-actions,
.form-actions,
.panel-head,
.items-head {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.form-actions,
.panel-head,
.items-head {
  align-items: center;
}

.company-switcher {
  color: var(--muted);
  display: grid;
  flex: 1 1 210px;
  gap: 6px;
  min-width: 190px;
}

.company-switcher select {
  height: 40px;
  margin-top: 0;
}

.btn,
.text-btn,
.icon-btn {
  border: 0;
  cursor: pointer;
}

.btn {
  align-items: center;
  border-radius: var(--radius);
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  min-width: 104px;
  padding: 10px 14px;
  text-align: center;
  white-space: nowrap;
}

.topbar-actions > .btn {
  flex: 0 0 auto;
  height: 40px;
}

.logout-form {
  align-items: flex-end;
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  justify-content: flex-end;
  min-width: 220px;
}

.logout-form span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-page {
  align-items: center;
  background: linear-gradient(135deg, #eef3fb 0%, #f8fafc 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.auth-card img {
  height: auto;
  width: 230px;
}

.auth-card h1 {
  margin: 0;
}

.auth-error,
.auth-success {
  border-radius: var(--radius);
  font-weight: 700;
  padding: 11px 12px;
}

.auth-error {
  background: #fff2f2;
  color: var(--red);
}

.auth-success {
  background: #edf8f3;
  color: var(--green);
}

.btn.primary {
  background: var(--blue);
  color: white;
}

.btn.ghost {
  background: #e8edf5;
  color: var(--ink);
}

.btn.danger {
  background: var(--red);
  color: white;
}

.text-btn {
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  padding: 6px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 16px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat {
  border-left: 5px solid var(--blue);
  min-width: 0;
  padding: 16px;
}

.stat span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.stat strong {
  display: block;
  font-size: clamp(18px, 1.7vw, 24px);
  line-height: 1.25;
  margin-top: 8px;
  overflow-wrap: normal;
  word-break: normal;
}

.stat.income {
  background: linear-gradient(180deg, #ffffff 0%, #f1fbf6 100%);
  border-left-color: var(--green);
}

.stat.expense {
  background: linear-gradient(180deg, #ffffff 0%, #fff4f4 100%);
  border-left-color: var(--red);
}

.stat.income strong,
.amount-income {
  color: var(--green);
}

.stat.expense strong,
.amount-expense {
  color: var(--red);
}

.stat.profit {
  border-left-color: var(--gold);
}

.stat.receivable {
  border-left-color: #5a7d2b;
}

.stat.payable {
  border-left-color: #7c4d9f;
}

.content-grid,
.two-column,
.doc-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.doc-layout {
  align-items: start;
  grid-template-columns: minmax(420px, 0.85fr) minmax(520px, 1.15fr);
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-head {
  margin-bottom: 14px;
}

.report-lines {
  display: grid;
  gap: 10px;
}

.report-lines div,
.compact-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 0;
}

.report-lines div:last-child,
.compact-item:last-child {
  border-bottom: 0;
}

.compact-item > b {
  min-width: 132px;
  text-align: right;
}

.total-line {
  font-size: 18px;
}

.form-stack {
  display: grid;
  gap: 12px;
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 40px;
  padding: 10px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.segmented {
  background: #e8edf5;
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
}

.segmented label {
  align-items: center;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
}

.segmented input {
  inline-size: 1px;
  opacity: 0;
  position: absolute;
}

.segmented label:has(input:checked) {
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 37, 59, 0.12);
}

.search {
  max-width: 230px;
}

.transaction-tools {
  align-items: center;
  display: flex;
  gap: 8px;
}

.aging-panel {
  margin-top: 16px;
}

.aging-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aging-card {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 13px;
}

.aging-card strong {
  color: var(--ink);
}

.aging-card span {
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.aging-card b {
  color: var(--ink);
}

.chart-panel {
  margin-top: 16px;
}

.chart-wrap {
  height: 260px;
  min-width: 0;
  width: 100%;
}

.chart-wrap canvas {
  display: block;
  height: 260px;
  width: 100%;
}

.chart-legend {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.chart-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
}

.chart-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.legend-income {
  background: var(--green);
}

.legend-expense {
  background: var(--red);
}

.legend-profit {
  background: var(--blue);
}

.receipt-preview {
  align-items: center;
  background: #f7f9fc;
  border: 1px dashed #aeb9c8;
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
  min-height: 180px;
  overflow: hidden;
  padding: 10px;
}

.receipt-preview img {
  border-radius: 6px;
  max-height: 320px;
  max-width: 100%;
  object-fit: contain;
}

.ocr-tools {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
}

.ocr-tools span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

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

.receipt-card strong,
.receipt-card span,
.receipt-card b {
  display: block;
}

.receipt-card span,
.receipt-card p {
  color: var(--muted);
  margin: 2px 0 0;
}

.receipt-thumb {
  align-items: center;
  background: #eef2f8;
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  height: 86px;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  width: 86px;
}

.receipt-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

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

table {
  border-collapse: collapse;
  min-width: 620px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.row-actions {
  display: grid;
  gap: 6px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(68px, auto);
  justify-content: flex-end;
}

.mini-btn,
.icon-btn {
  align-items: center;
  background: #eef2f8;
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  min-height: 32px;
  min-width: 68px;
  padding: 7px 9px;
  text-align: center;
  white-space: nowrap;
}

.mini-btn.danger {
  color: var(--red);
}

.item-rows {
  display: grid;
  gap: 8px;
}

.item-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 1fr) 70px 78px 130px 36px;
}

.document-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  min-height: 480px;
  overflow-x: auto;
  padding: 18px;
  width: 100%;
}

.paper {
  background: #fff;
  border: 1px solid #c9d2df;
  color: #000;
  margin: 0 auto;
  min-height: 880px;
  padding: 0;
  position: relative;
  width: 794px;
}

.paper.receipt {
  border-color: #777;
  min-height: 720px;
}

.paper-inner {
  padding: 8px 0 0;
}

.doc-brand {
  align-items: flex-start;
  border-bottom: 3px solid #154b85;
  display: flex;
  gap: 18px;
  padding: 22px 28px 16px;
}

.company-logo {
  flex: 0 0 auto;
  height: auto;
  width: 230px;
}

.company-lines {
  font-size: 13px;
  line-height: 1.4;
  padding-top: 6px;
  white-space: pre-line;
}

.company-lines strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.paper-title {
  color: #154b85;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  text-transform: uppercase;
}

.standard-paper {
  padding-bottom: 34px;
}

.standard-title-row {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 24px 28px 16px;
}

.standard-meta {
  border: 1px solid #b9c3d0;
  display: grid;
  font-size: 13px;
  min-width: 270px;
}

.standard-meta div {
  display: grid;
  grid-template-columns: 112px 1fr;
}

.standard-meta div + div {
  border-top: 1px solid #d6dde7;
}

.standard-meta span {
  background: #f1f4f8;
  border-right: 1px solid #d6dde7;
  padding: 7px 9px;
}

.standard-meta strong {
  font-weight: 700;
  padding: 7px 9px;
  text-align: right;
}

.standard-parties {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
  padding: 0 28px 18px;
}

.standard-box {
  border: 1px solid #b9c3d0;
  display: grid;
  gap: 5px;
  min-height: 118px;
  padding: 12px;
}

.standard-box b {
  color: #154b85;
  font-size: 12px;
  text-transform: uppercase;
}

.standard-box strong {
  font-size: 14px;
}

.standard-box span {
  font-size: 13px;
  white-space: pre-line;
}

.standard-ref-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 28px 18px;
}

.standard-ref-row div {
  background: #f5f7fb;
  border: 1px solid #d6dde7;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.standard-ref-row b {
  color: #154b85;
  font-size: 12px;
  text-transform: uppercase;
}

.standard-ref-row span {
  font-size: 13px;
}

.paper-head {
  display: flex;
  justify-content: space-between;
}

.paper-head .paper-title {
  padding: 8px 10px 0 0;
}

.doc-info-grid {
  display: grid;
  font-size: 14px;
  grid-template-columns: 90px 132px;
  margin-left: auto;
  margin-top: 6px;
  padding-right: 2px;
  text-align: right;
}

.doc-info-grid span {
  border: 1px solid #bbb;
  border-left: 0;
  min-height: 24px;
  padding: 2px 6px;
}

.doc-info-grid b {
  font-weight: 400;
  padding: 2px 6px;
}

.blue-bar {
  background: #3c4f88;
  color: #fff;
  font-weight: 700;
  padding: 2px 4px;
  text-transform: uppercase;
}

.party-grid {
  display: flex;
  gap: 86px;
  justify-content: space-between;
  padding: 0 2px 48px;
}

.party-box {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
}

.po-meta-row {
  display: grid;
  grid-template-columns: 110px 176px 88px 178px 1fr;
}

.po-meta-row div {
  border-bottom: 1px solid #bbb;
  font-size: 13px;
  min-height: 18px;
  text-align: center;
}

.doc-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 0;
  width: 100%;
}

.standard-table {
  margin: 0 28px;
  width: calc(100% - 56px);
}

.doc-table th {
  background: #154b85;
  color: #fff;
  font-size: 14px;
  padding: 8px 7px;
  text-align: center;
  text-transform: uppercase;
}

.doc-table td {
  border: 1px solid #d6dde7;
  padding: 8px 7px;
  vertical-align: top;
}

.delivery-table td {
  height: 30px;
  padding: 6px 7px;
  vertical-align: middle;
}

.doc-table.striped tbody tr:nth-child(even) {
  background: #eee;
}

.doc-table.dotted td {
  border-bottom: 1px dotted #333;
}

.doc-total {
  margin-left: auto;
  max-width: 330px;
  padding: 0;
  width: 330px;
}

.doc-total div {
  display: flex;
  justify-content: space-between;
  padding: 7px 9px;
}

.grand-total {
  background: #e8eef8;
  border-top: 0;
  font-size: 15px;
  font-weight: 800;
}

.standard-bottom {
  align-items: flex-start;
  display: flex;
  gap: 28px;
  justify-content: space-between;
  padding: 20px 28px 0;
}

.standard-notes {
  border: 1px solid #b9c3d0;
  flex: 1;
  font-size: 13px;
  min-height: 110px;
}

.standard-notes.full {
  margin: 22px 28px 0;
}

.standard-notes b {
  background: #f1f4f8;
  border-bottom: 1px solid #d6dde7;
  color: #154b85;
  display: block;
  padding: 8px 10px;
  text-transform: uppercase;
}

.standard-notes p {
  margin: 0;
  padding: 10px;
  white-space: pre-line;
}

.watermark {
  color: rgba(80, 80, 80, 0.62);
  font-size: 78px;
  left: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  text-align: center;
  top: 390px;
}

.instructions {
  border: 1px solid #111;
  font-size: 13px;
  margin: 24px 0 0 0;
  min-height: 86px;
  width: 390px;
}

.instructions strong {
  background: #efefef;
  border-bottom: 1px solid #111;
  display: block;
  padding: 5px;
}

.instructions p {
  margin: 6px 4px;
  white-space: pre-line;
}

.signature {
  font-size: 14px;
  margin-left: auto;
  margin-right: 28px;
  margin-top: 32px;
  text-align: center;
  width: 230px;
}

.signature strong {
  display: block;
  margin-top: 94px;
}

.signature-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  margin: 42px 28px 0 auto;
  max-width: 460px;
}

.signature-grid.four {
  grid-template-columns: repeat(4, 1fr);
  margin: 54px 28px 0;
  max-width: none;
}

.signature-grid div {
  border-top: 1px solid #333;
  font-size: 13px;
  min-height: 72px;
  padding-top: 8px;
  text-align: center;
}

.signature-grid strong {
  display: block;
  margin-top: 52px;
}

.receipt-title {
  border-bottom: 1px solid #777;
  border-top: 1px solid #777;
  font-size: 20px;
  font-weight: 800;
  margin: 68px 0 0;
  padding: 4px;
  text-align: center;
}

.receipt-lines {
  border-bottom: 1px solid #777;
  display: grid;
  font-size: 13px;
  gap: 0;
  grid-template-columns: 145px 18px 1fr;
}

.receipt-lines span {
  border-bottom: 1px solid #ddd;
  min-height: 28px;
  padding: 4px 2px;
}

.receipt-lines .wide {
  min-height: 56px;
}

.bank-box {
  border-bottom: 1px solid #777;
  font-size: 12px;
  padding: 18px 2px 50px;
}

.receipt-foot {
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  padding: 18px 56px 0 2px;
}

.do-signatures {
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1.55fr 2.35fr 1.25fr;
  left: 0;
  position: absolute;
  right: 0;
}

.do-signatures div {
  border-left: 1px solid #000;
  border-top: 1px solid #000;
  min-height: 105px;
  padding-top: 8px;
  text-align: center;
}

.do-signatures div:last-child {
  border-right: 1px solid #000;
}

.document-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.pagination {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

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

.pagination .mini-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.settings-lower {
  margin-top: 16px;
}

.doc-card {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.party-badge {
  background: #e8eef8;
  border-radius: 999px;
  color: #154b85;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 3px 8px;
  text-transform: uppercase;
}

.ship-fields {
  display: none;
}

.ship-fields.show {
  display: grid;
}

.expense-fields {
  display: none;
  gap: 12px;
}

.expense-fields.show {
  display: grid;
}

.expense-paper {
  border: 1px solid #d4dbe6;
  min-height: 760px;
  padding: 34px;
  width: 900px;
}

.expense-top {
  align-items: flex-start;
  border-bottom: 3px solid #154b85;
  display: flex;
  justify-content: space-between;
  padding-bottom: 22px;
}

.expense-top h3 {
  color: #162033;
  font-size: 32px;
  margin: 4px 0 8px;
}

.expense-top span,
.expense-kicker,
.expense-party small,
.expense-meta small,
.expense-approval span {
  color: #657287;
}

.expense-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.expense-top img {
  max-height: 72px;
  max-width: 230px;
  object-fit: contain;
}

.expense-meta,
.expense-party {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
}

.expense-meta div,
.expense-party div {
  background: #f7f9fc;
  border: 1px solid #dce3ed;
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.expense-meta strong,
.expense-party strong {
  font-size: 14px;
}

.expense-section {
  margin-top: 28px;
}

.expense-section h4,
.expense-notes h4 {
  color: #154b85;
  font-size: 14px;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.expense-table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.expense-table th,
.expense-table td {
  border-bottom: 1px solid #dce3ed;
  padding: 12px 10px;
}

.expense-table th {
  background: #154b85;
  color: white;
  font-weight: 700;
  text-align: left;
}

.expense-table .amount {
  text-align: right;
  white-space: nowrap;
}

.expense-bottom {
  align-items: flex-start;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 320px;
  margin-top: 26px;
}

.expense-notes {
  border: 1px solid #dce3ed;
  border-radius: 8px;
  min-height: 132px;
  padding: 14px;
}

.expense-notes p {
  color: #46556a;
  font-size: 13px;
  margin: 0;
  white-space: pre-line;
}

.expense-summary-card {
  border: 1px solid #dce3ed;
  border-radius: 8px;
  overflow: hidden;
}

.expense-summary-card div {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.expense-summary-card div + div {
  border-top: 1px solid #dce3ed;
}

.expense-total {
  background: #e8eef8;
  font-weight: 800;
}

.expense-approval {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 58px;
}

.expense-approval div {
  border-top: 1px solid #333;
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding-top: 8px;
  text-align: center;
}

.file-btn {
  display: inline-flex;
  width: auto;
}

.file-btn input {
  display: none;
}

.danger-panel {
  border-color: #efc0c0;
}

.empty-state {
  color: var(--muted);
  padding: 16px 0;
}

@media (max-width: 980px) {
  .app-shell,
  .content-grid,
  .two-column,
  .doc-layout,
  .aging-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(5, 1fr);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    width: 100%;
  }

  .company-switcher,
  .topbar-actions > .btn,
  .logout-form {
    min-width: 0;
    width: 100%;
  }

  .logout-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 1320px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat strong {
    font-size: 22px;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat strong {
    font-size: 20px;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .nav-list,
  .form-row,
  .item-row,
  .standard-title-row,
  .standard-parties,
  .standard-ref-row,
  .standard-bottom,
  .doc-brand {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .form-actions,
  .panel-head,
  .doc-header,
  .doc-parties,
  .standard-title-row,
  .standard-bottom,
  .doc-brand {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .logout-form {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .search {
    max-width: none;
  }

  .transaction-tools {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .ocr-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .company-logo {
    width: 210px;
  }

  .standard-table {
    margin: 0;
    width: 100%;
  }

  .standard-meta,
  .doc-total {
    min-width: 0;
    width: 100%;
  }

  .pagination {
    justify-content: stretch;
  }

  .pagination .mini-btn,
  .pagination span {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .document-list,
  .doc-layout > .panel:first-child,
  .panel-head {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .doc-layout {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .panel,
  .document-preview {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .paper {
    border-color: #c9d2df;
    margin: 0;
    min-height: 100vh;
    width: 100%;
  }
}
