:root {
  --icon-xs: 14px;
  --icon-sm: 16px;
  --icon-md: 18px;
  --icon-lg: 20px;
  --icon-xl: 24px;
  --icon-nav: 22px;
  --icon-dashboard: 28px;
  --icon-empty: 48px;

  --touch-target-min: 44px;
  --mobile-nav-height: 68px;
  --tablet-sidebar-width: 76px;
  --desktop-sidebar-width: 260px;

  --icon-color-default: var(--bc-muted);
  --icon-color-primary: var(--bc-rose-deep);
  --icon-color-success: #2f6b3a;
  --icon-color-warning: #9a6b1a;
  --icon-color-danger: #9b3b34;
  --icon-color-info: #3d5a80;
  --icon-color-muted: #a89892;

  --bc-success-bg: #eaf7ee;
  --bc-warning-bg: #fff6e5;
  --bc-danger-bg: #fff1f0;
  --bc-info-bg: #eef4fb;
}

.bc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--icon-md);
  height: var(--icon-md);
  color: currentColor;
  vertical-align: middle;
  line-height: 0;
}

.bc-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: inherit;
}

.bc-icon--xs { width: var(--icon-xs); height: var(--icon-xs); }
.bc-icon--sm { width: var(--icon-sm); height: var(--icon-sm); }
.bc-icon--md { width: var(--icon-md); height: var(--icon-md); }
.bc-icon--lg { width: var(--icon-lg); height: var(--icon-lg); }
.bc-icon--xl { width: var(--icon-xl); height: var(--icon-xl); }
.bc-icon--nav { width: var(--icon-nav); height: var(--icon-nav); }
.bc-icon--dashboard { width: var(--icon-dashboard); height: var(--icon-dashboard); }
.bc-icon--empty { width: var(--icon-empty); height: var(--icon-empty); }
.bc-icon--muted { color: var(--icon-color-muted); }
.bc-icon--primary { color: var(--icon-color-primary); }
.bc-icon--success { color: var(--icon-color-success); }
.bc-icon--warning { color: var(--icon-color-warning); }
.bc-icon--danger { color: var(--icon-color-danger); }

.bc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--bc-muted);
  cursor: pointer;
  text-decoration: none;
}

.bc-icon-btn:hover,
.bc-icon-btn:focus-visible {
  background: var(--bc-cream);
  color: var(--bc-ink);
  outline: none;
}

.bc-icon-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(212, 165, 160, 0.35);
}

.bc-icon-btn.is-danger:hover,
.bc-icon-btn.is-danger:focus-visible {
  background: var(--bc-danger-bg);
  color: var(--icon-color-danger);
}

.bc-btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bc-btn {
  min-height: 42px;
}

.bc-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.bc-alert__icon {
  margin-top: 2px;
  color: inherit;
}

.bc-alert__title {
  font-weight: 700;
  margin-bottom: 2px;
}

.bc-alert-warning {
  background: var(--bc-warning-bg);
  border: 1px solid #efd7a8;
  color: #7a5614;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.bc-alert-info {
  background: var(--bc-info-bg);
  border: 1px solid #c9daf0;
  color: #2f4a6b;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.bc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  background: var(--bc-cream);
  color: var(--bc-ink);
}

.bc-status-badge--success { background: var(--bc-success-bg); color: var(--icon-color-success); }
.bc-status-badge--warning { background: var(--bc-warning-bg); color: var(--icon-color-warning); }
.bc-status-badge--danger { background: var(--bc-danger-bg); color: var(--icon-color-danger); }
.bc-status-badge--info { background: var(--bc-info-bg); color: var(--icon-color-info); }
.bc-status-badge--muted { background: #f4f1ef; color: var(--bc-muted); }
.bc-status-badge--neutral { background: var(--bc-cream); color: var(--bc-ink); }

.bc-empty-state__icon {
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--bc-cream);
  color: var(--icon-color-muted);
}

.bc-stat-card {
  display: flex;
  gap: clamp(8px, 1.5vw, 14px);
  align-items: flex-start;
  padding: clamp(14px, 2.2vw, 24px);
}

.bc-stat-card__icon {
  display: grid;
  place-items: center;
  width: clamp(36px, 5vw, 48px);
  height: clamp(36px, 5vw, 48px);
  border-radius: 14px;
  background: var(--bc-cream);
  color: var(--icon-color-primary);
  flex-shrink: 0;
}

