/* HDLMonitor – Dark (default) + Light, responsive | BUILD: 20250528-r3 */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Poppins:wght@600&display=swap");
html {
  scrollbar-gutter: stable;
}
:root,
[data-theme="dark"] {
  --bg: #0f1727;
  --panel: #121c2e;
  --panel2: #1a2740;
  --border: #2a3a52;
  --text: #edf2f9;
  --muted: #9da9bb;
  --accent: #2c7be5;
  --accent-hover: #2569c7;
  --accent-text: #fff;
  --danger: #ef4444;
  --ok: #22c55e;
  --link: #60a5fa;
  --chart-grid: rgba(255, 255, 255, 0.08);
  --tbl-font: 0.95rem;
  --tbl-head-font: 0.75rem;
  --tbl-pad-y: 0.44rem;
  --tbl-pad-x: 0.42rem;
  --modal-tbl-font: 1rem;
  --modal-tbl-head-font: 0.8rem;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel2: #eef2f7;
  --border: #d0d7e2;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2c7be5;
  --accent-hover: #1f6fe0;
  --accent-text: #fff;
  --danger: #dc2626;
  --ok: #16a34a;
  --link: #2563eb;
  --chart-grid: rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--link); }
header.app-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel2) 100%);
  box-shadow: 0 8px 24px rgba(11, 23, 39, 0.16);
}
header.app-header h1 {
  margin: 0;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-family: "Poppins", "Open Sans", system-ui, sans-serif;
}
header .sub { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.nav-top {
  float: right;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
}
.nav-top a, .nav-top button {
  color: var(--muted);
  background: rgba(44, 123, 229, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8rem;
}
.nav-top a:hover, .nav-top button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(44, 123, 229, 0.18);
}
main {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0.9rem 1rem 2rem;
  box-sizing: border-box;
}
.app-footer {
  margin-top: auto;
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  background: rgba(18, 28, 46, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
}
.app-footer .footer-hdlx {
  max-width: 52rem;
  margin: 0;
  padding: 0 0.25rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.45;
  color: var(--text);
  opacity: 0.88;
  text-align: center;
}
.app-footer .footer-disclaimer {
  max-width: 52rem;
  margin: 0;
  padding: 0 0.25rem;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.app-footer .footer-kdnr {
  font-size: 0.72rem;
  color: var(--muted);
}
.app-footer .footer-kdnr.hidden {
  display: none;
}
.app-footer .footer-build {
  font-size: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  opacity: 0.85;
  letter-spacing: 0.02em;
}
[data-theme="light"] .app-footer {
  background: rgba(255, 255, 255, 0.7);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.toolbar label { font-size: 0.75rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
.toolbar select,
.toolbar input,
.toolbar .toolbar-select-wrap select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  min-height: 2.25rem;
}
.toolbar .toolbar-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.toolbar .toolbar-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 0.75rem;
  pointer-events: none;
  color: var(--muted);
  font-size: 0.7rem;
}
.toolbar .toolbar-select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 14rem;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.toolbar .toolbar-select-wrap select:hover {
  border-color: var(--accent-dim, #64748b);
}
.toolbar .toolbar-select-wrap select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}
[data-theme="light"] .toolbar .toolbar-select-wrap select {
  background: #fff;
}
tr.row-average {
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.18) 0%, rgba(96, 165, 250, 0.06) 55%);
  font-weight: 600;
}
tr.row-average td {
  border-top: 2px solid rgba(96, 165, 250, 0.45);
  border-bottom: 2px solid rgba(96, 165, 250, 0.45);
}
tr.row-average .rank-badge {
  background: rgba(96, 165, 250, 0.25);
  color: var(--text);
}
.top-match-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.15rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-text, #111);
  background: var(--accent);
  vertical-align: middle;
  cursor: help;
}
.top-in-anz-warn {
  color: var(--warn, #f59e0b);
  font-weight: 600;
  cursor: help;
}
.top-in-risiko-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--warn, #f59e0b);
  background: color-mix(in srgb, var(--warn, #f59e0b) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #f59e0b) 45%, transparent);
  cursor: help;
}
#top-in-tbody td.col-risiko {
  text-align: center;
  width: 3rem;
}
button.primary {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: var(--accent-hover); }
button.secondary, .btn-link {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.875rem;
  display: inline-block;
}
.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(18, 28, 46, 0.78);
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 20px rgba(11, 23, 39, 0.18);
  margin-bottom: 1rem;
}
@media (min-width: 1024px) {
  .table-wrap:has(#sites-table) {
    overflow-x: visible;
  }
}
.table-wrap.table-wrap-ranking {
  overflow: visible;
  backdrop-filter: none;
}
[data-theme="light"] .table-wrap {
  background: rgba(255, 255, 255, 0.8);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--tbl-font);
  min-width: 860px;
}
table.data th,
table.data td {
  padding: var(--tbl-pad-y) var(--tbl-pad-x);
  border-bottom: 1px solid var(--border);
  text-align: right;
}
table.data th:first-child,
table.data td:first-child,
table.data th:nth-child(2),
table.data td:nth-child(2) { text-align: left; }
table.data th.col-text,
table.data td.col-text { text-align: left; }
table.data th {
  color: var(--muted);
  font-size: var(--tbl-head-font);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
section.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(11, 23, 39, 0.16);
  margin-bottom: 1rem;
}
section.card h2 { margin: 0 0 0.75rem; font-size: 1rem; }
.charts-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .charts-row.two { grid-template-columns: 1fr 1fr; }
}
.chart-box { position: relative; height: 260px; }
.chart-caption {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.chart-caption .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.chart-caption.bestand .dot { background: rgba(59, 130, 246, 0.85); }
.chart-caption.sale .dot { background: rgba(245, 158, 11, 0.9); }
.sales-kpi-row {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .sales-kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }
  .sales-kpi-row > .sales-kpi-half + .sales-kpi-half {
    border-left: 1px solid var(--border);
    padding-left: 1.25rem;
  }
}
.sales-kpi-half h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.sales-kpi-hint {
  margin: -0.35rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.media-chart-row {
  display: grid;
  gap: 1.25rem;
  align-items: center;
}
@media (min-width: 640px) {
  .media-chart-row { grid-template-columns: 1fr min(260px, 48%); }
}
.media-pct-block { text-align: center; }
@media (min-width: 640px) {
  .media-pct-block { text-align: left; }
}
.media-pct-big {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
}
.chart-box-pie {
  height: 240px;
  max-width: 300px;
  margin: 0 auto;
  width: 100%;
}
.kpi-big {
  text-align: center;
  padding: 1.25rem;
}
.kpi-big .num { font-size: clamp(2rem, 8vw, 3rem); font-weight: 700; color: var(--accent); }
.kpi-big .sub { color: var(--muted); font-size: 0.95rem; }
.msg { padding: 0.6rem 0.75rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.875rem; }
.msg.err { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
[data-theme="light"] .msg.err { color: #b91c1c; }
.msg.ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }
[data-theme="light"] .msg.ok { color: #15803d; }
.hidden { display: none !important; }
.hidden-by-permission { display: none !important; }
.loading { color: var(--muted); padding: 2rem; text-align: center; }
/* Login (eBewerter-/Falcon-Anlehnung, nur diese Seite – unabhängig vom App-Theme) */
.login-page {
  --login-primary: #2c7be5;
  --login-primary-hover: #2569c7;
  --login-brand-from: #8b1a3a;
  --login-brand-to: #4a0f24;
  --login-panel-bg: #fff;
  --login-panel-text: #344050;
  --login-muted: #748194;
  --login-border: #d8e2ef;
  --login-focus: rgba(44, 123, 229, 0.25);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
  background-color: #3d4f63;
  background-image:
    linear-gradient(165deg, rgba(11, 23, 39, 0.72) 0%, rgba(44, 123, 229, 0.35) 100%),
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(139, 26, 58, 0.25), transparent 55%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 48px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 32px
    );
  background-size: auto, auto, 48px 32px, 48px 32px;
}
.login-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 880px;
  min-height: 420px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1.25rem 3.5rem rgba(11, 23, 39, 0.45);
}
@media (min-width: 720px) {
  .login-card { flex-direction: row; min-height: 400px; }
}
.login-brand {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.75rem;
  text-align: center;
  background: linear-gradient(155deg, var(--login-brand-from) 0%, var(--login-brand-to) 100%);
  overflow: hidden;
}
@media (min-width: 720px) {
  .login-brand { flex: 0 0 42%; max-width: 42%; }
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 11px, rgba(255, 255, 255, 0.08) 11px, rgba(255, 255, 255, 0.08) 12px),
    repeating-linear-gradient(90deg, transparent, transparent 11px, rgba(255, 255, 255, 0.06) 11px, rgba(255, 255, 255, 0.06) 12px);
  pointer-events: none;
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 55%;
  left: -20%;
  bottom: -18%;
  background:
    radial-gradient(circle at 20% 50%, rgba(245, 128, 62, 0.55) 0, transparent 42%),
    radial-gradient(circle at 75% 30%, rgba(44, 123, 229, 0.35) 0, transparent 38%);
  opacity: 0.85;
  pointer-events: none;
}
.login-brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 11rem;
  height: auto;
  margin: 0 auto 0.65rem;
  filter: brightness(0) invert(1);
  object-fit: contain;
}
.login-brand-tag {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}
.login-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.75rem 2.25rem;
  background: var(--login-panel-bg);
  color: var(--login-panel-text);
}
.login-panel-title {
  margin: 0 0 0.35rem;
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--login-panel-text);
}
.login-panel-sub {
  margin: 0 0 1.35rem;
  font-size: 0.875rem;
  color: var(--login-muted);
}
.login-form .login-field {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--login-muted);
}
.login-form input {
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--login-border);
  border-radius: 6px;
  background: #fff;
  color: var(--login-panel-text);
  font-size: 0.95rem;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--login-primary);
  box-shadow: 0 0 0 3px var(--login-focus);
}
.login-form input.login-field-prefilled {
  background: #f1f5f9;
  color: #334155;
  cursor: default;
}
.login-prefill-hint {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
}
.login-submit {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--login-primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: var(--login-primary-hover); }
.login-page .msg {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.login-page .msg.err {
  background: rgba(230, 55, 87, 0.12);
  color: #b42345;
  border: 1px solid rgba(230, 55, 87, 0.25);
}
.login-page .msg.ok {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.28);
}
.login-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}
/* Legacy-Klassen (falls noch referenziert) */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}
.col-details { white-space: nowrap; }

