:root {
  --bg: #0f1117;
  --bg-card: #181b24;
  --bg-hover: #1f2430;
  --border: #2a3040;
  --text: #e8eaef;
  --text-muted: #8b93a7;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.35rem 1.15rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.15rem 0.2rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-title span {
  color: #b84d7a;
  font-weight: 650;
}

.brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.brand-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: -0.55rem 0.2rem 0.25rem;
}

.brand-sources span {
  font-size: 0.65rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  line-height: 1.3;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  text-align: left;
  text-decoration: none;
  display: block;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.15s;
}

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

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-hover);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-user-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.auth-user-email {
  font-size: 0.75rem;
  color: var(--text-muted, #9aa3b5);
  word-break: break-all;
}

.status-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-ok {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.badge-warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--orange);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

/* Main */
.main {
  padding: 1.75rem 2rem;
  overflow-y: auto;
}

.topbar {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.mobile-nav-toggle {
  display: none;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  margin-top: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  padding: 10px 9px;
  flex-direction: column;
  justify-content: space-between;
}

.mobile-nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.sidebar-backdrop {
  display: none;
}

.topbar-head {
  min-width: 0;
  flex: 1;
}

.topbar-head h1 {
  font-size: 1.6rem;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 1rem;
}

.section-head-row .section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.section-head-row .toolbar-group {
  flex: 0 0 auto;
  max-width: 100%;
}

.section-head-row .segmented {
  flex-wrap: nowrap;
}

.section-head-row .segmented-btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
}

.readonly-hint {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.chart-formula {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.meta-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.meta-type-filter {
  align-items: flex-start;
}

.campaign-detail {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.campaign-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.campaign-detail-head h4 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.clickable-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.clickable-row:hover {
  background: rgba(99, 102, 241, 0.08);
}

.clickable-row.selected {
  background: rgba(99, 102, 241, 0.16);
}

.type-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(139, 147, 167, 0.2);
  color: var(--text-muted);
}

.type-pill.type-leads {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.type-pill.type-shopping {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.type-pill.type-pmax {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.type-pill.type-search {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}

.type-pill.type-display {
  background: rgba(244, 114, 182, 0.2);
  color: #f9a8d4;
}

.type-pill.type-other {
  background: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

.type-pill.type-andere {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.scenario-wrap {
  max-height: 280px;
}

.yoy-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.yoy-tables-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.yoy-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.yoy-table-title {
  background: #c9a227;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.45rem;
  flex: 0 0 auto;
  width: 100%;
}

.yoy-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.yoy-table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.yoy-table th {
  background: #1e3a5f;
  color: #fff;
  padding: 0.4rem 0.55rem;
  text-align: right;
  white-space: nowrap;
}

.yoy-table th:first-child,
.yoy-table td:first-child {
  text-align: left;
  background: #2a3040;
  color: #e8eaef;
  font-weight: 600;
}

.yoy-table td {
  padding: 0.4rem 0.55rem;
  text-align: right;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

.yoy-highlight td {
  background: rgba(201, 162, 39, 0.25);
  font-weight: 700;
}

.yoy-gap td {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.08);
}

.yoy-table small {
  font-weight: 400;
  opacity: 0.85;
}

.chart-card canvas {
  cursor: crosshair;
}

.nav a.nav-item {
  text-decoration: none;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 0 0 auto;
  align-self: flex-start;
  align-items: flex-start;
}

.th-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85em;
}

.toolbar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.period-picker {
  position: relative;
}

.period-control {
  position: relative;
}

.period-trigger {
  min-width: 210px;
  text-align: left;
  cursor: pointer;
}

.period-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 270px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0;
}

.period-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.period-option:hover {
  background: var(--bg-hover);
}

.period-option input {
  accent-color: #1877f2;
  width: 16px;
  height: 16px;
}

.period-custom {
  display: grid;
  gap: 0.5rem;
  padding: 0.65rem 0.95rem 0.9rem;
  border-top: 1px solid var(--border);
}

.period-custom label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.analyze-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0 0 1rem;
  width: 100%;
  max-width: none;
}

.analyze-panel-overview {
  width: 100%;
  max-width: none;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.analyze-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.analyze-question {
  width: 100%;
  resize: vertical;
  min-height: 3.25rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  box-sizing: border-box;
}

.analyze-question::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.analyze-question:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.analyze-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 0;
}

.analyze-result {
  margin-bottom: 1.25rem;
  padding: 0 0 1rem;
}

.analyze-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.analyze-loading .spinner-sm {
  flex-shrink: 0;
}

.analyze-body {
  padding: 0 1.25rem 0.75rem;
  line-height: 1.6;
  font-size: 0.95rem;
  color: var(--text);
  max-height: 720px;
  overflow-y: auto;
}

.analyze-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.analyze-msg {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
}

.analyze-msg-user {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.analyze-msg-assistant {
  background: rgba(15, 23, 42, 0.35);
}

.analyze-msg-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.analyze-bubble-text {
  white-space: pre-wrap;
}

.analyze-followup {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.analyze-followup-input {
  min-height: 2.75rem;
}

.analyze-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.analyze-body h1,
.analyze-body h2,
.analyze-body h3,
.analyze-body h4 {
  margin: 1.1rem 0 0.45rem;
  line-height: 1.3;
  color: var(--text);
}

.analyze-body h1 { font-size: 1.2rem; }
.analyze-body h2 { font-size: 1.08rem; }
.analyze-body h3 { font-size: 1rem; }

.analyze-body p {
  margin: 0.4rem 0 0.65rem;
}

.analyze-body ul,
.analyze-body ol {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.35rem;
}

.analyze-body li {
  margin: 0.25rem 0;
}

.analyze-body strong {
  color: #fff;
  font-weight: 600;
}

.analyze-body code {
  font-size: 0.86em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.analyze-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
  font-size: 0.88rem;
}

.analyze-body th,
.analyze-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  text-align: left;
}

.analyze-body th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}

.analyze-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.analyze-note {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.analyze-question-echo {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid #6366f1;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.segmented {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  height: auto;
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-sizing: border-box;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  align-self: center;
  height: auto;
  min-height: 0;
  max-height: 2.4rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.segmented-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.segmented-btn.active[data-brand="kosmetik"] {
  background: linear-gradient(135deg, #ec4899, #db2777);
  box-shadow: 0 2px 12px rgba(236, 72, 153, 0.35);
}

.segmented-btn.active[data-brand="bbc"] {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

.segmented-btn.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.seg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.seg-all { background: linear-gradient(135deg, #6366f1, #a855f7); }
.seg-kosmetik { background: #ec4899; }
.seg-bbc { background: #f59e0b; }

.filter-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0.65rem 0.95rem;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 8px;
  line-height: 1.45;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary {
  background: var(--accent);
  color: white;
}

.btn-secondary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  width: 100%;
}

.btn-lg {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  margin-top: 1rem;
}

.btn-google {
  background: #fff;
  color: #1f1f1f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  border: 1px solid #dadce0;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.link {
  color: var(--accent-hover);
  font-size: 0.8rem;
  display: inline-block;
  margin-top: 0.25rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-content h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.modal-lead {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setup-step {
  display: flex;
  gap: 0.85rem;
  font-size: 0.88rem;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.setup-step code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  word-break: break-all;
}

.upload-zone {
  display: block;
  margin-top: 0.5rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
}

.upload-status {
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.upload-status.ok { color: var(--green); }
.upload-status.error { color: var(--red); }

.select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

.section-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-charts {
  padding: 0 1.25rem 1rem;
  margin: 0;
}

#section-meta .kpi-grid {
  padding: 0 1.25rem 1rem;
  margin-bottom: 0;
}

#section-meta .table-wrap {
  border-top: 1px solid var(--border);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.kpi-card-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.kpi-card-split .kpi-label {
  margin-bottom: 0.75rem;
}

.kpi-split-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.kpi-split-cell {
  padding: 0.8rem 0.65rem;
}

.kpi-split-cell + .kpi-split-cell {
  border-left: 1px solid var(--border);
}

.kpi-split-head {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}

.kpi-split-value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kpi-value.accent { color: var(--accent-hover); }
.kpi-value.green { color: var(--green); }
.kpi-value.orange { color: var(--orange); }

/* Cards & Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.chart-card {
  position: relative;
  overflow: hidden;
}

#page-newsletter .chart-card.chart-wide:has(#nl-lag-heatmap),
#page-newsletter .chart-card.chart-wide .nl-lag-heatmap {
  overflow: auto;
}

.chart-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a855f7, transparent);
  opacity: 0.7;
}

.chart-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.chart-card canvas {
  max-height: 300px;
}

.chart-html-tooltip {
  position: absolute;
  z-index: 10000;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  background: rgba(15, 17, 23, 0.96);
  border: 1px solid #2a3040;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #e8eaef;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-wide canvas {
  max-height: 240px;
}

.nl-id {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  margin-right: 0.4rem;
}

.nl-lag-heatmap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 680px;
}

.nl-lag-heatmap-wrap {
  width: 100%;
  padding-top: 0.25rem;
}

.nl-lag-heatmap-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

.nl-lag-heatmap-table th,
.nl-lag-heatmap-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.35rem;
  text-align: center;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.nl-lag-heatmap-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}

.nl-lag-col-newsletter {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 3;
  width: 220px;
  min-width: 180px;
  max-width: 260px;
  text-align: left !important;
  white-space: nowrap;
}

.nl-lag-heatmap-table thead th.nl-lag-col-newsletter {
  z-index: 4;
}

.nl-lag-heatmap-table th:not(.nl-lag-col-newsletter),
.nl-lag-heatmap-table td:not(.nl-lag-col-newsletter) {
  width: calc((100% - 220px) / 12);
}

.nl-lag-cell {
  cursor: pointer;
  user-select: none;
}

.nl-lag-sent {
  outline: 2px solid rgba(236, 72, 153, 0.75);
  outline-offset: -2px;
}

.nl-lag-sent-dot {
  font-size: 0.7rem;
  color: rgba(236, 72, 153, 0.95);
  font-weight: 800;
}

.nl-lag-cell-value {
  font-variant-numeric: tabular-nums;
}

.gsc-breakdown-grid {
  align-items: stretch;
}

.gsc-donut-card {
  padding: 1.1rem 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.gsc-donut-card h3 {
  margin-bottom: 0.75rem;
}

.gsc-donut-layout {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  gap: 0.75rem 0.9rem;
  align-items: center;
  flex: 0 0 auto;
}

.pd-funnel-card .gsc-donut-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.25rem;
  width: 100%;
  margin: 0.35rem auto 0;
}

.pd-funnel-card .gsc-donut-canvas-wrap {
  width: 210px;
  max-width: 210px;
  flex: 0 0 auto;
  margin: 0;
}

.pd-funnel-card .gsc-donut-legend {
  flex: 0 1 auto;
  width: auto;
  min-width: 9rem;
}

/* JTL Donut: etwas größer, Legende neben Farbquadrat */
#page-jtl .gsc-donut-layout {
  grid-template-columns: minmax(120px, 140px) minmax(0, 1fr);
  gap: 0.65rem 0.85rem;
  align-items: center;
}

#page-jtl .gsc-donut-canvas-wrap {
  max-width: 160px;
}

#page-jtl .gsc-donut-legend {
  gap: 0.45rem;
}

#page-jtl .gsc-donut-legend li {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.3;
}

#page-jtl .gsc-donut-legend .swatch {
  margin-top: 0;
  flex: 0 0 auto;
}

#page-jtl .gsc-donut-legend .meta {
  flex: 1 1 auto;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: normal;
}

#page-jtl .gsc-breakdown-grid {
  align-items: stretch;
}

#page-jtl .gsc-donut-card {
  align-self: stretch;
  min-height: 0;
  padding: 1rem;
}

/* JTL: beide Donuts in einer Karte */
#page-jtl .jtl-donuts-card {
  padding: 1rem 1.15rem 1.05rem;
  height: auto !important;
  min-height: 0 !important;
  align-self: stretch;
}

#page-jtl .jtl-donuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.75rem;
  align-items: start;
}

#page-jtl .jtl-donut-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#page-jtl .jtl-donut-pane > h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  line-height: 1.3;
}

#page-jtl .jtl-donut-sub {
  margin: 0 0 0.65rem;
  min-height: 1.2rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text-muted);
}

#page-jtl .jtl-donut-sub strong {
  color: var(--text);
  font-weight: 600;
}

