.expenses-dashboard {
  padding: 20px;
}

.dashboard-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1b264f;
}

.financial-year-info {
  font-size: 14px;
  color: #6b7280;
  font-weight: 600;
}

.expenses-summary {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  flex: 1;
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(249, 115, 22, 0.1);
}

.summary-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 32px;
  font-weight: 700;
}

.expenses-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.mileage-expenses-section {
  margin-top: 30px;
  padding: 20px;
}

/* Hide mobile accordion on desktop */
.expenses-mobile-accordion {
  display: none;
}

.expenses-accordion {
  background: #fff;
}

.expense-acc-item {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.expense-acc-item:last-child {
  border-bottom: none;
}

.expense-acc-header {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 15px;
  padding: 16px 20px;
  background: #fff;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease;
}

.expense-acc-header:hover {
  background-color: #f8f9fa;
}

.expense-acc-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.expense-acc-date {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.expense-acc-amount {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.expense-acc-badge {
  font-size: 11px;
  padding: 4px 10px;
}

.expense-acc-caret {
  font-size: 16px;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.expense-acc-open {
  transform: rotate(180deg);
}

.expense-acc-body {
  padding: 0 20px 16px 20px;
  display: grid;
  gap: 12px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
  margin-top: 0;
}

.expense-acc-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 14px;
  gap: 15px;
}

.expense-acc-row-first {
  margin-top: 12px;
}

.expense-acc-row span:first-child {
  color: #6b7280;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 120px;
}

.expense-acc-row span:last-child {
  color: #111827;
  text-align: right;
  flex: 1;
}

.expense-acc-actions {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-danger {
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
  color: white !important;
}

.btn-danger:hover {
  background-color: #b91c1c !important;
  border-color: #b91c1c !important;
}

.expense-acc-receipt {
  cursor: pointer;
  display: inline-block;
}

/* Desktop table view - hide on mobile */
@media (max-width: 991px) {
  .expenses-table {
    display: none;
  }

  .expenses-mobile-accordion {
    display: block;
  }
}

/* Mobile accordion view - hide on desktop */
@media (min-width: 992px) {
  .expenses-mobile-accordion {
    display: none;
  }
}

.table-controls {
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.items-per-page-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #495057;
}

.items-per-page-control label {
  margin: 0;
  font-weight: 500;
}

.items-per-page-select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  min-width: 70px;
}

.items-per-page-select:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.expense-pagination,
.table-pagination {
  padding: 15px 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.pagination-info {
  font-size: 14px;
  color: #6b7280;
}

.pagination-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 4px;
  font-size: 14px;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover:not(:disabled):not(.disabled) {
  background: #f8f9fa;
  border-color: #f97316;
  color: #f97316;
}

.pagination-btn.active {
  background: #f97316;
  border-color: #f97316;
  color: white;
  font-weight: 600;
}

.pagination-btn:disabled,
.pagination-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn .icon {
  font-size: 16px;
}

.expenses-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.expenses-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.expenses-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #495057;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.expenses-table th.text-right {
  text-align: right;
}

.expenses-table th:hover {
  background: #e9ecef;
}

.expenses-table th i {
  margin-left: 5px;
  font-size: 12px;
  opacity: 0.5;
  vertical-align: middle;
}

.expenses-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background 0.2s;
}

.expenses-table tbody tr:hover {
  background: #f8f9fa;
}

.expenses-table td {
  padding: 15px;
  font-size: 14px;
  color: #495057;
  vertical-align: middle;
}

.text-right {
  text-align: right !important;
}

.amount-cell {
  font-weight: 600;
  font-size: 15px;
  color: #f97316;
}

.expense-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.type-parts {
  background: #dbeafe;
  color: #1e40af;
}

.type-mileage {
  background: #fef3c7;
  color: #92400e;
}

.type-tools {
  background: #f3e8ff;
  color: #6b21a8;
}

.type-equipment-hire {
  background: #ddd6fe;
  color: #5b21b6;
}

.type-subcontractor {
  background: #d1fae5;
  color: #065f46;
}

.type-permits-licenses {
  background: #fce7f3;
  color: #9f1239;
}

.type-other {
  background: #e5e7eb;
  color: #374151;
}

.related-job {
  font-size: 13px;
  color: #6b7280;
}

.no-job {
  color: #d1d5db;
  font-style: italic;
}

.actions-column {
  white-space: nowrap;
  text-align: left;
}

.actions-column .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  margin-right: 8px;
}

.actions-column .btn:last-child {
  margin-right: 0;
}

.actions-column .btn i {
  flex-shrink: 0;
}

.loading-message,
.error-message {
  text-align: center;
  padding: 60px 20px;
  font-size: 16px;
  color: #6b7280;
}

.error-message {
  color: #dc2626;
}

.loading-message i,
.error-message i {
  font-size: 24px;
  margin-right: 8px;
}

.no-expenses {
  text-align: center;
  padding: 80px 20px;
  color: #9ca3af;
}

.no-expenses .icon-large {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.no-expenses p {
  font-size: 18px;
  margin: 10px 0;
}

.no-expenses .hint {
  font-size: 14px;
  color: #d1d5db;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 12px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.btn-add-expense {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}

.btn-add-expense:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(249, 115, 22, 0.3);
}

.btn-add-expense:active {
  transform: translateY(0);
}

/* Add Expense Dialog Styles */
.add-expense-dialog {
  min-width: 500px;
}

/* Override Umbraco's absolute positioning for dialog body */
.add-expense-dialog .umb-dialog-body {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
}

.add-expense-dialog .form-group {
  margin-bottom: 20px;
}

.add-expense-dialog label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #111827;
  font-size: 14px;
}

.add-expense-dialog .required {
  color: #ef4444;
  margin-left: 4px;
}

.add-expense-dialog .form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  transition: border-color 0.2s ease;
  font-family: inherit;
  height: 41px;
}