/* App-Shell mit linker Navigation */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-shell > .app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.app-main > main {
  flex: 1;
  min-width: 0;
  width: 100%;
}
#content {
  width: 100%;
  min-width: 0;
}
.nav-rail {
  flex: 0 0 auto;
  width: 100%;
  border-right: none;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel2) 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  position: sticky;
  top: 0;
  align-self: auto;
  min-height: 0;
  z-index: 20;
  box-shadow: 0 8px 20px rgba(11, 23, 39, 0.12);
}
.nav-rail-left,
.nav-rail-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-rail-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.2rem 0.65rem;
  min-width: 0;
  width: min(100%, 48rem);
  justify-self: center;
}
.nav-current-title {
  margin: 0;
  font-family: "Poppins", "Open Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-rail-right {
  margin-left: auto;
}
.nav-rail .nav-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 8.8rem;
  padding: 0.35rem 0.9rem 0.15rem;
  border-radius: 12px;
  text-decoration: none;
  background: rgba(44, 123, 229, 0.08);
  border: 1px solid var(--border);
}
.nav-rail .nav-brand:hover { border-color: var(--accent); }
.nav-logo {
  display: block;
  width: 100%;
  max-width: 7.25rem;
  height: auto;
  object-fit: contain;
  aspect-ratio: 760 / 258;
}
.nav-brand-tagline {
  margin-top: -0.05rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-rail-divider {
  width: 1px;
  height: 2rem;
  margin: 0 0.35rem;
  background: var(--border);
  flex: 0 0 auto;
}
.nav-rail a,
.nav-rail .nav-rail-link,
.nav-rail .nav-rail-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  margin: 0;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
.nav-rail a,
.nav-rail .nav-rail-link {
  text-decoration: none;
}
.nav-rail .nav-rail-btn {
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  width: auto;
}
.nav-rail a .ico,
.nav-rail .nav-rail-link .ico,
.nav-rail .nav-rail-btn .ico {
  font-size: 0.95rem;
  line-height: 1;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(44, 123, 229, 0.12);
}
.nav-dd {
  position: relative;
}
.nav-dd > summary {
  list-style: none;
  cursor: pointer;
}
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 11rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(11, 23, 39, 0.28);
  padding: 0.35rem;
  display: grid;
  gap: 0.25rem;
  z-index: 35;
}
.nav-dd-sep {
  height: 1px;
  background: var(--border);
  margin: 0.18rem 0.15rem;
}
.nav-dd-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.58rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.nav-dd-item:hover { background: rgba(44, 123, 229, 0.14); }
.nav-dd-item.active {
  background: rgba(44, 123, 229, 0.2);
  color: var(--text);
}
.nav-icon-only {
  position: relative;
  padding-left: 0.45rem !important;
  padding-right: 0.45rem !important;
}
.nav-icon-only span:not(.ico) { display: none; }
.nav-icon-only[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.38rem);
  right: 0;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(11, 23, 39, 0.28);
}
.nav-user-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(44, 123, 229, 0.06);
  font-size: 0.76rem;
  font-weight: 600;
  max-width: 15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-rail a:hover,