#page-jtl .jtl-donut-pane .gsc-donut-layout {
  flex: 0 0 auto !important;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 0.55rem 0.85rem;
  align-items: start;
  width: 100%;
}

#page-jtl .jtl-donut-pane .gsc-donut-canvas-wrap {
  width: 140px;
  max-width: 140px;
  aspect-ratio: 1;
}

#page-jtl .jtl-donut-pane .gsc-donut-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#page-jtl .jtl-channel-card,
#page-jtl .jtl-attr-chart-card {
  display: flex;
  flex-direction: column;
  height: auto;
  overflow: visible;
}

#page-jtl .jtl-attr-chart-card .gsc-donut-layout,
#page-jtl .jtl-attr-chart-card .gsc-donut-canvas-wrap {
  overflow: visible;
}

#page-jtl .jtl-orders-card {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 1rem 1.1rem;
  width: 100%;
}

#page-jtl .jtl-orders-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

#page-jtl .jtl-orders-head > h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

#page-jtl .jtl-orders-filters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  width: max-content;
  max-width: 100%;
}

#page-jtl .jtl-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  width: max-content;
  max-width: 100%;
}

#page-jtl .jtl-filter-row .toolbar-label {
  padding-top: 0;
  line-height: 1.2;
  flex: 0 0 auto;
  min-width: 3.4rem;
}

