.bd-body {
  background-color: var(--ah-cream-soft);
}

.bd-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.bd-sidebar {
  width: 16rem;
  flex-shrink: 0;
  background-color: var(--ah-white);
  border-right: 1px solid rgba(42, 42, 40, 0.08);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .2s ease, padding .2s ease;
}

.bd-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .15rem;
}

.bd-sidebar-brand {
  display: block;
}

.bd-sidebar-toggle {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ah-charcoal-soft);
  padding: .3rem .45rem;
  border-radius: var(--ah-radius);
  flex-shrink: 0;
}

.bd-sidebar-toggle:hover {
  background-color: var(--ah-cream-soft);
  color: var(--ah-primary);
}

/* Collapsed state — icon-only rail, toggled by #sidebarToggle (admin-core.js), persisted
   in localStorage so it survives reloads/navigation. */
.bd-sidebar.is-collapsed {
  width: 4.75rem;
  padding-left: .65rem;
  padding-right: .65rem;
}

.bd-sidebar.is-collapsed .bd-sidebar-top {
  justify-content: center;
}

.bd-sidebar.is-collapsed .bd-sidebar-brand {
  font-size: 0;
}

.bd-sidebar.is-collapsed .bd-sidebar-brand::before {
  content: "🐾";
  font-size: 1.4rem;
}

.bd-sidebar.is-collapsed .bd-sidebar-text {
  display: none;
}

.bd-sidebar.is-collapsed .bd-nav-item {
  justify-content: center;
}

.bd-sidebar.is-collapsed .bd-sidebar-logout,
.bd-sidebar.is-collapsed .bd-sidebar-back-link {
  justify-content: center;
}

.bd-sidebar-label {
  font-size: .75rem;
  color: var(--ah-charcoal-soft);
  margin-bottom: 1.75rem;
}

.bd-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
  overflow-y: auto;
}

.bd-nav-section {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ah-charcoal-soft);
  margin: 1rem 0 .25rem .85rem;
}

.bd-nav-section:first-child {
  margin-top: 0;
}

.bd-nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: transparent;
  border: none;
  border-radius: var(--ah-radius);
  padding: .65rem .85rem;
  text-align: left;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ah-charcoal);
  font-family: var(--ah-font-body);
}

.bd-nav-item:hover {
  background-color: var(--ah-cream-soft);
}

.bd-nav-item.is-active {
  background-color: var(--ah-primary);
  color: var(--ah-white);
}

.bd-nav-icon {
  font-size: 1.1rem;
}

.bd-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(42, 42, 40, 0.08);
}

.bd-sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.bd-sidebar-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--ah-charcoal-soft);
  font-weight: 600;
}

.bd-sidebar-back-link:hover {
  color: var(--ah-primary);
}

/* Empty state (placeholder views) */
.bd-empty-state {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  padding: 3rem 2rem;
  text-align: center;
  max-width: 28rem;
  margin: 2rem auto 0;
}

.bd-empty-icon {
  font-size: 2.25rem;
  margin-bottom: .75rem;
}

.bd-empty-text {
  color: var(--ah-charcoal-soft);
  font-size: .9rem;
  margin: 0;
}

/* Login page */
.bd-login-body {
  background-color: var(--ah-cream);
  min-height: 100vh;
}

.bd-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.bd-login-card {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 24rem;
}

.bd-login-brand {
  display: block;
  text-align: center;
  font-size: 1.6rem;
}

.bd-login-label {
  display: block;
  width: fit-content;
  margin: .5rem auto 1.75rem;
}

.bd-login-field-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ah-charcoal);
  margin-bottom: .35rem;
  display: block;
}

.bd-login-input {
  border-radius: .6rem;
  border: 1px solid rgba(42, 42, 40, 0.15);
  padding: .55rem .85rem;
}

.bd-login-note {
  font-size: .78rem;
  color: var(--ah-charcoal-soft);
  margin: 1.25rem 0 0;
  text-align: center;
}

.bd-login-note code {
  background-color: rgba(42, 42, 40, 0.08);
  padding: .1rem .3rem;
  border-radius: .3rem;
}

.bd-login-error {
  font-size: .82rem;
  color: var(--ah-brick);
  font-weight: 600;
  margin: -.5rem 0 1rem;
}

/* Main */
.bd-main {
  flex: 1;
  padding: 2rem 2.5rem;
  min-width: 0;
}

.bd-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.75rem;
}