.nav-rail .nav-rail-link:hover,
.nav-rail .nav-rail-btn:hover {
  color: var(--text);
  background: rgba(44, 123, 229, 0.15);
  border-color: rgba(44, 123, 229, 0.4);
}
.nav-rail a.active,
.nav-rail .nav-rail-link.active {
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(44, 123, 229, 0.36);
}
.nav-rail .nav-rail-btn:hover { border-color: var(--border); }
@media (min-width: 700px) {
  .nav-rail {
    padding: 0.45rem 1rem;
    gap: 0.45rem;
  }
  .nav-rail a,
  .nav-rail .nav-rail-btn {
    font-size: 0.74rem;
  }
  .nav-logo { max-width: 8rem; }
}
.login-logo {
  display: block;
  max-width: 14rem;
  width: 100%;
  height: auto;
  margin: 0 auto 1rem;
  object-fit: contain;
  aspect-ratio: 760 / 258;
}
html.hdlmon-has-token #login-screen.login-page { display: none !important; }
@media (max-width: 640px) {
  .app-shell { flex-direction: column; }
  .nav-rail {
    flex-direction: row;
    width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    bottom: auto;
    left: auto;
    right: auto;
    padding: 0.3rem 0.4rem;
    justify-content: flex-start;
    overflow-x: hidden;
  }
  .nav-rail-right { margin-left: 0; }
  .nav-rail a,
  .nav-rail .nav-rail-link,
  .nav-rail .nav-rail-btn { flex: 0 0 auto; margin: 0; }
  .nav-rail .nav-brand {
    flex: 0 0 auto;
    min-width: 6.7rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }
  .nav-rail-center {
    align-items: flex-start;
    text-align: left;
    min-width: auto;
    padding-left: 0.15rem;
    padding-right: 0.35rem;
    justify-self: start;
  }
  .nav-logo { max-width: 6rem; }
  .nav-brand-tagline { font-size: 0.58rem; }
  .nav-user-pill { max-width: 8.5rem; }
  .nav-dd-menu { left: 0; right: auto; }
  .nav-rail-divider { display: none; }
  .app-shell > .app-main { padding-bottom: 0; }
  main { padding-left: 0.75rem; padding-right: 0.75rem; }
}

#upr-pct-main,
#fastsale-pct-main,
#sites-table th[data-sort="urr_quote"],
#sites-table th[data-sort="fastsale_quote"] {
  white-space: nowrap;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none !important; }