#page-jtl .jtl-filter-row .segmented {
  flex: 0 0 auto;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
}

#page-jtl #jtl-quelle-filter .segmented-btn,
#page-jtl #jtl-source-filter .segmented-btn {
  white-space: nowrap;
}

#page-jtl #jtl-orders-wrap {
  flex: 0 1 auto;
  max-height: min(58vh, 560px);
  min-height: 0;
  overflow: auto;
}

#page-jtl #jtl-orders-wrap table {
  margin: 0;
}

#page-jtl #jtl-samples-table {
  table-layout: fixed;
  width: 100%;
}

#page-jtl #jtl-samples-table th,
#page-jtl #jtl-samples-table td {
  padding: 0.4rem 0.55rem;
  line-height: 1.3;
}

#page-jtl #jtl-samples-table th:nth-child(1),
#page-jtl #jtl-samples-table td:nth-child(1) {
  width: 15%;
}

#page-jtl #jtl-samples-table th:nth-child(2),
#page-jtl #jtl-samples-table td:nth-child(2) {
  width: 12%;
}

#page-jtl #jtl-samples-table th:nth-child(3),
#page-jtl #jtl-samples-table td:nth-child(3) {
  width: 30%;
}

#page-jtl #jtl-samples-table th:nth-child(4),
#page-jtl #jtl-samples-table td:nth-child(4) {
  width: 22%;
}

#page-jtl #jtl-samples-table th:nth-child(5),
#page-jtl #jtl-samples-table td:nth-child(5) {
  width: 21%;
  text-align: right;
}

#page-jtl .jtl-double-tracked {
  margin-top: 0;
  padding: 1rem 1.15rem 1.1rem;
  min-width: 0;
}

#page-jtl .jtl-double-tracked[hidden] {
  display: none !important;
}

