/* Plugin: InstructorPro Suite | File Version: 2016v3 */
/* ==========================================================================
   EZ2D Finance Manager  Expenses Module v2.1 (FINAL)
   Beautiful, mobile-first design with improved spacing and labeled toggles
   ========================================================================== */

/* ==========================================================================
   HEADER SECTION (Matching Payments)
   ========================================================================== */

.ez2d-expense-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1.5rem !important;
  margin-bottom: 2rem !important;
  padding: 1.5rem !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25) !important;
}

.ez2d-expense-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ez2d-expense-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  flex-shrink: 0;
  font-size: 24px;
}

.ez2d-expense-icon .dashicons {
  width: 32px;
  height: 32px;
  font-size: 32px;
}

.ez2d-expense-title {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: white !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.ez2d-expense-subtitle {
  font-size: 0.9rem !important;
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 0.25rem 0 0 !important;
}

.ez2d-expense-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ==========================================================================
   MODERN BUTTONS (Matching Payments)
   ========================================================================== */

.ez2d-btn-modern {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 1.5rem !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  line-height: 1 !important;
}

.ez2d-btn-modern svg,
.ez2d-btn-modern .dashicons {
  flex-shrink: 0;
}

.ez2d-btn-modern.ez2d-btn-primary {
  background: white !important;
  color: #2563eb !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.ez2d-btn-modern.ez2d-btn-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
}

.ez2d-btn-modern.ez2d-btn-primary:active {
  transform: translateY(0) !important;
}

.ez2d-btn-modern.ez2d-btn-secondary {
  background: #f1f5f9 !important;
  color: #475569 !important;
  box-shadow: none !important;
}

.ez2d-btn-modern.ez2d-btn-secondary:hover {
  background: #e2e8f0 !important;
}

#ez2d-add-expense-btn,
#ez2d-export-btn {
  /* Inherits from .ez2d-btn-modern */
}

/* ==========================================================================
   MODERN CARDS (Totals, Filters, List)
   ========================================================================== */

.ez2d-modern-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.ez2d-modern-card-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #f1f5f9;
}

.ez2d-modern-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.ez2d-modern-card-body {
  padding: 1.5rem 2rem;
}

/* ==========================================================================
   TOTALS SUMMARY (Modern Design)
   ========================================================================== */

.ez2d-sticky-header {
  position: static !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 1.5rem !important;
}

.ez2d-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ez2d-totals > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  transition: all 0.2s ease;
}