.bc-stat-card__icon .bc-icon {
  width: clamp(18px, 3vw, 28px);
  height: clamp(18px, 3vw, 28px);
}

.bc-stat-card__body {
  min-width: 0;
  flex: 1 1 auto;
}

.bc-stat-card__label {
  color: var(--bc-muted);
  font-size: clamp(0.7rem, 1.6vw, 0.85rem);
  margin-bottom: 4px;
  line-height: 1.25;
}

.bc-stat-card__value {
  font-size: clamp(0.85rem, 1.8vw, 1.15rem);
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

@media (max-width: 767.98px) {
  .bc-stat-card {
    gap: 8px;
    padding: 12px;
  }

  .bc-stat-card__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .bc-stat-card__icon .bc-icon {
    width: 18px;
    height: 18px;
  }

  .bc-stat-card__label {
    font-size: 0.7rem;
    margin-bottom: 2px;
  }

  .bc-stat-card__value {
    font-size: 0.9rem;
  }
}

.bc-sidebar {
  display: flex;
  flex-direction: column;
  width: var(--desktop-sidebar-width);
  transition: width 0.2s ease;
}

.bc-sidebar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.bc-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.bc-sidebar__nav .bc-nav-link.active {
  scroll-margin-block: 12px;
}

.bc-nav-link__icon {
  color: currentColor;
}

.bc-nav-link__label {
  min-width: 0;
}

/* Grouped / accordion sidebar sections */
.bc-nav-group {
  margin-bottom: 4px;
}

.bc-nav-group__toggle {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.bc-nav-group__toggle .bc-nav-link__label {
  flex: 1;
}

.bc-nav-group__chevron {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.65;
  transition: transform 0.18s ease;
}

.bc-nav-group.is-open > .bc-nav-group__toggle .bc-nav-group__chevron {
  transform: rotate(90deg);
}

.bc-nav-group__toggle.is-current {
  color: var(--bc-ink);
  background: color-mix(in srgb, var(--bc-cream) 70%, transparent);
}

.bc-nav-group__panel {
  padding: 2px 0 6px 0;
}

.bc-nav-link--nested {
  padding-left: 28px;
  margin-bottom: 2px;
  font-size: 0.95em;
}

.bc-nav-flyout {
  position: fixed;
  z-index: 1080;
  min-width: 200px;
  max-width: min(280px, calc(100vw - 24px));
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(58, 47, 44, 0.18);
  border: 1px solid rgba(58, 47, 44, 0.08);
}

.bc-nav-flyout__title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bc-muted);
  padding: 4px 10px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bc-nav-flyout .bc-nav-link,
.bc-nav-flyout__link {
  margin-bottom: 2px;
}

.bc-app-shell.is-sidebar-collapsed {
  grid-template-columns: var(--tablet-sidebar-width) 1fr;
}

.bc-app-shell.is-sidebar-collapsed .bc-sidebar {
  width: var(--tablet-sidebar-width);
  padding-left: 12px;
  padding-right: 12px;
}

.bc-app-shell.is-sidebar-collapsed .bc-brand,
.bc-app-shell.is-sidebar-collapsed .bc-nav-link__label,
.bc-app-shell.is-sidebar-collapsed .bc-sidebar__logout span {
  display: none;
}

.bc-app-shell.is-sidebar-collapsed .bc-nav-link {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

.bc-app-shell.is-sidebar-collapsed .bc-nav-group__panel,
.bc-app-shell.is-sidebar-collapsed .bc-nav-group__chevron {
  display: none;
}

.bc-app-shell.is-sidebar-collapsed .bc-nav-group__toggle {
  justify-content: center;
}

.bc-app-shell.is-sidebar-collapsed .bc-sidebar__logout .bc-btn {
  justify-content: center;
}

.bc-topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bc-topbar__right .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bc-bottom-nav {
  display: none;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  min-height: var(--mobile-nav-height);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.bc-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: var(--touch-target-min);
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--bc-muted);
  font-size: 0.72rem;
  line-height: 1.15;
  text-align: center;
}

.bc-bottom-nav__item.active,
.bc-bottom-nav__item:hover,
.bc-bottom-nav__item:focus-visible {
  background: var(--bc-cream);
  color: var(--bc-ink);
  outline: none;
}

.bc-bottom-nav__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bc-bottom-nav__icon {
  display: grid;
  place-items: center;
}

.bc-sidebar-backdrop {
  display: none;
}

.bc-more-drawer .bc-nav-link {
  margin-bottom: 4px;
}

/* Theme / appearance settings */
.bc-theme-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bc-theme-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--bc-line);
  border-radius: 14px;
  background: var(--bc-surface);
  color: var(--bc-ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.bc-theme-preset:hover,
.bc-theme-preset.is-active {
  border-color: var(--bc-rose-deep);
  background: color-mix(in srgb, var(--bc-cream) 70%, var(--bc-surface));
}

.bc-theme-preset__swatches {
  display: flex;
  gap: 4px;
}

.bc-theme-preset__swatches i {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.bc-theme-preset__custom {
  width: 54px !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, #d4a5a0, #6ba3b8, #7a9e7e, #d4896a);
}

.bc-theme-preset__name {
  font-size: 0.85rem;
  font-weight: 600;
}

.bc-color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bc-color-field__picker {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--bc-line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.bc-color-field__hex {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: lowercase;
}

.bc-theme-preview {
  border: 1px solid var(--bc-line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bc-bg);
}

.bc-theme-preview__bar {
  height: 10px;
  background: linear-gradient(90deg, var(--bc-rose), var(--bc-gold));
}

.bc-theme-preview__body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bc-surface);
  color: var(--bc-ink);
}

.bc-theme-preview__btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--bc-rose-deep);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.bc-theme-preview__chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bc-cream);
  color: var(--bc-muted);
  font-size: 0.8rem;
}

