html, body {
  height: 100%;
}

body {
  margin: 0;
}

.global-loader {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 200;
}

.global-loader.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.global-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
}

#payment-error-dialog .js-dialog-overlay,
#send-invoice-error-dialog .js-dialog-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.global-loader-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 140px;
  padding: 18px 22px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

@media (prefers-color-scheme: dark) {
  .global-loader-center {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(148, 163, 184, 0.25);
  }
  .global-loader-text {
    color: #e2e8f0;
  }
}

.global-loader-spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid rgba(124,29,62,0.2);
  border-top-color: rgba(124,29,62,0.9);
  animation: global-loader-spin 0.8s linear infinite;
  background: transparent;
}

.global-loader-text {
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
  letter-spacing: 0.02em;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Sidebar collapse/expand (offcanvas mode) */
[data-slot="sidebar-gap"] {
  width: var(--sidebar-width);
  transition: width 0.2s ease-linear;
}
.js-sidebar[data-collapsible="offcanvas"] [data-slot="sidebar-gap"] {
  width: 0;
}
.js-sidebar[data-collapsible="offcanvas"] [data-slot="sidebar-container"] {
  left: calc(var(--sidebar-width) * -1);
}

/* Mobile sidebar overlay backdrop */
.js-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0,0,0,0.5);
}

/* Mobile: show sidebar container when sidebar is toggled open */
@media (max-width: 767px) {
  .js-sidebar:not(.hidden) [data-slot="sidebar-container"] {
    display: flex;
  }
}

/* Fix sync dialog styling */
.fix-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.2);
}
.fix-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--destructive) / 0.2);
  background: hsl(var(--destructive) / 0.08);
}
.fix-alert-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--destructive) / 0.12);
}
.fix-alert-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.2rem;
}
.fix-alert-text {
  font-size: 0.9rem;
  color: hsl(var(--destructive));
}
.fix-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.fix-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}
.fix-card {
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  padding: 1rem;
  background: hsl(var(--card));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.fix-card-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  margin: 0;
}
.fix-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
}
.fix-divider::before,
.fix-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: hsl(var(--border));
}
.fix-contact-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: hsl(var(--muted) / 0.3);
}
.fix-contact-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}
.fix-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}
.fix-subheader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.fix-line-table {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.fix-line-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground));
  padding: 0 0.25rem;
}
.fix-line-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: hsl(var(--background));
}
.fix-line-main {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.fix-line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}
.fix-line-subtotal {
  margin-left: auto;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
}
.fix-line-cell {
  display: flex;
  align-items: center;
}
.fix-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.fix-accordion-btn > span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.fix-accordion-body {
  border: 1px solid hsl(var(--border));
  border-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--muted) / 0.2);
}
.fix-code {
  font-size: 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  padding: 0.75rem;
  overflow: auto;
}
.fix-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.25rem;
}
.fix-footer-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.fix-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.fix-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  padding: 1.5rem 0;
}
@media (max-width: 640px) {
  .fix-line-head {
    display: none;
  }
  .fix-line-row {
    grid-template-columns: 1fr;
  }
  .fix-line-cell {
    justify-content: flex-start;
  }
  .fix-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .fix-footer-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