.ez2d-totals > div:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.ez2d-totals .lbl {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.ez2d-totals .val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.ez2d-totals .grand {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fbbf24;
}

.ez2d-totals .grand .lbl {
  color: #92400e;
}

.ez2d-totals .grand .val {
  color: #78350f;
  font-size: 1.5rem;
}

@media (max-width: 900px) {
  .ez2d-totals {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .ez2d-totals {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   FILTERS (Modern Design with Consistent Heights)
   ========================================================================== */

.ez2d-filters {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#ez2d-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

#ez2d-filter-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  min-width: 140px;
}

/*  FIX: Consistent height for all filter inputs */
#ez2d-filter-form input,
#ez2d-filter-form select {
  height: 38px;
  padding: 0 0.75rem;
  font-size: 0.9rem;
  color: #0f172a;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1;
}

#ez2d-filter-form input:focus,
#ez2d-filter-form select:focus {
  outline: none;
  background: white;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.ez2d-filter-btn,
.ez2d-reset-btn {
  height: 38px;
  padding: 0 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 1.6rem;
}

.ez2d-filter-btn {
  background: #2563eb;
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.ez2d-filter-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.ez2d-reset-btn {
  background: #f1f5f9;
  color: #475569;
}

.ez2d-reset-btn:hover {
  background: #e2e8f0;
}

@media (max-width: 768px) {
  #ez2d-filter-form label {
    min-width: 100%;
  }
  
  .ez2d-filter-btn,
  .ez2d-reset-btn {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* ==========================================================================
   TABLE (Modern Design)
   ========================================================================== */

.ez2d-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.ez2d-card-padded {
  padding: 0;
}

.ez2d-expenses-list-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #f1f5f9;
}

.ez2d-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.ez2d-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.ez2d-table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.ez2d-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.ez2d-table tbody tr:hover {
  background: #f8fafc;
}

.ez2d-table tbody td {
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  color: #0f172a;
}

.ez2d-table .num {
  text-align: right;
}

.ez2d-table .empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #94a3b8;
  font-size: 0.95rem;
}

/* ==========================================================================
   EXPAND BUTTON (Modern)
   ========================================================================== */

.ez2d-total-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.ez2d-tax-tags {\r\n  display: inline-flex !important;\r\n  gap: 0.4rem;\r\n  align-items: center;\r\n}

.ez2d-tax-tag {\r\n  display: inline-flex !important;\r\n  align-items: center;\r\n  font-size: 0.75rem;\r\n  font-weight: 700;\r\n  line-height: 1;\r\n  padding: 2px 6px;\r\n  border-radius: 6px;\r\n}

.ez2d-tax-tag.gst {
  background: #dbeafe;
  color: #1e40af;
}

.ez2d-tax-tag.pst {
  background: #fce7f3;
  color: #be185d;
}

.ez2d-tax-tag.placeholder {
  background: #f1f5f9;
  color: #cbd5e1;
}

.ez2d-amount {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
}

.ez2d-expand {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #64748b;
}

.ez2d-expand:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
  transform: translateY(-1px);
}

.ez2d-expand.open {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
  transform: rotate(180deg);
}

/* Receipt Indicator */
.ez2d-receipt-indicator {
  color: #22c55e;
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   DETAILS ROW (Expandable)
   ========================================================================== */

.ez2d-details-row {
  display: none;
}

.ez2d-details-row.show {
  display: table-row;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ez2d-details-content {
  background: #f8fafc;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 0.6rem 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.2rem 0.4rem;
  align-items: center;
  font-size: 0.85rem;
  color: #0f172a;
}

.ez2d-details-content > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ez2d-details-content strong {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}

.ez2d-row-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  grid-column: auto;
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
  justify-content: flex-end;
  align-self: center;
  flex-wrap: nowrap;
}

.ez2d-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ez2d-btn.ez2d-edit {
  background: #dbeafe;
  color: #1e40af;
}

.ez2d-btn.ez2d-edit:hover {
  background: #2563eb;
  color: white;
  transform: translateY(-1px);
}

.ez2d-btn.ez2d-del {
  background: #fee2e2;
  color: #b91c1c;
}

.ez2d-btn.ez2d-del:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-1px);
}


.ez2d-expand .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  line-height: 1;
}

.ez2d-expand {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

.ez2d-expand.open {
  color: #1f2937 !important;
  background: #e2e8f0 !important;
  border-color: #e2e8f0 !important;
}

.ez2d-expand:hover {
  color: #374151 !important;
  background: #e2e8f0 !important;
  border-color: #e2e8f0 !important;
}

.ez2d-expand .dashicons {
  color: inherit !important;
}

@media (min-width: 1024px) {
  .ez2d-details-content {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.8rem !important;
  }
  .ez2d-details-content > div {
    min-width: 0;
    flex: 0 0 auto;
  }
  .ez2d-details-content > div strong {
    font-size: 0.68rem;
  }
  .ez2d-details-content > div:not(.ez2d-row-actions):not(.ez2d-receipt-cell) {
    flex: 1 1 0;
  }
  .ez2d-details-content > div:not(.ez2d-row-actions):not(.ez2d-receipt-cell) strong {
    letter-spacing: 0.05em;
  }
  .ez2d-receipt-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .ez2d-row-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    flex: 0 0 auto;
  }
}

/* ==========================================================================
   MODERN MODAL (Matching Payments)
   ========================================================================== */

#ez2d-expense-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

#ez2d-expense-modal.show {
  display: flex !important;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ez2d-modal-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ez2d-modal-content {
  position: relative;
  width: min(600px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#ez2d-expense-modal h3 {
  padding: 1.75rem 2rem 1.25rem;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
}

.ez2d-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  font-size: 24px;
  line-height: 1;
  transition: all 0.2s ease;
}

