/* =============================================================================
   Glassmorphism Primitives + Cards + Buttons
   ============================================================================= */
.glass {
  background: var(--glass-dark);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.glass-light {
  background: var(--glass-light);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.card {
  background: var(--glass-dark);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card__title {
  font-size: var(--fs-h2);
  font-weight: 500;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--mod-crm);
  color: #fff;
  box-shadow: 0 4px 16px -4px rgba(37, 99, 235, 0.6);
}
.btn--primary:hover:not(:disabled) {
  background: #1D4ED8;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.10);
}
.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.btn--danger {
  background: var(--mod-alert);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  background: #B91C1C;
}

/* Headings */
.h1 {
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin: 0;
}
.h2 {
  font-size: var(--fs-h2);
  font-weight: 500;
  margin: 0;
}
.micro {
  font-size: var(--fs-micro);
  font-weight: 300;
  color: var(--text-muted);
}

/* Module Header (used by all module screens) */
.module-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.module-header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.module-header__body {
  flex: 1;
  min-width: 0;
}
.module-header__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* Alert Box */
.alert {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 12px;
}
.alert--error {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.10);
  color: var(--mod-alert);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.boot-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 100vh;
  color: var(--text-muted);
  font-size: 13px;
}

/* Toast (for non-blocking errors during runtime) */
/* =============================================================================
   Tab-Bar (für Detail-Screens)
   ============================================================================= */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border-subtle);
  border-radius: var(--radius-md);
  width: fit-content;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.375rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.tab-btn:hover {
  color: var(--text-primary);
}
.tab-btn[data-active="true"] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.10);
}

/* Module Toggle (Settings) */
.module-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 100ms ease;
}
.module-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}
.module-toggle input[type="checkbox"] {
  width: 32px;
  height: 18px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 120ms ease;
  margin: 0;
}
.module-toggle input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transition: transform 140ms ease;
}
.module-toggle input[type="checkbox"]:checked {
  background: var(--mod-finance);
}
.module-toggle input[type="checkbox"]:checked::before {
  transform: translateX(14px);
}

.toast-error {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
  max-width: 22rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(220, 38, 38, 0.4);
  background: rgba(220, 38, 38, 0.12);
  border-radius: var(--radius-md);
  color: var(--mod-alert);
  font-size: 12px;
  backdrop-filter: blur(var(--glass-blur));
}