.modal-backdrop.top-third {
  align-items: flex-start;
  padding-top: 12vh;
}
.modal-panel {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.modal-panel.wide {
  width: min(96vw, 960px);
  max-width: min(96vw, 960px);
  box-sizing: border-box;
}
.modal-panel.wide table.data { min-width: 640px; }
.modal-panel.wide .table-wrap { overflow-x: auto; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.modal-head h2 { margin: 0; font-size: 1rem; }
.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.hint-box {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px dashed var(--border);
}
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.admin-toolbar .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
/* Einheitliche Aktions-Buttons (nur Farbe unterscheidet Varianten) */
.btn-action {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-action.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-action.primary:hover { background: var(--accent-hover); }
.btn-action.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-action.danger:hover { filter: brightness(0.92); }
.admin-layout {
  display: grid;
  gap: 1rem;
  width: 100%;
  align-items: start;
}
.admin-layout > .card {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
#panel-detail {
  min-width: 0;
}
@media (min-width: 800px) {
  .admin-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}
.group-list { list-style: none; padding: 0; margin: 0; }
.group-list li {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.group-list li:hover { background: var(--bg); }
.group-list li.active { border-color: var(--accent); background: rgba(245, 158, 11, 0.12); }
.group-list .meta { font-size: 0.75rem; color: var(--muted); }
.tag-muted { font-size: 0.75rem; color: var(--muted); }

/* SellTrend: Text-Badge + Hover-Detail */
.sell-trend-wrap {
  position: relative;
  display: inline-flex;
  justify-content: center;
}
.sell-trend-tip {
  min-width: 13.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  pointer-events: none;
}
.sell-trend-wrap > .sell-trend-tip-src {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sell-trend-tip-float {
  position: fixed;
  z-index: 250;
  left: 0;
  top: 0;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}
.sell-trend-tip-float.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.sell-trend-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--panel2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.sell-trend-tip-float[data-placement="below"]::after {
  bottom: auto;
  top: -5px;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.sell-trend-tip-title {
  display: block;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sell-trend-tip-title strong {
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: none;
}
.sell-trend-tip-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  margin-top: 0.45rem;
}
.sell-trend-tip-row:first-of-type {
  margin-top: 0;
}
.sell-trend-tip-label {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}
.sell-trend-tip-val {
  font-size: 0.75rem;
  line-height: 1.3;
  margin-top: 0.1rem;
}
.sell-trend-tip-sub {
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.25;
}
.abgang-avg-14d {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
#rank-table th.col-abgang-14d,
#rank-table td.col-abgang-14d,
#sites-table th.col-abgang-14d,
#sites-table td.col-abgang-14d {
  text-align: right;
  white-space: nowrap;
}
#rank-table td.col-sell-trend,
#sites-table td.col-sell-trend {
  overflow: visible;
}
.sell-trend-badge {
  display: inline-block;
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}
[data-theme="dark"] .sell-trend-boom {
  color: #ecfdf5;
  background: #15803d;
  border-color: #22c55e;
}
[data-theme="dark"] .sell-trend-very-pos {
  color: #f0fdf4;
  background: #166534;
  border-color: #22c55e;
}
[data-theme="dark"] .sell-trend-pos {
  color: #dcfce7;
  background: #14532d;
  border-color: #4ade80;
}
[data-theme="dark"] .sell-trend-stable {
  color: #e2e8f0;
  background: #475569;
  border-color: #94a3b8;
}
[data-theme="dark"] .sell-trend-weaker {
  color: #fff7ed;
  background: #c2410c;
  border-color: #fb923c;
}
[data-theme="dark"] .sell-trend-neg {
  color: #fef2f2;
  background: #b91c1c;
  border-color: #f87171;
}
[data-theme="dark"] .sell-trend-critical {
  color: #fff;
  background: #991b1b;
  border-color: #ef4444;
}
[data-theme="light"] .sell-trend-boom {
  color: #052e16;
  background: #bbf7d0;
  border-color: #16a34a;
}
[data-theme="light"] .sell-trend-very-pos {
  color: #052e16;
  background: #86efac;
  border-color: #16a34a;
}
[data-theme="light"] .sell-trend-pos {
  color: #14532d;
  background: #dcfce7;
  border-color: #22c55e;
}
[data-theme="light"] .sell-trend-stable {
  color: #1e293b;
  background: #e2e8f0;
  border-color: #94a3b8;
}
[data-theme="light"] .sell-trend-weaker {
  color: #431407;
  background: #fed7aa;
  border-color: #ea580c;
}
[data-theme="light"] .sell-trend-neg {
  color: #450a0a;
  background: #fecaca;
  border-color: #dc2626;
}
[data-theme="light"] .sell-trend-critical {
  color: #fff;
  background: #dc2626;
  border-color: #b91c1c;
}
#rank-table th.col-sell-trend,
#rank-table td.col-sell-trend,
#sites-table th.col-sell-trend,
#sites-table td.col-sell-trend { text-align: center; }

/* Ranking + Gruppen-Standorte (gleicher Tabellenaufbau, kompakt) */
#rank-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--tbl-font);
  min-width: 0;
  table-layout: fixed;
}
#sites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--tbl-font);
  min-width: 0;
  table-layout: fixed;
}
#rank-table tbody td,
#sites-table th,
#sites-table td {
  padding: var(--tbl-pad-y) var(--tbl-pad-x);
  border-bottom: 1px solid var(--border);
  text-align: right;
  overflow: hidden;
}
#rank-table th,
#rank-table thead td {
  padding: var(--tbl-pad-y) var(--tbl-pad-x);
  border-bottom: 1px solid var(--border);
  text-align: right;
  overflow: visible;
}
#rank-table th:first-child,
#rank-table td:first-child,
#rank-table th:nth-child(2),
#rank-table td:nth-child(2),
#rank-table th:nth-child(3),
#rank-table td:nth-child(3),
#sites-table th:first-child,
#sites-table td:first-child,
#sites-table th:nth-child(2),
#sites-table td:nth-child(2),
#sites-table th:nth-child(3),
#sites-table td:nth-child(3) {
  text-align: left;
}
#rank-table th,
#sites-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--tbl-head-font);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
/* Ranking: Kopfzeile beim Seiten-Scroll unter der Nav-Leiste fixieren */
:root {
  --hdlmon-nav-sticky-top: 3.4rem;
}
@media (max-width: 640px) {
  :root {
    --hdlmon-nav-sticky-top: 3rem;
  }
}
.table-wrap-ranking #rank-table thead {
  position: sticky;
  top: var(--hdlmon-nav-sticky-top);
  z-index: 12;
}
.table-wrap-ranking #rank-table thead th {
  position: sticky;
  top: var(--hdlmon-nav-sticky-top);
  z-index: 12;
  background: rgba(18, 28, 46, 0.98);
  box-shadow: 0 1px 0 var(--border);
}
[data-theme="light"] .table-wrap-ranking #rank-table thead th {
  background: #f8fafc;
}

