.app-page {
  min-height: 100vh;
  background: #f5f7fb;
  color: #111827;
  font-size: 14px;
}

.app-page .btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 700;
}

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

.workspace-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: #171717;
  color: #f8fafc;
}

.workspace-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace-sidebar .app-menu-close {
  display: none;
}

.app-brand {
  color: #ffffff;
  font-size: 1.25rem;
}

.app-brand .brand-mark {
  color: #38bdf8;
}

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

.workspace-nav a {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 8px;
  color: #d1d5db;
  font-size: 0.85rem;
  font-weight: 600;
}

.workspace-nav a:hover,
.workspace-nav a:focus-visible,
.workspace-nav a.is-active {
  background: #262626;
  color: #ffffff;
}

.workspace-nav a.is-active svg {
  color: #34d399;
}

.workspace-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.workspace-user > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ecfeff;
  color: #155e75;
  font-weight: 700;
}

.workspace-user strong,
.workspace-user small {
  display: block;
}

.workspace-user small {
  color: #a3a3a3;
}

.workspace-main {
  min-width: 0;
}

.workspace-topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 26px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.workspace-search {
  min-width: 220px;
  max-width: 520px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #dbe1ea;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
}

.workspace-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: #111827;
  background: transparent;
  font: inherit;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #dbe1ea;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  cursor: pointer;
}

.app-menu-toggle {
  display: none;
}

.workspace-content {
  width: min(1280px, 100%);
  margin-inline: auto;
  padding: 24px 28px 40px;
}

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

.page-heading h1,
.panel-heading h2,
.settings-strip h2 {
  margin: 0;
  color: #111827;
  line-height: 1.2;
}

.page-heading h1 {
  font-size: 1.55rem;
  font-weight: 700;
}

.page-heading p {
  max-width: 540px;
  margin: 0;
  color: #526078;
}

.app-eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.flash-banner {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-weight: 850;
}

.flash-banner svg {
  color: #16a34a;
  fill: #16a34a;
  stroke: #ffffff;
  stroke-width: 2.4;
}

.app-stat,
.document-panel,
.document-preview,
.template-section,
.documents-panel,
.settings-strip {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.app-stat {
  min-height: 96px;
  padding: 15px;
}

.app-stat span,
.app-stat small {
  display: block;
  color: #64748b;
}

.app-stat strong {
  display: block;
  margin: 8px 0 3px;
  color: #111827;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.document-panel,
.document-preview,
.template-section,
.documents-panel,
.settings-strip {
  padding: 20px;
}

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

.panel-heading h2 {
  margin-top: 3px;
  font-size: 1.05rem;
  font-weight: 700;
}

.status-pill,
.documents-row em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.document-form {
  display: grid;
  gap: 14px;
}

.document-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 650;
}

.document-form input,
.document-form select,
.document-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #111827;
  font: inherit;
}

.document-form textarea {
  resize: vertical;
}

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

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

.document-preview {
  background: #fefce8;
}

.preview-sheet {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid #e8d88d;
  border-radius: 8px;
  background: #ffffff;
}

.preview-top,
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-top {
  color: #075985;
  font-weight: 700;
}

.preview-sheet h2 {
  margin: 26px 0 20px;
  color: #111827;
  font-size: 1.45rem;
  line-height: 1.25;
}

.preview-sheet dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.preview-sheet dl div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf0f5;
}

.preview-sheet dt {
  color: #64748b;
  font-weight: 800;
}

.preview-sheet dd {
  min-width: 0;
  margin: 0;
  color: #111827;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.preview-footer {
  margin-top: auto;
  padding-top: 24px;
  color: #64748b;
  font-size: 0.9rem;
}

.preview-footer strong {
  color: #92400e;
}

.template-section,
.documents-panel,
.settings-strip {
  margin-top: 18px;
}

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

.app-template {
  min-height: 128px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #fbfdff;
}

.template-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
}

.app-template h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.app-template p {
  margin: 0;
  color: #526078;
  font-size: 0.9rem;
}

.app-template strong {
  color: #047857;
  white-space: nowrap;
}

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

.documents-row {
  min-width: 860px;
  display: grid;
  grid-template-columns: 130px minmax(230px, 1.4fr) minmax(160px, 0.9fr) 100px 110px 96px 82px;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid #eef2f7;
}

.documents-row:first-child {
  border-top: 0;
}

.documents-row span,
.documents-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-row span {
  color: #526078;
  font-size: 0.9rem;
}

.documents-row strong {
  color: #111827;
  font-size: 0.92rem;
}

.row-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  color: #3730a3;
  font-size: 0.8rem;
  font-weight: 700;
}

.row-action:hover,
.row-action:focus-visible {
  background: #eef2ff;
}

