/*
 * Apple design layer — loaded after styles.css and dashboard_ai.css.
 * Dark appearance modelled on Apple's system colours (dark variants),
 * SF typography, filled controls, hairline separators and grouped surfaces.
 * Overrides tokens first, then shared components; module CSS inherits the tokens.
 */

:root {
  color-scheme: dark;

  /* Backgrounds: grouped hierarchy (systemGroupedBackground dark) */
  --bg-1: #000000;
  --bg-2: #0e0e10;
  --surface: #1c1c1e;
  --surface-2: #232325;
  --surface-raised: #2c2c2e;
  --surface-kpi: #1c1c1e;
  --surface-chart: #1c1c1e;
  --surface-table-head: rgba(28, 28, 30, .86);

  /* Fills (systemFill family) for controls */
  --fill-1: rgba(120, 120, 128, .36);
  --fill-2: rgba(120, 120, 128, .32);
  --fill-3: rgba(118, 118, 128, .24);
  --fill-4: rgba(118, 118, 128, .18);

  /* Separators */
  --line: rgba(84, 84, 88, .55);
  --line-soft: rgba(84, 84, 88, .34);
  --hairline: rgba(255, 255, 255, .07);

  /* Labels — secondary #98989f on #1c1c1e = 6.1:1, tertiary 4.6:1 */
  --text: #f5f5f7;
  --muted: #98989f;
  --text-tertiary: #8a8a90;

  /* System colours (dark) — one colour, one meaning */
  --tint: #0a84ff;          /* interaction, selection, focus */
  --brand: #30d158;         /* positive / brand */
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --violet: #bf5af2;
  --info: #64d2ff;
  --yellow: #ffd60a;
  --teal: #40c8e0;
  --indigo: #5e5ce6;
  --pink: #ff375f;

  --focus-ring: rgba(10, 132, 255, .5);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: none;
  --shadow-md: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .28);
  --btn-bg: var(--fill-3);
  --btn-border: transparent;
  --btn-shadow: none;

  --control-height: 36px;
  --control-compact-height: 30px;
  --control-radius: 9px;
  --control-active-bg: #636366;
  --control-active-border: transparent;
  --control-active-text: #ffffff;
  --accent: var(--tint);
  --good: var(--green);
  --bad: var(--red);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.25, .1, .25, 1);
}

/* ---------- Base ---------- */
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }

/* Service and time tracking use the shared section surface and table typography. */
.module-section[data-module="time"] .time-shell {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.module-section[data-module="service"] .service-shell { padding: 0 0 2rem; }
.time-lists { overflow: visible; align-items: start; }
.time-table-wrap { min-width: 0; }
.time-table { width: 100%; min-width: 0; }
.time-table td { white-space: nowrap; }
.service-card.dashboard-section > .section-content,
.time-list.dashboard-section > .section-content { padding: 0; }
.time-list .table-content { max-height: 480px; overflow: auto; }
.time-list .kpi-card-head h2 { margin: 0; }
.service-card.dashboard-section > .section-header { background: transparent; }
@media (max-width: 600px) {
  .time-left .time-range-group {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    margin-left: 0 !important;
  }
  .time-range-group input { min-width: 0; width: 100%; }
  .time-range-group button { grid-column: 1 / -1; }
}
body {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.45;
  letter-spacing: -.005em;
  color: var(--text);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
input, select, button, textarea { font-family: inherit; letter-spacing: inherit; }
::selection { background: rgba(10, 132, 255, .45); color: #fff; }

h1, h2, h3, h4 { letter-spacing: -.015em; color: var(--text); }
td, .num, .money, [class*="value"], [class*="-kpi"] strong { font-variant-numeric: tabular-nums; }

/* Scroll areas — thin, overlay-style */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .32); }
::-webkit-scrollbar-corner { background: transparent; }
.modal-body { overscroll-behavior: contain; }

/* ---------- Navigation bar (floating layer → material allowed) ---------- */
.app { --module-edge: 12px; --module-bottom-gap: 12px; padding: 0 var(--module-edge); }
/* Outer module edges belong to the app, never to individual module shells. */
.app > .module-section { margin-inline: 0; padding-inline: 0; max-width: none; min-width: 0; }
.app > .module-section > :is(.customer-service-shell, .service-shell) { padding-inline: 0; }
.app:has(> .module-section[data-module="kundenservice"]:not([hidden])) { margin-bottom: var(--module-bottom-gap); }
.app .customer-service-shell {
  height: max(420px, calc(100dvh - var(--customer-shell-top, 88px) - var(--module-bottom-gap)));
  padding-block: 0;
}
.module-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 2px;
  margin: 0 calc(-1 * clamp(16px, 2.2vw, 32px)) 20px;
  padding: 10px clamp(16px, 2.2vw, 32px);
  background: rgba(22, 22, 24, .72);
  border-bottom: .5px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  overflow-x: auto;
  scrollbar-width: none;
}
.module-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: rgba(235, 235, 245, .62);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -.01em;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tab-btn:hover { background: var(--fill-4); color: var(--text); }
.tab-btn.is-active {
  background: rgba(255, 255, 255, .14);
  border: 0;
  color: #fff;
  font-weight: 600;
}
.content-width-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--fill-4);
  color: rgba(235, 235, 245, .7);
  box-shadow: none;
  font-size: 0.9375rem;
}
.content-width-toggle:hover { background: var(--fill-3); color: #fff; }
.content-width-toggle.is-active { color: var(--tint); }

/* ---------- Grouped surfaces ---------- */
.filters,
.table-wrap,
.viz-card,
.time-shell,
.kpi-collapsible-card,
.projects-data-block.kpi-collapsible-card,
.service-card,
.magneto-panel,
.wabbelz-panel,
.marketing-section,
.modal-panel {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 .5px var(--hairline);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.viz-card:hover,
.projects-data-block.kpi-collapsible-card:hover { border-color: transparent; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12); }
.viz-card:not(.kpi-collapsible-card) { padding: 18px 20px; }
.filters { padding: 16px 18px; gap: 12px; }
.table-wrap { margin-top: 16px; }

/* Nested surfaces sit one step up */
.table-wrap .table-wrap,
.viz-card .table-wrap,
.kpi-card-content .table-wrap { background: var(--surface-2); box-shadow: none; }

/* ---------- Section headlines ---------- */
.kpi-card-head { min-height: 32px; margin-bottom: 12px; }
.kpi-card-head h2,
.viz-card .kpi-card-head h2,
.is-section-toggle-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.25;
  color: var(--text);
}
.kpi-card-head h3 { font-size: 0.9375rem; font-weight: 600; letter-spacing: -.016em; }
.is-section-toggle-header:hover h2,
.is-section-toggle-header:hover h3 { color: #fff !important; }
.magneto-eyebrow, .admin-subtitle {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.kpi-card-toggle {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
}
.kpi-card-toggle:hover { background: var(--fill-4); color: var(--text); border: 0; }

/* Collapsible table summary → plain disclosure row */
.table-summary {
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.table-summary:hover { background: var(--fill-4); }
.table-summary.section-heading,
.table-summary.section-heading:hover { padding: 0; min-height: 32px; background: transparent; cursor: default; }
.summary-main { font-size: 0.9375rem; font-weight: 600; letter-spacing: -.016em; color: var(--text); }
.summary-meta { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }
.summary-arrow { color: var(--text-tertiary); font-size: 0.8125rem; }

/* ---------- Labels & form controls ---------- */
label { gap: 6px; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.filters label { font-size: 0.75rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

input,
select,
textarea {
  height: var(--control-height);
  padding: 0 12px;
  border: 0;
  border-radius: var(--control-radius);
  background-color: var(--fill-3);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 400;
  box-shadow: none;
  transition: background-color .18s var(--ease), box-shadow .18s var(--ease);
}
textarea { height: auto; padding: 10px 12px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: rgba(235, 235, 245, .32); }
input:hover,
select:hover,
textarea:hover { background-color: var(--fill-2); border-color: transparent; }
input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: transparent;
  background-color: var(--fill-2);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input:disabled, select:disabled, textarea:disabled, button:disabled { opacity: .4; cursor: not-allowed; }

select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%23aeaeb2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E");
  background-position: right 11px center;
  background-size: 10px 14px;
  background-repeat: no-repeat;
}
select option { background: #2c2c2e; color: var(--text); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .55; cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--tint);
  appearance: auto;
  -webkit-appearance: auto;
}
input[type="range"] { accent-color: var(--tint); background: transparent; padding: 0; }

/* ---------- Buttons ---------- */
button,
.logout-link {
  height: var(--control-height);
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background-color: var(--fill-3);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -.008em;
  box-shadow: none;
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease), opacity .18s var(--ease);
}
button:hover,
.logout-link:hover { background-color: var(--fill-2); border-color: transparent; color: #fff; }
button:active { transform: scale(.97); }
button:focus-visible,
.logout-link:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Prominent (primary) actions */
#loadBtn,
.btn-primary,
.admin-create button[type="submit"],
.modal-actions button[type="submit"] {
  background-color: var(--tint);
  color: #fff;
}
#loadBtn:hover,
.btn-primary:hover,
.admin-create button[type="submit"]:hover,
.modal-actions button[type="submit"]:hover { background-color: #3395ff; }

/* ---------- Segmented controls (presets & metric switches) ---------- */
.preset-wrap,
.finance-metric-tabs,
.weekday-performance-tabs,
.weekday-performance-peak-tabs,
.marketing-attribution-tabs {
  gap: 2px;
}
.preset-btn,
.mkt-preset, .ship-preset, .projects-preset, .prod-preset, .wabbelz-preset,
.customer-status-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-compact-height);
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(235, 235, 245, .7);
  font-size: 0.78125rem;
  font-weight: 500;
  box-shadow: none;
}
.preset-btn:hover,
.mkt-preset:hover, .ship-preset:hover, .projects-preset:hover, .prod-preset:hover, .wabbelz-preset:hover,
.customer-status-filter:hover { background: var(--fill-4); color: var(--text); }
.preset-btn.is-active,
.mkt-preset.is-active, .ship-preset.is-active, .projects-preset.is-active, .prod-preset.is-active, .wabbelz-preset.is-active,
.customer-status-filter.is-active {
  background: #636366;
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.finance-trend-control { border-left: .5px solid var(--line); }

/* ---------- Tables ---------- */
table { border-collapse: separate; border-spacing: 0; }
th, td {
  padding: 10px 12px;
  border-bottom: .5px solid var(--line-soft);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 400;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-table-head);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: .5px solid var(--line);
  white-space: nowrap;
}
.modal-body th, .admin-table th, .service-table th { text-transform: none; letter-spacing: 0; }
tbody tr:last-child td { border-bottom: 0; }
td.num, td.money, th.num, th.money { white-space: nowrap; }
.table-wrap tbody tr { transition: background-color .15s var(--ease); }
.table-wrap tbody tr:hover,
tbody tr:hover { background: rgba(255, 255, 255, .035); }
.table-wrap tbody tr.row-active { background: rgba(255, 255, 255, .06); }
.table-content { padding: 4px 8px 8px; }
.expand-toggle { color: var(--text-tertiary); font-weight: 500; }
.expand-toggle.is-open { color: var(--text); }

/* ---------- Charts ---------- */
#trendCanvas,
#marketingMixCanvas,
#weekdayPerformanceCanvas,
#countryMixCanvas,
#productCategoryMixCanvas,
#revenueBarsCanvas,
#opsBarsCanvas {
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* ---------- Hints & status ---------- */
.hint { color: var(--muted); font-size: 0.78125rem; }
.hint.is-ok { color: var(--green); }
.hint.is-error { color: #ff6961; }

/* ---------- Modals (sheets) ---------- */
.modal-backdrop {
  background: rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal-panel {
  background: #1c1c1e;
  padding: 20px 22px;
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1), 0 24px 64px rgba(0, 0, 0, .55);
}
.modal-head { border-bottom: .5px solid var(--line-soft); }
.admin-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  background: var(--fill-3);
  color: var(--muted);
}

/* Module loader */
.module-loader { background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }

/* ---------- Motion & accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  button:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .module-tabs, thead th, .modal-backdrop, .module-loader { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .module-tabs { background: #161618; }
  thead th { background: var(--surface); }
}
@media (prefers-contrast: more) {
  :root { --muted: #c7c7cc; --line: rgba(255, 255, 255, .35); --line-soft: rgba(255, 255, 255, .22); --hairline: rgba(255, 255, 255, .25); }
  .tab-btn { color: #e5e5ea; }
}

/* ---------- Compact widths ---------- */
@media (max-width: 760px) {
  body { font-size: 0.9375rem; }
  .tab-btn { height: 36px; padding: 0 12px; }
  input, select, button, .logout-link { min-height: 40px; }
  .viz-card, .projects-data-block.kpi-collapsible-card, .filters { padding: 14px; border-radius: 14px; }
}

/* ---------- Icon system ----------
 * One stroke weight (1.75 on a 24 grid), rendered at 16px inside 30px circular
 * buttons, so every header and toolbar icon shares size, weight and spacing.
 * Text glyphs (⚙ ✕ 📋 ×) are hidden and replaced by masks; labels stay in aria-label.
 */
:root {
  --icon-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15.2a3.2 3.2 0 1 0 0-6.4 3.2 3.2 0 0 0 0 6.4z'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1.03 1.56V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1.1-1.56 1.7 1.7 0 0 0-1.88.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.56-1.03H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.56-1.1 1.7 1.7 0 0 0-.34-1.88l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34H9a1.7 1.7 0 0 0 1.03-1.56V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1.03 1.56 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87V9c.26.6.86 1 1.51 1.03H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  --icon-xmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E");
  --icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8.5' y='8.5' width='11' height='12' rx='2.5'/%3E%3Cpath d='M15.5 8.5V6a2.5 2.5 0 0 0-2.5-2.5H7A2.5 2.5 0 0 0 4.5 6v7A2.5 2.5 0 0 0 7 15.5h1.5'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5l5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  --icon-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M10 20H4v-6M20 4l-6.5 6.5M4 20l6.5-6.5'/%3E%3C/svg%3E");
  --icon-collapse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10h-6V4M4 14h6v6M14 10l6.5-6.5M10 14l-6.5 6.5'/%3E%3C/svg%3E");
}

.admin-gear,
.nav-settings-btn,
.admin-close,
.kpi-card-toggle,
.section-focus-btn,
.content-width-toggle,
.customer-imap-remove,
[data-draft-attachment-delete] {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 0;
  line-height: 0;
}
.admin-gear:hover,
.nav-settings-btn:hover,
.admin-close:hover,
.kpi-card-toggle:hover,
.section-focus-btn:hover,
.section-focus-btn.is-active,
.content-width-toggle:hover,
.customer-imap-remove:hover,
[data-draft-attachment-delete]:hover { background: var(--fill-3); color: var(--text); border: 0; }

/* Toolbar-level buttons sit on a filled circle like the nav icons */
.module-tabs .content-width-toggle,
.module-tabs .nav-settings-btn,
.admin-gear { width: 32px; min-width: 32px; height: 32px; background: var(--fill-4); }
.module-tabs .content-width-toggle svg { width: 16px; height: 16px; stroke-width: 1.75; }
.module-tabs .nav-settings-btn { margin-left: auto; }
.module-tabs .content-width-toggle:not(.nav-settings-btn) { margin-left: 4px; }

.admin-gear::before,
.nav-settings-btn::before,
.admin-close::before,
.customer-imap-remove::before,
[data-draft-attachment-delete]::before,
.section-focus-btn::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--icon-gear) center / contain no-repeat;
  mask: var(--icon-gear) center / contain no-repeat;
}
.admin-close::before,
.customer-imap-remove::before,
[data-draft-attachment-delete]::before { width: 13px; height: 13px; -webkit-mask-image: var(--icon-xmark); mask-image: var(--icon-xmark); }
.admin-close.copy-orders-csv::before,
#unfulfilledCsvBtn::before { width: 16px; height: 16px; -webkit-mask-image: var(--icon-copy); mask-image: var(--icon-copy); }
.admin-close { background: var(--fill-3); }
.customer-imap-remove, [data-draft-attachment-delete] { width: 24px; min-width: 24px; height: 24px; min-height: 24px; }

/* Section focus: hide the drawn corners, use expand / collapse arrows */
.section-focus-icon { display: none; }
.section-focus-btn::before { -webkit-mask-image: var(--icon-expand); mask-image: var(--icon-expand); width: 15px; height: 15px; }
.section-focus-btn.is-active::before { -webkit-mask-image: var(--icon-collapse); mask-image: var(--icon-collapse); }
.section-focus-btn.is-active { color: var(--tint); }

/* Collapse chevron: down = open, right = collapsed */
.kpi-card-toggle::before {
  content: "";
  position: static;
  width: 15px;
  height: 15px;
  border: 0;
  background: currentColor;
  -webkit-mask: var(--icon-chevron) center / contain no-repeat;
  mask: var(--icon-chevron) center / contain no-repeat;
  transform: none;
  transition: transform .2s var(--ease);
}
.kpi-collapsible-card.is-collapsed .kpi-card-toggle::before { top: auto; transform: rotate(-90deg); }
.section-head-actions { gap: 2px; }

/* Expand toggles inside tables and time lists */
.expand-toggle { font-size: 0.75rem; }
.time-toggle {
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}
.time-toggle:hover { background: var(--surface-raised); }
.time-toggle .toggle-icon { color: var(--text-tertiary); font-size: 0.8125rem; }

/* ---------- Settings sheets ---------- */
.admin-create {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  gap: 12px;
}
.admin-create label { color: var(--muted); }
.admin-divider { border: 0; border-top: .5px solid var(--line-soft); margin: 20px 0; }
.admin-list-wrap { border-radius: var(--radius-md); background: var(--surface-2); box-shadow: none; overflow: auto; }
.admin-table td, .admin-table th { padding: 10px 12px; }
.modal-head h2, .modal-head h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.024em; }
.admin-subtitle { font-size: 0.8125rem; }
.admin-subtitle { margin: 0 0 10px; color: var(--text); font-size: 0.9375rem; font-weight: 600; letter-spacing: -.016em; }