.ez2d-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: rotate(90deg);
}

body.ez2d-modal-open {
  overflow: hidden;
}

/* ==========================================================================
   MODERN FORM
   ========================================================================== */

#ez2d-expense-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ez2d-modern-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ez2d-modern-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

.ez2d-modern-label-required {
  color: #ef4444;
  font-weight: 700;
}

#ez2d-expense-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
}

#ez2d-expense-form input[type="text"],
#ez2d-expense-form input[type="date"],
#ez2d-expense-form input[type="number"] {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 0.95rem;
  color: #0f172a;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
}

#ez2d-expense-form input:focus {
  outline: none;
  background: white;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

#ez2d-expense-form input::placeholder {
  color: #94a3b8;
}

/*  FIX: Add gap between Date and Total fields */
.ez2d-row-inline {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(200px, 280px);
  gap: 18px;
  justify-content: start;
}

@media (max-width: 640px) {
  .ez2d-row-inline {
    grid-template-columns: 1fr;
  }
}

/*  Individual field wrappers */
.ez2d-date-field,
.ez2d-total-field {
  display: flex;
  flex-direction: column;
}

.ez2d-date-field input,
.ez2d-total-field input {
  max-width: 280px;
}

/* ==========================================================================
   TAX TOGGLES (Apple Style with Labels)  IMPROVED
   ========================================================================== */

.ez2d-tax-toggles {
  display: flex;
  gap: 2rem;
  padding: 1.25rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}/*  ADDED: Visible label text *//* ==========================================================================
   FILE UPLOAD (Modern Dropzone)
   ========================================================================== */

.ez2d-file-wrapper {
  position: relative;
}

.ez2d-ocr-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  z-index: 10;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.ez2d-file-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.ez2d-dropzone {
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.25s ease;
}

.ez2d-dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.ez2d-dropzone.dragover {
  background: #dbeafe;
  border-color: #1d4ed8;
  transform: scale(1.02);
}

.ez2d-dropzone-text {
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.6;
}

.ez2d-dropzone-text small {
  display: block;
  font-size: 0.85rem;
  color: #8b5cf6;
  font-weight: 600;
  margin-top: 0.5rem;
}

.ez2d-dropzone input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

/* File Name Display */
.ez2d-file-name {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  margin-top: 1rem;
}

.ez2d-file-name.show {
  display: flex;
}

.ez2d-file-name .dashicons {
  color: #22c55e;
}

.ez2d-file-name .name-text {
  flex: 1;
  font-size: 0.9rem;
  color: #15803d;
  font-weight: 500;
}

/* Receipt Preview */
.ez2d-receipt-preview {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.ez2d-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.ez2d-preview-header strong {
  font-size: 0.9rem;
  color: #0f172a;
}

.ez2d-preview-remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  border: none;
  border-radius: 6px;
  color: #b91c1c;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ez2d-preview-remove:hover {
  background: #ef4444;
  color: white;
}

#ez2d-preview-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.ez2d-pdf-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.ez2d-pdf-preview .dashicons {
  font-size: 48px;
  color: #ef4444;
}

.ez2d-pdf-preview a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.ez2d-pdf-preview a:hover {
  text-decoration: underline;
}

/* Mobile Upload Button */
@media (max-width: 768px) {
  .ez2d-dropzone {
    display: none;
  }
  
  .ez2d-file-label {
    display: block;
    width: 100%;
    padding: 1rem;
    background: #2563eb;
    color: white;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
  }
  
  .ez2d-file-label:hover {
    background: #1d4ed8;
  }
}

/* ==========================================================================
   FORM ACTIONS
   ========================================================================== */

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

.modal-actions .ez2d-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.modal-actions .ez2d-primary {
  background: #2563eb;
  color: white;
}

.modal-actions .ez2d-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.modal-actions .ez2d-cancel {
  background: #f1f5f9;
  color: #475569;
}

.modal-actions .ez2d-cancel:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   OVERLAYS & SPINNERS
   ========================================================================== */

#ez2d-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999998;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#ez2d-overlay.show {
  display: flex;
  opacity: 1;
}

