/* Backoffice-Shell: Seitenleiste, Kopfzeile, Dashboard (inc/backoffice-dashboard.php) */
:root {
  --bo-bg: #F6F7FB;
  --bo-card: #FFFFFF;
  --bo-line: #E6E8F0;
  --bo-ink: #1E1B3A;
  --bo-text: #475569;
  --bo-muted: #8B93A7;
  --bo-red: #DC2626;
  --bo-red-soft: #FEE8E8;
  --bo-blue: #2563EB;
  --bo-blue-soft: #E8EFFF;
  --bo-green: #16A34A;
  --bo-green-soft: #E6F7EC;
  --bo-orange: #EA580C;
  --bo-orange-soft: #FFF0E6;
  --bo-teal: #0E7490;
  --bo-teal-soft: #E3F4F8;
  --bo-radius: 14px;
  --bo-side: 252px;
}
html:has(body.ts24-backoffice) { margin-top: 0 !important; background: var(--bo-bg); }
body.ts24-backoffice { background: var(--bo-bg); }
body.ts24-backoffice { margin: 0; font-family: var(--ts24-font, 'Plus Jakarta Sans', sans-serif); color: var(--bo-text); }
body.ts24-backoffice.admin-bar .bo-side { top: 32px; }
.bo-app { display: grid; grid-template-columns: var(--bo-side) minmax(0, 1fr); min-height: 100vh; }
.bo-backdrop { display: none; }

/* Seitenleiste */
.bo-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #fff; border-right: 1px solid var(--bo-line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.bo-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-weight: 800; font-size: 19px; color: var(--bo-ink); text-decoration: none; letter-spacing: -.01em; }
.bo-brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--bo-red); flex: none; }
.bo-nav { display: flex; flex-direction: column; gap: 4px; }
.bo-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: var(--bo-text); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .15s, color .15s; }
.bo-nav a .bo-ico { color: var(--bo-muted); flex: none; }
.bo-nav a:hover { background: var(--bo-bg); color: var(--bo-ink); }
.bo-nav a.is-active { background: var(--bo-red-soft); color: var(--bo-red); }
.bo-nav a.is-active .bo-ico { color: var(--bo-red); }
.bo-side-promo { margin-top: auto; background: var(--bo-bg); border-radius: var(--bo-radius); padding: 18px; }
.bo-side-promo .bo-tile { margin-bottom: 10px; }
.bo-side-promo strong { display: block; color: var(--bo-ink); font-size: 15px; line-height: 1.3; margin-bottom: 6px; }
.bo-side-promo p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.bo-side-promo .ts24-btn { width: 100%; justify-content: center; }

/* Kopfzeile */
.bo-main { min-width: 0; display: flex; flex-direction: column; }
.bo-top { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--bo-line); position: sticky; top: 0; z-index: 20; min-width: 0; }
body.ts24-backoffice.admin-bar .bo-top { top: 32px; }
.bo-menu-btn { display: none; width: 42px; height: 42px; border: 1px solid var(--bo-line); background: #fff; border-radius: 10px; color: var(--bo-ink); cursor: pointer; align-items: center; justify-content: center; }
.bo-search { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; max-width: 600px; background: var(--bo-bg); border: 1px solid var(--bo-line); border-radius: 10px; padding: 0 14px; height: 44px; color: var(--bo-muted); }
.bo-search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--bo-ink); outline: none; }
.bo-search kbd { font: 600 11px/1 ui-monospace, monospace; background: #fff; border: 1px solid var(--bo-line); border-radius: 6px; padding: 4px 6px; color: var(--bo-muted); }
.bo-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bo-bell { position: relative; }
.bo-bell > summary { list-style: none; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 10px; cursor: pointer; color: var(--bo-ink); }
.bo-bell > summary::-webkit-details-marker { display: none; }
.bo-bell > summary:hover { background: var(--bo-bg); }
.bo-bell-n { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bo-red); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.bo-bell-list { position: absolute; right: 0; top: 50px; width: min(340px, 90vw); background: #fff; border: 1px solid var(--bo-line); border-radius: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, .12); padding: 8px; z-index: 30; }
.bo-bell-list a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--bo-ink); text-decoration: none; font-size: 13.5px; }
.bo-bell-list a:hover { background: var(--bo-bg); }
.bo-bell-list a span { display: block; color: var(--bo-muted); font-size: 12.5px; }
.bo-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; text-decoration: none; color: var(--bo-ink); }
.bo-user:hover { background: var(--bo-bg); }
.bo-user-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--bo-ink); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.bo-user strong { display: block; font-size: 14px; line-height: 1.2; }
.bo-user small { color: var(--bo-muted); font-size: 12px; }
.bo-user .bo-ico { color: var(--bo-muted); }