/* Admin / settings sheets */
.admin-modal-backdrop { background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.admin-panel {
  background: #1c1c1e;
  padding: 20px 22px;
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1), 0 24px 64px rgba(0, 0, 0, .55);
}
.admin-head { align-items: center; padding-bottom: 12px; margin-bottom: 8px; border-bottom: .5px solid var(--line-soft); }
.admin-head h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.024em; }
.admin-close { color: var(--text); }

/* Charts sit directly on the card — no inner frame */
.chart-shell { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.chart-shell canvas,
canvas[id$="Canvas"] { background: transparent !important; border: 0 !important; border-radius: 0 !important; }

/* Country presets carried id-level overrides */
#countryGroupPresets { padding: 2px; border: 0; border-radius: 999px; background: var(--fill-4); }
#countryGroupPresets .preset-btn { height: 28px; border: 0; background: transparent; color: rgba(235, 235, 245, .7); }
#countryGroupPresets .preset-btn:hover { background: var(--fill-4); color: var(--text); }
#countryGroupPresets .preset-btn.is-active { background: #636366; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }

/* Card titles placed directly in a card (no kpi-card-head) */
.viz-card > h2,
.viz-card > h3,
.service-card h2, .service-card h3,
.magneto-panel h2, .wabbelz-panel h2,
.marketing-section > h2, .marketing-section > h3 {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -.016em;
  line-height: 1.3;
}
/* Nested cards (card inside a card) step up one surface and drop the hairline */
.kpi-card-content .viz-card,
.table-content .viz-card { background: var(--surface-2); box-shadow: none; }

/* ---------- Unified section chrome ----------
 * Every collapsible section — table, chart card, Projekte block, Marketing
 * section — shares one header: 56px tall, 20px inset, 17px semibold title,
 * a single hairline below it and the icon buttons on the right.
 */
.table-wrap,
.viz-card.kpi-collapsible-card,
.projects-data-block.kpi-collapsible-card,
.marketing-section.kpi-collapsible-card,
.kpi-collapsible-card {
  --section-inline: 20px;
  --section-head-height: 56px;
}
.table-toolbar,
.kpi-collapsible-card > .kpi-card-head,
.viz-card.kpi-collapsible-card > .kpi-card-head,
.projects-data-block.kpi-collapsible-card > .kpi-card-head,
.marketing-section.kpi-collapsible-card > .kpi-card-head {
  min-height: var(--section-head-height);
  margin: 0;
  padding: 0 12px 0 var(--section-inline);
  border: 0;
  border-bottom: .5px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
}
.kpi-collapsible-card.is-collapsed > .kpi-card-head,
.table-wrap.is-collapsed > .table-toolbar { border-bottom-color: transparent; }
.kpi-collapsible-card.is-collapsed { padding-top: 0; padding-bottom: 0; }

.summary-main,
.summary-title,
.kpi-collapsible-card > .kpi-card-head h2,
.kpi-collapsible-card > .kpi-card-head h3,
.viz-card.kpi-collapsible-card > .kpi-card-head h2,
.viz-card.kpi-collapsible-card > .kpi-card-head h3,
.projects-data-block.kpi-collapsible-card > .kpi-card-head h2,
.projects-data-block.kpi-collapsible-card > .kpi-card-head h3,
.projects-data-block > .kpi-card-head h3,
.marketing-section.kpi-collapsible-card > .kpi-card-head h2,
.finance-comparison h2, .wbz-printer-head h2, .finance-history-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.25;
}
.table-summary:hover .summary-main,
.table-summary:hover .summary-title,
.is-section-toggle-header:hover h2,
.is-section-toggle-header:hover h3 { color: var(--text) !important; }
.is-section-toggle-header { border-radius: 0; }
.kpi-card-head > div > span:first-child:not(:only-child) { color: var(--muted); font-size: 0.75rem; font-weight: 500; }

/* Sections nested inside another section's content */
.kpi-card-content .kpi-collapsible-card,
.kpi-card-content .projects-data-block.kpi-collapsible-card { background: var(--surface-2); box-shadow: none; margin-top: 16px; }

/* Kundenservice: settings + reload share the filter / search row */
.customer-thread-search { flex-wrap: wrap; gap: 8px; }
.customer-thread-search .customer-head-actions { display: flex; align-items: center; gap: 8px; margin-left: 4px; padding-left: 12px; border-left: .5px solid var(--line); }
.customer-thread-search input { height: var(--control-height); }
.customer-thread-search button { height: var(--control-height); }
.customer-new-thread-btn { width: var(--control-height); min-width: var(--control-height); padding: 0; }
.customer-new-thread-btn svg { width: 17px; height: 17px; color: inherit; stroke-width: 1.75; }
.customer-status-filters { gap: 4px; }
.customer-status-count { background: var(--fill-3); color: var(--text); font-weight: 600; }
.customer-status-filter.is-active .customer-status-count { background: rgba(255, 255, 255, .22); }