.ez2d-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success Message */
#ez2d-success {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-weight: 600;
  color: #22c55e;
  animation: successSlideIn 0.3s ease;
}

@keyframes successSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#ez2d-success svg {
  width: 24px;
  height: 24px;
  stroke: #22c55e;
  stroke-width: 3;
  fill: none;
}

/* ==========================================================================
   CONFIRMATION MODAL
   ========================================================================== */

#ez2d-confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#ez2d-confirm-modal.show {
  display: flex;
  opacity: 1;
}

.ez2d-confirm-box {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ez2d-confirm-modal.show .ez2d-confirm-box {
  transform: scale(1);
}

.ez2d-confirm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
  text-align: center;
}

.ez2d-confirm-msg {
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 1.5rem;
  text-align: center;
}

.ez2d-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.ez2d-confirm-actions .ez2d-btn {
  min-width: 120px;
  padding: 0.75rem 1.5rem;
}

.ez2d-danger {
  background: #ef4444;
  color: white;
}

.ez2d-danger:hover {
  background: #dc2626;
}

/* ==========================================================================
   OCR AUTO-FILL ANIMATION
   ========================================================================== */

.ez2d-field-autofilled {
  background: linear-gradient(to right, #f0fdf4 0%, white 100%) !important;
  border-color: #10b981 !important;
  animation: fieldHighlight 0.6s ease-out;
}

@keyframes fieldHighlight {
  0% {
    background: #10b981;
    color: white;
  }
  100% {
    background: linear-gradient(to right, #f0fdf4 0%, white 100%);
    color: inherit;
  }
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .ez2d-expense-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .ez2d-expense-header-content {
    flex-direction: column;
    text-align: center;
  }

  .ez2d-expense-header-actions {
    width: 100%;
    flex-direction: column;
  }

  .ez2d-btn-modern {
    width: 100%;
    justify-content: center;
  }

  .ez2d-modal-content {
    width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }

  #ez2d-expense-form {
    padding: 1.5rem;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .ez2d-btn {
    width: 100%;
  }
  
  .ez2d-tax-toggles {
    gap: 1.5rem;
  }

  /* Table to Cards */
  .ez2d-table {
    border: none;
  }

  .ez2d-table thead {
    display: none;
  }

  .ez2d-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
  }

  .ez2d-table tbody td {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: left !important;
  }

  .ez2d-table tbody td:last-child {
    border-bottom: none;
  }

  .ez2d-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.25rem;
  }

  .ez2d-card-meta {
    display: block !important;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
  }

  .ez2d-meta-line {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  #ez2d-success {
    top: 10px;
    right: 10px;
    left: 10px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .ez2d-expense-title {
    font-size: 1.25rem !important;
  }

  .ez2d-expense-icon {
    width: 40px;
    height: 40px;
  }

  .ez2d-confirm-box {
    padding: 1.5rem;
  }

  .ez2d-confirm-actions {
    flex-direction: column-reverse;
  }

  .ez2d-confirm-actions .ez2d-btn {
    width: 100%;
  }
}

/* ==========================================================================
   MOBILE CARD LAYOUT (Hidden on Desktop)
   ========================================================================== */

.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }
}

/* ======================================================================
   Expenses Overrides (force scroll + spinner + header)
   ====================================================================== */

.ez2d-dashboard-main {
  overflow-y: auto !important;
}

.ez2d-expenses-wrapper {
  overflow: visible !important;
  min-height: 0 !important;
  position: relative !important;
}

/* Ensure hidden modal doesn't block scroll */
#ez2d-expense-modal {
  pointer-events: none;
}
#ez2d-expense-modal.show {
  pointer-events: auto;
}

/* Global-style overlay + success (match other modules) */
#ez2d-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 99998 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0 !important;
  transition: opacity 0.2s ease !important;
}

#ez2d-overlay.show {
  display: flex !important;
  opacity: 1 !important;
}

#ez2d-success {
  position: fixed !important;
  top: 24px !important;
  right: 24px !important;
  z-index: 999999 !important;
  display: none !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 16px 24px !important;
  background: #ffffff !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
  font-weight: 600 !important;
  color: #22c55e !important;
}