#page-jtl .jtl-double-list {
  grid-template-columns: 1fr;
  gap: 0.7rem;
  max-height: min(360px, 42vh);
  overflow: auto;
}

#page-jtl .jtl-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

#page-jtl .jtl-bottom-grid:has(#jtl-double-tracked[hidden]) {
  grid-template-columns: 1fr;
}

#page-jtl .jtl-attr-card {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  min-width: 0;
}

#page-jtl .jtl-attr-grid {
  align-items: stretch;
}

@media (max-width: 900px) {
  #page-jtl .jtl-donuts-grid,
  #page-jtl .jtl-bottom-grid {
    grid-template-columns: 1fr;
  }
}

#page-jtl .jtl-overtrack {
  margin: 1.25rem 0 0;
}

#page-jtl .kpi-grid {
  grid-template-columns: repeat(4, minmax(240px, 1fr));
}

@media (max-width: 1200px) {
  #page-jtl .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#page-jtl .kpi-split-head {
  font-size: 0.62rem;
  line-height: 1.25;
  hyphens: auto;
}

#page-jtl .kpi-split-value {
  font-size: 0.95rem;
}

.jtl-attr-card {
  margin: 0;
}

.jtl-attr-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.jtl-attr-card .jtl-attr-head h3 {
  margin: 0;
  margin-bottom: 0;
}

.jtl-attr-summary,
.jtl-attr-detail {
  display: grid;
  gap: 0.65rem;
}

.jtl-attr-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0.75rem;
  align-items: stretch;
}

.jtl-attr-detail {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.jtl-attr-channels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: stretch;
}

.jtl-attr-channels > .jtl-attr-stat {
  min-height: 100%;
}

@media (max-width: 1100px) {
  .jtl-attr-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .jtl-attr-channels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .jtl-attr-summary {
    grid-template-columns: 1fr;
  }
}

.jtl-attr-stat {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.jtl-attr-compact .jtl-attr-value {
  font-size: 1.1rem;
}

.jtl-attr-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.jtl-attr-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.jtl-attr-pct {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.jtl-attr-net {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.jtl-attr-ok {
  border-color: rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.06);
}

.jtl-attr-ok .jtl-attr-value {
  color: #0f766e;
}

.jtl-attr-miss {
  border-color: rgba(148, 163, 184, 0.45);
}

.jtl-attr-meta-block {
  border-color: rgba(24, 119, 242, 0.4);
  background: rgba(24, 119, 242, 0.06);
}

.jtl-attr-meta-block .jtl-attr-value {
  color: #1877f2;
}

.jtl-attr-pd-block {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.06);
}

.jtl-attr-pd-block .jtl-attr-value {
  color: #fbbf24;
}

.jtl-attr-meta-split {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(24, 119, 242, 0.25);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.jtl-attr-pd-block .jtl-attr-meta-split {
  border-top-color: rgba(245, 158, 11, 0.28);
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.jtl-attr-pd-block .jtl-attr-meta-row-val {
  color: #fcd34d;
}

.jtl-attr-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.35);
}

.jtl-attr-meta-row-lab {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.jtl-attr-meta-row-val {
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
  line-height: 1.2;
}

.jtl-attr-meta-row-net {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.jtl-attr-google {
  border-color: rgba(66, 133, 244, 0.35);
  background: rgba(52, 168, 83, 0.05);
}

.jtl-attr-google .jtl-attr-value {
  color: #34a853;
}

.jtl-attr-newsletter {
  border-color: rgba(192, 38, 108, 0.35);
  background: rgba(192, 38, 108, 0.05);
}

.jtl-attr-newsletter .jtl-attr-value {
  color: #c0266c;
}

.jtl-attr-both {
  border-color: rgba(132, 24, 83, 0.3);
  background: rgba(132, 24, 83, 0.05);
}

.jtl-attr-both .jtl-attr-value {
  color: #841853;
}

.jtl-attr-legend-total {
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.jtl-attr-legend-total .meta {
  font-size: 0.82rem !important;
  color: var(--text) !important;
}

#page-jtl .jtl-double-tracked {
  margin-top: 0;
  padding: 0.85rem 0.95rem;
}

#page-jtl .jtl-double-tracked[hidden] {
  display: none !important;
}

.jtl-double-head {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.jtl-double-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
  line-height: 1.4;
}

.jtl-double-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
}

.jtl-double-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.jtl-double-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.85rem;
  margin-bottom: 0.55rem;
}

.jtl-double-nr {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}

.jtl-double-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.jtl-double-net {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.jtl-double-camp-row {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
  margin-top: 0.28rem;
  font-size: 0.84rem;
  line-height: 1.4;
}

.jtl-double-camp-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.1rem;
}

.jtl-double-camp-name {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.jtl-double-meta {
  color: #93c5fd;
}

.jtl-double-google {
  color: #86efac;
}

.jtl-double-empty {
  color: var(--text-muted);
}

.jtl-overtrack {
  margin: 1rem 0 0;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.28);
  color: var(--text);
}

.jtl-overtrack-alert {
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.55);
}

.jtl-overtrack-warn {
  background: rgba(120, 53, 15, 0.28);
  border-color: rgba(251, 191, 36, 0.45);
}