/* ---------- Nav icon controls: one size, one weight, one colour ---------- */
:root {
  --icon-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black'%3E%3Ccircle cx='12' cy='12' r='8.7' stroke-width='2.8' stroke-dasharray='3.1 3.73' transform='rotate(-10 12 12)'/%3E%3Ccircle cx='12' cy='12' r='6.4' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='2.3' stroke-width='1.9'/%3E%3C/svg%3E");
  --icon-arrows-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 12h17M7.5 8l-4 4 4 4M16.5 8l4 4-4 4'/%3E%3C/svg%3E");
}
.module-tabs .content-width-toggle,
.module-tabs .nav-settings-btn,
.admin-gear,
.module-tabs .sync-indicator {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--fill-4);
  color: rgba(235, 235, 245, .78);
}
.module-tabs .content-width-toggle:hover,
.module-tabs .nav-settings-btn:hover,
.admin-gear:hover { background: var(--fill-3); color: #fff; }
.module-tabs .content-width-toggle.is-active { color: #fff; background: var(--fill-2); }
.admin-gear::before,
.nav-settings-btn::before { width: 17px; height: 17px; }
#contentWidthToggle svg { display: none; }
#contentWidthToggle::before {
  content: "";
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: var(--icon-arrows-h) center / contain no-repeat;
  mask: var(--icon-arrows-h) center / contain no-repeat;
}
.module-tabs { gap: 2px; }
.module-tabs .nav-settings-btn { margin-left: auto; margin-right: 6px; }
.module-tabs .content-width-toggle:not(.nav-settings-btn) { margin-left: 0; }

/* Sync status: a progress ring drawn inside the same 32px circle */
.module-tabs .sync-indicator {
  position: relative;
  margin: 0 6px 0 0;
  flex: 0 0 auto;
  border: 0;
  box-shadow: none;
}
.module-tabs .sync-indicator::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 0;
  border-radius: 999px;
  background: conic-gradient(currentColor calc(var(--sync-progress, 0) * 1turn), rgba(255, 255, 255, .16) 0);
  -webkit-mask: radial-gradient(circle, transparent 5.2px, #000 5.7px);
  mask: radial-gradient(circle, transparent 5.2px, #000 5.7px);
}
.module-tabs .sync-indicator::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  width: 8px;
  height: 8px;
  border: 0;
  background: #8e8e93;
  box-shadow: none;
  z-index: 2;
}
.module-tabs .sync-indicator.is-ok::before { background: var(--green); }
.module-tabs .sync-indicator.is-bad::before { background: var(--red); }

/* ---------- Icon refinements ----------
 * Filled gear (gearshape.fill-style) reads crisply at small sizes; close
 * buttons get a larger glyph. Toolbar icons render at 20px, close at 14px.
 */
:root {
  --icon-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' stroke='black' stroke-width='1' stroke-linejoin='round' d='M19.91 13.22 L22.29 14.55 L21.08 17.47 L18.45 16.73 L16.73 18.45 L17.47 21.08 L14.55 22.29 L13.22 19.91 L10.78 19.91 L9.45 22.29 L6.53 21.08 L7.27 18.45 L5.55 16.73 L2.92 17.47 L1.71 14.55 L4.09 13.22 L4.09 10.78 L1.71 9.45 L2.92 6.53 L5.55 7.27 L7.27 5.55 L6.53 2.92 L9.45 1.71 L10.78 4.09 L13.22 4.09 L14.55 1.71 L17.47 2.92 L16.73 5.55 L18.45 7.27 L21.08 6.53 L22.29 9.45 L19.91 10.78Z M12 8.4a3.6 3.6 0 1 0 0 7.2a3.6 3.6 0 1 0 0-7.2Z'/%3E%3C/svg%3E");
  --icon-xmark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}
.module-tabs .nav-settings-btn::before,
.admin-gear::before { width: 20px; height: 20px; }
#contentWidthToggle::before { width: 19px; height: 19px; }
.admin-close { width: 30px; min-width: 30px; height: 30px; min-height: 30px; background: var(--fill-3); color: rgba(235, 235, 245, .8); }
.admin-close:hover { background: var(--fill-2); color: #fff; }
.admin-close::before { width: 14px; height: 14px; }
.admin-close.copy-orders-csv::before,
#unfulfilledCsvBtn::before { width: 17px; height: 17px; }

/* ---------- Pointer affordance ----------
 * A collapsible header is clickable across its whole width, so the pointer
 * shows everywhere on it — except over text fields, which keep their caret.
 * Headers without a toggle stay with the default cursor.
 */
.kpi-card-head,
.table-toolbar,
.table-summary,
.table-summary.section-heading { cursor: default; }
.is-section-toggle-header,
.is-section-toggle-header .table-summary,
.is-section-toggle-header .section-heading,
.is-section-toggle-header h2,
.is-section-toggle-header h3,
.is-section-toggle-header span { cursor: pointer; }
.is-section-toggle-header input:not([type="checkbox"]):not([type="radio"]),
.is-section-toggle-header textarea { cursor: text; }
.is-section-toggle-header select,
button,
[role="button"],
summary,
.tab-btn,
.preset-btn { cursor: pointer; }
button:disabled { cursor: not-allowed; }

/* Navigation bar spans the full window at any content width (incl. the
 * reduced-width mode): border-image paints bar colour and bottom hairline
 * 100vmax beyond the box on both sides, so there are no edges or tone steps. */
.module-tabs {
  border-bottom: 0;
  background: transparent;
  border-image: linear-gradient(to bottom, rgba(22, 22, 24, .72) calc(100% - 1px), rgba(84, 84, 88, .55) calc(100% - 1px)) fill 0 / / 0 100vmax;
}
@media (prefers-reduced-transparency: reduce) {
  .module-tabs { border-image: linear-gradient(to bottom, #161618 calc(100% - 1px), rgba(84, 84, 88, .55) calc(100% - 1px)) fill 0 / / 0 100vmax; }
}
body { overflow-x: hidden; }

/* Icon buttons still contain their hidden text glyph (✕, ⚙). In a grid that
 * glyph forms a second row and pushes the icon up; flex keeps one centred line. */
.admin-gear,
.nav-settings-btn,
.admin-close,
.kpi-card-toggle,
.section-focus-btn,
.content-width-toggle,
.customer-imap-remove,
[data-draft-attachment-delete] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-gear[hidden], .nav-settings-btn[hidden], .admin-close[hidden] { display: none; }
.admin-gear::before, .nav-settings-btn::before, .admin-close::before, .kpi-card-toggle::before,
.section-focus-btn::before, #contentWidthToggle::before, .customer-imap-remove::before,
[data-draft-attachment-delete]::before { flex: 0 0 auto; }

/* ---------- Info / KPI tiles ----------
 * One tile style everywhere: flat grouped surface, hairline edge, no gradient
 * or tint. On the page background a tile is #1c1c1e; inside a card it steps
 * up to #2a2a2c so it still separates from its parent.
 */
body :is(.card, .cards .card, .summary-cards .card, .cards > div, .summary-cards > div, .mini-card,
  .magneto-kpi, .magneto-marketing-card, .magneto-purchase-kpi, .wabbelz-kpi, .marketing-kpi-tile,
  .marketing-evidence-card, .customer-order-card, .service-count, .ai-result, .wabbelz-head) {
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  background-image: none;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .08);
}
body :is(.viz-card, .table-wrap, .kpi-collapsible-card, .kpi-card-content, .magneto-panel, .wabbelz-panel,
  .service-card, .marketing-section, .admin-panel, .modal-panel, .customer-service-shell aside, .customer-context)
  :is(.card, .mini-card, .magneto-kpi, .magneto-marketing-card, .magneto-purchase-kpi, .wabbelz-kpi,
  .marketing-kpi-tile, .marketing-evidence-card, .customer-order-card, .service-count, .ai-result) {
  background: #2a2a2c;
  box-shadow: none;
}

/* Shared segmented selection controls across all modules. */
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets) {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  max-width: 100%;
  height: auto;
  min-height: 36px;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-4);
  overflow-x: auto;
}
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets) > button {
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 32px;
  min-height: 32px;
  max-height: none;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 500;
  line-height: normal;
  white-space: nowrap;
  box-shadow: none;
  transform: none;
}
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets) > button:hover {
  background: var(--fill-3);
  color: var(--text);
}
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets) > button:is(.is-active, [aria-selected="true"], [aria-pressed="true"]) {
  background: #636366;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets) > button:disabled {
  opacity: .45;
  cursor: default;
}
body :is(.marketing-attribution-tabs, .marketing-buyer-filters, .production-plan-views,
  .finance-metric-tabs, .finance-trend-control, .weekday-performance-tabs,
  .weekday-performance-peak-tabs, .wbz-forecast-years, .customer-thread-shop-filter, #countryGroupPresets)[hidden] { display: none !important; }
body #customerThreadShopFilter:empty { display: none; }
body #customerThreadShopFilter > button { width: 36px; padding: 0; }
.production-booking-table input[data-booking-quantity] { box-sizing: border-box; width: 100px; min-width: 0; max-width: 100%; height: var(--control-height); margin: 0; }
body :is(.card, .mini-card, .magneto-kpi, .wabbelz-kpi, .marketing-kpi-tile, .magneto-purchase-kpi, .magneto-marketing-card)
  :is(.label, span:first-child) { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
body :is(.card, .mini-card) .value { color: var(--text); font-weight: 600; letter-spacing: -.02em; }

/* Selected / flagged tiles: a ring in the meaning colour instead of a tinted fill */
body .marketing-evidence-card.is-open { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--tint); }
body .customer-order-card.is-name-match { box-shadow: inset 0 0 0 1.5px var(--orange); }
.ai-result.ai-insight { border-top: 0; }

/* ---------- Drilldowns (KPI day details, inline breakdowns) ----------
 * The open day row is marked by a tint bar on its left edge plus a light
 * fill; its detail row reads as an inset grouped panel below it.
 */
.table-wrap tbody tr.row-active,
tbody tr.row-active { background: rgba(255, 255, 255, .06); }
.table-wrap tbody tr.row-active > td:first-child { box-shadow: none; }
.table-wrap tbody tr.row-active > td { border-bottom-color: transparent; }
.table-wrap tbody tr.detail-row,
.table-wrap tbody tr.detail-row:hover { background: transparent; cursor: default; }
.detail-row td {
  padding: 4px 8px 16px;
  background: transparent;
  border-bottom: .5px solid var(--line);
}

.inline-detail-wrap {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .07);
}
.inline-detail-title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -.016em;
}
.inline-detail-actions { gap: 6px; }
.inline-drill { margin-top: 14px; }

