/* Trial Balance Section Styles - Consistent with other sections */

/* Controls */
.trial-balance-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.tb-source-group {
  flex: 1;
  max-width: 300px;
}

.tb-source-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--warm-700);
}

.tb-source-group label .required {
  color: var(--error);
  margin-left: 2px;
}

.tb-source-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--warm-300);
  border-radius: 6px;
  font-size: 14px;
  color: var(--warm-900);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.tb-source-select:hover {
  border-color: var(--warm-400);
}

.tb-source-select:focus {
  outline: none;
  border-color: var(--info-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tb-source-select optgroup {
  font-weight: 600;
  color: var(--warm-500);
}

.tb-import-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.btn-secondary {
  background: white;
  color: var(--warm-700);
  border: 1px solid var(--warm-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--warm-50);
  border-color: var(--warm-400);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--warm-50);
}

.btn-primary {
  background: var(--info-color);
  color: white;
}

.btn-primary:hover {
  background: var(--info-dark);
}

.btn-outline {
  background: white;
  color: var(--warm-500);
  border: 1px solid var(--warm-200);
}

.btn-outline:hover {
  background: var(--warm-50);
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Status Indicator */
.tb-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--warm-50);
  font-size: 13px;
}

.status-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.status-text {
  color: var(--warm-700);
}

.tb-status-indicator.success .status-text {
  color: var(--primary-600);
}

.tb-status-indicator.error .status-text {
  color: var(--error);
}

/* Modal Styles - Enhanced Brand Design */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalOverlayFadeIn 0.25s ease-out;
}

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

/* Use submission-modal class for consistency */
.submission-modal {
  background: white;
  border-radius: 20px;
  width: 680px;
  max-width: min(90vw, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes slideIn {
  from {
    transform: translateY(-30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--warm-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-radius: 20px 20px 0 0;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h2 {
  margin: 0;
  color: var(--warm-900);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.modal-close {
  background: white;
  border: 2px solid var(--warm-200);
  cursor: pointer;
  color: var(--warm-500);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--error-light);
  color: var(--error);
  border-color: var(--error-border);
  transform: rotate(90deg);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  padding-right: 0.75rem; /* Reduced to make room for wider scrollbar */
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, white 0%, var(--warm-50) 100%);
  max-height: calc(90vh - 160px);
}

/* Custom scrollbar styling - wider and easier to grab (customer feedback) */
.modal-body::-webkit-scrollbar {
  width: 14px; /* Much wider than default ~7px */
}

.modal-body::-webkit-scrollbar-track {
  background: var(--warm-100);
  border-radius: 7px;
  margin: 4px 0;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--warm-300);
  border-radius: 7px;
  border: 3px solid var(--warm-100); /* Creates visual padding */
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--warm-400);
}

/* Firefox scrollbar styling */
.modal-body {
  scrollbar-width: auto;
  scrollbar-color: var(--warm-300) var(--warm-100);
}

/* Enhanced Modal Steps */
.modal-step {
  padding: 0;
}

/* Software Selection Container */
.software-select-container {
  margin-bottom: 1.25rem;
}

/* Step Indicators */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .step-indicator {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.75rem;
  }

  .step-indicator .step-number {
    margin-bottom: 0.25rem;
  }
}

/* Inline select layout */
.step-indicator.inline-select {
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.step-indicator.inline-select .select-label {
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.step-indicator.inline-select .form-select-enhanced {
  flex: 0 1 auto;
  min-width: 180px;
  max-width: 280px;
}

@media (max-width: 640px) {
  .step-indicator.inline-select {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.75rem;
  }

  .step-indicator.inline-select .select-label {
    width: 100%;
    margin-right: 0;
  }

  .step-indicator.inline-select .form-select-enhanced {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green) 0%, var(--primary-600) 100%);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.3s;
}

.step-number.disabled {
  background: var(--warm-200);
  color: var(--warm-400);
}

.select-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--warm-800);
  margin: 0;
  transition: color 0.3s;
}

.select-label.disabled {
  color: var(--warm-400);
}

.form-select-enhanced {
  width: 100%;
  padding: 0.875rem 1.125rem;
  border: 2px solid var(--warm-200);
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--warm-900);
  background: white;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-select-enhanced:hover {
  border-color: var(--green);
  background-color: var(--primary-50);
}

.form-select-enhanced:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.form-select-enhanced optgroup {
  font-weight: 600;
  color: var(--warm-600);
  padding: 4px 0;
}

