:root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light dark;
  line-height: 1.5;
}

body {
  margin: 0;
  background: #f6f7f9;
  color: #1f2933;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #111827;
    color: #e5e7eb;
  }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

.top-bar {
  background: #223654;
  color: white;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.25rem;
}

.top-bar a {
  color: inherit;
  text-decoration: none;
}

.section {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
  border: 1px solid #d8dee6;
}

@media (prefers-color-scheme: dark) {
  .section {
    background: rgba(17, 24, 39, 0.92);
    border-color: #1f2933;
  }
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.simple-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.simple-form label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.simple-form input[type="number"] {
  width: 4.8rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.4rem;
  border: 1px solid #c3ccd8;
  font-size: 1rem;
  background: inherit;
  color: inherit;
}

.simple-form button {
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 600;
  background: #2d6cdf;
  color: white;
  cursor: pointer;
}

.period-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.period-table th,
.period-table td {
  padding: 0.5rem 0;
  border-bottom: 1px solid #d8dee6;
}

.period-table td:last-child {
  text-align: right;
}

.period-table a {
  color: #2d6cdf;
  text-decoration: none;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.task-table th,
.task-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #d8dee6;
  white-space: nowrap;
}

.task-table th {
  text-align: left;
  font-weight: 600;
  background: rgba(226, 232, 240, 0.6);
}

.task-form {
  display: inline;
}

.task-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

.task-row.completed .task-label,
.task-row.completed .task-category {
  text-decoration: line-through;
  color: #94a3b8;
}

.task-label {
  white-space: nowrap;
  max-width: 100%;
}

.footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #7b8794;
}

/* ========================================
   Wizard Styles
   ======================================== */

.wizard-container {
  display: flex;
  gap: 1.5rem;
}

.wizard-sidebar {
  width: 280px;
  flex-shrink: 0;
}

.wizard-main {
  flex: 1;
  min-width: 0;
}

.wizard-steps {
  list-style: none;
  padding: 0;
  margin: 0;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
}

.wizard-step:hover {
  background: rgba(45, 108, 223, 0.1);
}

.wizard-step.active {
  background: #2d6cdf;
  color: white;
}

.wizard-step.completed {
  color: #10b981;
}

.wizard-step.completed .step-icon::before {
  content: "✓";
}

.step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.wizard-step.active .step-icon {
  background: white;
  color: #2d6cdf;
}

.wizard-step.completed .step-icon {
  background: #10b981;
  color: white;
}

.step-label {
  font-size: 0.9rem;
}

.step-sublabel {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Account step cards */
.account-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid #d8dee6;
}

@media (prefers-color-scheme: dark) {
  .account-card {
    background: rgba(17, 24, 39, 0.92);
    border-color: #1f2933;
  }
}

.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.account-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.account-status {
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.account-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.account-status.in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.account-status.completed {
  background: #d1fae5;
  color: #065f46;
}

/* Dropzone styles */
.statement-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: rgba(248, 250, 252, 0.5);
}

.statement-dropzone:hover,
.statement-dropzone.dz-drag-hover {
  border-color: #2d6cdf;
  background: rgba(45, 108, 223, 0.05);
}

.statement-dropzone .dz-message {
  margin: 0;
}

.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #94a3b8;
}

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

.dropzone-subtext {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* Bank portal links */
.bank-links {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.bank-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #f1f5f9;
  border-radius: 0.5rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.bank-link:hover {
  background: #e2e8f0;
}

.bank-link-icon {
  font-size: 1.1rem;
}

/* Transaction table */
.transaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.transaction-table th {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #64748b;
}

.transaction-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.transaction-table tr:hover {
  background: rgba(45, 108, 223, 0.03);
}

.txn-date {
  white-space: nowrap;
  color: #64748b;
  font-size: 0.85rem;
}

.txn-payee {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.txn-amount {
  text-align: right;
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 0.9rem;
}

.txn-amount.positive {
  color: #10b981;
}

.txn-amount.negative {
  color: #ef4444;
}

/* Category select */
.category-select {
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
  background: white;
  min-width: 180px;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .category-select {
    background: #1f2937;
    border-color: #374151;
    color: inherit;
  }
}

/* Tag pills */
.tag-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.tag-pill.joint {
  background: #fef3c7;
  color: #92400e;
}

.tag-pill.joint.active {
  background: #f59e0b;
  color: white;
}

.tag-pill.healthcare {
  background: #dbeafe;
  color: #1e40af;
}

.tag-pill.healthcare.active {
  background: #3b82f6;
  color: white;
}

.tag-pill.review {
  background: #fce7f3;
  color: #9d174d;
}

.tag-pill.review.active {
  background: #ec4899;
  color: white;
}

/* Reconcile panel */
.reconcile-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.reconcile-item {
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  .reconcile-item {
    background: #1f2937;
  }
}

.reconcile-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.reconcile-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "SF Mono", "Monaco", monospace;
}

.reconcile-value.match {
  color: #10b981;
}

.reconcile-value.mismatch {
  color: #ef4444;
}

/* Transfer merge */
.transfer-match {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (prefers-color-scheme: dark) {
  .transfer-match {
    background: #1f2937;
  }
}

.transfer-side {
  flex: 1;
  padding: 0.75rem;
  background: white;
  border-radius: 0.4rem;
  font-size: 0.85rem;
}

@media (prefers-color-scheme: dark) {
  .transfer-side {
    background: #111827;
  }
}

.transfer-arrow {
  font-size: 1.5rem;
  color: #94a3b8;
}

.transfer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: #2d6cdf;
  color: white;
}

.btn-primary:hover {
  background: #1d5cc9;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-secondary {
  background: #e2e8f0;
  color: #475569;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.4rem;
  border-radius: 0.4rem;
}

/* Progress bar */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Alert/message boxes */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Console/output display */
.console-output {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* Loading spinner */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request.htmx-indicator {
  display: inline-block;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e2e8f0;
  border-top-color: #2d6cdf;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .wizard-container {
    flex-direction: column;
  }
  
  .wizard-sidebar {
    width: 100%;
  }
  
  .reconcile-panel {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Entity Management Styles
   ============================================================================= */

/* Entity type badges */
.entity-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.entity-type-badge.vendor {
  background: #dbeafe;
  color: #1e40af;
}

.entity-type-badge.employee {
  background: #d1fae5;
  color: #065f46;
}

.entity-type-badge.contractor {
  background: #fef3c7;
  color: #92400e;
}

.entity-type-badge.customer {
  background: #ede9fe;
  color: #5b21b6;
}

.entity-type-badge.other {
  background: #f1f5f9;
  color: #475569;
}

/* Inactive row */
.inactive-row {
  opacity: 0.6;
  background: #f8fafc;
}

/* Form styles */
.form-row {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
  color: #9ca3af;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Entity pattern list */
.pattern-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pattern-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.pattern-list li:last-child {
  border-bottom: none;
}

.pattern-code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
}

/* Small buttons */
.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Entity card in transaction table */
.payee-cell {
  min-width: 140px;
}

.payee-suggested {
  background: #fef3c7;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.7rem;
  color: #92400e;
  margin-left: 4px;
}

/* Payee dropdown Tom Select overrides */
.payee-search + .ts-wrapper .ts-control {
  min-height: 24px !important;
  padding: 1px 6px !important;
  font-size: 0.75rem !important;
}

.payee-search + .ts-wrapper .ts-dropdown {
  font-size: 0.75rem;
}

