/* Invoice Axis — Enhanced Expenses Module */

#main-content.ia-exp-active > .page-container {
  display: none !important;
}

#ia-expenses-root {
  width: 100%;
  min-height: 40vh;
  animation: ia-exp-fade 0.25s ease;
}

@keyframes ia-exp-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.ia-exp-page {
  padding-bottom: 2rem;
}

.ia-exp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ia-exp-subtitle {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.92rem;
}

.ia-exp-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ia-exp-header-actions .secondary-button,
.ia-exp-header-actions .add-customer-btn,
.ia-exp-modal-footer .secondary-button,
.ia-exp-modal-footer .primary-button,
.ia-exp-form-actions .secondary-button,
.ia-exp-form-actions .primary-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ia-exp-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1rem;
}

.ia-exp-summary-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ia-exp-summary-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.ia-exp-summary-icon .material-icons {
  font-size: 1.25rem;
}

.ia-exp-summary-label {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 500;
}

.ia-exp-summary-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  margin-top: 0.15rem;
}

.ia-exp-summary-sub {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.15rem;
}

.ia-exp-filters {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
}

.ia-exp-filters-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)) auto auto;
  gap: 0.6rem;
  align-items: center;
}

.ia-exp-filters-grid input,
.ia-exp-filters-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  background: #fff;
}

.ia-exp-search {
  position: relative;
  display: flex;
  align-items: center;
}

.ia-exp-search .material-icons {
  position: absolute;
  left: 0.65rem;
  color: #9ca3af;
  font-size: 1.1rem;
  pointer-events: none;
}

.ia-exp-search input {
  padding-left: 2.2rem !important;
}

.ia-exp-table-card {
  padding: 0;
  overflow: hidden;
}

.ia-exp-table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #eef2f7;
  color: #6b7280;
  font-size: 0.9rem;
}

.ia-exp-table-wrap {
  overflow-x: auto;
}

.ia-exp-table {
  width: 100%;
  border-collapse: collapse;
}

.ia-exp-table th,
.ia-exp-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}

.ia-exp-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ia-exp-table tbody tr:hover {
  background: #fafbff;
}

.ia-exp-desc {
  font-weight: 500;
  color: #111827;
}

.ia-exp-notes-preview {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 0.15rem;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ia-exp-amount {
  text-align: right !important;
  font-weight: 700;
  white-space: nowrap;
}

.ia-exp-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.ia-exp-status-draft { background: #f3f4f6; color: #4b5563; }
.ia-exp-status-submitted { background: #eff6ff; color: #1d4ed8; }
.ia-exp-status-approved { background: #ecfdf5; color: #047857; }
.ia-exp-status-rejected { background: #fef2f2; color: #b91c1c; }
.ia-exp-status-paid { background: #f0fdf4; color: #15803d; }

.ia-exp-receipt-btn {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: default;
  position: relative;
  padding: 0.2rem;
  display: inline-flex;
  align-items: center;
}

.ia-exp-receipt-btn.has-receipt {
  color: #10b981;
  cursor: pointer;
}

.ia-exp-receipt-btn.has-receipt:hover {
  color: #059669;
  transform: scale(1.06);
}

.ia-exp-receipt-count {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #667eea;
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 700;
}

.ia-exp-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6b7280;
}

.ia-exp-empty h3 {
  margin: 0.75rem 0 0.35rem;
  color: #111827;
}

.ia-exp-empty p {
  margin: 0 0 1rem;
}

.ia-exp-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid #eef2f7;
}

.ia-exp-page-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ia-exp-page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  color: #374151;
}

.ia-exp-page-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: #fff;
  font-weight: 700;
}

/* Form */
.ia-exp-form .ia-exp-section {
  margin-bottom: 1rem;
}

.ia-exp-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.ia-exp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.ia-exp-hint {
  margin: 0 0 0.75rem;
  color: #6b7280;
  font-size: 0.88rem;
}

.ia-exp-upload-zone {
  position: relative;
  border: 2px dashed #c7d2fe;
  background: #f8fafc;
  border-radius: 12px;
  padding: 1.4rem;
  text-align: center;
  color: #4b5563;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ia-exp-upload-zone.dragover,
.ia-exp-upload-zone:hover {
  border-color: #667eea;
  background: #eef2ff;
}

.ia-exp-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ia-exp-receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.ia-exp-thumb {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.ia-exp-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: #f8fafc;
}

.ia-exp-thumb-pdf {
  height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: #fef2f2;
  color: #b91c1c;
}

.ia-exp-thumb-name {
  font-size: 0.75rem;
  padding: 0.4rem 0.5rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #374151;
}

.ia-exp-thumb-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem 0.55rem;
}

.ia-exp-thumb-actions .secondary-button {
  flex: 1;
  min-height: 32px;
  padding: 0.2rem;
  justify-content: center;
}

.ia-exp-no-receipts {
  color: #9ca3af;
  font-size: 0.88rem;
  padding: 0.5rem 0;
}

.ia-exp-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.ia-exp-report-card {
  margin-bottom: 1rem;
  padding: 1rem;
}

.ia-exp-report-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

/* Modals */
.ia-exp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: ia-exp-fade 0.18s ease;
}

.ia-exp-modal {
  background: #fff;
  border-radius: 14px;
  width: min(920px, 100%);
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.ia-exp-confirm-modal {
  width: min(420px, 100%);
}

.ia-exp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #eef2f7;
}

.ia-exp-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.ia-exp-modal-header p {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.85rem;
}

.ia-exp-modal-body {
  padding: 1rem;
  overflow: auto;
  flex: 1;
}

.ia-exp-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid #eef2f7;
  background: #fafafa;
}

.ia-exp-icon-btn {
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ia-exp-preview-stage {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #111827;
  border-radius: 10px;
}

.ia-exp-preview-stage img {
  max-width: 100%;
  max-height: 60vh;
  transition: transform 0.15s ease;
  transform-origin: center center;
}

.ia-exp-preview-pdf {
  width: 100%;
  min-height: 60vh;
  border: 0;
  border-radius: 10px;
  background: #f8fafc;
}

.ia-exp-danger {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

.ia-exp-danger-outline {
  color: #dc2626 !important;
  border-color: #fecaca !important;
}

@media (max-width: 1100px) {
  .ia-exp-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ia-exp-filters-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .ia-exp-summary-grid {
    grid-template-columns: 1fr;
  }

  .ia-exp-filters-grid {
    grid-template-columns: 1fr;
  }

  .ia-exp-form-row {
    grid-template-columns: 1fr;
  }

  .ia-exp-table thead {
    display: none;
  }

  .ia-exp-table tr {
    display: block;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
  }

  .ia-exp-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: none;
    padding: 0.35rem 1rem;
  }

  .ia-exp-table td::before {
    content: attr(data-label);
    color: #6b7280;
    font-weight: 600;
    font-size: 0.78rem;
  }

  .ia-exp-amount {
    text-align: right;
  }

  .ia-exp-pager {
    flex-direction: column;
  }
}