#ez2d-success.show {
  display: flex !important;
}

#ez2d-success svg {
  width: 24px !important;
  height: 24px !important;
  stroke: #22c55e !important;
  stroke-width: 3 !important;
  fill: none !important;
}

/* Form sizing tweaks (force) */
#ez2d-expense-form .ez2d-row-inline {
  display: grid !important;
  grid-template-columns: minmax(200px, 260px) minmax(200px, 260px) !important;
  gap: 18px !important;
  justify-content: start !important;
}

#ez2d-expense-form .ez2d-date-field input,
#ez2d-expense-form .ez2d-total-field input {
  max-width: 260px !important;
}

.ez2d-tax-toggles .ez2d-label {
  display: inline-block !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

@media (max-width: 640px) {
  #ez2d-expense-form .ez2d-row-inline {
    grid-template-columns: 1fr !important;
  }
  #ez2d-expense-form .ez2d-date-field input,
  #ez2d-expense-form .ez2d-total-field input {
    max-width: 100% !important;
  }
}

/* Expenses action buttons match Products */
.ez2d-row-actions .ez2d-btn-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 0;
}

.ez2d-row-actions .ez2d-btn-3d:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.8);
}

.ez2d-row-actions .ez2d-btn-3d:active {
  transform: translateY(1px);
}

.ez2d-row-actions .ez2d-btn-3d .dashicons {
  width: 18px;
  height: 18px;
  font-size: 18px;
  line-height: 1;
}


/* Force Date/Total row layout to prevent overlap */
#ez2d-expense-form .ez2d-row-inline {
  display: flex !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
}
#ez2d-expense-form .ez2d-date-field,
#ez2d-expense-form .ez2d-total-field {
  flex: 0 0 260px !important;
}
#ez2d-expense-form .ez2d-date-field input,
#ez2d-expense-form .ez2d-total-field input {
  width: 100% !important;
  max-width: 260px !important;
}

.ez2d-tax-toggles .ez2d-label {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

/* Force labels to appear next to GST/PST toggles */.ez2d-tax-toggles .ez2d-label::before {
  content: attr(data-label);
  display: none;
}

.ez2d-tax-toggles .ez2d-toggle-text {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}/* Tax Tag Visibility Override */
.ez2d-tax-tags { display: inline-flex !important; gap: 0.4rem !important; align-items: center !important; }
.ez2d-tax-tag { display: inline-flex !important; align-items: center !important; font-size: 0.75rem !important; font-weight: 700 !important; line-height: 1 !important; padding: 2px 6px !important; border-radius: 6px !important; }
.ez2d-tax-tag.gst { background: #dbeafe !important; color: #1e40af !important; }
.ez2d-tax-tag.pst { background: #fce7f3 !important; color: #be185d !important; }
.ez2d-tax-tag.placeholder { background: #f1f5f9 !important; color: #94a3b8 !important; }

/* ======================================================================
   Final Mobile Fit Overrides (Expenses List)
   ====================================================================== */
@media (max-width: 900px) {
  .ez2d-expenses-wrapper .ez2d-card.ez2d-expenses-list-card,
  .ez2d-expenses-wrapper .ez2d-expenses-list-card .ez2d-table,
  .ez2d-expenses-wrapper .ez2d-expenses-list-card #ez2d-expenses-body,
  .ez2d-expenses-wrapper .ez2d-expenses-list-card .ez2d-main-row,
  .ez2d-expenses-wrapper .ez2d-expenses-list-card .ez2d-main-row td {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .ez2d-expenses-wrapper .ez2d-table tbody tr {
    overflow: hidden;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-card-meta {
    margin-bottom: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-meta-line {
    display: grid !important;
    grid-template-columns: 90px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 8px !important;
    justify-content: initial !important;
    width: 100% !important;
    padding: 0.28rem 0 !important;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-meta-line strong {
    margin: 0 !important;
    white-space: nowrap;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-meta-value {
    display: block !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    text-align: left !important;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-total-cell {
    width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 8px !important;
  }

  .ez2d-expenses-wrapper .ez2d-table .ez2d-amount {
    white-space: nowrap;
  }
}

