@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Colors */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: rgba(255, 255, 255, 0.6);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-light: rgba(226, 232, 240, 0.8);
  
  --accent-purple: #7c3aed;
  --accent-purple-hover: #6d28d9;
  --accent-purple-light: rgba(124, 58, 237, 0.1);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Shadows - Modern SaaS multi-layered */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.03), 0 0 0 1px rgba(15, 23, 42, 0.02);
  --shadow-float: 0 20px 40px -8px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 0 4px rgba(124, 58, 237, 0.15);
  
  /* Radii */
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --transition-fluid: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s ease-out;
  --sidebar-width: 260px;
}

[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: rgba(30, 41, 59, 0.7);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --border-light: rgba(255, 255, 255, 0.08);
  
  --accent-purple: #8b5cf6;
  --accent-purple-hover: #7c3aed;
  --accent-purple-light: rgba(139, 92, 246, 0.15);
  
  --shadow-sm: 0 1px 2px rgba(0,0,0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0, 0.5), 0 2px 4px -1px rgba(0,0,0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0, 0.6), 0 4px 6px -2px rgba(0,0,0, 0.4), 0 0 0 1px rgba(255,255,255, 0.05);
  --shadow-float: 0 20px 25px -5px rgba(0,0,0, 0.7), 0 10px 10px -5px rgba(0,0,0, 0.5), 0 0 0 1px rgba(255,255,255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 14px;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,50%,30%,0.05) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,50%,30%,0.05) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,50%,30%,0.05) 0, transparent 50%);
}

code, .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* === TYPOGRAPHY === */
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Das Logo lag als PNG mit eingebranntem weissen Hintergrund vor und sass
   im dunklen Theme in einem hellen Kasten. Beide Fassungen sind jetzt
   freigestellt; die dunkle traegt eine helle Wortmarke. */
.marke-bild { height: 32px; width: auto; display: block; }
.login-card .marke-bild { height: 36px; margin: 0 auto; }
.marke-dunkel { display: none; }
[data-theme="dark"] .marke-hell { display: none; }
[data-theme="dark"] .marke-dunkel { display: block; }



.page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  animation: fadeSlideUp 0.6s var(--transition-fluid) forwards;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

/* === ANIMATIONS === */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* === FLOATING SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  z-index: 10;
  transition: transform 0.3s ease;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
}

.sidebar-brand {
  padding: 2rem 1.75rem 1.5rem;
}

.nav-menu {
  list-style: none;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent-purple);
  background: var(--accent-purple-light);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  transition: var(--transition-fast);
}

.user-profile {
  margin: auto 1rem 1rem 1rem;
  padding: 12px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  background: var(--bg-app);
  border: 1px solid transparent;
}

.user-profile:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 2.5rem 3rem;
  max-width: 1400px;
}

.view { 
  display: none; 
  opacity: 0;
}
.view.active { 
  display: block; 
  animation: fadeSlideUp 0.5s var(--transition-fluid) forwards; 
}

/* === BENTO GRID CARDS === */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 2rem;
}

.bento-col-12 { grid-column: span 12; }
.bento-col-8 { grid-column: span 8; }
.bento-col-6 { grid-column: span 6; }
.bento-col-4 { grid-column: span 4; }
.bento-col-3 { grid-column: span 3; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  transition: transform var(--transition-fluid), box-shadow var(--transition-fluid);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-app);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* STATS */
.stat-group {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: center;
}

.stat-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

/* Status Pulse */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-primary);
  border-radius: 50%;
}

/* === TABLES & LISTS === */
.table-container { width: 100%; overflow-x: auto; margin-top: 1rem; }
.logs-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
.logs-table th { 
  color: var(--text-muted); 
  font-size: 12px; 
  padding: 12px 16px; 
  font-weight: 500; 
  border-bottom: 1px solid var(--border-light);
}
.logs-table td { 
  padding: 16px; 
  font-size: 14px; 
  color: var(--text-primary); 
  vertical-align: middle; 
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}
.logs-table tr { cursor: pointer; }
.logs-table tr:hover td { background: var(--bg-hover); }
.logs-table tr:last-child td { border-bottom: none; }