.table-head span {
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.settings-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.settings-strip p {
  max-width: 560px;
  margin: 0;
  color: #166534;
}

.not-found {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.not-found-panel {
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.not-found-panel h1 {
  margin: 26px 0 8px;
}

.not-found-panel p {
  margin: 0 0 22px;
  color: #526078;
}

.document-type-panel,
.form-main,
.side-panel > section,
.supplier-document {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.document-type-panel,
.form-main,
.side-panel > section {
  padding: 18px;
}

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

.document-type-card {
  min-height: 132px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfdff;
}

.document-type-card:hover,
.document-type-card:focus-visible {
  border-color: #93c5fd;
  background: #f0f9ff;
}

.document-type-card h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 700;
}

.document-type-card p {
  margin: 0;
  color: #526078;
  font-size: 0.88rem;
}

.document-type-card strong {
  color: #0369a1;
  font-size: 0.82rem;
}

.document-form-page {
  width: min(1280px, 100%);
  min-height: 100vh;
  margin-inline: auto;
  padding: 22px 24px 40px;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.form-layout-single {
  grid-template-columns: minmax(0, 1fr);
}

.form-layout-single .side-panel {
  display: none;
}

.form-heading {
  align-items: start;
  margin-bottom: 16px;
}

.dedicated-form {
  gap: 16px;
}

.compact-form {
  gap: 10px;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.people-list span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.8rem;
}

.supplier-documents {
  display: grid;
  gap: 14px;
}

.supplier-document {
  padding: 16px;
}

.supplier-heading,
.repeater-actions,
.expense-grand-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.supplier-heading {
  margin-bottom: 14px;
}

.supplier-heading h2 {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.four-cols {
  grid-template-columns: 0.7fr 1fr 1fr 0.7fr;
}

.expense-items {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.expense-item {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) 72px 80px 94px 94px 94px 94px 38px;
  gap: 8px;
  align-items: center;
}

.expense-item.table-head {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.expense-item input {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  padding: 8px 9px;
  font: inherit;
}

.expense-item input[readonly] {
  background: #f8fafc;
  color: #334155;
}

.danger-button {
  color: #991b1b;
}

.repeater-actions {
  margin-top: 14px;
}

.supplier-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: #526078;
  font-size: 0.84rem;
}

.supplier-totals strong {
  color: #111827;
  font-weight: 700;
}

.add-document-button {
  width: fit-content;
}

.expense-grand-total {
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
}

.expense-grand-total strong {
  font-size: 1.15rem;
  font-weight: 700;
}

.document-detail-page {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin-inline: auto;
  padding: 24px;
}

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

.detail-brand {
  color: #111827;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.detail-panel,
.snapshot-panel {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.detail-panel {
  padding: 22px;
}

.detail-panel h1 {
  max-width: 760px;
  margin: 4px 0 0;
  color: #111827;
  font-size: 1.65rem;
  line-height: 1.25;
}

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

.detail-list div {
  min-height: 72px;
  padding: 14px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfdff;
}

.detail-list dt {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 6px 0 0;
  color: #111827;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.detail-notes {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #e0f2fe;
  border-radius: 8px;
  background: #f0f9ff;
}

.detail-notes h2 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.detail-notes p {
  margin: 0;
  color: #334155;
}

.expense-detail {
  margin-top: 18px;
}

.supplier-summary {
  padding: 14px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfdff;
}

.supplier-summary + .supplier-summary {
  margin-top: 12px;
}

.supplier-summary header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.supplier-summary header strong {
  color: #111827;
  font-weight: 700;
}

.supplier-summary header span {
  color: #526078;
  font-size: 0.84rem;
}

.expense-detail-table {
  overflow-x: auto;
}

.expense-detail-row {
  min-width: 760px;
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) 70px 70px 100px 100px 100px 100px;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid #eef2f7;
  color: #334155;
}

.expense-detail-row:first-child {
  border-top: 0;
}

.expense-detail-row.table-head {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.expense-detail-row strong {
  color: #111827;
  font-weight: 700;
}

.snapshot-panel {
  padding: 18px;
  background: #fefce8;
}

.snapshot-paper {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid #e8d88d;
  border-radius: 8px;
  background: #ffffff;
}

.snapshot-paper h2 {
  margin: 36px 0 12px;
  color: #111827;
  font-size: 1.55rem;
  line-height: 1.25;
}

.snapshot-paper p {
  margin: 0;
  color: #526078;
  font-weight: 800;
}

.snapshot-paper > strong {
  display: block;
  margin-top: 14px;
  color: #047857;
  font-size: 1.45rem;
}

.snapshot-lines {
  display: grid;
  gap: 13px;
  margin-top: 42px;
}

.snapshot-lines span {
  height: 10px;
  border-radius: 999px;
  background: #edf0f5;
}

.snapshot-lines span:nth-child(2) {
  width: 82%;
}

.snapshot-lines span:nth-child(3) {
  width: 68%;
}

.snapshot-lines span:nth-child(4) {
  width: 74%;
}

@media (max-width: 1080px) {
  .product-app {
    grid-template-columns: 1fr;
  }

  .workspace-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .workspace-sidebar.is-open {
    transform: translateX(0);
  }

  .workspace-sidebar .app-menu-close {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 38px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: #262626;
    color: #ffffff;
  }

  .workspace-sidebar .app-menu-close span {
    font-size: 1.45rem;
    line-height: 1;
  }

  .workspace-sidebar .app-menu-close:hover,
  .workspace-sidebar .app-menu-close:focus-visible {
    background: #404040;
  }

  .app-menu-toggle {
    display: inline-grid;
  }
}

@media (max-width: 860px) {
  .workspace-topbar,
  .page-heading,
  .settings-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
  }

  .workspace-actions .btn {
    flex: 1;
  }

  .app-stat-grid,
  .workspace-grid,
  .app-template-grid,
  .document-type-grid,
  .form-layout,
  .detail-layout,
  .detail-list,
  .four-cols {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    align-items: start;
  }
}

@media (max-width: 560px) {
  .workspace-content {
    padding: 20px 14px 32px;
  }

  .workspace-topbar {
    padding-inline: 14px;
  }

  .workspace-search {
    min-width: 0;
  }

  .page-heading h1 {
    font-size: 1.65rem;
  }

  .form-row,
  .app-template,
  .document-type-card {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    width: 100%;
  }

  .preview-sheet dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .document-detail-page {
    padding: 16px 14px 28px;
  }

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

  .document-form-page {
    padding: 16px 14px 30px;
  }

  .supplier-heading,
  .repeater-actions,
  .expense-grand-total {
    align-items: stretch;
    flex-direction: column;
  }

  .expense-items {
    overflow-x: auto;
  }

  .expense-item {
    min-width: 760px;
  }
}
