/* Reports — Design-Tokens 1:1 aus dem Claude-Design-Mockup übernommen */
body {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface-2: #fafafb;
    --text: #17181f;
    --muted: #6d7080;
    --line: rgba(23, 24, 31, .11);
    --brand: #ED1C24;
    --brand-ink: #ED1C24;
    --brand-soft: rgba(237, 28, 36, .09);
    --shadow: 0 1px 2px rgba(23, 24, 31, .06), 0 8px 24px rgba(23, 24, 31, .05);
}

body[data-theme="dark"] {
    --bg: #12141f;
    --surface: #1b1e2b;
    --surface-2: #232634;
    --text: #e9e9ed;
    --muted: #9397ab;
    --line: rgba(233, 233, 237, .13);
    --brand: #ED1C24;
    --brand-ink: #ff6b70;
    --brand-soft: rgba(237, 28, 36, .16);
    --shadow: 0 0 0 1px rgba(233, 233, 237, .07), 0 14px 34px rgba(0, 0, 0, .45);
}

.bb-app,
.bb-app * {
    box-sizing: border-box;
}

.bb-flash {
    margin: 16px 32px 0;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}

.bb-flash--error {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.bb-field__error {
    margin-top: 6px;
    color: var(--brand-ink);
    font-size: 13px;
}

.bb-app {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
}

.bb-app h1, .bb-app h2, .bb-app h3, .bb-app h4 {
    margin: 0;
    font-weight: 500;
    letter-spacing: -.015em;
    line-height: 1.14;
}

:where(.bb-app) button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
}

.bb-app input, .bb-app select, .bb-app textarea {
    font: inherit;
}

:where(.bb-app) a {
    color: var(--brand-ink);
    text-decoration: none;
}

:where(.bb-app) a:hover {
    color: var(--brand);
}

/* Ganze Zeilen/Karten sind Links (fuer echte Navigation), sollen aber wie im
   Mockup normale Textfarbe zeigen statt der generischen Link-Akzentfarbe. */
.bb-list-row,
.bb-table-row--dash,
.bb-table__row,
.bb-history-row {
    color: var(--text);
}

.bb-app :focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Header */
.bb-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 28px;
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.bb-header__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 8px;
}

.bb-header__logo-wrap {
    display: flex;
    align-items: center;
}

.bb-header__logo-img {
    height: 26px;
    width: auto;
}

body[data-theme="dark"] .bb-header__logo-img {
    filter: brightness(0) invert(1);
}

.bb-header__logo-fallback {
    display: none;
    align-items: baseline;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--text);
    line-height: 1;
}

.bb-header__logo-fallback span {
    color: #ED1C24;
}

.bb-header__divider {
    width: 1px;
    height: 24px;
    background: var(--line);
}

.bb-header__label {
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--muted);
}

.bb-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bb-nav__item {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--muted);
    background: transparent;
}

.bb-nav__item:hover {
    background: var(--brand-soft);
}

.bb-nav__item.is-active {
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.bb-header__spacer {
    flex: 1;
}

.bb-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 12px;
    min-width: 240px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
}

.bb-search input {
    flex: 1;
    border: 0;
    background: none;
    color: var(--text);
    outline: none;
    font-size: 13px;
}

.bb-icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: var(--muted);
}

.bb-icon-btn:hover {
    color: var(--brand);
    border-color: var(--brand);
}

.bb-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px 0 0;
}

.bb-avatar, .bb-avatar-img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.bb-avatar {
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    letter-spacing: .04em;
}

.bb-avatar-img {
    object-fit: cover;
}

.bb-avatar-name {
    font-size: 13px;
    color: var(--muted);
}

/* Main layout */
.bb-main {
    max-width: 1360px;
    margin: 0 auto;
    padding: 34px 28px 72px;
}

.bb-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.bb-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--brand-ink);
    margin-bottom: 8px;
}

.bb-h1--lg { font-size: 34px; }
.bb-h1 { font-size: 30px; }

.bb-lead {
    margin: 8px 0 0;
    color: var(--muted);
    max-width: 52ch;
}

/* Buttons */
.bb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
}

.bb-btn--sm {
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
}

.bb-btn--outline-brand {
    border: 1px solid var(--brand);
    color: var(--brand-ink);
}