.jtl-overtrack-ok {
  background: rgba(6, 78, 59, 0.22);
  border-color: rgba(52, 211, 153, 0.4);
}

.jtl-ot-head {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fecaca;
  margin: 0 0 0.4rem;
}

.jtl-overtrack-warn .jtl-ot-head {
  color: #fcd34d;
}

.jtl-overtrack-ok .jtl-ot-head {
  color: #a7f3d0;
}

.jtl-ot-summary {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.45;
}

.jtl-ot-hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.jtl-ot-gap-flag {
  color: #fca5a5;
}

.jtl-ot-warn-flag {
  color: #fcd34d;
}

.jtl-ot-day {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.jtl-ot-day-alert {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.22);
}

.jtl-ot-day-warn {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.22);
}

.jtl-ot-day-ok {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(6, 78, 59, 0.18);
}

.jtl-ot-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.jtl-ot-day-date {
  font-weight: 700;
  color: var(--text);
}

.jtl-ot-day-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.jtl-ot-day-badge-alert {
  color: #fecaca;
  background: rgba(185, 28, 28, 0.45);
}

.jtl-ot-day-badge-warn {
  color: #fef3c7;
  background: rgba(180, 83, 9, 0.5);
}

.jtl-ot-day-badge-ok {
  color: #a7f3d0;
  background: rgba(6, 95, 70, 0.45);
}

.jtl-ot-day-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
}

.jtl-ot-over-line {
  margin: 0.15rem 0 0;
}

.jtl-ot-over-line strong {
  color: #fecaca;
  font-weight: 700;
}

.jtl-ot-gt {
  color: #fca5a5;
  font-weight: 700;
  margin: 0 0.15rem;
}

.jtl-ot-table-wrap {
  max-height: 240px;
  margin-top: 0.55rem;
}

.jtl-ot-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  color: var(--text);
}

.jtl-ot-table th,
.jtl-ot-table td {
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  color: var(--text);
  box-sizing: border-box;
}

.jtl-ot-table th {
  font-weight: 600;
  color: var(--text-muted);
  border-top: 0;
  background: rgba(15, 23, 42, 0.35);
}

/* festes Raster – Status/Beträge bleiben über alle Tages-Tabellen bündig */
.jtl-ot-table th:nth-child(1),
.jtl-ot-table td:nth-child(1) {
  width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jtl-ot-table th:nth-child(2),
.jtl-ot-table td:nth-child(2),
.jtl-ot-table th:nth-child(3),
.jtl-ot-table td:nth-child(3),
.jtl-ot-table th:nth-child(4),
.jtl-ot-table td:nth-child(4) {
  width: 14%;
}

.jtl-ot-table th:nth-child(5),
.jtl-ot-table td:nth-child(5) {
  width: 22%;
}

.jtl-ot-table td.num,
.jtl-ot-table th:nth-child(2),
.jtl-ot-table th:nth-child(3),
.jtl-ot-table th:nth-child(4) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.jtl-ot-table td:last-child,
.jtl-ot-table th:last-child {
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.jtl-ot-gap {
  color: #fca5a5;
  font-weight: 600;
}

.jtl-ot-conv {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85em;
}

.jtl-ot-status {
  display: inline-block;
  min-width: 6.5rem;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.2;
  vertical-align: middle;
}

.jtl-ot-status-miss {
  color: #fca5a5;
}

.jtl-ot-status-part {
  color: #fcd34d;
}

.jtl-ot-camp-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.55rem;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.jtl-ot-camp-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  padding: 0.65rem 0.75rem;
}

.jtl-ot-camp-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.55rem;
  word-break: break-word;
}

.jtl-ot-camp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.65rem;
}

.jtl-ot-camp-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.jtl-ot-camp-k {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.jtl-ot-camp-v {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jtl-ot-ch {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #93c5fd;
  margin-right: 0.25rem;
}

.gsc-donut-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 150px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.gsc-donut-canvas-wrap canvas {
  max-height: none !important;
  width: 100% !important;
  height: 100% !important;
}

.gsc-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.gsc-donut-legend li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.gsc-donut-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

.gsc-donut-legend .name {
  color: var(--text);
  font-weight: 500;
  flex: 0 1 auto;
}

.gsc-donut-legend .meta {
  color: var(--text-muted, #64748b);
  font-size: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

.gsc-pos-hint {
  display: none;
}

@media (max-width: 720px) {
  .gsc-donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .gsc-donut-legend {
    width: 100%;
  }
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

.section-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-charts {
  padding: 0 1.25rem 1rem;
  margin: 0;
}

#section-meta .kpi-grid {
  padding: 0 1.25rem 1rem;
  margin-bottom: 0;
}

#section-meta .table-wrap {
  border-top: 1px solid var(--border);
}

/* Table */
.table-card {
  padding: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.search {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  width: 220px;
}

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

#campaigns-table {
  width: 100%;
  table-layout: fixed;
}

#campaigns-table th,
#campaigns-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 1. Spalte (Newsletter) etwas breiter, Rest verteilt sich gleichmäßig. */
#campaigns-table th:first-child,
#campaigns-table td:first-child {
  width: 34%;
}

.table-wrap-y {
  max-height: 460px;
  overflow-y: auto;
}

.meta-table-scroll {
  max-width: 100%;
}

#meta-table {
  min-width: 1500px;
  width: max-content;
}

#meta-table th:first-child,
#meta-table td:first-child,
#google-table th:first-child,
#google-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-card);
  min-width: 180px;
  width: 280px;
  max-width: none;
  box-shadow: 4px 0 8px -6px rgba(0, 0, 0, 0.25);
}

