:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #13251f;
  background: #f3f7f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top right, rgba(133, 194, 168, 0.24), transparent 28rem),
    #f3f7f5;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.page-header,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.header-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #327258;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.3rem;
}

.lede,
.panel-heading p {
  color: #587068;
}

.environment-badge,
.user-badge,
.panel-heading > span {
  border: 1px solid #bdd6cb;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #286247;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.user-badge {
  border-color: #d8e3de;
  color: #4f655c;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #286247;
  border-radius: 10px;
  background: #286247;
  color: #fff;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #1f513a;
}

.button-secondary {
  border-color: #bdd6cb;
  background: rgba(255, 255, 255, 0.78);
  color: #286247;
}

.button-secondary:hover {
  background: #eaf3ef;
}

.button-danger-subtle {
  border-color: #e0b7b7;
  background: rgba(255, 255, 255, 0.78);
  color: #8d3838;
}

.button-danger-subtle:hover,
.button-danger:hover {
  background: #7f3030;
  color: #fff;
}

.button-danger {
  border-color: #963a3a;
  background: #963a3a;
}

.button-quiet {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: #4f655c;
  padding-inline: 8px;
}

.button-quiet:hover {
  background: #e7efeb;
  color: #244d3b;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(100%, 470px);
  border: 1px solid rgba(93, 128, 113, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(29, 65, 52, 0.14);
  padding: clamp(28px, 7vw, 48px);
}

.login-brand {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 16px;
  background: #286247;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 850;
}

.login-card h1 {
  font-size: clamp(2rem, 8vw, 3rem);
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bdd0c8;
  border-radius: 10px;
  background: #fbfdfc;
  padding: 10px 12px;
  font: inherit;
}

.login-form input:focus {
  border-color: #286247;
  outline: 3px solid rgba(40, 98, 71, 0.12);
}

.login-button {
  width: 100%;
  margin-top: 6px;
}

.login-note {
  margin: 28px 0 0;
  color: #6b7d76;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.text-link {
  color: #286247;
  font-weight: 700;
}

.message-list {
  margin: 24px 0;
}

.message {
  margin: 0 0 10px;
  border: 1px solid #bdd6cb;
  border-radius: 12px;
  background: #e8f5ee;
  color: #1f5e40;
  padding: 13px 16px;
}

.message-error {
  border-color: #e4bcbc;
  background: #fbe9e9;
  color: #8e3232;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 36px 0 20px;
}

.summary-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 32px 0 18px;
  border: 1px solid #d6e4de;
  border-radius: 14px;
  background: #d6e4de;
}

.workflow-strip div {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 10px;
  background: rgba(255, 255, 255, 0.94);
  padding: 16px 18px;
}

.workflow-strip span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #286247;
  color: #fff;
  font-weight: 800;
}

.workflow-strip small {
  margin-top: 2px;
  color: #64766f;
}