.form-select-enhanced option {
  padding: 8px;
}

/* Inline select variant for modal */
.form-select-enhanced.inline {
  width: auto;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-width: 1px;
  background-position: right 0.5rem center;
  background-size: 16px;
  border-radius: 8px;
}

/* Upload Section */
.upload-section {
  transition: all 0.3s ease;
}

.upload-section.disabled-section {
  opacity: 1;
}

/* Smooth enable animation */
.upload-section.enabling {
  animation: enablePulse 0.5s ease;
}

@keyframes enablePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.section-divider {
  position: relative;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--warm-200), transparent);
}

.divider-text {
  position: relative;
  padding: 0 1rem;
  background: linear-gradient(180deg, white 0%, var(--warm-50) 100%);
  color: var(--warm-500);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Enhanced Upload Area */
.modal-upload-area-enhanced {
  border: 2px dashed var(--warm-300);
  border-radius: 16px;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--warm-50) 0%, var(--warm-50) 100%);
  transition: all 0.3s;
  position: relative;
}

.modal-upload-area-enhanced.disabled {
  border-color: var(--warm-200);
  background: var(--warm-50);
  pointer-events: none;
}

.modal-upload-area-enhanced:not(.disabled).drag-active {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 50%, var(--primary-50) 100%);
  transform: scale(1.02);
}

/* Disabled Overlay */
.disabled-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(248, 250, 252, 0.95);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 10;
  transition: all 0.3s;
}

.disabled-overlay span {
  color: var(--warm-500);
  font-size: 0.9375rem;
  font-weight: 500;
}

.modal-upload-area-enhanced:not(.disabled) .disabled-overlay {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.modal-upload-area-enhanced.disabled .upload-icon-enhanced path,
.modal-upload-area-enhanced.disabled .upload-icon-enhanced rect {
  stroke: var(--warm-300);
}

.modal-upload-area-enhanced.disabled .upload-text-enhanced {
  opacity: 0.5;
}

.modal-upload-area-enhanced.disabled .paste-header svg path {
  stroke: var(--warm-300);
}

.modal-upload-area-enhanced.disabled .paste-header span {
  color: var(--warm-400);
}

.upload-zone {
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.upload-zone:hover:not(.disabled) {
  background-color: rgba(16, 185, 129, 0.03);
}

.upload-zone.disabled,
.disabled-section .upload-zone,
.modal-upload-area-enhanced.disabled .upload-zone {
  cursor: not-allowed;
  opacity: 0.6;
}

.upload-zone.disabled:hover,
.disabled-section .upload-zone:hover,
.modal-upload-area-enhanced.disabled .upload-zone:hover {
  background-color: transparent;
}

.upload-zone.compact-upload {
  padding: 1.5rem 1rem;
}

.upload-icon-enhanced {
  margin-bottom: 1rem;
}

.compact-upload .upload-icon-enhanced {
  margin-bottom: 0.75rem;
}

.upload-text-enhanced {
  margin-bottom: 0;
}

.upload-text-enhanced .upload-main {
  font-size: 1rem;
  font-weight: 600;
  color: var(--warm-800);
  margin: 0 0 0.375rem 0;
}

.upload-text-enhanced .upload-sub {
  font-size: 0.875rem;
  color: var(--warm-500);
  margin: 0;
}

.link-button-enhanced {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  font-size: inherit;
  transition: all 0.2s;
  padding: 0;
  position: relative;
}

.link-button-enhanced::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transition: transform 0.2s;
}

.link-button-enhanced:hover {
  color: var(--primary-600);
}

.link-button-enhanced:hover::after {
  transform: scaleX(1);
}

/* Paste Zone - Removed to reduce modal height */

.paste-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--warm-500);
}

.modal-paste-enhanced {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--warm-200);
  border-radius: 10px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.8125rem;
  resize: vertical;
  background: white;
  transition: all 0.2s;
}