/* Inhalt */
.bo-content { padding: 26px 28px 48px; display: flex; flex-direction: column; gap: 22px; }
.bo-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.bo-page-head small { display: block; color: var(--bo-muted); font-size: 13.5px; margin-bottom: 2px; }
.bo-page-head h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; color: var(--bo-ink); letter-spacing: -.02em; line-height: 1.1; }
.bo-page-head p { margin: 6px 0 0; color: var(--bo-text); font-size: 15px; }
.bo-range { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--bo-line); border-radius: 10px; padding: 0 12px; height: 44px; color: var(--bo-ink); font-size: 14px; font-weight: 600; }
.bo-range select { border: 0; background: none; font: inherit; font-weight: 600; color: var(--bo-ink); padding-right: 22px; cursor: pointer; }
.bo-range .bo-ico { color: var(--bo-muted); }

.bo-card { background: var(--bo-card); border: 1px solid var(--bo-line); border-radius: var(--bo-radius); padding: 22px; min-width: 0; }
.bo-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.bo-card-head h2 { margin: 0; font-size: 17px; font-weight: 800; color: var(--bo-ink); letter-spacing: -.01em; }
.bo-card-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--bo-muted); }
.bo-card-link { display: inline-flex; align-items: center; gap: 6px; color: var(--bo-red); font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.bo-card-link:hover { text-decoration: underline; }
.bo-card > .bo-card-link { margin-top: 14px; justify-content: center; width: 100%; border: 1px solid var(--bo-line); border-radius: 10px; padding: 11px; }
.bo-card > .bo-card-link:hover { background: var(--bo-bg); text-decoration: none; }
.bo-empty { color: var(--bo-muted); font-size: 14px; margin: 0; }

.bo-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .bo-grid-main { grid-template-columns: 2fr 1fr; } }
.bo-stack { display: flex; flex-direction: column; gap: 22px; }