.add-expense-dialog .form-control:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.add-expense-dialog textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.add-expense-dialog .input-group {
  display: flex;
  align-items: stretch;
}

.add-expense-dialog .input-group-addon {
  padding: 10px 12px;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 6px 0 0 6px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
}

.add-expense-dialog .input-group .form-control {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

.add-expense-dialog .input-group .form-control:focus {
  border-left: 1px solid #f97316;
}

.add-expense-dialog .help-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

.add-expense-dialog .form-error {
  padding: 12px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  font-size: 14px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-expense-dialog .form-error .icon {
  font-size: 16px;
}


/* Receipt upload - first field, modern button style */
.add-expense-dialog .form-group-receipt {
  margin-bottom: 24px;
}

.add-expense-dialog .receipt-upload-wrap {
  position: relative;
}

.add-expense-dialog .receipt-upload-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.add-expense-dialog .receipt-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}

.add-expense-dialog .receipt-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(249, 115, 22, 0.3);
}

.add-expense-dialog .receipt-upload-btn .icon {
  font-size: 18px;
}

.add-expense-dialog .receipt-upload-btn span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dialog footer - no overlap, single row */
.add-expense-dialog .add-expense-dialog-footer,
.add-expense-dialog .umb-dialog-footer {
  margin-top: 24px;
  padding: 16px 0 0;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.add-expense-dialog .btn-cancel {
  color: #6b7280;
  margin: 0;
}

.add-expense-dialog .btn-create {
  background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}

.add-expense-dialog .btn-create:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(249, 115, 22, 0.3);
}

/* Receipt column styles */
.expenses-table th:nth-child(6) {
  text-align: center;
}

.receipt-cell {
  text-align: center;
  padding: 15px;
}

.receipt-thumbnail {
  display: inline-block;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid #e5e7eb;
}

.receipt-thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-color: #f97316;
}

.receipt-thumbnail-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  display: block;
}

.receipt-file-icon {
  width: 60px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
  color: #6b7280;
  gap: 4px;
}

.receipt-file-icon .icon {
  font-size: 24px;
}

.receipt-file-ext {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.no-receipt {
  color: #9ca3af;
}

/* Receipt Modal */
.receipt-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.receipt-modal-content {
  position: relative;
  background: white;
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.receipt-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: background-color 0.2s ease;
}

.receipt-modal-close:hover {
  background: rgba(0, 0, 0, 0.9);
}

.receipt-modal-close .icon {
  font-size: 18px;
}

.receipt-modal-image-container {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-modal-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.receipt-modal-file-container {
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-width: 300px;
}

.receipt-modal-file-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #6b7280;
}

.receipt-modal-file-icon p {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.receipt-modal-download {
  padding: 12px 24px;
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .btn-add-expense {
    width: 100%;
    justify-content: center;
  }

  .add-expense-dialog {
    min-width: 100%;
  }

  .receipt-modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .receipt-modal-image-container {
    padding: 10px;
  }

  .receipt-modal-file-container {
    padding: 40px 20px;
    min-width: auto;
  }
}