/* AI-Hosting Dashboard – optische Nachbildung */

:root {
  --sidebar-bg: #1b254b;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-text-dim: rgba(255, 255, 255, 0.5);
  --nav-active-bg: #e0f2ff;
  --nav-active-text: #1b254b;
  --nav-icon-ai: #f59e0b;
  --header-bg: #1b254b;
  --main-bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #22c55e;
  --green-hover: #16a34a;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--main-bg);
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, min-width 0.2s ease;
  overflow: hidden;
}

.app.sidebar-hidden .sidebar {
  width: 0;
  min-width: 0;
  border: none;
  box-shadow: none;
}

.org-block {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.org-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.org-image-placeholder {
  aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, #1e3a5f 0%, #2d4a6f 40%, #3d5a80 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.5);
}

.container-icon {
  display: inline-block;
  margin-right: 4px;
  font-size: 12px;
  opacity: 0.9;
}

.org-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text-dim);
  margin-bottom: 2px;
}

.org-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text-dim);
  padding: 8px 20px 4px;
  margin-bottom: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-icon-ai {
  color: var(--nav-icon-ai);
}

.nav-item.active .nav-icon-ai {
  color: var(--nav-icon-ai);
}

.nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active .nav-avatar {
  background: rgba(37, 99, 235, 0.2);
  color: var(--nav-active-text);
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.badge-neu {
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
}

.nav-item.active .badge-neu {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary);
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--main-bg);
}