.bd-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ah-primary-dark);
  margin: 0;
}

.bd-page-label {
  background-color: rgba(140, 58, 53, 0.1);
  color: var(--ah-brick);
  font-size: .75rem;
  font-weight: 700;
  padding: .3rem .75rem;
  border-radius: 999px;
}

/* Views */
.bd-view {
  display: none;
}

.bd-view.is-active {
  display: block;
}

/* Stat cards — 6 equal columns on Overview (Articles/Lost & Found/Marketplace/Community/
   Adoption/Pet Passport) */
.col-lg-2-4 {
  flex: 0 0 16.6667%;
  max-width: 16.6667%;
}

@media (max-width: 991px) {
  .col-lg-2-4 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

.bd-stat-card {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  padding: 1.1rem;
  text-align: center;
}

.bd-stat-icon {
  font-size: 1.6rem;
  margin-bottom: .35rem;
}

.bd-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ah-primary-dark);
}

.bd-stat-label {
  font-size: .78rem;
  color: var(--ah-charcoal-soft);
}

.bd-stat-mock-tag {
  font-style: italic;
  opacity: .65;
}

/* Theme/brand-color settings (mock, see admin-theme.js) */
.bd-theme-card {
  padding: 1.5rem;
}

.bd-theme-color-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 1rem 0;
}

.bd-theme-color-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.bd-theme-color-label {
  flex: 1 1 auto;
  margin: 0;
}

.bd-theme-color-input {
  width: 3rem;
  height: 2.25rem;
  padding: 2px;
  border: 1px solid rgba(42, 42, 40, 0.15);
  border-radius: .4rem;
  background: none;
  cursor: pointer;
}

.bd-theme-color-hex {
  font-family: monospace;
  font-size: .85rem;
  color: var(--ah-charcoal-soft);
  width: 5rem;
}

.bd-theme-actions {
  border-top: none;
  padding-top: 0;
}

/* Block title */
.bd-block-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ah-primary-dark);
  margin-bottom: .9rem;
}

/* Toolbar */
.bd-table-toolbar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.bd-table-search {
  max-width: 22rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 40, 0.15);
}

.bd-role-select {
  width: auto;
  font-size: .82rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 40, 0.15);
  padding: .3rem .8rem;
}

.bd-status-toggle {
  background: transparent;
  border: none;
  color: var(--ah-primary);
  font-weight: 600;
  font-size: .82rem;
}

.bd-status-toggle:hover {
  color: var(--ah-primary-dark);
}

.bd-mock-note {
  font-size: .8rem;
  color: var(--ah-charcoal-soft);
  margin-top: 1rem;
}

.bd-mock-note-top {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.bd-mock-note code {
  background-color: rgba(42, 42, 40, 0.08);
  padding: .1rem .3rem;
  border-radius: .3rem;
}

/* Sub-tabs (e.g. Animal Master Data) */
.bd-subtabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.bd-subtab {
  background-color: var(--ah-white);
  border: 1px solid rgba(42, 42, 40, 0.15);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  padding: .45rem 1.1rem;
  color: var(--ah-charcoal-soft);
  font-family: var(--ah-font-body);
}

.bd-subtab:hover {
  border-color: var(--ah-primary);
  color: var(--ah-primary);
}

.bd-subtab.is-active {
  background-color: var(--ah-primary);
  border-color: var(--ah-primary);
  color: var(--ah-white);
}

.bd-subview {
  display: none;
}

.bd-subview.is-active {
  display: block;
}

/* Animal Data modal — only the active type's fields show */
[data-modal-fields] {
  display: none;
}

[data-modal-fields].is-active {
  display: block;
}

/* Tables */
.bd-table-card {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  overflow: hidden;
  overflow-x: auto;
}

.bd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
  white-space: nowrap;
}

.bd-table th {
  background-color: var(--ah-cream-soft);
  color: var(--ah-primary-dark);
  text-align: left;
  padding: .65rem .9rem;
  font-weight: 700;
}

.bd-table td {
  padding: .65rem .9rem;
  border-top: 1px solid rgba(42, 42, 40, 0.06);
  color: var(--ah-charcoal);
}

.bd-row-link {
  background: transparent;
  border: none;
  color: var(--ah-primary);
  font-weight: 600;
  font-size: .82rem;
  font-family: var(--ah-font-body);
}

.bd-row-link:hover {
  color: var(--ah-primary-dark);
}