.bb-btn--outline-brand:hover {
    background: var(--brand-soft);
}

.bb-btn--brand {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

.bb-btn--brand:hover {
    opacity: 0.9;
}

.bb-btn--outline-line {
    border: 1px solid var(--line);
    color: var(--muted);
}

.bb-btn--outline-line:hover {
    color: var(--brand-ink);
    border-color: var(--brand);
}

.bb-btn--text {
    height: auto;
    padding: 0;
    font-size: 13px;
    color: var(--muted);
}

.bb-btn--text:hover {
    color: var(--brand-ink);
}

.bb-btn--link-brand {
    height: auto;
    padding: 0;
    font-size: 13px;
    color: var(--brand-ink);
}

/* Cards & KPI grid */
.bb-card {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.bb-card--padded {
    padding: 22px 24px;
}

.bb-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.bb-kpi-card {
    padding: 18px 20px;
}

.bb-kpi-card__label {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .02em;
}

.bb-kpi-card__value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 10px;
}

.bb-kpi-card__value {
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -.02em;
}

.bb-kpi-card__unit {
    font-size: 12px;
    color: var(--muted);
}

.bb-kpi-card__delta {
    margin-top: 12px;
    font-size: 12px;
    color: var(--brand-ink);
}

.bb-grid-2 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}

.bb-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 22px;
}

.bb-card__title {
    font-size: 17px;
}

.bb-card__meta {
    font-size: 12px;
    color: var(--muted);
}

/* Chart */
.bb-chart {
    display: flex;
    align-items: stretch;
    gap: 14px;
    height: 170px;
}

.bb-chart__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bb-chart__value {
    font-size: 11px;
    color: var(--muted);
}

.bb-chart__bar-track {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.bb-chart__bar {
    width: 100%;
    border-radius: 5px 5px 2px 2px;
}

.bb-chart__bar--high { background: var(--brand); }
.bb-chart__bar--low { background: var(--brand-soft); }

.bb-chart__label {
    font-size: 11px;
    color: var(--muted);
}

/* Generic row lists (Wiedervorlagen, Kontakte, KPI-Zeilen) */
.bb-list {
    display: flex;
    flex-direction: column;
}

.bb-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-top: 1px solid var(--line);
    text-align: left;
    width: 100%;
}

.bb-list-row:hover {
    background: var(--surface-2);
}

.bb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand);
    flex: none;
}

.bb-list-row__main {
    flex: 1;
    min-width: 0;
}