/* Header */
.header {
  height: 56px;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.logo-m {
  width: 32px;
  height: 32px;
  background: #fff;
  color: var(--sidebar-bg);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.header-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s, color 0.15s;
}

.header-btn svg {
  flex-shrink: 0;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-toggle {
  margin-right: 8px;
}

.sidebar-toggle .sidebar-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

.header-btn.notifications {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
}

.header-right {
  display: flex;
  align-items: center;
}

/* Content */
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page-head {
  margin-bottom: 24px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.btn-actions {
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

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

.tarif-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.tarif-switcher-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.tarif-switcher-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tarif-pill {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tarif-pill:hover {
  color: var(--text);
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.tarif-pill.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.tarif-pill.is-active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.tarif-pill:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  bottom: -2px;
  transition: color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  margin-bottom: -2px;
}

.tab-pane[hidden] {
  display: none !important;
}

/* Tarif */
.tarif-intro {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.tarif-actions {
  margin-bottom: 24px;
}

.gebuchte-tarife {
  margin-bottom: 24px;
}

.gebuchte-tarife-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.gebuchte-tarife-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .gebuchte-tarife-grid {
    grid-template-columns: 1fr;
  }
}

.tarif-gebucht {
  margin-bottom: 0;
}

.tarif-gebucht .card-header-tarif {
  margin-bottom: 12px;
}

.tarif-gebucht-notiz {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tarif-gebucht-notiz-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tarif-gebucht-notiz-text {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.card-header-tarif {
  margin-bottom: 20px;
}

.tarif-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 32px;
  margin-bottom: 20px;
}

.tarif-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tarif-meta-label {
  font-size: 12px;
  color: var(--text-muted);
}

.tarif-meta-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tarif-limits {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tarif-limit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tarif-limit-label {
  font-size: 14px;
  color: var(--text-muted);
}

.tarif-limit-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.tarif-limit-tokens {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.tarif-limit-tokens .tarif-limit-value {
  align-self: flex-end;
}

/* Schulungen & Consulting */
.schulungen-intro {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.schulungen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 800px) {
  .schulungen-grid {
    grid-template-columns: 1fr;
  }
}

.schulung-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.schulung-header {
  margin-bottom: 12px;
}

.schulung-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: 8px;
}

.schulung-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.schulung-desc {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
  flex: 1;
}

.schulung-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.schulung-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.btn-schulung {
  flex-shrink: 0;
}

/* Videotutorials (Udemy-Style) */
.schulungen-videos {
  margin-top: 8px;
}

.schulungen-videos-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.schulungen-videos-desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.video-tutorial-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 700px) {
  .video-tutorial-grid {
    grid-template-columns: 1fr;
  }
}

.video-tutorial-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-tutorial-preview {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #1e293b 0%, #334155 50%, #475569 100%);
}

.video-tutorial-thumb {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.2s;
}

.video-tutorial-preview:hover .video-tutorial-thumb {
  background: rgba(0, 0, 0, 0.5);
}

.video-tutorial-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding-left: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
}

.video-tutorial-preview:hover .video-tutorial-play {
  transform: scale(1.08);
  background: #fff;
}

.video-tutorial-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 4px;
}

.video-tutorial-body {
  padding: 16px 20px;
}

.video-tutorial-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.video-tutorial-meta {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.btn-video-watch {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-video-watch:hover {
  background: var(--primary);
  color: #fff;
}

/* Integrationen */
.integrationen-intro {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.integration-card {
  margin-bottom: 0;
}

.integration-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.integration-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.integration-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.integration-icon-typo3 {
  background: linear-gradient(135deg, #f49700 0%, #ff8700 100%);
  color: #1a1a1a;
}

.integration-typo3-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.integration-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.integration-tagline {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--primary);
  font-style: italic;
}

.integration-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 56ch;
}

.integration-desc strong {
  color: var(--text);
  font-weight: 600;
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.integration-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.integration-link:hover {
  text-decoration: underline;
}

.integration-link .icon-external {
  flex-shrink: 0;
  opacity: 0.8;
}

.integration-link code {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
  color: var(--primary);
}

.integration-title.integration-title-extension {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.integration-preview-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Fake TYPO3 Backend Preview */
.typo3-preview {
  --t3-bg: #1e1e1e;
  --t3-sidebar: #252526;
  --t3-surface: #2d2d30;
  --t3-text: #cccccc;
  --t3-text-dim: #858585;
  --t3-orange: #f49700;
  --t3-border: #3c3c3c;
  background: var(--t3-bg);
  border: 1px solid var(--t3-border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
  color: var(--t3-text);
}

.typo3-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--t3-surface);
  border-bottom: 1px solid var(--t3-border);
}

.typo3-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.typo3-grid-icon {
  color: var(--t3-text-dim);
  font-size: 16px;
}

.typo3-logo {
  font-weight: 700;
  color: var(--t3-orange);
  font-size: 14px;
}

.typo3-version {
  font-size: 12px;
  color: var(--t3-text-dim);
}

.typo3-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.typo3-topbar-icon {
  color: var(--t3-text-dim);
  font-size: 14px;
  cursor: default;
}

.typo3-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--t3-border);
}

.typo3-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #4a4a4a;
  color: var(--t3-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.typo3-username {
  font-size: 13px;
  color: var(--t3-text);
}

.typo3-body {
  display: flex;
  min-height: 320px;
}

.typo3-sidebar {
  width: 220px;
  background: var(--t3-sidebar);
  border-right: 1px solid var(--t3-border);
  padding: 12px 0;
}

.typo3-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.typo3-nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--t3-text-dim);
  padding: 12px 16px 6px;
  margin-top: 4px;
}

.typo3-nav-section:first-child {
  margin-top: 0;
}

.typo3-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--t3-text);
  text-decoration: none;
  transition: background 0.15s;
}

.typo3-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.typo3-nav-item-active {
  background: rgba(244, 151, 0, 0.15);
  color: var(--t3-orange);
}

.typo3-nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.typo3-nav-icon-dash { color: #9d7bd8; }
.typo3-nav-icon-page,
.typo3-nav-icon-forms { color: var(--t3-orange); }
.typo3-nav-icon-view { color: #e51400; }
.typo3-nav-icon-list { color: var(--t3-orange); }
.typo3-nav-icon-ws,
.typo3-nav-icon-file { color: #22c55e; }
.typo3-nav-icon-site { color: #22c55e; }
.typo3-nav-icon-gear { color: #22c55e; }
.typo3-nav-icon-ai { color: var(--t3-orange); }

.typo3-main {
  flex: 1;
  padding: 24px 32px 32px;
  overflow: auto;
  background: var(--t3-bg);
}

.typo3-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.typo3-hero-logo {
  font-weight: 800;
  font-size: 32px;
  color: var(--t3-orange);
  flex-shrink: 0;
}

.typo3-hero-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--t3-text);
}

.typo3-hero-sub {
  margin: 0;
  font-size: 14px;
  color: var(--t3-text-dim);
}

.typo3-modules-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--t3-text);
}

.typo3-modules-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--t3-text-dim);
}

.typo3-modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .typo3-modules-grid {
    grid-template-columns: 1fr;
  }
}