#meta-table thead th:first-child,
#google-table thead th:first-child,
#meta-table tfoot th:first-child,
#google-table tfoot th:first-child {
  background: var(--bg);
  z-index: 3;
}

#meta-table tfoot th,
#google-table tfoot th,
#meta-table tfoot td,
#google-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}

#meta-table tfoot th:first-child,
#google-table tfoot th:first-child {
  background: rgba(15, 23, 42, 0.06);
}

.campaign-forecast {
  margin: 0.85rem 1.25rem 1.1rem;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.04));
  color: var(--text);
}

.campaign-forecast-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.campaign-forecast-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
  color: var(--text);
}

.campaign-forecast-sub {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.campaign-forecast-result {
  text-align: right;
}

.campaign-forecast-result-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.campaign-forecast-value {
  font-weight: 750;
  font-size: 1.25rem;
  color: #5eead4;
  font-variant-numeric: tabular-nums;
}

.campaign-forecast-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.1fr);
  gap: 0.65rem 0.55rem;
  align-items: stretch;
}

.campaign-forecast-tile {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  min-width: 0;
}

.campaign-forecast-tile-result {
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(15, 118, 110, 0.18);
}

.campaign-forecast-tile-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.campaign-forecast-tile-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}

.campaign-forecast-tile-result .campaign-forecast-tile-value {
  color: #5eead4;
}

.campaign-forecast-tile-meta {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.campaign-forecast-op {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0 0.1rem;
}

@media (max-width: 900px) {
  .campaign-forecast-grid {
    grid-template-columns: 1fr;
  }
  .campaign-forecast-op {
    display: none;
  }
  .campaign-forecast-result {
    text-align: left;
  }
}

.campaign-forecast[hidden],
#meta-table-foot[hidden],
#google-table-foot[hidden] {
  display: none !important;
}

#google-table {
  min-width: 1400px;
  width: max-content;
}

.col-resizable {
  position: relative;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 4;
}

.col-resize-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 2px;
  width: 2px;
  border-radius: 1px;
  background: rgba(148, 163, 184, 0.45);
}

.col-resize-handle:hover::after,
body.is-col-resizing .col-resize-handle::after {
  background: var(--accent);
}

.budget-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.budget-link:hover {
  color: #fff;
}

.modal-content-wide {
  max-width: 920px;
}

.budget-range-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin: 0.35rem 0 0.15rem;
}

.budget-range-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.budget-range-custom label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.budget-range-custom input[type="date"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  font: inherit;
}

#budget-history-table td {
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

/* JTL Tabelle: feste Spaltenbreiten (kein Springen beim Filtern). */
#jtl-samples-table {
  table-layout: fixed;
  width: 100%;
}

#jtl-samples-table th:nth-child(3),
#jtl-samples-table td:nth-child(3),
#jtl-samples-table th:nth-child(4),
#jtl-samples-table td:nth-child(4) {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

#jtl-samples-table td:nth-child(3) {
  white-space: normal;
}

#jtl-orders-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
}

.quelle-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.quelle-stack-clickable {
  cursor: pointer;
}

.quelle-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.quelle-badge-meta {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.quelle-badge-google {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.quelle-badge-newsletter {
  background: rgba(192, 38, 108, 0.16);
  color: #f9a8d4;
  border: 1px solid rgba(192, 38, 108, 0.4);
}

.quelle-badge-katalog {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.quelle-badge-website {
  background: rgba(14, 165, 233, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.quelle-badge-other {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* Pipedrive Gesamtkennzahlen */
.pd-overall {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.06), transparent);
}

.pd-overall-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.pd-overall-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.pd-overall-sub {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pd-overall-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: var(--bg-card);
}

.pd-overall-stat {
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--border);
}

.pd-overall-stat:last-child {
  border-right: none;
}

.pd-overall-stat .kpi-value {
  font-size: 1.35rem;
}

@media (max-width: 800px) {
  .pd-overall-stats {
    grid-template-columns: 1fr;
  }
  .pd-overall-stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .pd-overall-stat:last-child {
    border-bottom: none;
  }
}

#pipedrive-owners-table tr.pd-onlineshop-row td {
  font-weight: 600;
  background: rgba(100, 116, 139, 0.06);
}

.quelle-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.jtl-order-expandable {
  cursor: pointer;
}

.jtl-order-expandable:hover {
  background: rgba(148, 163, 184, 0.08);
}

.jtl-order-cancelled {
  opacity: 0.72;
}

.jtl-order-cancelled td {
  color: #94a3b8;
}

.jtl-storno-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fecaca;
  background: rgba(185, 28, 28, 0.28);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 4px;
  vertical-align: middle;
}

.jtl-order-expandable.is-open .quelle-caret {
  transform: rotate(180deg);
}

.jtl-order-detail td {
  padding: 0 0.75rem 0.7rem !important;
  border-top: 0 !important;
  background: rgba(15, 23, 42, 0.35);
}

.jtl-order-detail-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid rgba(132, 24, 83, 0.55);
  margin-left: 0.15rem;
}