@media (prefers-reduced-motion: reduce) {
  .bc-sidebar,
  .bc-icon.bc-spin {
    transition: none !important;
    animation: none !important;
  }
}

@keyframes bc-spin {
  to { transform: rotate(360deg); }
}

.bc-spin {
  animation: bc-spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .bc-spin { animation: none; }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 768px) {
  .bc-app-shell {
    grid-template-columns: var(--tablet-sidebar-width) 1fr;
  }

  .bc-sidebar {
    width: var(--tablet-sidebar-width);
    padding-left: 12px;
    padding-right: 12px;
  }

  .bc-brand,
  .bc-nav-link__label,
  .bc-sidebar__logout span {
    display: none;
  }

  .bc-nav-link {
    justify-content: center;
  }

  .bc-nav-group__panel,
  .bc-nav-group__chevron {
    display: none;
  }

  .bc-nav-group__toggle {
    justify-content: center;
  }

  .bc-sidebar__logout .bc-btn {
    justify-content: center;
  }

  .bc-main {
    padding: 22px 18px 28px;
  }
}

/* Mobile / small tablet portrait */
@media (max-width: 767.98px) {
  .bc-app-shell {
    grid-template-columns: 1fr;
  }

  .bc-sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1040;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--bc-shadow);
  }

  .bc-app-shell.is-drawer-open .bc-sidebar {
    transform: translateX(0);
  }

  .bc-app-shell.is-drawer-open .bc-brand,
  .bc-app-shell.is-drawer-open .bc-nav-link__label,
  .bc-app-shell.is-drawer-open .bc-sidebar__logout span {
    display: initial;
  }

  .bc-app-shell.is-drawer-open .bc-nav-link {
    justify-content: flex-start;
  }

  .bc-app-shell.is-drawer-open .bc-nav-group__panel,
  .bc-app-shell.is-drawer-open .bc-nav-group__chevron {
    display: revert;
  }

  .bc-app-shell.is-drawer-open .bc-nav-group__toggle {
    justify-content: flex-start;
  }

  .bc-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(58, 47, 44, 0.35);
    z-index: 1035;
  }

  .bc-sidebar-backdrop[hidden] {
    display: none;
  }

  .bc-main {
    padding: 16px 14px calc(var(--mobile-nav-height) + 20px + env(safe-area-inset-bottom));
  }

  .bc-bottom-nav {
    display: flex;
  }

  .bc-btn.bc-btn-block-mobile,
  .bc-form-actions .bc-btn-primary {
    width: 100%;
  }

  .bc-page-title {
    font-size: 1.25rem;
  }
}
