:root {
  color-scheme: dark;
  --bg: #161622;
  --panel: #1e1e2e;
  --raised: #262637;
  --ink: #cdd6f4;
  --muted: #a6adc8;
  --line: #38384d;
  --green: #a6da95;
  --lime: #a6da95;
  --blue: #8aadf4;
  --purple: #c6a0f6;
  --danger: #ed8796;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html { font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--bg); }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, a { transition: background .15s, border-color .15s, color .15s; }
button { cursor: pointer; }
a { color: var(--blue); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .table-scroll:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px;
}
::selection { background: var(--blue); color: var(--bg); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px 16px; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.sidebar-brand div { display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 21px; letter-spacing: -.06em; }
.sidebar-brand small { color: var(--green); margin-top: 4px; font-size: 11px; }
.brand-mark { flex-shrink: 0; width: 48px; height: 48px; border: 1px solid var(--green); border-radius: 4px; background: #24332c; color: var(--green); display: grid; place-items: center; font-size: 24px; font-weight: 900; letter-spacing: -.08em; }
.brand-mark.small { width: 42px; height: 42px; font-size: 22px; }
.sidebar-site { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line); border-radius: 5px; padding: 11px 10px; color: var(--muted); font-size: 11px; }
.sidebar nav { display: grid; gap: 4px; margin-top: 20px; }
.nav-item, .logout { border: 1px solid transparent; background: transparent; color: var(--muted); text-align: left; border-radius: 5px; padding: 10px 12px; font-weight: 500; }
.nav-item span { display: inline-block; width: 26px; color: var(--muted); }
.nav-item:hover, .logout:hover { background: var(--raised); color: var(--ink); }
.nav-item.active { background: var(--raised); color: var(--ink); border-color: var(--line); }
.nav-item.active span { color: var(--green); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.logout { width: 100%; }
.dashboard { min-width: 0; padding: 24px 24px 48px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.dashboard-header h1 { font-size: 26px; line-height: 1.3; margin: 7px 0 0; letter-spacing: -.045em; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 600; color: var(--muted); margin: 0; }
.site-badge { max-width: 45%; border: 1px solid var(--line); border-radius: 5px; padding: 10px 14px; display: grid; gap: 6px; }
.site-badge small { color: var(--green); font-size: 10px; }
.site-badge strong { font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.toolbar-title { color: var(--ink); font-size: 12px; margin-right: auto; }
.range-label { display: flex; align-items: center; font-size: 11px; color: var(--muted); gap: 10px; }
.range-label select, .secondary, .search { min-height: 34px; border: 1px solid #51516a; background: var(--bg); border-radius: 4px; }
.range-label select { padding: 0 28px 0 10px; }
.secondary { display: inline-flex; justify-content: center; align-items: center; padding: 7px 16px; text-decoration: none; color: var(--ink); font-size: 12px; }
.secondary:hover { border-color: var(--blue); background: var(--raised); }
.view { display: none; }
.view.active { display: block; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; min-width: 0; }
.kpi small { display: block; color: var(--ink); font-size: 11px; }
.kpi strong { display: block; color: var(--green); font-size: 26px; font-weight: 500; letter-spacing: -.04em; margin: 8px 0 5px; font-variant-numeric: tabular-nums; }
.change { font-size: 10px; color: var(--green); }
.change.down { color: var(--danger); }
.change.neutral { color: var(--muted); }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.panel-heading h2 { font-size: 14px; font-weight: 600; line-height: 1.45; margin: 4px 0 0; }
.chart-panel { margin-bottom: 12px; }
.chart-wrap { height: 245px; position: relative; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.legend .visitors { background: var(--blue); }
.legend .views { background: var(--purple); }
.two-column, .three-column, .install-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.three-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.text-button { border: 0; background: none; color: var(--blue); padding: 5px 0; font-size: 11px; }
.text-button:hover { color: var(--green); }
.ranking, .dimension-list { display: grid; }
.rank-row, .dimension-row { min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child, .dimension-row:last-child { border-bottom: 0; }
.rank-main, .dimension-main { min-width: 0; }
.rank-title, .dimension-title { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.rank-title span:first-child, .dimension-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta, .dimension-meta { font-size: 10px; color: var(--muted); margin-top: 5px; }
.bar { height: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--green); }
.dimension-row .bar > span { background: var(--blue); }
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-heading { padding: 14px 16px; margin: 0; }
.search { display: flex; align-items: center; gap: 7px; padding: 0 10px; min-width: 0; }
.search input { border: 0; width: 220px; max-width: 100%; min-width: 0; background: transparent; padding: 8px 0; }
.search:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.search input:focus-visible { outline: 0; }
input::placeholder { color: var(--muted); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th { text-align: right; color: var(--ink); font-size: 10px; font-weight: 600; padding: 10px 12px; background: var(--raised); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child { text-align: left; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
td:first-child { text-align: left; white-space: normal; min-width: 230px; }
tbody tr:nth-child(even) { background: #212131; }
tbody tr:hover { background: var(--raised); }
.page-cell strong { display: block; font-weight: 500; }
.page-cell small { color: var(--muted); display: block; margin-top: 4px; overflow-wrap: anywhere; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.donut-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut { width: 108px; height: 108px; border-radius: 50%; position: relative; }
.donut:after { content: ""; position: absolute; inset: 21px; border-radius: 50%; background: var(--panel); }
.donut-legend { display: grid; gap: 10px; }
.donut-legend div { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.donut-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 7px; }
.prose h2 { font-size: 21px; letter-spacing: -.04em; margin: 10px 0 16px; overflow-wrap: anywhere; }
.prose h3 { margin-top: 24px; font-size: 14px; }
.prose p, .prose li { line-height: 1.8; color: var(--muted); overflow-wrap: anywhere; }
.prose pre { background: var(--bg); color: var(--green); border: 1px solid var(--line); border-radius: 4px; padding: 16px; overflow: auto; line-height: 1.65; }
.prose code { font-family: var(--mono); }
.notice { padding: 12px 14px; border-radius: 4px; margin-bottom: 12px; }
.notice.error { background: #35232f; color: var(--danger); border: 1px solid #714354; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--bg); }
.auth-card { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--green); border-radius: 6px; padding: 32px; }
.auth-card.compact { width: min(430px, 100%); }
.auth-card .brand-mark { margin-bottom: 24px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.045em; margin: 12px 0; }
.muted { color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.auth-card form { display: grid; gap: 16px; margin-top: 24px; }
.auth-card label { display: grid; gap: 8px; font-size: 11px; }
.auth-card input, .auth-card select { width: 100%; min-width: 0; height: 42px; border: 1px solid #51516a; border-radius: 4px; padding: 0 12px; background: var(--bg); }
.primary { min-height: 42px; border: 1px solid var(--blue); border-radius: 4px; background: var(--blue); color: var(--bg); font-weight: 700; padding: 10px; }
.primary:hover { background: #b7cafa; }
.loading { opacity: .55; pointer-events: none; }
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .dashboard { padding: 22px 18px 40px; }
  .three-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three-column .panel:last-child { grid-column: 1 / -1; }
  .donut-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; overflow: visible; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .sidebar-brand { padding: 0; }
  .sidebar-site { display: none; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; overflow-x: auto; margin: 0; padding-bottom: 3px; }
  .nav-item { flex-shrink: 0; white-space: nowrap; }
  .sidebar-bottom { grid-column: 2; grid-row: 1; border: 0; padding: 0; margin: auto 0; }
  .two-column, .install-grid { grid-template-columns: 1fr; }
  .dashboard { padding: 20px 16px 40px; }
}
@media (max-width: 620px) {
  .dashboard-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .dashboard-header h1 { font-size: 24px; }
  .site-badge { max-width: 100%; width: 100%; }
  .header-actions { gap: 10px; }
  .toolbar-title { width: 100%; }
  .range-label { width: 100%; justify-content: space-between; }
  .range-label select { flex: 1; min-width: 0; }
  .secondary { flex: 1; padding: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi strong { font-size: 24px; }
  .change { line-height: 1.6; }
  .panel { padding: 14px; }
  .panel-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .chart-wrap { height: 210px; }
  .three-column { grid-template-columns: 1fr; }
  .three-column .panel:last-child { grid-column: auto; }
  .donut-row { grid-template-columns: 110px minmax(0, 1fr); }
  .table-panel { padding: 0; }
  .search { width: 100%; }
  .search input { width: 100%; }
  .auth-shell { padding: 16px; }
  .auth-card { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { button, a { transition: none; } }

/* Accountverwaltung und nachvollziehbare Aktivitäten. */
.nav-item { text-decoration: none; }
.current-account { margin: 4px 12px 12px; font-size: 12px; overflow-wrap: anywhere; }
.current-account small { display: block; margin-top: 5px; color: var(--green); font-size: 10px; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, 1fr); gap: 16px; align-items: start; }
.account-form { display: grid; gap: 18px; }
.account-form label { display: grid; gap: 8px; font-size: 12px; }
.account-form input, .account-form select { width: 100%; min-width: 0; min-height: 40px; border: 1px solid #51516a; border-radius: 4px; padding: 8px 10px; background: var(--bg); }
.account-form small { color: var(--muted); font-size: 10px; line-height: 1.6; }
.account-form .checkbox-label { display: flex; align-items: center; gap: 10px; }
.account-form input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--green); }
.account-table td:first-child { min-width: 150px; }
.account-table th, .account-table td, .audit-table th, .audit-table td { text-align: left; }
.audit-table td:first-child { min-width: 185px; }
.audit-table td:last-child { white-space: normal; min-width: 260px; overflow-wrap: anywhere; }
.account-status { color: var(--green); }
.account-status.inactive { color: var(--danger); }
.notice.success { border: 1px solid #496341; color: var(--green); background: #24332c; }
.pagination { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1200px) { .account-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .current-account { display: none; } }
@media (max-width: 620px) { .audit-filters .range-label select { width: 0; } }

.chart-tooltip { position: absolute; z-index: 2; pointer-events: none; display: grid; gap: 7px; max-width: calc(100% - 8px); padding: 10px 12px; background: var(--bg); color: var(--ink); border: 1px solid var(--muted); border-radius: 5px; box-shadow: 0 4px 16px #0006; font-size: 11px; }
.chart-tooltip[hidden] { display: none; }
.chart-tooltip span { display: flex; justify-content: space-between; gap: 16px; }
.tooltip-visitors { color: var(--blue); }
.tooltip-views { color: var(--purple); }