.bb-list-row__title {
    display: block;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bb-list-row__sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.bb-list-row__meta {
    font-size: 12px;
    color: var(--muted);
    flex: none;
}

/* Dashboard "Zuletzt eingegangen" table */
.bb-table-row--dash {
    display: grid;
    grid-template-columns: 96px 1.4fr 1fr 130px 96px;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    text-align: left;
}

.bb-table-row--dash:hover {
    background: var(--surface-2);
}

/* List page table */
.bb-table {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.bb-table__head {
    display: grid;
    grid-template-columns: 110px 1.5fr 1fr 130px 120px 120px 110px;
    gap: 16px;
    padding: 13px 22px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.bb-table__sort-link {
    color: inherit;
    text-decoration: none;
}

.bb-table__sort-link:hover {
    color: var(--text);
}

.bb-table__row {
    display: grid;
    grid-template-columns: 110px 1.5fr 1fr 130px 120px 120px 110px;
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 15px 22px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.bb-table__row:hover {
    background: var(--surface-2);
}

.bb-table__cell {
    font-size: 13px;
}

.bb-table__cell--muted {
    font-size: 13px;
    color: var(--muted);
}

.bb-table__cell-title {
    display: block;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bb-table__cell-sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.bb-justify-end {
    justify-self: end;
}

/* Status-Badge */
.bb-badge {
    display: inline-block;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
}

.bb-badge--freigegeben {
    color: var(--muted);
    box-shadow: inset 0 0 0 1px var(--line);
}

.bb-badge--zur_pruefung {
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.bb-badge--entwurf {
    color: var(--muted);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
}

/* Filter-Pillen (Liste + Besuchsart-Auswahl) */
.bb-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.bb-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 13px;
    border-radius: 20px;
    font-size: 13px;
}

.bb-pill--on {
    color: #fff;
    background: var(--brand);
}

.bb-pill--off {
    color: var(--muted);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--line);
}

.bb-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
}

/* Detailseite */
.bb-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 18px;
}

.bb-back-link:hover {
    color: var(--brand-ink);
}

.bb-detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}

.bb-detail-main {
    padding: 30px 34px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.bb-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.bb-detail-actions {
    display: flex;
    gap: 8px;
}

.bb-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 28px 0 4px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.bb-meta-item__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.bb-meta-item__value {
    margin-top: 6px;
    font-size: 14px;
}

.bb-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.bb-section:last-of-type {
    border-bottom: 0;
}

.bb-section__title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.bb-section__body {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    max-width: 70ch;
    text-wrap: pretty;
}

.bb-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.bb-photo-placeholder {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    gap: 6px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.bb-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bb-side-card {
    padding: 20px 22px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.bb-side-card__title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.bb-step-row {
    display: flex;
    gap: 10px;
    padding: 9px 0;
    font-size: 14px;
    border-top: 1px solid var(--line);
}

.bb-step-row__icon {
    color: var(--brand-ink);
    font-size: 15px;
    margin-top: 3px;
}

.bb-followup-box {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--brand-soft);
    font-size: 13px;
}

.bb-map-placeholder {
    height: 150px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    gap: 6px;
}

.bb-map {
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.bb-map--full {
    height: 600px;
}

/* MapLibres Standard-Popup ist fest hell gestylt und dadurch im Dark Mode
   unlesbar - an die Theme-Tokens dieser Seite angleichen. */
.bb-map .maplibregl-popup-content {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.bb-map .maplibregl-popup-tip {
    border-top-color: var(--surface);
    border-bottom-color: var(--surface);
    border-left-color: var(--surface);
    border-right-color: var(--surface);
}

.bb-side-note {
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
}

.bb-side-link-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 14px;
    color: var(--brand-ink);
}

/* Kundenseite */
.bb-history-row {
    display: grid;
    grid-template-columns: 100px 1fr 150px 20px;
    gap: 16px;
    align-items: center;
    width: 100%;
    padding: 15px 0;
    border-top: 1px solid var(--line);
    text-align: left;
}

.bb-history-row:hover {
    background: var(--surface-2);
}

.bb-contact {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.bb-contact__name {
    font-size: 14px;
}

.bb-contact__role {
    font-size: 12px;
    color: var(--muted);
}

.bb-kv-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.bb-kv-row__label {
    color: var(--muted);
}

/* Formular "Neuer Bericht" */
.bb-form-wrap {
    max-width: 840px;
}

.bb-form-card {
    padding: 28px 32px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.bb-form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.bb-form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
}

.bb-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.bb-field__label {
    font-size: 12px;
    color: var(--muted);
}

.bb-input, .bb-select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
}

.bb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 4px;
}

.bb-checkbox-group__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.bb-checkbox-group__item:hover {
    background: var(--surface-2);
}

.bb-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--brand);
    cursor: pointer;
    flex-shrink: 0;
}

.bb-lang-switch {
    position: relative;
}

.bb-lang-switch__toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bb-lang-switch__menu:not([hidden]) {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: 72px;
    padding: 6px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    z-index: 10;
}

.bb-lang-switch__item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--muted);
}

.bb-lang-switch__item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.bb-lang-switch__item.is-active {
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.bb-account-menu {
    position: relative;
}

.bb-account-menu__menu:not([hidden]) {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    padding: 6px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    z-index: 10;
}

.bb-account-menu__item {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--muted);
    text-align: left;
    width: 100%;
    background: none;
    border: 0;
}

.bb-account-menu__item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.bb-impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 13px;
}

.bb-impersonation-banner a {
    font-weight: 600;
    text-decoration: underline;
}

.bb-textarea {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    resize: vertical;
    line-height: 1.6;
}

.bb-dropzone {
    height: 96px;
    display: grid;
    place-items: center;
    gap: 6px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
}

.bb-location-box {
    height: 96px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 13px;
}

.bb-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.bb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.bb-modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 520px;
    width: calc(100% - 32px);
    max-height: 80vh;
    overflow-y: auto;
}

.bb-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

.bb-modal__body {
    padding: 16px 20px;
}