.summary-card {
  min-height: 132px;
  padding: 22px;
  border: 1px solid rgba(93, 128, 113, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 34px rgba(29, 65, 52, 0.07);
}

.summary-card span {
  display: block;
  margin-bottom: 26px;
  color: #64766f;
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-card strong {
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.035em;
}

.summary-card.income strong,
.summary-card.paid strong,
.amount-income {
  color: #14734b;
}

.summary-card.open strong,
.summary-card.review strong {
  color: #9b6910;
}

.summary-card.expense strong,
.amount-expense {
  color: #a84242;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(93, 128, 113, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 50px rgba(29, 65, 52, 0.08);
}

.shell-narrow {
  max-width: 880px;
}

.upload-panel,
.preview-panel {
  margin-top: 36px;
}

.reset-panel {
  margin-top: 36px;
}

.reset-content {
  padding: 30px;
}

.reset-content > p:not(.warning-label) {
  color: #587068;
  line-height: 1.6;
}

.warning-label {
  margin-bottom: 12px;
  color: #963a3a;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reset-actions {
  justify-content: flex-end;
  margin-top: 28px;
}

.invoice-panel {
  margin-bottom: 20px;
}

.invoice-table {
  min-width: 850px;
}

.reconciliation-table {
  min-width: 1380px;
}

.reconciliation-table .invoice-side {
  background: #f7faf8;
}

.reconciliation-table .payment-side {
  background: #f4f8ff;
}

.match-row-automatic,
.match-row-confirmed {
  box-shadow: inset 4px 0 #38a169;
}

.match-row-suggested {
  box-shadow: inset 4px 0 #d69e2e;
  background: #fffdf5;
}

.match-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.match-automatic,
.match-confirmed {
  background: #dff3e8;
  color: #176842;
}

.match-suggested {
  background: #fff0c9;
  color: #825f09;
}

.match-open,
.match-rejected {
  background: #edf0ef;
  color: #5b6a64;
}

.difference-zero {
  color: #14734b;
  font-weight: 800;
}

.match-actions {
  display: flex;
  gap: 8px;
}

.button-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.action-complete {
  color: #64766f;
  font-size: 0.82rem;
}

.customer-cell strong,
.customer-address {
  display: block;
}

.customer-address {
  margin-top: 5px;
  color: #64766f;
  font-size: 0.8rem;
  line-height: 1.45;
}

.technical-details {
  margin-top: 22px;
}

.technical-details > summary {
  color: #49645a;
  font-weight: 750;
  cursor: pointer;
}

.technical-panel {
  margin-top: 12px;
}

.invoice-preview-panel {
  margin-top: 36px;
}

.invoice-form {
  padding: 28px;
}

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

.invoice-form input:not([type="hidden"]),
.invoice-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bdd0c8;
  border-radius: 9px;
  background: #fbfdfc;
  padding: 9px 11px;
  font: inherit;
}

.invoice-form textarea {
  resize: vertical;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.preview-note {
  margin-top: 24px;
  border-radius: 12px;
  background: #edf5f1;
  padding: 16px 18px;
}

.preview-note p {
  margin: 5px 0 0;
  color: #587068;
  font-size: 0.88rem;
}

.invoice-actions {
  justify-content: flex-end;
  margin-top: 24px;
}

.review-shell {
  max-width: 1480px;
}

.review-header {
  margin-bottom: 28px;
}

.review-pending {
  border-color: #e5c473;
  background: #fff8df;
  color: #765408;
}

.review-reason {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 1px solid #ead69b;
  border-radius: 16px;
  background: #fffaf0;
  padding: 18px 20px;
}

.review-reason div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-reason p {
  margin: 0;
  color: #6f5b28;
  font-size: 0.9rem;
}

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

.evidence-card {
  border: 1px solid #dfe7e3;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: 15px 17px;
}

.evidence-card span {
  display: block;
  margin-bottom: 6px;
  color: #64766f;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.evidence-card strong {
  color: #805d13;
}

.evidence-card.evidence-positive {
  border-color: #b9d9ca;
  background: #f2faf6;
}

.evidence-card.evidence-positive strong {
  color: #176842;
}

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

.comparison-panel {
  padding: 24px;
}

.comparison-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.comparison-heading h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.comparison-label {
  margin-bottom: 5px;
  color: #64766f;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.bank-source {
  border-radius: 999px;
  background: #edf3ff;
  color: #385d91;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.comparison-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.comparison-details-payment {
  grid-template-columns: 1fr;
}

.comparison-details div {
  min-width: 0;
  border: 1px solid #e4ebe7;
  border-radius: 12px;
  background: #f8fbf9;
  padding: 13px 14px;
}

.comparison-details dt {
  margin-bottom: 5px;
  color: #64766f;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.comparison-details dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-weight: 700;
}

.pdf-viewer {
  display: block;
  width: 100%;
  min-height: 620px;
  border: 1px solid #d7e2dd;
  border-radius: 12px;
  background: #eef2f0;
}

.decision-help {
  border-radius: 12px;
  background: #f1f5f3;
  padding: 17px 18px;
}

.decision-help p {
  margin: 6px 0 0;
  color: #587068;
  line-height: 1.55;
}

.review-actions {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 20px;
  border: 1px solid #bed3ca;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 48px rgba(29, 65, 52, 0.16);
  padding: 18px 20px;
}

.review-actions p {
  margin: 5px 0 0;
  color: #64766f;
  font-size: 0.86rem;
}

.review-action-buttons {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.review-action-buttons form {
  margin: 0;
}

.upload-form {
  padding: 28px 26px 30px;
}

.form-field label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.file-input {
  display: block;
  width: 100%;
  border: 1px dashed #9bbcaf;
  border-radius: 12px;
  background: #f7faf8;
  padding: 20px;
}

.help-text,
.privacy-note,
.confirmation-bar p {
  color: #64766f;
  font-size: 0.88rem;
}

.help-text {
  margin: 9px 0 0;
}

.field-error {
  margin: 10px 0 0;
  color: #963a3a;
  font-weight: 700;
}

.upload-form .form-actions {
  margin-top: 26px;
}

.privacy-note {
  margin: 18px 4px 0;
}

.confirmation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 20px;
  border: 1px solid #bdd6cb;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  padding: 20px 22px;
}

.confirmation-bar p {
  margin: 5px 0 0;
}

.panel-heading {
  padding: 24px 26px 20px;
  border-bottom: 1px solid #e2ece7;
}

.panel-heading p {
  margin-bottom: 0;
}

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

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

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid #edf2ef;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f9f7;
  color: #5a6b65;
  font-size: 0.74rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
}

tbody tr:hover {
  background: #f8fbf9;
}

td small {
  display: block;
  margin-top: 5px;
  color: #8a5d26;
}

.amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-paid {
  background: #dff3e8;
  color: #176842;
}

.status-open,
.status-partial {
  background: #fff0c9;
  color: #825f09;
}

.status-planned {
  background: #e8e5ff;
  color: #5344a3;
}

.status-cancelled {
  background: #f7dddd;
  color: #963a3a;
}

.empty-state {
  padding: 40px;
  color: #6d7d77;
  text-align: center;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 28px;
  }

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

  .workflow-strip {
    grid-template-columns: 1fr;
  }

  .page-header,
  .panel-heading,
  .confirmation-bar {
    flex-direction: column;
  }

  .header-actions {
    align-items: flex-start;
    flex-direction: column-reverse;
  }

  .confirmation-bar .form-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .confirmation-bar form,
  .confirmation-bar .button {
    width: 100%;
  }

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

  .form-field-wide {
    grid-column: auto;
  }

  .review-reason,
  .review-reason div,
  .review-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .evidence-grid,
  .comparison-grid,
  .comparison-details {
    grid-template-columns: 1fr;
  }

  .pdf-viewer {
    min-height: 520px;
  }

  .review-action-buttons,
  .review-action-buttons form,
  .review-action-buttons .button {
    width: 100%;
  }
}