.bd-row-link:disabled {
  color: var(--ah-taupe);
  opacity: .5;
  cursor: not-allowed;
}

.bd-row-link-danger {
  color: var(--ah-brick);
}

.bd-row-link-danger:hover {
  color: #6e2c28;
}

.bd-row-actions {
  display: flex;
  gap: .65rem;
  white-space: nowrap;
}

.bd-field-hint {
  font-size: .76rem;
  color: var(--ah-charcoal-soft);
  margin: .35rem 0 0;
}

.bd-tags-cell {
  font-size: .78rem;
  color: var(--ah-charcoal-soft);
}

.bd-cover-preview {
  display: block;
  max-width: 100%;
  max-height: 10rem;
  border-radius: var(--ah-radius);
  margin-top: .6rem;
  object-fit: cover;
}

.bd-editor-toolbar {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .4rem;
  flex-wrap: wrap;
}

.bd-editor-sep {
  width: 1px;
  height: 1.4rem;
  background-color: rgba(42, 42, 40, 0.12);
  margin: 0 .15rem;
}

.bd-editor-btn {
  background-color: var(--ah-cream-soft);
  border: 1px solid rgba(42, 42, 40, 0.12);
  border-radius: .5rem;
  font-size: .82rem;
  padding: .3rem .7rem;
  color: var(--ah-charcoal);
  font-family: var(--ah-font-body);
}

.bd-editor-btn:hover {
  border-color: var(--ah-primary);
  color: var(--ah-primary);
}

.bd-editor-body {
  min-height: 8rem;
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid rgba(42, 42, 40, 0.15);
  border-radius: .6rem;
  padding: .6rem .8rem;
  font-size: .9rem;
  background-color: var(--ah-white);
}

.bd-editor-body img {
  max-width: 100%;
  border-radius: .4rem;
  margin: .4rem 0;
}

.bd-editor-body h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ah-primary-dark);
  margin: .5rem 0;
}

.bd-editor-body ul,
.bd-editor-body ol {
  padding-left: 1.4rem;
  margin: .4rem 0;
}

.bd-editor-body a {
  color: var(--ah-primary);
  text-decoration: underline;
}

.bd-editor-body p {
  margin: 0 0 .5rem;
}

.bd-editor-body:focus {
  outline: none;
  border-color: var(--ah-primary);
}

.bd-related-results {
  background-color: var(--ah-white);
  border: 1px solid rgba(42, 42, 40, 0.1);
  border-radius: .6rem;
  margin-top: .35rem;
  overflow: hidden;
}

.bd-related-results:empty {
  display: none;
  border: none;
}

.bd-related-result-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: .5rem .8rem;
  font-size: .85rem;
  color: var(--ah-charcoal);
  font-family: var(--ah-font-body);
}

.bd-related-result-item:hover {
  background-color: var(--ah-cream-soft);
  color: var(--ah-primary);
}

.bd-related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .6rem;
}

.bd-related-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background-color: rgba(44, 79, 108, 0.1);
  color: var(--ah-primary);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  padding: .3rem .55rem .3rem .75rem;
}

.bd-related-chip-remove {
  background: transparent;
  border: none;
  color: var(--ah-primary);
  font-weight: 700;
  line-height: 1;
  font-size: .9rem;
  padding: 0;
}

.bd-category-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}

.bd-category-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.bd-category-row .bd-login-input {
  flex: 1;
}

.bd-category-add-row {
  display: flex;
  gap: .5rem;
}

.bd-category-add-row input {
  flex: 1;
}

/* Lost & Found map + photo gallery */
.bd-lf-map {
  height: 16rem;
  border-radius: var(--ah-radius);
  overflow: hidden;
  border: 1px solid rgba(42, 42, 40, 0.15);
}

/* Business modal map — smaller than Lost & Found's so the add/edit form fits on one
   screen without scrolling (Business has more fields competing for vertical space). */
.bd-biz-map {
  height: 9rem;
}

.bd-photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: .75rem;
}

.bd-photo-thumb {
  position: relative;
  width: 6rem;
  height: 6rem;
  border-radius: var(--ah-radius);
  overflow: hidden;
  box-shadow: var(--ah-shadow);
}

.bd-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bd-photo-thumb-remove {
  position: absolute;
  top: .25rem;
  right: .25rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background-color: rgba(42, 42, 40, 0.75);
  color: var(--ah-white);
  border: none;
  font-size: .8rem;
  line-height: 1;
}