/* Value tiles inside drilldowns */
.inline-detail-grid,
.inline-channel-list,
.breakdown-cards,
.mix-stats { gap: 8px; }
.inline-detail-grid div,
.inline-channel-list div,
.mix-row,
body .mini-card {
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: #2c2c2e;
  box-shadow: none;
}
.inline-detail-grid span,
.inline-channel-list span,
.mix-row .name,
body .mini-card .label { color: var(--muted); font-size: 0.75rem; font-weight: 500; margin-bottom: 2px; }
.inline-detail-grid strong,
.inline-channel-list strong,
.mix-row .abs { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.mix-row .pct { color: var(--muted); }

/* Nested drilldown tables */
.drilldown-table-wrap {
  border: 0;
  border-radius: 12px;
  background: #1c1c1e;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .08);
}
.drilldown-table th,
.drilldown-table td {
  padding: 9px 12px;
  border-bottom: .5px solid var(--line-soft);
  color: var(--text);
  font-size: 0.8125rem;
}
.drilldown-table th {
  background: rgba(28, 28, 30, .9);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.drilldown-table tbody tr:hover { background: rgba(255, 255, 255, .035); }
.drilldown-table td a.order-link,
a.shopify-order-link { color: var(--tint); }
.month-summary-row td { background: rgba(255, 255, 255, .03); font-weight: 600; border-bottom: .5px solid var(--line); }
.month-summary-row .summary-label { color: var(--text); }

/* Channel bars use the system palette */
.channel-track { height: 6px; background: rgba(255, 255, 255, .1); }
.channel-fill { border-radius: inherit; }
.fill-facebook { background: #0a84ff; }
.fill-google { background: #ff375f; }
.fill-tiktok { background: #ffd60a; }
.fill-pinterest { background: #40c8e0; }
#tableWrap tbody td:nth-child(2) { white-space: nowrap; }

/* ---------- Links ----------
 * Links keep the surrounding text colour; a faint underline marks them and
 * strengthens on hover. No link blue.
 */
a,
.drilldown-table td a.order-link,
a.shopify-order-link,
.table-wrap td a,
td a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(235, 235, 245, .28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s var(--ease), color .15s var(--ease);
}
a:hover,
.drilldown-table td a.order-link:hover,
a.shopify-order-link:hover,
td a:hover { color: #fff; text-decoration-color: rgba(235, 235, 245, .8); }
/* Links styled as controls keep their control look */
a.tab-btn, a.logout-link, a.btn-primary, a[class*="-btn"], a[role="button"] { text-decoration: none; }
a.tab-btn:hover, a.logout-link:hover { color: #fff; }
/* Strong selector so module-specific link colours (blue tints) can't win */
body a:is([href], :link):not(.tab-btn):not(.logout-link):not([class*="-btn"]):not([role="button"]) {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(235, 235, 245, .28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
body a:is([href], :link):not(.tab-btn):not(.logout-link):not([class*="-btn"]):not([role="button"]):hover {
  color: #fff;
  text-decoration-color: rgba(235, 235, 245, .8);
}

/* Wochentag-Performance takes one column like the other KPI cards */
.kpi-chart-grid > .weekday-performance-card { grid-column: auto; }

/* ---------- One disclosure chevron everywhere ----------
 * Every expand / collapse control uses the KPI section chevron:
 * pointing right when closed, down when open, same 15px glyph and weight.
 * Text glyphs (▸ ▾) set by JS are hidden; state comes from classes/ARIA.
 */
.marketing-plan-chevron::before,
.marketing-evidence-toggle > span,
.expand-toggle::before,
.time-toggle .toggle-icon::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 0;
  background: currentColor;
  -webkit-mask: var(--icon-chevron) center / contain no-repeat;
  mask: var(--icon-chevron) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform .2s var(--ease);
}
.marketing-plan-chevron { display: inline-flex; align-items: center; justify-content: center; width: 20px; color: var(--muted); }
.marketing-plan-chevron.is-open::before,
.marketing-evidence-toggle[aria-expanded="true"] > span,
.expand-toggle.is-open::before,
tr.row-active .expand-toggle::before,
.time-toggle[aria-expanded="true"] .toggle-icon::before { transform: none; }
.marketing-plan-row:hover .marketing-plan-chevron { color: var(--text); }
.marketing-plan-row:hover .marketing-plan-chevron::before { border-color: transparent; }

.expand-toggle,
.time-toggle .toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 0;
  line-height: 0;
  color: var(--muted);
}
.expand-toggle.is-open,
tr.row-active .expand-toggle { transform: none; color: var(--text); }
.marketing-evidence-toggle { gap: 6px; border: 0; background: var(--fill-4); color: var(--muted); }
.marketing-evidence-toggle[aria-expanded="true"] { border: 0; color: var(--text); background: var(--fill-3); }

/* Marketing headers force every span to display:block, which revealed the
 * legacy corner icon inside the focus button. The mask icon is the only glyph. */
.section-focus-btn .section-focus-icon { display: none !important; }

/* Print button in the generic modal shares the admin-close class: give it a printer glyph */
:root {
  --icon-print: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3.5h10V9'/%3E%3Crect x='3.5' y='9' width='17' height='8' rx='2.5'/%3E%3Cpath d='M7 14h10v6.5H7z'/%3E%3C/svg%3E");
}
#genericModalPrintBtn::before { width: 17px; height: 17px; -webkit-mask-image: var(--icon-print); mask-image: var(--icon-print); }

/* Produktbuchung: one row per mapped article */
.production-booking-table th:nth-child(1) { width: auto; }
.production-booking-table th:nth-child(2) { width: 30%; }
.production-booking-table th:nth-child(3),
.production-booking-table th:nth-child(4) { width: 148px; }
.production-booking-table th:nth-child(5),
.production-booking-table th:nth-child(6) { width: 112px; }
body #productionBookingWrap .production-booking-table th { text-align: left; }
body #productionBookingWrap [data-booking-sort] { justify-content: flex-start; text-align: left; }
body #productionBookingBody td:nth-child(n+4) { text-align: left; vertical-align: middle; }
body #productionBookingBody td:nth-child(n+5) > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: var(--control-height);
  margin: 0;
  white-space: nowrap;
}
body #productionBookingBody :is(input[data-booking-quantity], button[data-booking-manual], td:nth-child(6) > button) {
  box-sizing: border-box;
  min-height: var(--control-height);
}
@media (pointer: coarse) {
  body #productionBookingBody :is(input[data-booking-quantity], button[data-booking-manual], td:nth-child(6) > button) { min-height: 44px; }
}
.production-booking-table td small,
.production-mapping-table td small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.75rem; line-height: 1.4; }
.production-booking-projects { white-space: normal; }
.production-stock-adjust p { margin: 6px 0 12px; color: var(--muted); font-size: 0.8125rem; }
.production-stock-adjust .production-stock-quantity-input { width: 110px; text-align: right; }
.production-mapping-filters [data-stock-bulk] { height: var(--control-height); }
.production-mapping-table table { min-width: 0; width: 100%; }
.production-booking-table table { min-width: 860px; }

/* ---------- AI module: shared icons, history section, collapsible answers ---------- */
:root {
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

/* Disclosure chevrons replace the ⌄ / ⌃ text glyphs: right = closed, down = open */
body .ai-module :is(.ai-sources-details summary, .ai-card-details > summary, .ai-transcript > summary, .ai-data-details summary) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}
body .ai-module :is(.ai-sources-details summary, .ai-card-details > summary, .ai-transcript > summary, .ai-data-details summary)::-webkit-details-marker { display: none; }
body .ai-module :is(.ai-sources-details summary, .ai-card-details > summary, .ai-transcript > summary, .ai-data-details summary)::after,
body .ai-module .ai-process-toggle::after,
body .ai-module .ai-turn-chevron {
  content: "";
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin: 0;
  background: currentColor;
  -webkit-mask: var(--icon-chevron) center / contain no-repeat;
  mask: var(--icon-chevron) center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform .2s var(--ease);
}
body .ai-module :is(.ai-sources-details[open] summary, .ai-card-details[open] > summary, .ai-transcript[open] > summary, .ai-data-details[open] summary)::after,
body .ai-module .ai-process[open] .ai-process-toggle::after { transform: none; }
body .ai-module .ai-process-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; }
body .ai-module .ai-input-row .ai-process-toggle { font-size: 0; }
body .ai-module .ai-card-details > summary::after { margin-left: auto; }

/* Status check and web toggle check */
body .ai-module:not(.is-working) .ai-process-spinner { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 0; }
body .ai-module:not(.is-working) .ai-process-spinner::after,
body .ai-module .ai-web-toggle:has(input:checked)::after {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}
body .ai-module:not(.is-working) .ai-process-spinner { color: var(--green); }
body .ai-module .ai-process > summary { align-items: center; }

/* Icon buttons: 30px circles with centred glyphs */
body .ai-module .ai-result .ai-card-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 999px;
  color: var(--muted);
}
body .ai-module .ai-card-expand svg { display: none; }
body .ai-module .ai-card-expand::before {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--icon-expand) center / contain no-repeat;
  mask: var(--icon-expand) center / contain no-repeat;
}
body .ai-module .ai-result.is-expanded .ai-card-expand::before { -webkit-mask-image: var(--icon-collapse); mask-image: var(--icon-collapse); }
body .ai-module .ai-card-expand:hover,
body .ai-module .ai-voice-repeat:hover { background: var(--fill-3); color: var(--text); }
body .ai-module .ai-voice-repeat { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; min-height: 30px; color: var(--muted); }
body .ai-module .ai-voice-repeat svg { display: block; }

/* Text actions: quiet pills like the other modules */
body .ai-module .ai-secondary {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-4);
  color: rgba(235, 235, 245, .78);
  font-size: 0.78125rem !important;
  font-weight: 500;
}
body .ai-module .ai-secondary:hover { background: var(--fill-3); color: var(--text); }
body .ai-module .ai-header .ai-secondary { background: transparent; }
body .ai-module .ai-header .ai-secondary:hover { background: var(--fill-4); }

/* History: one large section … */
body .ai-module .ai-history {
  margin-top: 8px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: inset 0 0 0 .5px var(--hairline);
  overflow: hidden;
}
body .ai-module .ai-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 12px 0 20px;
  border-bottom: .5px solid var(--line-soft);
  cursor: pointer;
}
body .ai-module .ai-history.is-collapsed .ai-history-head { border-bottom-color: transparent; }
body .ai-module .ai-history-head > div { display: flex; align-items: baseline; gap: 10px; }
body .ai-module .ai-history-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.022em; }
body .ai-module .ai-history-head span { color: var(--muted); font-size: 0.8125rem; }
body .ai-module .ai-history.is-collapsed .kpi-card-toggle::before { transform: rotate(-90deg); }
body .ai-module .ai-history > .ai-conversation { gap: 8px; padding: 12px; }