/* Ranking: JS-Klon der Kopfzeile (zuverlässiger als reines CSS-sticky) */
.rank-sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 18;
  pointer-events: none;
}
.rank-sticky-bar.hidden {
  display: none;
}
.rank-sticky-bar-inner {
  position: absolute;
  top: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: rgba(18, 28, 46, 0.98);
  box-shadow: 0 4px 14px rgba(11, 23, 39, 0.22);
}
[data-theme="light"] .rank-sticky-bar-inner {
  background: #f8fafc;
}
.rank-table-sticky-clone {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--tbl-font);
  margin: 0;
}
.rank-table-sticky-clone th {
  padding: var(--tbl-pad-y) var(--tbl-pad-x);
  border-bottom: 1px solid var(--border);
  text-align: right;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--tbl-head-font);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: transparent;
}
.rank-table-sticky-clone th:first-child,
.rank-table-sticky-clone th:nth-child(2),
.rank-table-sticky-clone th:nth-child(3) {
  text-align: left;
}

#rank-table th[data-sort],
#sites-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}
#rank-table th[data-sort]:hover,
#sites-table th[data-sort]:hover,
#rank-table th.sorted,
#sites-table th.sorted {
  color: var(--accent);
}
#rank-table col.col-rank,
#sites-table col.col-rank { width: 2.4rem; }
#rank-table col.col-handler,
#sites-table col.col-handler { width: 12.5%; }
#rank-table col.col-num,
#sites-table col.col-num { width: 4.9%; }
#rank-table col.col-bestand,
#rank-table col.col-verkaeufe,
#sites-table col.col-bestand,
#sites-table col.col-verkaeufe { width: 5.8%; }
#rank-table col.col-upr,
#sites-table col.col-upr { width: 3rem; }
#rank-table col.col-abgang-14d,
#sites-table col.col-abgang-14d { width: 3.75rem; }
#rank-table col.col-sell-trend,
#sites-table col.col-sell-trend { width: 7.25rem; }
#rank-table col.col-details { width: 3.75rem; }
#rank-table th.col-bestand,
#rank-table td.col-bestand,
#rank-table th.col-verkaeufe,
#rank-table td.col-verkaeufe,
#sites-table th.col-bestand,
#sites-table td.col-bestand,
#sites-table th.col-verkaeufe,
#sites-table td.col-verkaeufe {
  white-space: nowrap;
  overflow: visible;
}
#rank-table td.col-bestand,
#rank-table td.col-verkaeufe {
  overflow: visible;
}
#rank-table td.col-bestand .num-with-action,
#rank-table td.col-verkaeufe .num-with-action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
}
.preisr-fictive-warn {
  color: #dc2626;
  font-weight: 600;
  cursor: help;
}
.veh-fictive-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  color: #b45309;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.35);
  cursor: help;
}
#vehicle-modal-table tr.veh-fictive-row td {
  background: rgba(245, 158, 11, 0.06);
}
#rank-table th.col-upr,
#rank-table td.col-upr,
#sites-table th.col-upr,
#sites-table td.col-upr,
#rank-table th.col-urr,
#rank-table td.col-urr,
#sites-table th.col-urr,
#sites-table td.col-urr {
  white-space: nowrap;
  overflow: visible;
}
#rank-table td.col-handler,
#sites-table td.col-handler {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sites-table tfoot tr.sites-totals-row td {
  font-weight: 600;
  border-top: 2px solid var(--border);
  background: rgba(44, 123, 229, 0.06);
}
[data-theme="light"] #sites-table tfoot tr.sites-totals-row td {
  background: rgba(44, 123, 229, 0.05);
}
#sites-table tfoot tr.sites-totals-row td:first-child {
  text-align: left;
}
#rank-table .col-details .btn-link {
  padding: 0.26rem 0.45rem;
  font-size: 0.8rem;
}
.inline-list-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: 0;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 1.35rem;
  height: 1.35rem;
  line-height: 1;
  text-align: center;
  background: rgba(59, 130, 246, 0.08);
}
.inline-list-link:hover {
  color: var(--text);
  border-color: var(--accent);
}
.table-wrap:has(#recent-sales-table) {
  margin-bottom: 1.15rem;
}
#recent-sales-table col.col-abgang { width: 9%; }
#recent-sales-table col.col-marke { width: 11%; }
#recent-sales-table col.col-modell { width: 24%; }
#recent-sales-table col.col-ez { width: 8%; }
#recent-sales-table col.col-km { width: 10%; }
#recent-sales-table col.col-kw { width: 8%; }
#recent-sales-table col.col-vk { width: 14%; }
#recent-sales-table col.col-stand { width: 10%; }
#recent-sales-table th.col-marke,
#recent-sales-table td.col-marke,
#recent-sales-table th.col-modell,
#recent-sales-table td.col-modell {
  text-align: left;
}
#recent-sales-table td.col-modell {
  white-space: normal;
  line-height: 1.35;
}
#recent-sales-table th.col-ez,
#recent-sales-table td.col-ez,
#recent-sales-table th.col-km,
#recent-sales-table td.col-km,
#recent-sales-table th.col-kw,
#recent-sales-table td.col-kw,
#recent-sales-table th.col-vk,
#recent-sales-table td.col-vk,
#recent-sales-table th.col-stand,
#recent-sales-table td.col-stand {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rank-badge {
  display: inline-block;
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
}
.rank-1 { color: #fcd34d; }
.rank-2 { color: #cbd5e1; }
.rank-3 { color: #d97706; }
[data-theme="light"] .rank-1 { color: #b45309; }
[data-theme="light"] .rank-2 { color: #475569; }
[data-theme="light"] .rank-3 { color: #c2410c; }
.col-handler { font-weight: 600; }
.col-plz { font-variant-numeric: tabular-nums; white-space: nowrap; }
.site-standort { max-width: 42ch; line-height: 1.35; }
.site-standort .site-name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-standort .site-addr {
  display: block;
  margin-top: 0.15rem;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.num-null { color: var(--muted); }

.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.detail-toolbar .site-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.detail-toolbar .site-filter-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.detail-toolbar .site-filter-select::after {
  content: "▾";
  position: absolute;
  right: 0.75rem;
  pointer-events: none;
  color: var(--muted);
  font-size: 0.7rem;
}
.detail-toolbar select#site-filter,
.detail-toolbar select#brand-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 16rem;
  max-width: 32rem;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.detail-toolbar select#site-filter:hover,
.detail-toolbar select#brand-select:hover {
  border-color: var(--accent-dim, #64748b);
}
.detail-toolbar select#site-filter:focus,
.detail-toolbar select#brand-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}
[data-theme="light"] .detail-toolbar select#site-filter,
[data-theme="light"] .detail-toolbar select#brand-select {
  background: #fff;
}
.recent-sales-day-sep td {
  font-weight: 600;
  font-size: var(--tbl-head-font);
  text-align: left !important;
  padding-top: calc(var(--tbl-pad-y) + 0.35rem);
  padding-bottom: var(--tbl-pad-y);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.recent-sales-day-sep.day-today td {
  background: rgba(34, 197, 94, 0.1);
}
.recent-sales-day-sep.day-yesterday td {
  background: rgba(59, 130, 246, 0.08);
}
.recent-sales-day-sep.day-before td {
  background: rgba(148, 163, 184, 0.12);
}
.vehicle-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 1rem;
}
.vehicle-modal {
  width: min(1200px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-rows: auto auto 1fr;
}
.vehicle-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.vehicle-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.vehicle-modal-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.vehicle-modal-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
}
.vehicle-modal-table-wrap {
  overflow: auto;
  max-height: calc(88vh - 120px);
  padding-right: 0.85rem;
  scrollbar-gutter: stable;
}
#vehicle-modal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
  font-size: var(--modal-tbl-font);
}
#vehicle-modal-table th,
#vehicle-modal-table td {
  padding: calc(var(--tbl-pad-y) + 0.06rem) calc(var(--tbl-pad-x) + 0.08rem);
  border-bottom: 1px solid var(--border);
  text-align: right;
}
#vehicle-modal-table th {
  color: var(--muted);
  font-size: var(--modal-tbl-head-font);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
#vehicle-modal-table th[data-sort] {
  cursor: pointer;
}
#vehicle-modal-table th.sorted {
  color: var(--accent);
}
#vehicle-modal-body td:first-child {
  text-align: center;
}
#vehicle-modal-table th.col-vehicle,
#vehicle-modal-table td.col-vehicle,
.veh-model-cell {
  text-align: left;
  min-width: 240px;
}
#vehicle-modal-table th.col-inserat,
#vehicle-modal-table td.col-inserat {
  text-align: center;
  padding-right: 1.1rem;
  white-space: nowrap;
}
.veh-mobile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  min-height: 1.65rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}
.veh-model-main {
  font-weight: 600;
}
.veh-model-sub {
  color: var(--muted);
  font-size: 0.86rem;
}
.vehicle-modal-more {
  display: flex;
  justify-content: center;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.vehicle-modal-more button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}