.typo3-module-card {
  background: var(--t3-surface);
  border: 1px solid var(--t3-border);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.typo3-module-card.typo3-module-ai {
  border-color: rgba(244, 151, 0, 0.4);
  background: rgba(244, 151, 0, 0.06);
}

.typo3-module-icon {
  font-size: 28px;
  color: var(--t3-orange);
  line-height: 1;
}

.typo3-module-ai .typo3-module-icon {
  color: var(--t3-orange);
}

.typo3-module-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--t3-text);
}

.typo3-module-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--t3-text-dim);
  flex: 1;
}

.typo3-module-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--t3-orange);
  text-decoration: none;
}

.typo3-module-link:hover {
  text-decoration: underline;
}

.typo3-module-link .icon-external {
  flex-shrink: 0;
  opacity: 0.9;
}

.typo3-module-btn {
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 12px;
  font-family: inherit;
  color: var(--t3-text);
  background: transparent;
  border: 1px solid var(--t3-border);
  border-radius: 4px;
  cursor: pointer;
  margin-top: 4px;
}

.typo3-module-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--t3-text-dim);
}

@media (max-width: 700px) {
  .typo3-sidebar {
    width: 180px;
    padding: 8px 0;
  }

  .typo3-nav-item {
    padding: 6px 12px;
    font-size: 12px;
  }

  .typo3-main {
    padding: 16px 20px;
  }

  .typo3-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .typo3-hero-logo {
    font-size: 24px;
  }
}

.doku-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 13px;
  cursor: default;
}