.modal-paste-enhanced:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Import Actions */
.import-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.btn-primary-enhanced {
  background: linear-gradient(135deg, var(--green) 0%, var(--primary-600) 100%);
  color: white;
  padding: 0.875rem 2rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.btn-primary-enhanced:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-primary-enhanced:disabled {
  background: linear-gradient(135deg, var(--warm-300) 0%, var(--warm-400) 100%);
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn-primary-enhanced:not(:disabled):active {
  transform: translateY(0);
}

/* Upload Area */
.modal-upload-area {
  border: 2px dashed var(--warm-300);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  transition: all 0.2s;
}

.modal-upload-area.drag-active {
  border-color: var(--info-color);
  background: var(--info-light);
}

.upload-icon svg {
  color: var(--warm-400);
}

.upload-text {
  margin-top: 16px;
}

.upload-main {
  font-size: 16px;
  font-weight: 500;
  color: var(--warm-900);
  margin: 0 0 4px 0;
}

.upload-sub {
  font-size: 14px;
  color: var(--warm-500);
  margin: 0 0 8px 0;
}

.upload-sub--meta {
  font-size: 12px;
  color: var(--warm-400);
  margin-top: 8px;
}

/* CSV Template Section - Step 2 when CSV is selected */
.template-section {
  margin-bottom: 20px;
}

.template-download-card {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 12px;
}

.template-download-card__content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.template-download-card__text {
  font-size: 14px;
  color: var(--warm-700);
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.template-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.template-download-btn svg {
  flex-shrink: 0;
}

.link-button {
  background: none;
  border: none;
  color: var(--info-color);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
}

.link-button:hover {
  color: var(--info-dark);
}

.upload-formats {
  font-size: 12px;
  color: var(--warm-400);
  margin: 0;
}

.modal-paste {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--warm-300);
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

/* Mapping Results */
.mapping-results {
  animation: fadeIn 0.3s ease-out;
}

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

/* Info box (matching standard styling from submission-preview.css) */
.info-box {
  border: 1px solid var(--border-color, var(--warm-200));
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.info-box.info {
  background: var(--info-bg);
  border-color: var(--info-dark);
  color: var(--info-dark);
}

.mapping-header {
  margin-bottom: 32px;
}

.mapping-header .header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.mapping-header h4 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--warm-900);
}

.mapping-header p {
  margin: 0;
  color: var(--warm-500);
  font-size: 14px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-sm .btn-icon {
  width: 14px;
  height: 14px;
}

/* Mapping Visualization */
.mapping-visualization {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.mapping-section {
  background: var(--warm-50);
  border-radius: 12px;
  padding: 20px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--warm-500);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--warm-200);
}

.mapping-category {
  margin-bottom: 16px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.mapping-category.highlight {
  background: linear-gradient(135deg, var(--info-light), var(--info-bg));
  border: 1px solid var(--info-border);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--warm-200);
}

.mapping-category.highlight .category-header {
  background: transparent;
  border-bottom: none;
  font-weight: 600;
}

.category-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--warm-700);
}

.category-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--warm-900);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.mapping-rows {
  padding: 8px 0;
}

/* Field-based mapping groups */
.field-mapping-group {
  margin-bottom: 20px;
  background: white;
  border: 1px solid var(--warm-200);
  border-radius: 6px;
  overflow: hidden;
}

.field-mapping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--warm-50);
  border-bottom: 1px solid var(--warm-200);
}

.field-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--info-dark);
}


.account-mapping-row {
  padding: 8px 14px;
  border-bottom: 1px solid var(--warm-100);
  transition: background 0.2s;
}

.account-mapping-row:last-child {
  border-bottom: none;
}

.account-mapping-row:hover {
  background: var(--warm-50);
}

.source-account-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 20px;
}

.account-name {
  font-size: 13px;
  color: var(--warm-500);
}

.account-amount {
  font-size: 13px;
  font-weight: 500;
  color: var(--warm-700);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

/* Unmapped fields */
.field-mapping-group.unmapped {
  opacity: 0.6;
}


.account-mapping-row.empty {
  padding: 6px 14px;
}

.account-name.empty {
  color: var(--warm-400);
  font-style: italic;
}

/* Mapping tables */
.mapping-table-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mapping-section-table {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.mapping-section-table h5 {
  margin: 0;
  padding: 12px 16px;
  background: var(--warm-50);
  border-bottom: 2px solid var(--warm-200);
  font-size: 14px;
  font-weight: 600;
  color: var(--warm-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
}

.mapping-table thead {
  background: var(--warm-50);
}

.mapping-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--warm-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--warm-200);
}

.mapping-table th.field-col {
  width: 35%;
}

.mapping-table th.value-col {
  width: 20%;
  text-align: right;
}

.mapping-table th.source-col {
  width: 45%;
}

.mapping-table tbody tr {
  border-bottom: 1px solid var(--warm-100);
}

.mapping-table tbody tr:hover {
  background: var(--warm-50);
}

.field-name-cell {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--warm-900);
}