.jtl-order-camp {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.35;
}

.jtl-order-camp-label {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-width: 3.4rem;
}

.jtl-order-camp-meta .jtl-order-camp-label {
  color: #93c5fd;
}

.jtl-order-camp-google .jtl-order-camp-label {
  color: #86efac;
}

.jtl-order-camp-newsletter .jtl-order-camp-label {
  color: #f9a8d4;
}

.jtl-order-camp-name {
  color: var(--text);
  word-break: break-word;
}

.quelle-empty {
  color: var(--text-muted);
}

thead {
  background: var(--bg);
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--bg-hover);
}

.campaign-name {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.match-utm_id { color: var(--green); }
.match-utm_id_name { color: var(--green); font-weight: 600; }
.match-utm_campaign_id { color: #38bdf8; font-weight: 600; }
.match-utm_campaign { color: var(--orange); }
.match-kein { color: var(--text-muted); }

/* Loading-Overlay (nicht mit Filter-Buttons teilen – sonst padding:4rem auf Buttons) */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  gap: 1rem;
}

.loading[hidden],
.meta-loading[hidden],
.page[hidden],
#content[hidden],
#campaign-detail[hidden],
.modal[hidden],
.jtl-overtrack[hidden],
.jtl-double-tracked[hidden] {
  display: none !important;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.warnings {
  margin-bottom: 1rem;
}

.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--orange);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

/* Responsive – Desktop unverändert; ab hier Handy */
@media (max-width: 1100px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-wide {
    grid-column: auto;
  }
  .yoy-tables-2col {
    grid-template-columns: 1fr;
  }
}

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

  .mobile-nav-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
  }

  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 300px);
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--border);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  body.nav-open {
    overflow: hidden;
  }

  .brand-sources {
    display: none;
  }

  .status-card {
    font-size: 0.8rem;
  }

  .main {
    padding: 0.85rem 0.85rem 1.5rem;
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .topbar-head h1 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.85rem;
  }

  .toolbar-group {
    width: 100%;
  }

  .period-control,
  .period-trigger,
  .select {
    width: 100%;
    max-width: 100%;
  }

  .period-menu {
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
  }

  .segmented {
    flex-wrap: wrap;
    width: 100%;
  }

  .segmented-btn {
    flex: 1 1 auto;
    min-height: 40px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  #meta-kpi-grid,
  #google-kpi-grid,
  #ov-meta-kpis,
  #ov-google-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    padding: 0.75rem;
  }

  .kpi-value {
    font-size: 1.05rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* JTL Auftragswert-Split: volle Breite, Beträge in einer Zeile */
  #page-jtl .kpi-card-split,
  #jtl-kpi-grid .kpi-card-split {
    grid-column: 1 / -1;
  }

  #page-jtl .kpi-split-value,
  .kpi-split-value {
    font-size: 0.95rem;
    white-space: nowrap;
    word-break: normal;
  }

  #page-jtl .kpi-split-cell {
    padding: 0.65rem 0.5rem;
  }

  /* Donuts wie Pipedrive-Daily: Chart oben, Legende darunter – nicht gequetscht */
  #page-jtl .jtl-donut-pane .gsc-donut-layout,
  .gsc-donut-layout,
  #page-gsc .gsc-donut-layout,
  #page-pipedrive .gsc-donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.85rem;
  }

  #page-jtl .jtl-donut-pane .gsc-donut-canvas-wrap,
  .gsc-donut-canvas-wrap {
    width: 170px;
    max-width: 170px;
    margin: 0 auto;
  }

  /* Pipedrive Funnel: großer Kreis, zentriert */
  #page-pipedrive .pd-funnel-card .gsc-donut-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
  }

  #page-pipedrive .pd-funnel-card .gsc-donut-canvas-wrap {
    width: min(72vw, 240px);
    max-width: 240px;
  }

  #page-pipedrive .pd-funnel-card .gsc-donut-legend {
    width: auto;
    text-align: left;
  }

  .gsc-donut-legend,
  #page-jtl .gsc-donut-legend {
    width: 100%;
  }

  #page-jtl .gsc-donut-legend .meta,
  .gsc-donut-legend .meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .chart-card,
  .card {
    padding: 0.85rem;
  }

  /* Diagramme mobil: feste Proportionen, keine Riesenhöhe */
  .chart-card canvas {
    max-height: 280px;
    min-height: 0;
  }

  #page-meta .chart-card canvas,
  #page-google-ads .chart-card canvas {
    max-height: 300px;
    min-height: 0;
  }

  #chart-meta-regression,
  #chart-meta-regression-leads,
  #chart-google-regression {
    max-height: 300px !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  .section-title {
    font-size: 1.05rem;
    margin-top: 1.25rem;
  }

  .section-head-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .table-wrap,
  .table-wrap-y,
  #page-jtl .jtl-orders-card .table-wrap,
  .meta-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    overscroll-behavior-x: contain;
  }

  /* Meta/Google Kampagnen: schmale Sticky-Spalte, Rest horizontal scrollbar */
  #meta-table,
  #google-table {
    min-width: 1200px;
  }

  #meta-table th:first-child,
  #meta-table td:first-child,
  #google-table th:first-child,
  #google-table td:first-child {
    min-width: 7.5rem;
    width: 7.5rem;
    max-width: 8.5rem;
    white-space: normal;
    word-break: break-word;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  #meta-table th,
  #meta-table td,
  #google-table th,
  #google-table td {
    font-size: 0.72rem;
    padding: 0.4rem 0.45rem;
    white-space: nowrap;
  }

  /* JTL-Auftragstabelle: nicht zusammendrücken */
  #page-jtl #jtl-samples-table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
  }

  #page-jtl #jtl-samples-table th,
  #page-jtl #jtl-samples-table td {
    width: auto !important;
    white-space: nowrap;
    font-size: 0.75rem;
    vertical-align: top;
  }

  #page-jtl #jtl-samples-table th:nth-child(3),
  #page-jtl #jtl-samples-table td:nth-child(3) {
    white-space: normal;
    min-width: 8rem;
    max-width: 11rem;
  }

  #page-jtl #jtl-samples-table th:nth-child(5),
  #page-jtl #jtl-samples-table td:nth-child(5) {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  #page-jtl #jtl-orders-wrap {
    max-height: min(55vh, 420px);
  }

  /* Overtracking-Kampagnen-Karten */
  .jtl-ot-camp-v {
    white-space: nowrap;
    font-size: 0.78rem;
  }

  .jtl-ot-camp-name {
    font-size: 0.8rem;
  }

  /* Newsletter-Tabelle + Nachlauf-Heatmap: horizontal scrollen statt quetschen */
  #campaigns-table {
    table-layout: auto;
    width: max-content;
    min-width: 920px;
  }

  #campaigns-table th,
  #campaigns-table td {
    white-space: nowrap;
    font-size: 0.72rem;
    overflow: visible;
    text-overflow: clip;
  }

  #campaigns-table th:first-child,
  #campaigns-table td:first-child {
    width: auto;
    max-width: 11rem;
    white-space: normal;
    word-break: break-word;
  }

  .campaign-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .campaign-detail-head h4 {
    font-size: 0.95rem;
    word-break: break-word;
  }

  #detail-meta {
    font-size: 0.72rem;
    word-break: break-word;
    white-space: normal;
  }

  #detail-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .nl-lag-heatmap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nl-lag-heatmap-table {
    table-layout: auto;
    width: max-content;
    min-width: 760px;
  }

  .nl-lag-col-newsletter {
    width: 7.5rem;
    min-width: 7rem;
    max-width: 9rem;
    white-space: normal !important;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .nl-lag-heatmap-table th:not(.nl-lag-col-newsletter),
  .nl-lag-heatmap-table td:not(.nl-lag-col-newsletter) {
    width: 3.4rem;
    min-width: 3.4rem;
    font-size: 0.68rem;
  }

  .nl-lag-cell-value {
    white-space: nowrap;
  }

  /* YoY: gelber Titel durchgehend, Tabelle darunter scrollbar */
  .yoy-tables {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .yoy-table {
    min-width: 26rem;
    font-size: 0.75rem;
  }

  .yoy-table-title {
    font-size: 0.8rem;
    padding: 0.5rem 0.4rem;
  }

  /* Monatsende-Prognose mobil klar gestapelt */
  .campaign-forecast {
    margin: 0.75rem 0.65rem 1rem;
    padding: 0.85rem;
  }

  .campaign-forecast-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .campaign-forecast-result {
    text-align: left;
  }

  .campaign-forecast-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .campaign-forecast-op {
    display: none;
  }

  .campaign-forecast-tile-value {
    font-size: 1.05rem;
  }

  /* KI-Analyse: mobil zugeklappt hinter Button */
  .analyze-mobile-toggle {
    display: flex;
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }

  .analyze-panel.analyze-collapsed > :not(.analyze-mobile-toggle) {
    display: none !important;
  }

  .analyze-panel:not(.analyze-collapsed) .analyze-mobile-toggle {
    margin-bottom: 0.35rem;
  }

  .analyze-panel,
  .analyze-question {
    width: 100%;
  }

  .analyze-panel-overview {
    padding: 0.75rem;
  }

  .analyze-question {
    min-height: 2.75rem;
    max-height: 8rem;
    font-size: 0.9rem;
    resize: vertical;
  }

  .analyze-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .analyze-bar .btn {
    width: 100%;
  }

  .analyze-bar .section-hint {
    font-size: 0.72rem;
  }

  table {
    font-size: 0.78rem;
  }

  #page-jtl .jtl-donuts-grid,
  #page-jtl .jtl-bottom-grid,
  .jtl-attr-grid {
    grid-template-columns: 1fr !important;
  }

  /* alte Donut-Grid-Overrides entfernt – Stack-Layout oben */
  .pd-overall-stats {
    grid-template-columns: 1fr;
  }

  .modal-content,
  .modal .modal-card {
    width: calc(100vw - 1.25rem);
    max-width: 100%;
    margin: 0.5rem;
  }

  .btn-sm {
    min-height: 40px;
  }
}

@media (min-width: 769px) {
  .analyze-mobile-toggle {
    display: none !important;
  }
}