.bd-self-note {
  font-size: .78rem;
  color: var(--ah-charcoal-soft);
  font-style: italic;
}

.bd-modal-content {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  font-family: var(--ah-font-body);
}

/* Inline add/edit "page" that swaps in place of a table — used where a popup felt
   wrong for the workflow (e.g. Marketplace). Same field/grid conventions as the wide
   modal pattern (.bd-modal-full-width still spans both columns) but laid out as a
   normal in-page card instead of a Bootstrap modal. */
.bd-form-page {
  background-color: var(--ah-white);
  border-radius: var(--ah-radius);
  box-shadow: var(--ah-shadow);
  padding: 1.5rem;
}

.bd-form-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.bd-form-page-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: .5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(42, 42, 40, 0.1);
}

@media (min-width: 992px) {
  .bd-form-page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
  }

  .bd-form-page-grid .bd-modal-full-width {
    grid-column: 1 / -1;
  }

  /* Business fields take the full page width and lay out their own explicit left/right
     split instead of being squeezed into a single 1fr cell of the outer 2-col grid. */
  .bd-form-page-grid [data-modal-fields="business"] {
    grid-column: 1 / -1;
  }
}

.bd-biz-form-split {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
}

.bd-biz-form-col {
  flex: 1 1 280px;
  min-width: 280px;
}

/* Wide modal (e.g. Article add/edit) — only on screens roomy enough (lg and up, ~992px+).
   Below that (tablets/phones) it falls back to modal-fullscreen-lg-down for a full-screen sheet instead. */
@media (min-width: 992px) {
  .bd-modal-wide {
    max-width: 80vw;
    width: 80vw;
  }

  .bd-modal-wide .modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2rem;
  }

  .bd-modal-wide .modal-body .bd-modal-full-width {
    grid-column: 1 / -1;
  }
}

/* Business & Membership modal — extra wide + tighter vertical rhythm so the Business
   sub-type's many fields (owner picker, map, photos) fit on one screen without scrolling. */
@media (min-width: 992px) {
  #businessDataModal .bd-modal-wide {
    max-width: 92vw;
    width: 92vw;
  }
}

#businessDataModal .bd-photo-gallery {
  margin-top: .4rem;
}

#businessDataModal .bd-field-hint {
  margin: .25rem 0 0;
}

/* Badges */
.bd-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 999px;
}

.bd-badge-ok {
  background-color: rgba(44, 79, 108, 0.1);
  color: var(--ah-primary);
}

.bd-badge-warn {
  background-color: rgba(140, 58, 53, 0.12);
  color: var(--ah-brick);
}

.bd-badge-neutral {
  background-color: rgba(232, 180, 104, 0.3);
  color: var(--ah-charcoal);
}

.bd-mod-tag {
  font-size: .75rem;
  font-weight: 700;
  color: var(--ah-accent-dark);
}

/* Lost & Found inline status select (table-row status change without opening the edit modal) */
.bd-lf-status-select {
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.bd-lf-status-select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.bd-lf-status-select.is-lost {
  background-color: rgba(140, 58, 53, 0.12);
  color: var(--ah-brick);
}

.bd-lf-status-select.is-found {
  background-color: rgba(44, 79, 108, 0.1);
  color: var(--ah-primary);
}

.bd-lf-status-select.is-closed {
  background-color: rgba(232, 180, 104, 0.3);
  color: var(--ah-charcoal);
}

/* Membership inline status select (table-row status change without opening the edit modal) */
.bd-mem-status-select {
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.bd-mem-status-select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.bd-mem-status-select.is-active {
  background-color: rgba(44, 79, 108, 0.1);
  color: var(--ah-primary);
}

.bd-mem-status-select.is-expired {
  background-color: rgba(140, 58, 53, 0.12);
  color: var(--ah-brick);
}

/* Marketplace inline status select (table-row status change without opening the edit modal) */
.bd-mkt-status-select {
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.bd-mkt-status-select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.bd-mkt-status-select.is-active {
  background-color: rgba(44, 79, 108, 0.1);
  color: var(--ah-primary);
}

.bd-mkt-status-select.is-pending {
  background-color: rgba(232, 180, 104, 0.3);
  color: var(--ah-charcoal);
}

.bd-mkt-status-select.is-disabled {
  background-color: rgba(140, 58, 53, 0.12);
  color: var(--ah-brick);
}