.field-value-cell {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--warm-900);
  text-align: right;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.source-accounts-cell {
  padding: 12px 16px;
}

.source-account-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.source-name {
  color: var(--warm-500);
}

.source-value {
  color: var(--warm-700);
  font-weight: 500;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.no-mapping {
  color: var(--warm-400);
  font-style: italic;
  font-size: 13px;
}

/* Summary Bar */
.mapping-summary-bar {
  padding: 16px 20px;
  background: var(--warm-50);
  border-radius: 8px;
  margin-bottom: 20px;
}

.summary-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.stat-item {
  font-size: 14px;
  color: var(--warm-500);
}

.stat-item strong {
  color: var(--warm-900);
  font-weight: 600;
}

.stat-divider {
  color: var(--warm-300);
}

#tax-provision-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-600);
}

#tax-provision-indicator.not-found {
  color: var(--warm-500);
}

#tax-provision-indicator .inline-icon {
  vertical-align: middle;
}

/* Mapping Actions */
.mapping-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--warm-200);
}

.mapping-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--warm-500);
  font-size: 13px;
}

.mapping-hint svg {
  width: 16px;
  height: 16px;
  color: var(--warm-400);
}

.mapping-actions-buttons {
  display: flex;
  gap: 12px;
}

/* Draggable Account Items */
.account-item {
  padding: 8px 12px;
  margin: 4px 8px;
  background: var(--warm-50);
  border: 1px solid var(--warm-200);
  border-radius: 6px;
  cursor: grab;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  user-select: none;
}

/* Drag handle icon */
.account-item .drag-handle {
  color: var(--warm-400);
  flex-shrink: 0;
  transition: color 0.2s;
}

/* Allow/Disallow select styling */
.account-item .allowable-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: white url('data:image/svg+xml;utf8,<svg fill="%236b7280" height="16" viewBox="0 0 20 20" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5.516 7.548l4.484 4.486 4.484-4.486 1.516 1.516-6 6-6-6z"/></svg>') no-repeat right 8px center;
  border: 1px solid var(--warm-200);
  border-radius: 6px;
  color: var(--warm-700);
  font-size: 12px;
  padding: 4px 22px 4px 8px;
  margin-right: 8px;
  min-width: 90px;
  cursor: pointer;
}

.account-item .allowable-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.account-item .allowable-select option[value="disallowable"] {
  color: var(--error);
}

.account-item .allowable-select option:disabled {
  color: var(--warm-500);
  font-weight: 600;
}

.account-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border-width: 2px;
}

.account-item:hover .drag-handle {
  color: var(--green);
}

/* Preserve colored backgrounds on hover for different item types */
.account-item.income-item:hover {
  background: var(--primary-100);
  border-color: var(--green);
}

.account-item.turnover-item:hover {
  background: var(--primary-100);
  border-color: var(--green);
}

.account-item.expense-item:hover {
  background: var(--error-border);
  border-color: var(--error);
}

.account-item.credit-balance:hover {
  background: var(--error-border);
  border-color: var(--error);
}

.account-item.debit-balance:hover {
  background: var(--primary-100);
  border-color: var(--green);
}

.account-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
  background: var(--draft-light);
  border-color: var(--draft);
  transform: rotate(2deg) scale(1.02);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.account-item .account-name {
  flex: 1;
  font-size: 13px;
  color: var(--warm-700);
  font-weight: 500;
}