/* Kacheln + Farben */
.bo-tile { width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.bo-tile-sm { width: 34px; height: 34px; border-radius: 9px; }
.bo-tile-red { background: var(--bo-red-soft); color: var(--bo-red); }
.bo-tile-blue { background: var(--bo-blue-soft); color: var(--bo-blue); }
.bo-tile-green { background: var(--bo-green-soft); color: var(--bo-green); }
.bo-tile-orange { background: var(--bo-orange-soft); color: var(--bo-orange); }
.bo-tile-teal { background: var(--bo-teal-soft); color: var(--bo-teal); }
.bo-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.bo-pill-red { background: var(--bo-red-soft); color: var(--bo-red); }
.bo-pill-green { background: var(--bo-green-soft); color: var(--bo-green); }
.bo-pill-grey { background: var(--bo-bg); color: var(--bo-muted); }

/* KPIs */
.bo-kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.bo-kpi { background: #fff; border: 1px solid var(--bo-line); border-radius: var(--bo-radius); padding: 18px 20px; display: flex; gap: 16px; align-items: center; min-width: 0; }
.bo-kpi-body { display: flex; flex-direction: column; min-width: 0; }
.bo-kpi-label { font-size: 13.5px; color: var(--bo-text); }
.bo-kpi-value { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; color: var(--bo-ink); letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.bo-kpi-sub { font-size: 12.5px; color: var(--bo-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.bo-kpi-sub em { font-style: normal; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.bo-kpi-sub em.is-up { color: var(--bo-green); }
.bo-kpi-sub em.is-down { color: var(--bo-red); }

/* Umsatzkurve */
.bo-chart { width: 100%; height: auto; display: block; }
.bo-chart-grid { stroke: var(--bo-line); stroke-width: 1; stroke-dasharray: 3 4; }
.bo-chart-y, .bo-chart-x { font-size: 11px; fill: var(--bo-muted); font-family: inherit; }
.bo-chart-area { fill: rgba(220, 38, 38, .10); }
.bo-chart-line { fill: none; stroke: var(--bo-red); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.bo-chart-dot { fill: #fff; stroke: var(--bo-red); stroke-width: 2.5; }

/* Aktivitäten */
.bo-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bo-activity li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--bo-line); }
.bo-activity li:last-child { border-bottom: 0; }
.bo-activity a { flex: 1; min-width: 0; text-decoration: none; color: var(--bo-ink); }
.bo-activity a strong { display: block; font-size: 14px; }
.bo-activity a span { display: block; font-size: 12.5px; color: var(--bo-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-activity time { font-size: 12px; color: var(--bo-muted); white-space: nowrap; }

/* Tabellen (Dashboard/Suche) */
.bo-table-wrap { overflow-x: auto; }
.bo-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bo-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--bo-muted); font-weight: 700; padding: 6px 10px 10px; border-bottom: 1px solid var(--bo-line); }
.bo-table td { padding: 12px 10px; border-bottom: 1px solid var(--bo-line); color: var(--bo-ink); vertical-align: middle; }
.bo-table tr:last-child td { border-bottom: 0; }
.bo-table a { color: var(--bo-ink); font-weight: 700; text-decoration: none; }
.bo-table a:hover { color: var(--bo-red); }
.bo-avatar { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--bo-blue-soft); color: var(--bo-blue); font-size: 12px; font-weight: 800; align-items: center; justify-content: center; margin-right: 8px; vertical-align: middle; }

/* Zähler-Listen */
.bo-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bo-counts li { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; color: var(--bo-ink); }
.bo-count { margin-left: auto; min-width: 34px; text-align: center; padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.bo-count-red { background: var(--bo-red-soft); color: var(--bo-red); }
.bo-count-blue { background: var(--bo-blue-soft); color: var(--bo-blue); }
.bo-count-green { background: var(--bo-green-soft); color: var(--bo-green); }
.bo-count-orange { background: var(--bo-orange-soft); color: var(--bo-orange); }
.bo-list { list-style: none; margin: 0; padding: 0; }
.bo-list li { padding: 8px 0; border-bottom: 1px solid var(--bo-line); }
.bo-list a { color: var(--bo-ink); font-weight: 600; text-decoration: none; }

/* Kurskarten */
.bo-courses { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.bo-course { display: flex; flex-direction: column; border: 1px solid var(--bo-line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--bo-ink); background: #fff; transition: box-shadow .15s; }
.bo-course:hover { box-shadow: 0 10px 24px rgba(15, 23, 42, .08); }
.bo-course-img { display: block; aspect-ratio: 16 / 9; background: var(--bo-bg); }
.bo-course-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bo-course-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 12px 4px; }
.bo-course-body strong { font-size: 13.5px; line-height: 1.35; }
.bo-course small { padding: 0 12px 12px; color: var(--bo-muted); font-size: 12.5px; }

/* Donut */
.bo-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.bo-donut > svg { width: 120px; height: 120px; flex: none; transform: rotate(-90deg); }
.bo-donut-bg { fill: none; stroke: var(--bo-bg); stroke-width: 12; }
.bo-donut-seg { fill: none; stroke-width: 12; }
.bo-donut-green { stroke: var(--bo-green); }
.bo-donut-blue { stroke: var(--bo-blue); }
.bo-donut-red { stroke: var(--bo-red); }
.bo-donut-center { position: absolute; }
.bo-donut { position: relative; }
.bo-donut-center { left: 60px; top: 50%; transform: translate(-50%, -50%); color: var(--bo-ink); pointer-events: none; }
.bo-donut-text { flex: 1; min-width: 160px; }
.bo-donut-text strong { display: block; font-size: 26px; font-weight: 800; color: var(--bo-ink); line-height: 1.1; }
.bo-donut-text > span { display: block; color: var(--bo-muted); font-size: 13px; margin-bottom: 10px; }
.bo-donut-text ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--bo-ink); }
.bo-donut-text li { display: flex; align-items: center; gap: 8px; }
.bo-donut-text li b { margin-left: auto; }
.bo-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.bo-dot-green { background: var(--bo-green); }
.bo-dot-blue { background: var(--bo-blue); }
.bo-dot-red { background: var(--bo-red); }

/* Fachbereiche: bestehendes Modul-Markup in einer Karte */
.bo-section .ts24-bo-h2 { font-size: 17px; }
.bo-section .ts24-bo-cards { margin-bottom: 20px; }
.bo-section .ts24-bo-card { border-radius: 12px; }
.bo-section .ts24-bo-login { max-width: 420px; margin: 60px auto; }
.bo-tutorial-video { width: 100%; max-width: 960px; border-radius: 12px; display: block; }

/* Handy / Tablet */
@media (max-width: 980px) {
  .bo-app { grid-template-columns: 1fr; }
  .bo-side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: var(--bo-side); transform: translateX(-100%); transition: transform .2s; z-index: 40; box-shadow: 0 0 40px rgba(15, 23, 42, .2); }
  body.ts24-backoffice.bo-nav-open .bo-side { transform: none; }
  .bo-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }
  body.ts24-backoffice.bo-nav-open .bo-backdrop { display: block; }
  .bo-menu-btn { display: inline-flex; }
  .bo-top { padding: 10px 16px; }
  .bo-search kbd, .bo-user > span:not(.bo-user-avatar), .bo-user .bo-ico { display: none; }
  .bo-top { gap: 8px; }
  .bo-top-right { gap: 2px; }
  .bo-user { padding: 2px; }
  .bo-content { padding: 18px 16px 40px; gap: 16px; }
  .bo-card { padding: 16px; }
  .bo-grid { gap: 16px; }
  .bo-table thead { display: none; }
  .bo-table, .bo-table tbody, .bo-table tr, .bo-table td { display: block; width: 100%; }
  .bo-table tr { border: 1px solid var(--bo-line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
  .bo-table td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0; text-align: right; }
  .bo-table td::before { content: attr(data-label); color: var(--bo-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .bo-donut-center { left: 60px; }
}

/* Konflikte mit älteren Modul-Stilen auflösen */
.ts24-bo-lms-actions a.ts24-btn-primary { color: #fff; }
.ts24-bo-field .ts24-bo-toggle { display: inline-flex; align-items: center; gap: 12px; }
.ts24-bo-toggle-track { display: inline-block; }
.ts24-bo-toggle-knob { display: block; }
.ts24-bo-toggle-state { display: inline-block; font-size: 13.5px; color: var(--bo-text); }

/* Zertifikate: Reiter, Ausstellen mit Vorschau, Vorlagen-Karten */
.bo-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--bo-line); padding-bottom: 10px; }
.bo-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 14px; color: var(--bo-text); text-decoration: none; }
.bo-tabs a:hover { background: var(--bo-bg); }
.bo-tabs a.is-active { background: var(--bo-red-soft); color: var(--bo-red); }
.zc-grid { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
@media (min-width: 1100px) { .zc-grid { grid-template-columns: 400px minmax(0, 1fr); } }
.zc-form { border: 1px solid var(--bo-line); border-radius: 12px; padding: 18px; background: #fff; }
.zc-nr { display: flex; justify-content: space-between; align-items: center; background: var(--bo-bg); border-radius: 8px; padding: 10px 14px; margin: 4px 0 14px; font-size: 13.5px; color: var(--bo-text); }
.zc-nr strong { font-size: 16px; color: var(--bo-ink); }
.zc-preview-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bo-muted); margin-bottom: 8px; }
.zc-preview iframe { width: 100%; aspect-ratio: 210 / 297; border: 1px solid var(--bo-line); border-radius: 8px; background: #fff; display: block; }
.zc-zaehler { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--bo-line); font-size: 13.5px; }
.zc-zaehler input { width: 110px; padding: 8px 10px; border: 1px solid var(--bo-line); border-radius: 6px; font: inherit; }
.zc-zaehler small { width: 100%; color: var(--bo-muted); }
.zc-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 16px; }
.zc-card { border: 1px solid var(--bo-line); border-top: 3px solid var(--bo-red); border-radius: 12px; padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.zc-card h3 { margin: 0; font-size: 15px; line-height: 1.35; color: var(--bo-ink); }
.zc-card small { color: var(--bo-muted); font-size: 12.5px; }
.zc-card ul { margin: 0; padding: 0 0 0 16px; font-size: 13px; color: var(--bo-text); display: flex; flex-direction: column; gap: 4px; }
.zc-card li::marker { color: var(--bo-red); }
.zc-more { font-size: 12.5px; color: var(--bo-muted); }
.zc-card > a { margin-top: auto; color: var(--bo-red); font-weight: 700; font-size: 13.5px; text-decoration: none; }
.zc-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.zc-filter select, .zc-filter input { padding: 8px 10px; border: 1px solid var(--bo-line); border-radius: 8px; font: inherit; font-size: 13.5px; min-width: 0; }
.zc-filter input[type="search"] { flex: 1 1 200px; }
.bo-bar { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--bo-bg); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bo-bar i { display: block; height: 100%; background: var(--bo-green); }
.lm-form { border: 1px solid var(--bo-line); border-radius: 12px; padding: 18px; margin-bottom: 18px; background: #fff; }

.ts24-backoffice input[type="date"], .ts24-backoffice input[type="number"], .ts24-backoffice input[type="email"], .ts24-backoffice input[type="url"], .ts24-backoffice input[type="search"] { font-family: inherit; font-size: 14px; color: var(--bo-ink); -webkit-appearance: none; appearance: none; color-scheme: light; }
.ts24-bo-field input[type="date"], .ts24-bo-field input[type="email"], .ts24-bo-field input[type="search"], .zc-filter input, .zc-filter select { width: 100%; padding: 10px 12px; border: 1px solid var(--bo-line); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; }
.zc-filter input, .zc-filter select { width: auto; }