.log-status { 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  padding: 4px 12px; 
  border-radius: 20px; 
  font-size: 12px; 
  font-weight: 500; 
  border: 1px solid var(--border-light);
}

/* === FORMS & INPUTS === */
.form-group { margin-bottom: 1.5rem; }
.form-label { 
  display: block; 
  font-size: 13px; 
  font-weight: 500; 
  color: var(--text-secondary); 
  margin-bottom: 8px; 
}
.form-control {
  width: 100%; 
  padding: 12px 16px;
  background: var(--bg-card); 
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md); 
  color: var(--text-primary); 
  font-size: 14px; 
  font-family: inherit;
  outline: none; 
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { 
  border-color: var(--accent-purple); 
  box-shadow: var(--shadow-glow); 
}
.form-control[readonly] { 
  background: var(--bg-app); 
  color: var(--text-muted); 
  cursor: not-allowed;
  box-shadow: none;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.5rem 1rem;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  outline: none;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-purple) 0%, #6d28d9 100%);
  color: white;
  border: 1px solid #5b21b6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.15);
  text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(109, 40, 217, 0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-secondary { 
  background: var(--bg-card); 
  color: var(--text-primary); 
  border: 1px solid var(--border-light); 
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-save {
  background: var(--accent-purple);
  color: #fff;
}
.btn-save:hover {
  background: #6D28D9;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.2);
}

/* === AUTH PORTAL === */
body.is-login .sidebar { display: none; }
body.is-login .main-content { 
  margin-left: 0; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  min-height: 100vh; 
  padding: 2rem; 
  /* Das Dashboard deckelt .main-content auf 1400px. Im Login-Zustand
     bleibt der Deckel sonst stehen und die Karte sitzt in einem
     1400px-Kasten am linken Rand statt in der Fenstermitte. */
  max-width: none;
  width: 100%;
}
.login-card { 
  width: 100%; 
  max-width: 440px; 
  padding: 3rem;
  box-shadow: var(--shadow-float);
  border-radius: var(--radius-xl);
}

.auth-tabs {
  display: flex;
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 32px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
}

.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.auth-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 24px;
  display: none;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}
.auth-alert.show { display: flex; animation: fadeSlideUp 0.3s ease-out; }

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.4s ease-out; }

.auth-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 13px;
  transition: color var(--transition-fast);
}
.auth-link:hover { color: var(--text-primary); }

/* === CHARTS (Canvas wrappers) === */
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  margin-top: 1rem;
}
.chart-wrapper-large {
  height: 250px;
}

/* === DOCUMENT MODAL === */
.document-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.4s, opacity 0.4s;
}
.document-modal.open {
  visibility: visible;
  opacity: 1;
}
.document-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.document-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  background: var(--bg-card);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-float);
  padding: 2rem;
}
.document-modal.open .document-modal-content { transform: translateX(0); }

/* Skeleton Loader */
.skeleton-box {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-sm);
  height: 20px;
  width: 100%;
}
@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toggles / Switches */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.05);
}

input:checked + .slider {
  background-color: var(--accent-purple);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   ONBOARDING PAYWALL (Model 1)
   ========================================================================== */
body.is-paywall .sidebar { 
  display: none !important; 
}

body.is-paywall .main-content {
  margin-left: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 100vh !important;
  padding: 3rem 1.5rem !important;
  max-width: none !important;
  width: 100% !important;
}

.paywall-plan-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.paywall-plan-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.4) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.paywall-plan-card.active {
  border-color: var(--accent-purple) !important;
  background: rgba(124, 58, 237, 0.04) !important;
  box-shadow: 0 0 0 2px var(--accent-purple), 0 10px 25px rgba(124, 58, 237, 0.15) !important;
  transform: translateY(-2px);
}