.account-item .account-amount {
  font-size: 13px;
  color: var(--primary-600);
  font-weight: 600;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

/* Balance Sheet: credit balances (negative values shown in parentheses) */
.account-item.credit-balance {
  background: var(--error-light);
  border-color: var(--error-border);
}

.account-item.credit-balance .account-amount {
  color: var(--error);
  font-weight: 600;
}

/* Balance Sheet: debit balances (positive values, assets) */
.account-item.debit-balance {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.account-item.debit-balance .account-amount {
  color: var(--primary-600);
  font-weight: 600;
}

/* P&L: Income items (credits shown as positive) */
.account-item.income-item {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.account-item.income-item .account-amount {
  color: var(--primary-600);
  font-weight: 600;
}

/* Turnover styling: green background like other income */
.account-item.turnover-item {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.account-item.turnover-item .account-amount {
  color: var(--primary-600);
  font-weight: 600;
}

/* P&L: Expense items (debits shown in parentheses) */
.account-item.expense-item {
  background: var(--error-light);
  border-color: var(--error-border);
}

.account-item.expense-item .account-amount {
  color: var(--error);
  font-weight: 600;
}

/* Drop zones */
.drop-zone {
  min-height: 40px;
  border: 2px dashed transparent;
  border-radius: 8px;
  transition: all 0.3s;
  padding: 4px;
}

.drop-zone.drag-over {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border-color: var(--green);
}

.drop-zone.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--warm-400);
  font-size: 13px;
  font-style: italic;
  padding: 12px;
  border: 2px dashed var(--warm-200);
}

/* Field mapping with drag support */
.field-mapping {
  background: white;
  border: 1px solid var(--warm-200);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s;
}

.field-mapping.drag-target {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--warm-50);
  border-bottom: 1px solid var(--warm-200);
}

.field-name-with-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.field-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--warm-900);
}

.field-total-rounded {
  font-size: 14px;
  font-weight: 600;
  color: var(--warm-900);
}

.field-total-raw {
  font-size: 13px;
  font-weight: 400;
  color: var(--warm-500);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.accounts-list {
  padding: 4px;
  min-height: 40px;
}

/* Loading State */
.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--warm-200);
  border-top-color: var(--info-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.modal-loading p {
  font-size: 14px;
  color: var(--warm-500);
  margin: 0;
}

/* Trial Balance Info Icon */
.tb-info-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  color: var(--green);
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s;
}

.tb-info-icon:hover {
  transform: scale(1.1);
  color: var(--primary-600);
}

.tb-info-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Info Panel */
.tb-info-panel {
  border: 2px dashed var(--green);
  border-radius: 16px;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 20%, var(--primary-50) 100%);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.info-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.info-panel-header h4 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--warm-900);
}

.info-panel-close {
  background: white;
  border: 2px solid var(--warm-200);
  cursor: pointer;
  color: var(--warm-500);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.info-panel-close:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
  transform: rotate(90deg);
}

.info-panel-content {
  text-align: left;
}

.info-description {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--warm-600);
  margin: 0 0 1.5rem 0;
}

.tb-tooltip {
  position: absolute;
  top: calc(100% + 12px);
  left: -180px;
  width: 380px;
  background: white;
  border: 1px solid var(--warm-200);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000;
  pointer-events: none;
  max-height: 500px;
  overflow-y: auto;
}

.tb-info-icon:hover .tb-tooltip,
.tb-info-icon:focus .tb-tooltip,
.tb-tooltip:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Ensure tooltip stays visible when clicking */
.tb-info-icon.tooltip-active .tb-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tooltip-arrow {
  position: absolute;
  top: -6px;
  left: 180px;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: white;
  border-top: 1px solid var(--warm-200);
  border-left: 1px solid var(--warm-200);
}

.tooltip-content h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--warm-800);
}

.tooltip-content p {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--warm-500);
}

.software-instructions {
  background: var(--warm-50);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.software-instructions h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--warm-700);
}

.software-instructions #software-name {
  color: var(--green);
  font-weight: 600;
}

.software-instructions p,
.software-instructions ol {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--warm-600);
}

.software-instructions ol {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}

.software-instructions li {
  margin-bottom: 0.375rem;
}

.software-note {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--warning-dark);
}

.tooltip-note {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  border: 1px solid var(--primary-200);
  border-radius: 8px;
}

.tooltip-note svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.tooltip-note span {
  font-size: 0.8125rem;
  color: var(--primary-900);
  line-height: 1.4;
}

/* Info Note in Panel */
.info-note {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--info-light);
  border-left: 4px solid var(--green);
  border-radius: 4px;
  margin: 1.5rem 0;
}

.info-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--green);
}

.info-note span {
  font-size: 0.875rem;
  color: var(--warm-600);
  line-height: 1.5;
}

.info-continue-btn {
  width: 100%;
  margin-top: 1rem;
  justify-content: center;
  padding: 1rem;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
  .trial-balance-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tb-source-group {
    max-width: none;
  }

  .tb-import-group {
    justify-content: flex-start;
  }

  .info-tooltip {
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 40px);
  }

  .tooltip-arrow {
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
  }

  .mapping-summary {
    flex-direction: column;
    gap: 12px;
  }

  .modal-container {
    max-height: 90vh;
  }
}