#vehicle-modal-table:not(.modal-sale) .col-abgang {
  display: none;
}

.risk-modal {
  max-width: min(1120px, 96vw);
}
#risk-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
#risk-modal-table th,
#risk-modal-table td {
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
#risk-modal-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  font-size: 0.75rem;
  color: var(--muted);
}
#risk-modal-table tr.risk-audit-row--yes td {
  color: var(--accent);
}
#risk-modal-table tr.risk-audit-row--dup td {
  opacity: 0.72;
}
#risk-modal-table .risk-audit-source {
  font-size: 0.72rem;
  color: var(--muted);
}
#langsteher-table tr.langsteher-intake-suspect td {
  color: var(--danger, #ef4444);
}
#langsteher-table tr.langsteher-intake-suspect:hover td {
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
}
#pt-modal-table tr.pt-audit-row--fallback td {
  color: var(--warn, #f59e0b);
}
#pt-modal-table tr.pt-audit-row--dup td {
  opacity: 0.72;
}
#pt-modal-table tr.pt-audit-row--diff td {
  background: color-mix(in srgb, var(--warn, #f59e0b) 10%, transparent);
}
#pt-modal-table .pt-audit-source {
  font-size: 0.72rem;
  color: var(--muted);
}

.chart-box-line { height: 280px; }