/* … with every answer as a collapsible sub-section */
body .ai-module .ai-history .ai-turn {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}
body .ai-module .ai-turn-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  height: auto;
  padding: 10px 14px 10px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
body .ai-module .ai-turn-toggle:hover { background: rgba(255, 255, 255, .03); }
body .ai-module .ai-turn-toggle:active { transform: none; }
body .ai-module .ai-turn-toggle .ai-question {
  display: block;
  margin: 0;
  padding: 0;
  max-width: none;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -.016em;
  line-height: 1.4;
  text-align: left;
}
body .ai-module .ai-turn-chevron { width: 15px; height: 15px; color: var(--muted); transform: none; }
body .ai-module .ai-turn.is-collapsed .ai-turn-chevron { transform: rotate(-90deg); }
body .ai-module .ai-turn.is-collapsed > :not(.ai-turn-toggle) { display: none !important; }
body .ai-module .ai-history .ai-turn > :not(.ai-turn-toggle) { margin-left: 18px; margin-right: 18px; }
body .ai-module .ai-history .ai-turn > :last-child { margin-bottom: 18px; }
body .ai-module .ai-history .ai-turn > .ai-answer { max-width: none; justify-content: flex-start; text-align: left; padding-top: 4px; border-top: .5px solid var(--line-soft); }
body .ai-module .ai-history .ai-turn .ai-answer-heading,
body .ai-module .ai-history .ai-turn .ai-answer-actions,
body .ai-module .ai-history .ai-turn > .ai-answer > .ai-citations { justify-content: flex-start; }
body .ai-module .ai-history .ai-turn .ai-answer-text { text-align: left; }
body .ai-module .ai-history .ai-result { background: #2a2a2c; box-shadow: none; }

/* ---------- Marketing: Attribution & Übersicht ----------
 * The KPI strip was a bordered band with divider lines; the shared tile style
 * rounded each cell and produced notches at the dividers. It is now a grid of
 * separate tiles. Toolbars and inner panels lose their dark framed boxes.
 */
body .marketing-module .section-content-toolbar,
body .marketing-module .marketing-attribution-toolbar {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  gap: 16px 20px;
  align-items: flex-end;
}
body .marketing-module :is(.marketing-attribution-control, .marketing-attribution-search) > span,
body .marketing-module .marketing-buyer-control > span { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
body .marketing-module .marketing-attribution-search input { height: var(--control-height); border-radius: var(--control-radius); }

body .marketing-module .marketing-attribution-kpis {
  gap: 8px;
  margin: 0 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
body .marketing-module .marketing-attribution-kpis > div,
body .marketing-module .marketing-attribution-kpis > div:last-child {
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: #2a2a2c;
  box-shadow: none;
}
body .marketing-module .marketing-attribution-kpis > div::before,
body .marketing-module .marketing-attribution-kpis > div::after { display: none; }
body .marketing-module .marketing-kpi-tile > strong { margin-top: 4px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
body .marketing-module .marketing-kpi-tile ul { margin-top: 12px; border-top: .5px solid var(--line-soft); }
body .marketing-module .marketing-kpi-tile li { border-bottom: .5px solid rgba(255, 255, 255, .05); }

/* Inner panels: nested grouped surfaces instead of dark framed boxes */
body .marketing-module :is(.marketing-attribution-layout, .marketing-buyer-panel, .marketing-evidence, .marketing-evidence-detail, .marketing-attribution-leaderboards) {
  border: 0;
  border-radius: 12px;
  background: #232325;
  box-shadow: none;
}
body .marketing-module .marketing-evidence-cards .marketing-evidence-card { background: #2a2a2c; box-shadow: none; }
body .marketing-module .marketing-evidence-card.is-open { box-shadow: inset 0 0 0 1.5px rgba(235, 235, 245, .35); }
body .marketing-module .marketing-attribution-overview { border: 0; }
body .marketing-module .marketing-attribution-search input { background-color: var(--fill-3); border: 0; }
body .marketing-module .marketing-attribution-search input:hover,
body .marketing-module .marketing-attribution-search input:focus { background-color: var(--fill-2); }

/* ---------- One gap for every KPI / info tile grid ----------
 * 12px between tiles, horizontally and vertically, in every module.
 */
:root { --tile-gap: 12px; }
body :is(.cards, .summary-cards, .breakdown-cards, .inline-detail-grid, .inline-channel-list, .mix-stats,
  .magneto-kpis, .magneto-summary-card-row, .wabbelz-kpis, .marketing-attribution-kpis, .marketing-evidence-cards,
  .marketing-evidence-grid, .marketing-plan-summary, .marketing-plan-kpis, .marketing-decision-metrics,
  .marketing-plan-learning-grid, .finance-history-metrics, .production-plan-metrics, .ai-metrics, .ai-insights-grid) {
  gap: var(--tile-gap) !important;
}
body .marketing-module .marketing-attribution-kpis { margin-bottom: var(--tile-gap); }

/* ---------- Section headers: one size, subtitle inline ----------
 * Title 16px semibold (between Marketing's former 17px and Produktion's 15px);
 * a subtitle / meta sits on the same line, 13px muted, baseline-aligned.
 */
body :is(.summary-main, .summary-title,
  .kpi-card-head h2, .kpi-card-head h3,
  .kpi-collapsible-card > .kpi-card-head h2, .kpi-collapsible-card > .kpi-card-head h3,
  .viz-card.kpi-collapsible-card > .kpi-card-head h2, .viz-card.kpi-collapsible-card > .kpi-card-head h3,
  .projects-data-block.kpi-collapsible-card > .kpi-card-head h2, .projects-data-block.kpi-collapsible-card > .kpi-card-head h3,
  .projects-data-block > .kpi-card-head h3, .marketing-section.kpi-collapsible-card > .kpi-card-head h2,
  .finance-comparison h2, .wbz-printer-head h2, .finance-history-head h3, .ai-history-head h2) {
  margin: 0;
  font-size: 16px !important;
  font-weight: 600;
  letter-spacing: -.018em;
  line-height: 1.3;
}
/* Title block: title first, then subtitle / count / eyebrow on the same line */
body .kpi-card-head > div:first-child,
body .ai-history-head > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
}
body .kpi-card-head > div:first-child > :is(h2, h3) { order: -1; }
body .kpi-card-head > div:first-child > span,
body .marketing-section.kpi-collapsible-card > .kpi-card-head > div:first-child > span:not(.marketing-ai-eyebrow),
body .ai-history-head > div:first-child > span,
body .summary-meta {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-size: 13px !important;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
}
body .table-summary { column-gap: 10px; align-items: baseline; }
body .table-summary.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; }

/* Title line is vertically centred in every section header (title + subtitle
 * stay baseline-aligned with each other; the line itself is centred). */
body .table-summary,
body .table-summary.section-heading,
body .kpi-card-head > div:first-child,
body .ai-history-head > div:first-child { align-content: center; align-self: center; }
body .table-summary.section-heading { min-height: 0; }

/* ---------- Section header: one rule for colour and pointer ----------
 * Title is always the primary label colour, subtitle/meta always muted —
 * whether the title is an h2/h3 (cards) or a span (table sections).
 * A collapsible header shows the pointer across its full area and every child.
 */
body :is(.kpi-card-head, .table-toolbar, .ai-history-head) :is(h2, h3, .summary-title, .summary-main) { color: var(--text) !important; }
body :is(.kpi-card-head, .table-toolbar, .ai-history-head) > div:first-child > span:not(.summary-title):not(.summary-main),
body :is(.kpi-card-head, .table-toolbar) .summary-meta { color: var(--muted) !important; }
body :is(.table-summary, .table-summary.section-heading):hover :is(.summary-title, .summary-main),
body .is-section-toggle-header:hover :is(h2, h3, .summary-title, .summary-main) { color: var(--text) !important; }

body .is-section-toggle-header,
body .is-section-toggle-header *,
body .ai-history-head,
body .ai-history-head * { cursor: pointer; }
body .is-section-toggle-header :is(input:not([type="checkbox"]):not([type="radio"]), textarea) { cursor: text; }
body .is-section-toggle-header :is(button:disabled, button:disabled *) { cursor: not-allowed; }

/* ---------- Rounded table rows ----------
 * Header row reads as one rounded band; hovered / active rows get the same
 * 8px rounding on their outer cells. Needs separate borders (spacing 0) —
 * collapsed borders ignore border-radius.
 */
body table { border-collapse: separate !important; border-spacing: 0; }
body thead tr:first-child > th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
body thead tr:first-child > th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
body thead th { border-bottom-color: transparent; }
body tbody tr > td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
body tbody tr > td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
body tbody tr:hover > td,
body tbody tr.row-active > td { border-bottom-color: transparent; }
/* Hover / active fill on the cells so the rounding is visible */
body tbody tr:hover,
body .table-wrap tbody tr:hover,
body tbody tr.row-active,
body .table-wrap tbody tr.row-active { background: transparent; }
body tbody tr:hover > td { background-color: rgba(255, 255, 255, .04); }
body tbody tr.row-active > td { background-color: rgba(255, 255, 255, .06); }
body .table-wrap tbody tr.detail-row > td,
body .table-wrap tbody tr.detail-row:hover > td { background-color: transparent; border-radius: 0; }

/* ---------- One table schema, dashboard-wide ----------
 * Module stylesheets give some tables their own header case, tints and
 * borders. These rules win over them for structure and neutral colours only;
 * semantic cell colours (negative values, status badges) stay untouched.
 */
body table th,
body table thead th {
  padding: 9px 12px !important;
  background: #262628 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  white-space: nowrap;
}
body table td {
  padding: 10px 12px;
  border-top: 0 !important;
  border-bottom: .5px solid var(--line-soft) !important;
  font-size: 13px;
}
body table tbody tr:last-child > td { border-bottom-color: transparent !important; }
body table td small { color: var(--muted); }
body table tr:is(.is-active, .row-active, .is-selected) > td { background-color: rgba(255, 255, 255, .06) !important; }
body table tbody tr:hover > td { background-color: rgba(255, 255, 255, .04); }

/* Direct table wrappers: no framed boxes, rounded clip */
body :is(div, section):has(> table):not(.table-content):not(.modal-body) {
  border: 0 !important;
  border-radius: 12px;
}

/* Buttons inside tables: neutral fills, no tinted borders */
/* Media Buyer icons and its ROAS/lifecycle area keep their own plain look (styles.css). */
body table td button:not(.btn-primary):not(.kpi-card-toggle):not(.admin-close):not(.production-stock-quantity):not(.production-mapping-hide):not(.expand-toggle):not(.marketing-buyer-scale):not(.marketing-buyer-insight) {
  min-height: 30px;
  padding: 0 12px;
  border: 0 !important;
  border-radius: var(--control-radius);
  background: var(--fill-3) !important;
  color: var(--text) !important;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none !important;
}
body table td button:not(:disabled):not(.marketing-buyer-scale):not(.marketing-buyer-insight):hover { background: var(--fill-2) !important; }
body table td button[aria-current="true"] { background: transparent !important; color: var(--muted) !important; }

body #adminUsersBody button.admin-user-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}
body .admin-table .admin-user-action img { filter: invert(1); opacity: .85; }
@media (pointer: coarse) {
  body #adminUsersBody button.admin-user-action { width: 44px; height: 44px; min-height: 44px; }
}

/* Marketing AI history: section title inline like other sub-headers */
body .marketing-ai-history { border-top: .5px solid var(--line-soft); }
body .marketing-ai-section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: 2px 10px; margin-bottom: 12px; }
body .marketing-ai-section-title h5 { margin: 0; color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -.016em; }
body .marketing-ai-section-title span { color: var(--muted); font-size: 13px; }
body .marketing-ai-history td { color: var(--text); }
/* Raise the schema above module rules that also use !important (e.g. ".marketing-attribution-table th").
 * :is() takes its most specific argument, so the never-matching id lifts the whole selector. */
body :is(table, #table-schema) th { background: #262628 !important; color: var(--muted) !important; text-transform: none !important; letter-spacing: 0 !important; font-size: 12px !important; }
body :is(table, #table-schema) td { border-top: 0 !important; }

/* 2px clearance between the header band and the first row (its hover/active fill):
 * a transparent bottom border with the background clipped to the padding box. */
body :is(table, #table-schema) :is(thead th, tr:first-child > th) {
  border-bottom: 2px solid transparent !important;
  background-clip: padding-box !important;
}
/* Cells holding only buttons/controls centre them vertically, whatever the row height */
body :is(table, #table-schema) td:has(> :is(button, a[class*="-btn"], select):only-child),
body :is(table, #table-schema) td.production-mapping-action-cell { vertical-align: middle !important; }

/* Row chevrons follow the open state only. A selected row (row-active) can be
 * collapsed again in KPI, so selection must not rotate the chevron; only the
 * shipping and production tables mark their open row via row-active. */
body tr.row-active .expand-toggle:not(.is-open)::before { transform: rotate(-90deg); }
body tr.row-active :is(.shipping-toggle, .production-toggle)::before,
body .expand-toggle.is-open::before { transform: none; }
body tr.row-active .expand-toggle:not(.is-open):not(.shipping-toggle):not(.production-toggle) { color: var(--muted); }

/* Kundenservice draft: warnings and status share one line between text and actions, 50 / 50 */
.customer-draft-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 32px;
  margin: -6px 18px 8px;
}
.customer-draft-feedback > * { min-width: 0; margin: 0 !important; }
.customer-draft-feedback > .customer-draft-warnings { display: block; }
.customer-draft-feedback > #customerDraftStatus { max-height: none; border: 0; background: transparent; padding: 0; }
.customer-draft-feedback > .customer-draft-warnings { justify-self: stretch; }
.customer-draft-feedback > .hint { text-align: right; }
/* The empty attachment strip is [hidden] but a display rule kept its padding in the flow */
.customer-draft-attachments[hidden] { display: none !important; }

/* Kundenservice: the reply draft keeps at least one third of the column height,
 * even when a long customer mail is loaded; the conversation scrolls inside. */
@media (min-width: 1181px) {
  .customer-service-grid { grid-template-rows: minmax(0, auto) minmax(calc((100% - 1rem) / 3), 1fr); }
  .customer-conversation { min-height: 0; overflow: hidden; }
  .customer-draft-box { min-height: 0; }
}

/* ---------- Pointer only where a click does something ----------
 * Rows: default cursor; only rows the dashboard wires a click to get the hand
 * (KPI / Produktion days and months, Versand status groups, product trend rows).
 * Sortable column headers: the sort button fills the whole cell and the cell
 * shows the hand, so the header behaves like the section headers.
 */
body table tbody tr,
body .table-wrap tbody tr { cursor: default; }
body table tbody tr:is([data-day], [data-month], [data-status], [data-order-product-key], [data-product-absolute-sales-key]),
body table tbody tr:is([data-day], [data-month], [data-status], [data-order-product-key], [data-product-absolute-sales-key]) > td { cursor: pointer; }
body table tbody tr.detail-row,
body table tbody tr.detail-row > td { cursor: default; }
body table td :is(a, button, select, label, summary, [role="button"]) { cursor: pointer; }
body table td :is(input:not([type="checkbox"]):not([type="radio"]), textarea) { cursor: text; }

body table th:has(> button),
body table th:has(> button) * { cursor: pointer; }
body table th > button:only-child,
body table th > button:first-child:has(+ :empty:last-child) {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent !important;
  color: inherit;
  font: inherit;
  text-align: inherit;
  justify-content: flex-start;
}
body table th.num > button, body table th.money > button { justify-content: flex-end; }

/* Collapsible headers: the hand wins over every older cursor rule on their children
 * (e.g. ".table-summary.section-heading { cursor: default }"). */
body .is-section-toggle-header,
body .is-section-toggle-header *,
body .ai-history-head,
body .ai-history-head * { cursor: pointer !important; }
body .is-section-toggle-header :is(input:not([type="checkbox"]):not([type="radio"]), textarea) { cursor: text !important; }
body .is-section-toggle-header :is(button:disabled, button:disabled *) { cursor: not-allowed !important; }

/* One surface for every collapsible section card (marketing, projects, charts): the default of .marketing-section above. */
body :is(.viz-card, .projects-data-block, .marketing-section).kpi-collapsible-card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 .5px var(--hairline);
}
