:root {
  --bc-primary: #1f6feb;
  --bc-accent:  #0d4cb8;
  --bc-bg:      #f4f6fa;
  --bc-fg:      #1d2330;
  --bc-muted:   #6b7385;
  --bc-line:    #e3e7ee;
  --bc-ok:      #1a8a4a;
  --bc-err:     #c0392b;
  --bc-radius:  10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bc-bg);
  color: var(--bc-fg);
}

a { color: var(--bc-primary); }

.bc-header {
  background: linear-gradient(135deg, var(--bc-primary) 0%, var(--bc-accent) 100%);
  color: #fff;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  position: sticky; top: 0; z-index: 100;
}
.bc-header__inner {
  display: flex; align-items: center; gap: 0;
  min-height: 56px;
}
.bc-brand {
  color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; gap: 7px; letter-spacing: -0.01em;
  padding: 0 20px 0 0; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.18);
  margin-right: 4px;
}
.bc-brand__icon { font-size: 1.3rem; line-height: 1; }
.bc-brand:hover { opacity: 0.9; }

.bc-nav {
  display: flex; align-items: stretch; flex: 1; gap: 0;
  justify-content: space-between;
}
.bc-nav__links {
  display: flex; align-items: center; gap: 2px; padding: 0 8px;
}
.bc-nav__link {
  color: rgba(255,255,255,0.82); text-decoration: none;
  padding: 6px 11px; border-radius: 8px; font-size: 0.88rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.bc-nav__link:hover { background: rgba(255,255,255,0.15); color: #fff; }
.bc-nav__link--active {
  background: rgba(255,255,255,0.22); color: #fff; font-weight: 700;
}
.bc-nav__link-icon { margin-right: 4px; font-size: 0.95em; }

.bc-nav__right {
  display: flex; align-items: center; gap: 8px; padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.18); margin-left: auto;
}
.bc-nav__user {
  display: flex; align-items: center; gap: 7px; padding: 0 4px;
}
.bc-nav__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.25); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.5);
}
.bc-nav__username {
  font-size: 0.82rem; color: rgba(255,255,255,0.9); max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bc-nav__logout {
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,255,255,0.25); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; font: inherit; font-size: 0.84rem;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.bc-nav__logout:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* bc-link outside the nav (e.g. <details> summaries inside cards) uses primary color */
.bc-link {
  color: var(--bc-primary); text-decoration: none; background: none; border: 0;
  cursor: pointer; font: inherit;
}
.bc-link:hover { text-decoration: underline; color: var(--bc-accent); }

.bc-main { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.bc-footer {
  text-align: center; color: var(--bc-muted); padding: 24px; font-size: 0.9rem;
}

.bc-card {
  background: #fff; border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius); padding: 20px; margin-bottom: 20px;
}
.bc-card h1 { margin-top: 0; }

.bc-muted { color: var(--bc-muted); font-size: 0.9rem; }

.bc-flash {
  border-radius: var(--bc-radius); padding: 10px 14px; margin-bottom: 12px;
}
.bc-flash--ok  { background: #e9f8ef; color: var(--bc-ok);  border: 1px solid #b5e2c4; }
.bc-flash--err { background: #fdecea; color: var(--bc-err); border: 1px solid #f4b6ad; }

.bc-button {
  background: var(--bc-primary); color: #fff; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; font: inherit; text-decoration: none; display: inline-block;
}
.bc-button:hover { background: var(--bc-accent); }
.bc-button[disabled] { opacity: 0.5; cursor: not-allowed; }
.bc-button--danger { background: var(--bc-err); }
.bc-button--ghost  { background: transparent; color: var(--bc-primary); border: 1px solid var(--bc-primary); }

.bc-form { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.bc-form label { display: flex; flex-direction: column; gap: 4px; }
.bc-form input, .bc-form select {
  padding: 8px 10px; border: 1px solid var(--bc-line); border-radius: 6px; font: inherit;
}
.bc-form--inline, .bc-inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.bc-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.bc-tabs a { padding: 6px 12px; border-radius: 6px; background: #eef1f6; text-decoration: none; }
.bc-tabs a.is-active { background: var(--bc-primary); color: #fff; }

.bc-table { width: 100%; border-collapse: collapse; }
.bc-table th, .bc-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bc-line); }
.bc-table th { background: #f8fafd; }

.bc-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eef1f6; color: var(--bc-fg); font-size: 0.85rem; }
.bc-tag--mine  { background: #e9f8ef; color: var(--bc-ok); }
.bc-tag--taken   { background: #fdecea; color: var(--bc-err); }
.bc-tag--closed  { background: #f5f5f5; color: #888; }

.bc-color { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--bc-line); vertical-align: middle; }

.bc-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.bc-bike { padding: 0; overflow: hidden; }
.bc-bike__image { aspect-ratio: 1 / 1; background: #eef1f6; display: flex; align-items: center; justify-content: center; }
.bc-bike__image img { width: 100%; height: 100%; object-fit: cover; }
.bc-bike__placeholder { font-size: 2rem; color: var(--bc-muted); }
.bc-bike__body { padding: 12px; }
.bc-bike__body h2 { margin: 0 0 6px; font-size: 1.1rem; }
.bc-bike--taken { opacity: 0.7; }

.bc-pre { background: #0d1117; color: #d4d4d4; padding: 16px; border-radius: 6px; overflow: auto; }

.bc-locale { display: inline-flex; gap: 6px; align-items: center; }
.bc-locale__select {
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 8px;
  padding: 5px 8px; font: inherit; font-size: 0.84rem; cursor: pointer;
  transition: background 0.15s;
}
.bc-locale__select:hover { background: rgba(255,255,255,0.22); }
.bc-locale__select option { color: #1d2330; background: #fff; }

.bc-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.bc-modal__box {
  background: #fff; border-radius: var(--bc-radius); padding: 24px;
  max-width: 480px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.bc-modal__title { margin: 0 0 8px; }
.bc-modal__warning {
  background: #fff7e6; border: 1px solid #f0c674; color: #6b4f00;
  padding: 10px 12px; border-radius: 6px; margin: 12px 0;
}
.bc-code-display {
  display: flex; gap: 8px; align-items: stretch; margin: 16px 0;
}
.bc-code-display__value {
  flex: 1; font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.5rem; letter-spacing: 0.25em; text-align: center;
  padding: 12px 16px; border: 1px solid var(--bc-line);
  border-radius: 6px; background: #f4f6fa; user-select: all;
}
.bc-code-display__copy {
  background: var(--bc-primary); color: #fff; border: 0;
  padding: 0 16px; border-radius: 6px; cursor: pointer; font: inherit;
}
.bc-code-display__copy:hover { background: var(--bc-accent); }
.bc-code-display__copy.is-copied { background: var(--bc-ok); }

.bc-edit-form { display: flex; gap: 6px; align-items: stretch; }
.bc-edit-form input[type="text"] {
  flex: 1; padding: 6px 10px; border: 1px solid var(--bc-line); border-radius: 6px; font: inherit;
}
.bc-edit-form button {
  background: var(--bc-primary); color: #fff; border: 0;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit;
}
.bc-edit-form button:hover { background: var(--bc-accent); }

/* ---------------------------------------------------------------------------
 * Compact tables: tighter rows + better column widths, plus horizontal
 * scroll for narrow viewports instead of breaking layout.
 * ------------------------------------------------------------------------- */
.bc-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bc-table--compact th, .bc-table--compact td { padding: 6px 8px; font-size: 0.92rem; }
.bc-table--compact .bc-col-num    { width: 64px;  white-space: nowrap; }
.bc-table--compact .bc-col-actions { width: 1%; white-space: nowrap; }
.bc-table--compact .bc-thumb     { width: 48px; height: 48px; }

/* ---------------------------------------------------------------------------
 * Inline cell editing: the cell looks like text, but is editable on click.
 * ------------------------------------------------------------------------- */
.bc-cell-editable {
  cursor: text;
  border-radius: 4px;
  padding: 4px 6px;
  min-height: 1.6em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--bc-fg);
}
.bc-cell-editable:hover { background: #f4f6fa; }
.bc-cell-editable:focus,
.bc-cell-editable.is-editing {
  background: #fff;
  border-color: var(--bc-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(31,111,235,0.15);
}
.bc-cell-editable input {
  width: 100%;
  border: 0; outline: none; background: transparent;
  font: inherit; color: inherit; padding: 0;
}
.bc-cell-editable.is-saving { color: var(--bc-muted); }
.bc-cell-editable.is-saved  { background: #e9f8ef; transition: background 0.4s; }
.bc-cell-editable.is-error  { background: #fdecea; }

/* ---------------------------------------------------------------------------
 * Project actions cell: stacks forms vertically so the table row doesn't
 * explode horizontally on mobile.
 * ------------------------------------------------------------------------- */
.bc-project-actions { display: flex; flex-direction: column; gap: 8px; min-width: 280px; padding-top: 8px; }
.bc-project-actions form { display: flex; flex-direction: column; gap: 6px; }
.bc-project-actions label.bc-inline-label { display: inline-flex; gap: 6px; align-items: center; }
.bc-project-actions .bc-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bc-project-edit label { display: flex; flex-direction: column; gap: 4px; }
.bc-project-edit input,
.bc-project-edit select { padding: 6px 8px; border: 1px solid var(--bc-line); border-radius: 6px; font: inherit; }

/* ---------------------------------------------------------------------------
 * Compact inputs / selects for inline forms (radverwertung, etc.).
 * ------------------------------------------------------------------------- */
.bc-input-sm, .bc-select-sm { padding: 4px 6px; border: 1px solid var(--bc-line); border-radius: 4px; font: inherit; background: #fff; color: var(--bc-fg); }
.bc-button--icon { width: 28px; height: 28px; padding: 0; line-height: 1; font-size: 1.2rem; border-radius: 14px; }

.bc-thumb-btn {
  background: none; border: 0; padding: 0; margin: 0;
  display: block; cursor: zoom-in; line-height: 0;
  width: 48px; height: 48px;
}
.bc-thumb-btn:focus-visible { outline: 2px solid var(--bc-primary); outline-offset: 2px; }
.bc-thumb-btn img,
.bc-thumb {
  display: block; width: 48px; height: 48px;
  object-fit: cover; border-radius: 6px; border: 1px solid var(--bc-line);
}
.bc-thumb--placeholder {
  display: flex; align-items: center; justify-content: center;
  background: #eef1f6; color: var(--bc-muted); font-size: 0.8rem;
}
.bc-thumb-btn--gallery img {
  width: 100%; height: 100%; border: 0; border-radius: 0;
  aspect-ratio: 1 / 1;
}

.bc-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 24px;
}
.bc-lightbox[hidden] { display: none; }
.bc-lightbox__img {
  max-width: 92vw; max-height: 92vh;
  object-fit: contain; background: #fff;
  border-radius: 6px; box-shadow: 0 12px 48px rgba(0,0,0,0.4);
}
.bc-lightbox__close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 22px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.bc-lightbox__close:hover { background: rgba(0,0,0,0.85); }

/* ---------------------------------------------------------------------------
 * Responsive: on phones, tables reflow into stacked cards.  Only triggers
 * for narrow viewports (default threshold 720px).
 * ------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .bc-header { padding: 0 12px; }
  .bc-header__inner { flex-wrap: wrap; min-height: auto; padding: 8px 0; gap: 6px; }
  .bc-brand { border-right: 0; padding-right: 0; margin-right: 0; margin-bottom: 2px; }
  .bc-nav { flex-wrap: wrap; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
  .bc-nav__links { flex-wrap: wrap; padding: 0; gap: 2px; }
  .bc-nav__right { border-left: 0; padding-left: 0; margin-left: 0; flex-wrap: wrap; }
  .bc-nav__username { max-width: 80px; }
}

@media (max-width: 720px) {
  .bc-main { margin: 12px auto; padding: 0 12px; }

  .bc-table--responsive thead { display: none; }
  .bc-table--responsive,
  .bc-table--responsive tbody,
  .bc-table--responsive tr,
  .bc-table--responsive td { display: block; width: 100%; }
  .bc-table--responsive tr {
    border: 1px solid var(--bc-line);
    border-radius: var(--bc-radius);
    margin-bottom: 12px;
    padding: 8px;
    background: #fff;
  }
  .bc-table--responsive td {
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .bc-table--responsive td:last-child { border-bottom: 0; }
  .bc-table--responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--bc-muted);
    text-align: left;
    flex: 0 0 auto;
  }
  .bc-table--responsive .bc-cell-editable { flex: 1; text-align: right; }
  .bc-table--responsive .bc-col-num { text-align: right; }
  .bc-table--responsive .bc-col-actions { justify-content: flex-end; }

  .bc-form--inline, .bc-form { max-width: 100%; }
  .bc-project-actions { min-width: 0; }
  .bc-thumb-btn, .bc-thumb { width: 64px; height: 64px; }
}

/* ---------------------------------------------------------------------------
 * Frist countdown badge (resident my-claims page).
 * ------------------------------------------------------------------------- */
.bc-countdown-wrap {
  display: flex; justify-content: flex-end; margin-bottom: 16px;
}
.bc-countdown-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #e6f4ea 0%, #d0f0dd 100%);
  border: 2px solid var(--bc-ok);
  border-radius: 14px; padding: 12px 18px;
  box-shadow: 0 2px 12px rgba(26,138,74,0.13);
  animation: bc-countdown-pulse 2s ease-in-out infinite;
}
.bc-countdown-badge--urgent {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-color: #e65100;
  animation: bc-countdown-pulse-urgent 1s ease-in-out infinite;
}
.bc-countdown-badge--critical {
  background: linear-gradient(135deg, #fdecea 0%, #fbb 100%);
  border-color: var(--bc-err);
  animation: bc-countdown-pulse-urgent 0.5s ease-in-out infinite;
}
@keyframes bc-countdown-pulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(26,138,74,0.13); }
  50%       { box-shadow: 0 4px 20px rgba(26,138,74,0.30); }
}
@keyframes bc-countdown-pulse-urgent {
  0%, 100% { box-shadow: 0 2px 12px rgba(230,81,0,0.15); transform: scale(1); }
  50%       { box-shadow: 0 4px 24px rgba(230,81,0,0.35); transform: scale(1.02); }
}
.bc-countdown-badge__icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.bc-countdown-badge__body { display: flex; flex-direction: column; gap: 1px; }
.bc-countdown-badge__label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--bc-ok); opacity: 0.8;
}
.bc-countdown-badge--urgent  .bc-countdown-badge__label { color: #e65100; }
.bc-countdown-badge--critical .bc-countdown-badge__label { color: var(--bc-err); }
.bc-countdown-badge__date {
  font-size: 1rem; font-weight: 700; color: var(--bc-fg); line-height: 1.1;
}
.bc-countdown-badge__timer {
  font-size: 0.82rem; color: var(--bc-ok); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bc-countdown-badge--urgent  .bc-countdown-badge__timer { color: #e65100; }
.bc-countdown-badge--critical .bc-countdown-badge__timer { color: var(--bc-err); }

/* ---------------------------------------------------------------------------
 * Audit log page.
 * ------------------------------------------------------------------------- */
.bc-audit-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.bc-audit-header h1 { margin: 0; }

.bc-audit-filters { display: flex; flex-direction: column; gap: 10px; }
.bc-audit-filter-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.bc-audit-filter-row label {
  display: flex; flex-direction: column; gap: 3px; min-width: 140px;
}
.bc-audit-filter-row label span { font-size: 0.78rem; font-weight: 600; color: var(--bc-muted); }
.bc-audit-filter-row input,
.bc-audit-filter-row select {
  padding: 5px 8px; border: 1px solid var(--bc-line); border-radius: 6px;
  background: #fff; color: var(--bc-fg); font: inherit; font-size: 0.88rem;
}
.bc-audit-filter-actions { display: flex; gap: 8px; }

.bc-audit-action {
  font-weight: 600; font-size: 0.88rem; color: var(--bc-fg);
}
.bc-audit-ts { font-size: 0.82rem; color: var(--bc-muted); white-space: nowrap; }
.bc-audit-role { font-size: 0.78rem; }
.bc-audit-target strong { color: var(--bc-fg); }
.bc-audit-details {
  display: flex; flex-direction: column; gap: 3px;
}
.bc-audit-detail {
  display: block; font-size: 0.84rem; color: var(--bc-fg);
  background: #f4f6fa; border-radius: 4px; padding: 2px 7px;
  line-height: 1.4;
}

.bc-payload {
  background: #1d2330; color: #d4d4d4;
  padding: 8px 10px; border-radius: 4px;
  font-size: 0.78rem; line-height: 1.4;
  max-width: 480px; overflow: auto;
  margin: 0;
}
.bc-pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.bc-pagination .bc-button { min-width: 36px; text-align: center; }
.bc-button--active { background: var(--bc-accent); color: #fff; }

/* ---------------------------------------------------------------------------
 * Print styles.
 * ------------------------------------------------------------------------- */
@media print {
  .bc-no-print, .bc-header, .bc-footer, .bc-pagination { display: none !important; }
  .bc-print-only { display: block !important; margin-bottom: 12px; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .bc-card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
  .bc-audit-detail { background: #f0f0f0; }
  .bc-main { margin: 0; padding: 0; max-width: 100%; }
  .bc-audit-ts { color: #555; }
  .bc-table th { background: #eee; }
  a { color: inherit; text-decoration: none; }
}