.hdlmon-print-only {
  display: none !important;
}

/* —— Druck / PDF-Export (siehe print.js) —— */
.sell-trend-print-label,
.hdlmon-print-chrome-header,
.hdlmon-print-chrome-footer,
.hdlmon-page-counter-activator {
  display: none;
}

@media print {
  /* margin: 0 unterdrückt Browser-Kopf-/Fußzeilen (https:// …) in Chrome/Edge */
  @page {
    size: A4 landscape;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 7mm 9mm !important;
    background: #fff !important;
    color: #111 !important;
    font-size: 9pt;
    line-height: 1.25;
    overflow: visible !important;
    box-sizing: border-box;
  }

  .hdlmon-print-chrome-header {
    display: flex !important;
    flex-direction: column;
    gap: 0.1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 1.5mm 7mm 1.5mm;
    background: #fff;
    border-bottom: 1.5px solid #1e293b;
    box-sizing: border-box;
  }
  .hdlmon-print-chrome-header::before {
    content: "";
    position: absolute;
    top: -14mm;
    left: 0;
    right: 0;
    height: 14mm;
    background: #fff;
    z-index: -1;
  }
  .hdlmon-print-chrome-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }
  .hdlmon-print-chrome-logo {
    height: 18px;
    width: auto;
    flex-shrink: 0;
  }
  .hdlmon-print-chrome-title {
    margin: 0;
    font-size: 11pt;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
  }
  .hdlmon-print-chrome-meta {
    margin: 0;
    font-size: 7pt;
    color: #475569;
    line-height: 1.2;
  }
  .hdlmon-print-chrome-footer {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 1.5mm 7mm 2mm;
    background: #fff;
    border-top: 1px solid #cbd5e1;
    font-size: 7pt;
    color: #64748b;
    box-sizing: border-box;
    gap: 0.6rem;
    position: fixed;
  }
  .hdlmon-print-chrome-footer::before {
    content: "";
    position: absolute;
    bottom: -12mm;
    left: 0;
    right: 0;
    height: 12mm;
    background: #fff;
    z-index: -1;
  }
  .hdlmon-print-footer-note {
    display: inline-block;
    font-size: 6.1pt;
    color: #64748b;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    max-width: 82%;
  }
  .hdlmon-print-chrome-footer::after {
    content: "";
    display: none !important;
  }
  .hdlmon-print-footer-pages {
    display: none !important;
  }
  .hdlmon-page-counter-activator {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }
  .hdlmon-page-counter-activator::after {
    content: counter(pages);
  }

  .rank-sticky-bar,
  .nav-rail,
  .btn-pdf,
  #btn-logout,
  #btn-theme,
  .nav-dd,
  .inline-list-link,
  .col-details,
  .vehicle-modal-backdrop,
  #veh-img-zoom,
  .detail-toolbar,
  .toolbar,
  label.debug-toggle,
  #sql-debug,
  #login-screen,
  #loading,
  #flash,
  .sell-trend-tip,
  .sell-trend-tip-float,
  .sell-trend-wrap > .sell-trend-tip-src,
  .sell-trend-wrap .sell-trend-badge,
  .veh-fictive-badge,
  .preisr-fictive-warn,
  .my-group-badge,
  #langsteher-section,
  #reentries-section {
    display: none !important;
  }

  .sell-trend-print-label {
    display: inline !important;
    font-size: 8pt;
    font-weight: 600;
    white-space: nowrap;
  }

  .app-shell,
  .app-main,
  main,
  #content {
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .app-footer {
    display: none !important;
  }

  .meta-line {
    display: none !important;
  }

  .card {
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin-bottom: 20px !important;
    padding: 0.5rem 0.6rem;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    break-inside: auto;
    page-break-inside: auto;
  }
  body.hdlmon-print-gruppe section.card {
    display: block;
    contain: none !important;
  }
  body.hdlmon-print-gruppe section.card .table-wrap {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  body.hdlmon-print-gruppe section.card .sales-kpi-row,
  body.hdlmon-print-gruppe section.card .charts-row,
  body.hdlmon-print-gruppe section.card .media-chart-row {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  body.hdlmon-print-gruppe section.card .sales-kpi-half {
    min-width: 0 !important;
    overflow: visible !important;
  }
  .card h2 {
    margin: 0 0 0.35rem;
    font-size: 10pt;
    color: #0f172a;
    break-after: avoid;
  }
  .card .sub,
  .chart-caption,
  .hint-box,
  .sales-kpi-hint {
    font-size: 7.5pt !important;
    color: #475569 !important;
    margin: 0 0 0.35rem !important;
  }

  .table-wrap {
    background: #fff !important;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: none !important;
    overflow: visible !important;
    margin-bottom: 0.35rem;
  }
  .table-wrap-ranking {
    overflow: visible !important;
  }

  #rank-table,
  #sites-table,
  table.data {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-size: 7.5pt !important;
    border-collapse: collapse;
    table-layout: fixed;
  }
  #rank-table thead,
  #sites-table thead,
  table.data thead {
    display: table-header-group;
  }
  #rank-table th,
  #rank-table td,
  #sites-table th,
  #sites-table td,
  table.data th,
  table.data td {
    padding: 0.2rem 0.25rem !important;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    line-height: 1.2;
  }
  #rank-table th,
  #sites-table th,
  table.data th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-size: 7pt !important;
    font-weight: 700;
    white-space: nowrap;
  }
  #rank-table thead th,
  .table-wrap-ranking #rank-table thead th {
    position: static !important;
    box-shadow: none !important;
  }
  body.hdlmon-print-ranking #rank-table thead th {
    padding-top: 2mm !important;
  }
  body.hdlmon-print-gruppe #sites-table thead th {
    padding-top: 10mm !important;
  }

  #rank-table .col-handler,
  #sites-table .col-handler,
  #sites-table td:nth-child(2) {
    max-width: 34mm;
    white-space: normal !important;
    word-break: break-word;
    text-align: left !important;
  }
  .site-standort .site-name,
  .site-standort .site-addr {
    display: block;
    line-height: 1.15;
    font-size: 7pt;
  }

  tr.row-my-group {
    background: #fff8e6 !important;
  }
  tr.row-my-group .handler,
  tr.row-my-group .col-handler {
    border-left: 2px solid #ca8a04 !important;
    padding-left: 0.35rem !important;
  }
  tr.row-average {
    background: #eff6ff !important;
  }
  tr.row-average td {
    border-top: 2px solid #3b82f6 !important;
    border-bottom: 2px solid #3b82f6 !important;
    font-weight: 700;
  }
  body.hdlmon-print-gruppe #sites-tfoot,
  body.hdlmon-print-gruppe #sites-tfoot.hidden {
    display: table-footer-group !important;
  }
  #sites-table tfoot tr.sites-totals-row td {
    border-top: 2px solid #3b82f6 !important;
    font-weight: 700;
    background: #eff6ff !important;
  }
  .rank-badge {
    font-size: 7pt !important;
    padding: 0.1rem 0.3rem !important;
  }
  .rank-1, .rank-2, .rank-3 {
    color: #111 !important;
  }

  .num-null {
    color: #94a3b8 !important;
  }

  /* Stufe 1 Gruppendetail: keine Grafiken im PDF */
  body.hdlmon-print-gruppe #card-standzeit,
  body.hdlmon-print-gruppe #card-sales-dev,
  body.hdlmon-print-gruppe #card-power,
  body.hdlmon-print-gruppe #card-recent-sales,
  body.hdlmon-print-gruppe .sales-kpi-price-weekday {
    display: none !important;
  }
  body.hdlmon-print-gruppe .chart-box,
  body.hdlmon-print-gruppe .chart-box-line,
  body.hdlmon-print-gruppe .chart-box-pie,
  body.hdlmon-print-gruppe .charts-row,
  body.hdlmon-print-gruppe .chart-caption {
    display: none !important;
  }
  body.hdlmon-print-gruppe #card-inventory-kpi .sales-kpi-row {
    grid-template-columns: 1fr !important;
  }
  body.hdlmon-print-gruppe .media-chart-row {
    display: block !important;
  }
  body.hdlmon-print-gruppe .hdlmon-print-only {
    display: block !important;
  }
  body.hdlmon-print-gruppe #powertrain-print-table {
    font-size: 8pt !important;
  }

  body.hdlmon-print-gruppe .print-top-bundle {
    break-inside: avoid;
    page-break-inside: avoid;
    break-before: page;
    page-break-before: always;
    padding-top: 12mm;
    margin-bottom: 20px;
  }
  body.hdlmon-print-gruppe .print-top-bundle > section.card {
    break-before: avoid !important;
    page-break-before: avoid !important;
    margin-bottom: 10px !important;
    padding: 0.35rem 0.45rem;
  }
  body.hdlmon-print-gruppe .print-top-bundle > section.card:last-child {
    margin-bottom: 0 !important;
  }
  body.hdlmon-print-gruppe .print-top-bundle h2 {
    font-size: 9pt;
    margin-bottom: 0.2rem;
  }
  body.hdlmon-print-gruppe .print-top-bundle .sub {
    font-size: 7pt !important;
    margin: -0.2rem 0 0.35rem !important;
  }
  body.hdlmon-print-gruppe .print-top-bundle #powertrain-print-table,
  body.hdlmon-print-gruppe .print-top-bundle #card-top-inbound table.data {
    font-size: 7pt !important;
  }
  body.hdlmon-print-gruppe .print-top-bundle #card-top-inbound table.data td,
  body.hdlmon-print-gruppe .print-top-bundle #card-top-inbound table.data th {
    padding: 0.1rem 0.2rem !important;
  }

  .sales-kpi-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .sales-kpi-half {
    break-inside: avoid;
  }
  .media-pct-big {
    font-size: 14pt !important;
  }

  body.hdlmon-print-gruppe #content > section.card:not(.hidden) ~ section.card:not(.hidden),
  body.hdlmon-print-gruppe #content > section.card:not(.hidden) ~ .print-top-bundle,
  body.hdlmon-print-gruppe #content > .print-top-bundle ~ section.card:not(.hidden) {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
    padding-top: 12mm;
  }

  body.hdlmon-print-ranking #app-screen,
  body.hdlmon-print-ranking .app-shell {
    min-height: 0 !important;
    height: auto !important;
  }

  body.hdlmon-print-ranking #content > section.card:not(.hidden) ~ section.card:not(.hidden) {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
  }

  body.hdlmon-print-ranking .app-main main {
    padding-top: 16mm !important;
  }
  body.hdlmon-print-ranking .table-wrap-ranking {
    margin-top: 0 !important;
  }
  body.hdlmon-print-ranking #rank-table {
    font-size: 7pt !important;
  }
}