.doku-hint .icon-external {
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.models-table .doku-hint,
.models-ref-table .doku-hint {
  color: var(--primary);
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header .card-title {
  margin-bottom: 0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 16px;
  max-width: 640px;
}

/* AI-Zugang */
.field {
  margin-top: 12px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-with-icon {
  display: flex;
  align-items: stretch;
  max-width: 480px;
}

.input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: #fff;
  color: var(--text);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-copy {
  padding: 10px 14px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-copy:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-copy .btn-copy-icon,
.btn-copy .btn-copy-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-copy [hidden] {
  display: none !important;
}

/* Whitelabel Block */
.whitelabel-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.whitelabel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.whitelabel-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}

.whitelabel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.whitelabel-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.whitelabel-block .field {
  margin-bottom: 10px;
}

.whitelabel-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.whitelabel-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.whitelabel-link:hover {
  text-decoration: underline;
}

/* API-Fehlerprotokoll */
.api-logs-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.api-logs-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.api-logs-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}

.api-logs-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.api-logs-desc {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.api-logs-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fafafa;
}

.api-logs-table-wrap {
  overflow-x: auto;
}

.api-logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.api-logs-table th,
.api-logs-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.api-logs-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
}

.api-logs-table tbody tr:last-child td {
  border-bottom: none;
}

.api-logs-row-error td {
  background: rgba(220, 38, 38, 0.04);
}

.api-logs-row-ok td {
  background: rgba(34, 197, 94, 0.04);
}

.api-logs-key {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}

.api-logs-table code {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.api-logs-status {
  display: inline-block;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.api-logs-status-200 {
  background: rgba(34, 197, 94, 0.2);
  color: #15803d;
}

.api-logs-status-401 {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.api-logs-status-429 {
  background: rgba(234, 179, 8, 0.2);
  color: #a16207;
}

.api-logs-msg {
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-logs-hint {
  margin: 12px 0 0;
  font-size: 13px;
}

.api-logs-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.api-logs-link:hover {
  text-decoration: underline;
}

/* API-Keys */
.btn-primary {
  padding: 8px 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-secondary {
  padding: 8px 16px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: var(--text-muted);
}

.apikey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.apikey-item {
  display: grid;
  grid-template-columns: 40px 1fr 1fr auto 40px;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.apikey-item:last-child {
  border-bottom: none;
}

.apikey-item:hover {
  background: #f8fafc;
}

.apikey-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: #e0f2fe;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.apikey-info {
  min-width: 0;
}

.apikey-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.apikey-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.apikey-status {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.apikey-status-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.apikey-status-running .apikey-status-inner {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.apikey-status-running .container-icon {
  width: 16px;
  height: 16px;
  margin: 0;
  margin-right: 6px;
  border-radius: 4px;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.apikey-status-running .container-type {
  font-weight: 600;
  color: var(--text);
}

.apikey-status-multi .apikey-status-inner {
  flex-shrink: 0;
}

.apikey-status-multi-hint {
  font-size: 12px;
  color: #15803d;
  font-weight: 500;
  flex-shrink: 0;
}

.apikey-status-multi {
  align-items: center;
  justify-content: center;
}

.apikey-status-none .apikey-status-inner {
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.apikey-status-none {
  display: flex;
  justify-content: center;
  align-items: center;
}

.apikey-status-sep {
  color: #94a3b8;
  margin: 0 2px;
  font-size: 12px;
  user-select: none;
}

.apikey-link-container {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}

.apikey-link-container:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.apikey-tokens {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.apikey-menu {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.apikey-menu:hover {
  background: #e2e8f0;
  color: var(--text);
}

/* Tokenverbrauch */
.stats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.stats-head .card-title {
  margin: 0;
}

.stats-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.btn-stats-reload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-stats-reload:hover {
  background: #dbeafe;
  color: var(--primary-dark);
}

.btn-stats-reload:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-stats-reload.is-loading .btn-stats-reload-icon {
  animation: stats-spin 0.6s linear infinite;
}

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

.btn-stats-reload-icon {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
}

.stats-autoreload {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.stats-autoreload input {
  width: 16px;
  height: 16px;
}

.stats-interval {
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stats-updated {
  font-size: 12px;
  color: var(--text-muted);
}

.token-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.token-label {
  font-size: 14px;
  color: var(--text-muted);
}

.token-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.token-bar {
  height: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  margin-bottom: 16px;
}

.token-bar-inner {
  display: flex;
  min-width: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.token-segment {
  min-width: 2px;
  transition: flex 0.2s;
}

.token-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Pay-per-Token & Warnstufen */
.token-overage-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.token-overage-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.token-overage-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

.token-overage-budget {
  margin-bottom: 18px;
}

.token-overage-budget .field-label {
  margin-bottom: 6px;
}

.token-overage-input-wrap {
  max-width: 280px;
}

.token-overage-input-wrap .input {
  border-right: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.token-overage-input-wrap .btn-secondary {
  flex-shrink: 0;
  padding: 8px 14px;
  margin-left: 8px;
}

.btn-overage-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.token-overage-prices-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.token-overage-table {
  font-size: 13px;
  max-width: 400px;
}

.token-overage-table th,
.token-overage-table td {
  padding: 6px 12px 6px 0;
}

.token-overage-th-price {
  text-align: right;
}

.token-overage-price {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.token-warnings-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.token-warnings-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.token-warnings-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.token-warnings-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.token-warning-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fafafa;
}

.token-warning-item:last-child {
  margin-bottom: 0;
}

.token-warning-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.token-warning-1 .token-warning-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.token-warning-2 .token-warning-badge {
  background: rgba(234, 179, 8, 0.2);
  color: #a16207;
}

.token-warning-3 .token-warning-badge {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.token-warning-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

/* Tokenverbrauch pro Key und Modell */
.models-ref {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 24px;
  margin-bottom: 0;
}

.models-ref-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.models-ref .table-wrap {
  border: none;
  border-radius: 0;
  overflow: visible;
}

.models-ref-table {
  font-size: 13px;
}

.models-ref-table td {
  color: var(--text-muted);
  vertical-align: top;
}

.models-ref-table td:first-child {
  color: var(--text);
  white-space: nowrap;
}

.model-name {
  font-weight: 600;
}

.model-badge-neu {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
  margin-left: 6px;
  white-space: nowrap;
}

.token-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .token-tables {
    grid-template-columns: 1fr;
  }
}

.token-table-block {
  min-width: 0;
}

.token-table-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.token-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.token-table th,
.token-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.token-table th {
  font-weight: 600;
  color: var(--text);
  background: #f8fafc;
}

.token-table td {
  color: var(--text-muted);
}

.token-table tbody tr:last-child th,
.token-table tbody tr:last-child td {
  border-bottom: none;
}

.token-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.token-table-total td {
  font-weight: 600;
  color: var(--text);
  background: #f8fafc;
  padding-top: 12px;
  padding-bottom: 12px;
}

.token-table-key-model .token-table-num {
  white-space: nowrap;
}

/* Content panes (AI-Hosting vs. LeadFyndr) */
.content-pane[hidden] {
  display: none !important;
}

.page-head-leadfyndr .tabs {
  display: none;
}

/* LeadFyndr */
.leadfyndr-search-card {
  margin-bottom: 24px;
}

.leadfyndr-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.leadfyndr-search-input {
  flex: 1;
  min-width: 240px;
}

.leadfyndr-table-card .card-header {
  margin-bottom: 16px;
}

.leadfyndr-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.table-wrap-leads {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leads-table {
  width: 100%;
  min-width: 1400px;
  border-collapse: collapse;
  font-size: 13px;
}

.leads-table th,
.leads-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leads-table th {
  font-weight: 600;
  color: var(--text);
  background: #f8fafc;
  white-space: nowrap;
}

.leads-table td {
  color: var(--text-muted);
}

.leads-table tbody tr:hover {
  background: #f8fafc;
}

.leads-table tbody tr:last-child td {
  border-bottom: none;
}

.leads-voransicht-table {
  min-width: 0;
}

.leads-th-screenshot,
.leads-td-screenshot {
  width: 80px;
  text-align: center;
}

.leads-th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.leads-th-sortable:hover {
  background: #f1f5f9;
}

.sort-indicator {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.35;
  font-size: 10px;
}

.leads-th-sortable.sort-asc .sort-indicator,
.leads-th-sortable.sort-desc .sort-indicator {
  opacity: 1;
}

.leads-th-sortable.sort-asc .sort-indicator::after {
  content: "▲";
}

.leads-th-sortable.sort-desc .sort-indicator::after {
  content: "▼";
}

.leads-thumb {
  display: block;
  width: 64px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: #e2e8f0;
}

.leads-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.leads-thumb-btn {
  padding: 0;
  border: none;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.leads-thumb-btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: scale(1.03);
}

.leads-thumb-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.leads-firma {
  font-weight: 500;
  color: var(--text);
}

.leads-email {
  color: var(--primary);
  text-decoration: none;
}

.leads-email:hover {
  text-decoration: underline;
}

.leads-th-num,
.leads-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.leads-th-score {
  text-align: center;
}

.leads-table .score-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.score-pill.score-green {
  background: #dcfce7;
  color: #166534;
}

.score-pill.score-orange {
  background: #ffedd5;
  color: #c2410c;
}

.score-pill.score-red {
  background: #fee2e2;
  color: #b91c1c;
}

.ssl-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

.ssl-meta {
  font-weight: 400;
  opacity: 0.9;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill.status-aktiv {
  background: #dcfce7;
  color: #166534;
}

.status-pill.status-inaktiv {
  background: #fee2e2;
  color: #b91c1c;
}

.size-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 999px;
  white-space: nowrap;
}

.size-pill.size-klein {
  background: #e0f2fe;
  color: #0369a1;
}

.size-pill.size-mittel {
  background: #fef3c7;
  color: #b45309;
}

.size-pill.size-gross {
  background: #e0e7ff;
  color: #4338ca;
}

.leads-profit-pos {
  color: var(--green) !important;
  font-weight: 500;
}

.leads-profit-neg {
  color: #dc2626 !important;
  font-weight: 500;
}

/* Screenshot-Popup */
.screenshot-popup {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
  visibility: hidden;
}

.screenshot-popup[aria-hidden="false"] {
  pointer-events: auto;
  visibility: visible;
}

.screenshot-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.screenshot-popup[aria-hidden="false"] .screenshot-popup-backdrop {
  opacity: 1;
}

.screenshot-popup-box {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.screenshot-popup[aria-hidden="false"] .screenshot-popup-box {
  transform: scale(1);
  opacity: 1;
}

.screenshot-popup-img {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  vertical-align: middle;
}

.screenshot-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.screenshot-popup-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.screenshot-popup-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Modal: API-Key anlegen (von rechts) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
}

.modal.is-open {
  pointer-events: auto;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal.is-open .modal-backdrop {
  opacity: 1;
}

.modal-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal.is-open .modal-panel {
  transform: translateX(0);
}

/* Modal: Tarif auswählen (zentriert) */
.modal.modal-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-center .modal-backdrop {
  position: absolute;
  inset: 0;
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 48px);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-dialog-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.modal-center .modal-close {
  color: var(--text-muted);
}

.modal-center .modal-close:hover {
  background: #f1f5f9;
  color: var(--text);
}

.modal-dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.tarif-modal-intro {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
}

.tarif-plans {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 500px) {
  .tarif-plans {
    grid-template-columns: 1fr;
  }
}

.tarif-plan {
  cursor: pointer;
  margin: 0;
}

.tarif-plan input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.tarif-plan-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.tarif-plan:hover .tarif-plan-inner {
  border-color: #cbd5e1;
}

.tarif-plan:has(input:checked) .tarif-plan-inner {
  background: #eff6ff;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.tarif-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tarif-plan-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.tarif-plan-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: var(--primary);
}

.tarif-plan-features {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tarif-plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tarif-plan-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  color: var(--primary);
  font-size: 12px;
}

.tarif-plan-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: auto;
}

.tarif-plan-period {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.tarif-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--sidebar-bg);
  color: #fff;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-intro {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
}

.modal-link {
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.modal-link:hover {
  text-decoration: underline;
}

.modal-link .icon-external {
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.modal-field {
  margin-bottom: 24px;
}

.modal-input,
.modal-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
}

.modal-input::placeholder {
  color: var(--text-muted);
}

.modal-input:focus,
.modal-select:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.modal-section-desc {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.modal-section-desc strong {
  color: var(--text);
}

/* Template-Karten */
.modal-section-templates .modal-section-desc {
  margin-bottom: 16px;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
}

.template-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--template-color, #94a3b8);
  opacity: 0;
  transition: opacity 0.2s;
}

.template-card[data-template="openwebui"] { --template-color: #0ea5e9; }
.template-card[data-template="librechat"] { --template-color: #8b5cf6; }
.template-card[data-template="n8n"]       { --template-color: #22c55e; }
.template-card[data-template="opencode"]  { --template-color: #f59e0b; }
.template-card[data-template="perplexica"] { --template-color: #ec4899; }
.template-card[data-template="none"]      { --template-color: #94a3b8; }

.template-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.template-card:hover::before {
  opacity: 0.5;
}

.template-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.template-card input:checked ~ .template-marker,
.template-card:has(input:checked) .template-marker {
  background: radial-gradient(circle at center, #fff 5px, var(--template-color, var(--primary)) 6px);
  border-color: var(--template-color, var(--primary));
}

.template-card:has(input:checked) {
  border-color: var(--template-color, var(--primary));
  background: color-mix(in srgb, var(--template-color, var(--primary)) 8%, #fff);
  box-shadow: 0 0 0 1px var(--template-color, var(--primary));
}

.template-card:has(input:checked)::before {
  opacity: 1;
}

.template-marker {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #fff;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  margin-top: 1px;
}

.template-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.template-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.template-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: var(--text-muted);
}

.template-card:has(input:checked) .template-badge {
  background: color-mix(in srgb, var(--template-color, var(--primary)) 20%, transparent);
  color: var(--text);
}

.template-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  width: 100%;
  padding-left: 28px;
}

.template-none .template-desc {
  padding-left: 28px;
}

.template-none .template-head {
  flex: 1;
}

.template-card.template-none {
  --template-color: #94a3b8;
}

.template-card:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal-select-wrap {
  position: relative;
}

.modal-select {
  appearance: none;
  padding-right: 36px;
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 12px;
}

.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.modal-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.modal-checkbox input:checked + .checkbox-box {
  background: var(--primary);
  border-color: var(--primary);
}

.modal-checkbox input:checked + .checkbox-box::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.modal-checkbox input:focus-visible + .checkbox-box {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.checkbox-label {
  user-select: none;
}
