.expenses-page {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.expenses-page,
.expense-layout,
.expense-form-card,
.expense-side-card,
.expense-list-card,
.card {
  min-width: 0;
}

.expenses-hero-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background:
    radial-gradient(circle at top right, rgba(255, 176, 74, 0.18), transparent 32%),
    #ffffff;
}

.expenses-kicker {
  margin: 0 0 4px;
  color: #b26a00;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.expenses-hero-card h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.expenses-hero-card p {
  margin: 6px 0 0;
  color: #6d7788;
  font-weight: 700;
}

.expense-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
  max-width: 100%;
}

.expense-form-card {
  overflow: hidden;
}

.expense-form-card h3,
.expense-side-card h3 {
  margin-top: 0;
}

.summary-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.summary-actions button {
  min-width: 130px;
}

.expense-side-card {
  position: sticky;
  top: 16px;
}

.expense-mini-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.expense-mini-summary > div {
  border: 1px solid #e0e6ef;
  border-radius: 14px;
  padding: 12px;
  background: #fbfcfe;
}

.expense-mini-summary span {
  display: block;
  color: #6d7788;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.expense-mini-summary b {
  font-size: 20px;
  color: #152033;
}

.expense-list-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.expense-export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.expense-export-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 10px;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  width: 100%;
}

.expense-export-btn.excel {
  background: #16803a;
}

.expense-export-btn.zip {
  background: #7c3aed;
}

.expense-export-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.expense-search-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 135px 125px 125px 80px 120px 150px;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.expense-search-panel input,
.expense-search-panel select,
.expense-search-panel button {
  min-width: 0;
  width: 100%;
}

#expenseTableWrap {
  max-width: 100%;
  overflow: hidden;
}

.expense-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  border: 1px solid #e3e8f1;
  border-radius: 14px;
  background: #fff;
}

.expense-table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed !important;
  font-size: 12px;
}

.expense-table th,
.expense-table td {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  vertical-align: top;
  padding: 8px 5px;
}

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

.expense-table th:nth-child(1),
.expense-table td:nth-child(1) {
  width: 96px;
}

.expense-table th:nth-child(2),
.expense-table td:nth-child(2) {
  width: 78px;
}

.expense-table th:nth-child(3),
.expense-table td:nth-child(3) {
  width: 126px;
}

.expense-table th:nth-child(4),
.expense-table td:nth-child(4) {
  width: 115px;
}

.expense-table th:nth-child(6),
.expense-table td:nth-child(6) {
  width: 112px;
}

.expense-table th:nth-child(7),
.expense-table td:nth-child(7),
.expense-table th:nth-child(8),
.expense-table td:nth-child(8),
.expense-table th:nth-child(9),
.expense-table td:nth-child(9) {
  width: 78px;
}

.expense-table th:nth-child(10),
.expense-table td:nth-child(10) {
  width: 64px;
}

.expense-table th:nth-child(11),
.expense-table td:nth-child(11) {
  width: 102px;
}

.expense-table th:nth-child(12),
.expense-table td:nth-child(12) {
  width: 78px;
}

.expense-table .button-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.expense-table .button-group button,
.expense-table .small-btn {
  width: 100%;
  padding: 7px 5px;
  font-size: 12px;
}

.evidence-file-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-category-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff4e2;
  color: #9a5b00;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}

.attachment-picker {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 96px 70px;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

.attachment-picker input[type="file"] {
  min-width: 0;
  width: 100%;
  font-size: 12px;
}

.attachment-picker button {
  width: 100%;
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.attachment-preview {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #ccd3dd;
  background: #fbfcfe;
  color: #64748b;
  line-height: 1.45;
  max-width: 100%;
  overflow: hidden;
}

.attachment-preview.ok {
  border-color: #8ed5a8;
  background: #f0fff5;
  color: #167a3a;
}

.attachment-preview-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 10px;
  min-width: 0;
}

.attachment-preview-title {
  display: block;
  color: #167a3a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-file-name {
  display: block;
  width: 100%;
  max-width: 100%;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-status {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  background: #e8f6ee;
  color: #167a3a;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-open-btn {
  margin-top: 4px;
  width: fit-content;
}

.attachment-image-frame {
  width: 100%;
  max-width: 360px;
  max-height: 280px;
  border: 1px solid #d7e2d9;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-image-preview {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #fff;
}

.attachment-file-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #d7e2d9;
  border-radius: 12px;
  padding: 10px;
  color: #30415c;
}

.attachment-file-card.warning {
  border-color: #ffc7c7;
  background: #fff7f7;
}

.attachment-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eef6ff;
  color: #0b5f99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
}

.attachment-loading,
.attachment-empty {
  color: #7b8797;
  font-size: 12px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.small-btn {
  border: 0;
  border-radius: 8px;
  padding: 7px 9px;
  background: #0b83d8;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.small-text {
  color: #6d7788;
  font-size: 12px;
  margin-top: 3px;
  word-break: break-word;
}

.muted {
  color: #7b8797;
  font-size: 12px;
}

.empty-box {
  border: 1px dashed #ccd3dd;
  padding: 14px;
  border-radius: 10px;
  color: #666;
  background: #fff;
}

@media (max-width: 1100px) {
  .expense-layout,
  .expense-search-panel,
  .attachment-picker {
    grid-template-columns: 1fr;
  }

  .expense-side-card {
    position: static;
  }

  .expenses-hero-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .expenses-page,
  .expense-form-card,
  .expense-side-card,
  .expense-list-card,
  .table-scroll {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
  }

  .attachment-image-frame {
    max-width: 100%;
  }

  .summary-actions {
    justify-content: stretch;
  }

  .summary-actions button {
    width: 100%;
  }
}
