/* Shelf of Holding — design tokens and page primitives */

:root {
  --soh-canvas: #f0f4f2;
  --soh-ink: #1a2e28;
  --soh-primary: #2f6b5a;
  --soh-primary-hover: #265a4b;
  --soh-accent: #c47a3a;
  --soh-accent-hover: #a8652e;
  --soh-surface: #ffffff;
  --soh-muted: #5c7268;
  --soh-border: #d5ded9;
  --soh-radius: 0.5rem;
  --soh-shadow: 0 1px 2px rgba(26, 46, 40, 0.06);
  --soh-font-brand: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --soh-font-body: "Source Sans 3", "Segoe UI", sans-serif;

  /* Inventory status badges (Phase 2+) */
  --soh-status-wishlist: #5c6b8a;
  --soh-status-owned: #2f6b5a;
  --soh-status-loaned: #c47a3a;
  --soh-status-removal: #a35a3a;
  --soh-status-previous: #7a8580;

  /* Bootstrap theme bridge */
  --bs-body-font-family: var(--soh-font-body);
  --bs-body-color: var(--soh-ink);
  --bs-body-bg: var(--soh-canvas);
  --bs-primary: var(--soh-primary);
  --bs-primary-rgb: 47, 107, 90;
  --bs-link-color: var(--soh-primary);
  --bs-link-hover-color: var(--soh-primary-hover);
  --bs-border-color: var(--soh-border);
  --bs-border-radius: var(--soh-radius);
  --bs-focus-ring-color: rgba(47, 107, 90, 0.35);
}

html {
  font-size: 16px;
  position: relative;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--soh-font-body);
  color: var(--soh-ink);
  background-color: var(--soh-canvas);
  background-image:
    linear-gradient(180deg, #e8efeb 0%, var(--soh-canvas) 28%, var(--soh-canvas) 100%);
}

body > .app-main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.brand-mark {
  font-family: var(--soh-font-brand);
  letter-spacing: -0.02em;
  color: var(--soh-ink);
}

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

a:hover {
  color: var(--soh-primary-hover);
}

/* ----- Buttons ----- */

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--soh-primary);
  --bs-btn-border-color: var(--soh-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--soh-primary-hover);
  --bs-btn-hover-border-color: var(--soh-primary-hover);
  --bs-btn-focus-shadow-rgb: 47, 107, 90;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--soh-primary-hover);
  --bs-btn-active-border-color: var(--soh-primary-hover);
}

.btn-outline-primary {
  --bs-btn-color: var(--soh-primary);
  --bs-btn-border-color: var(--soh-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--soh-primary);
  --bs-btn-hover-border-color: var(--soh-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--soh-primary-hover);
  --bs-btn-active-border-color: var(--soh-primary-hover);
  --bs-btn-focus-shadow-rgb: 47, 107, 90;
}

.btn-outline-secondary {
  --bs-btn-color: var(--soh-muted);
  --bs-btn-border-color: var(--soh-border);
  --bs-btn-hover-color: var(--soh-ink);
  --bs-btn-hover-bg: #e8efeb;
  --bs-btn-hover-border-color: var(--soh-border);
}

.btn-outline-danger {
  --bs-btn-border-radius: var(--soh-radius);
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(47, 107, 90, 0.25);
  border-color: var(--soh-primary);
}

/* ----- App chrome ----- */

.app-header {
  background: var(--soh-surface);
  border-bottom: 1px solid var(--soh-border);
  box-shadow: var(--soh-shadow);
}

.app-navbar {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.app-navbar .navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--soh-primary) !important;
  text-decoration: none;
  white-space: nowrap;
}

.app-navbar .navbar-brand:hover {
  color: var(--soh-primary-hover) !important;
}

.app-navbar .nav-link {
  color: var(--soh-muted) !important;
  font-weight: 550;
  padding: 0.4rem 0.75rem !important;
  border-radius: var(--soh-radius);
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
  color: var(--soh-ink) !important;
  background: #e8efeb;
}

.app-navbar .navbar-text {
  color: var(--soh-muted);
}

.app-navbar .btn-link.nav-link {
  text-decoration: none;
  border: 0;
  background: transparent;
}

.app-footer {
  margin-top: auto;
  padding: 1rem 0;
  border-top: 1px solid var(--soh-border);
  color: var(--soh-muted);
  font-size: 0.9rem;
  background: transparent;
}

.app-footer__sep {
  margin: 0 0.35rem;
}

.app-footer a {
  color: var(--soh-primary);
}

.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1080;
  padding: 0.5rem 0.75rem;
  background: var(--soh-surface);
  border: 2px solid var(--soh-primary);
  border-radius: var(--soh-radius);
  color: var(--soh-ink);
  text-decoration: none;
  box-shadow: var(--soh-shadow);
}

.app-navbar .nav-link.active {
  color: var(--soh-primary);
  font-weight: 600;
}

.app-navbar .nav-link:focus-visible,
.filter-chip:focus-visible,
.action-list a:focus-visible,
.shelves-count-link:focus-visible,
.navbar-toggler:focus-visible {
  outline: 2px solid var(--soh-primary);
  outline-offset: 2px;
}

.app-main {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

/* ----- Page primitives ----- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header__text {
  min-width: 0;
  flex: 1 1 16rem;
}

.page-header__title {
  margin: 0 0 0.25rem;
  font-size: clamp(1.5rem, 2vw + 1rem, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
}

.page-header__subtitle {
  margin: 0;
  color: var(--soh-muted);
  font-size: 1rem;
  max-width: 40rem;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.panel {
  background: var(--soh-surface);
  border: 1px solid var(--soh-border);
  border-radius: var(--soh-radius);
  box-shadow: var(--soh-shadow);
  padding: 1.25rem 1.35rem;
}

.panel + .panel,
.panel + form,
form + .panel {
  margin-top: 1rem;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  padding: 1rem 1.25rem;
  background: var(--soh-surface);
  border: 1px solid var(--soh-border);
  border-radius: var(--soh-radius);
  box-shadow: var(--soh-shadow);
  margin-bottom: 1.5rem;
}

.summary-strip__label {
  color: var(--soh-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.summary-strip__value {
  font-family: var(--soh-font-brand);
  font-weight: 650;
  font-size: 1.15rem;
}

.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.action-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--soh-surface);
  border: 1px solid var(--soh-border);
  border-radius: var(--soh-radius);
  text-decoration: none;
  color: var(--soh-ink);
  box-shadow: var(--soh-shadow);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.action-list a:hover {
  border-color: var(--soh-primary);
  background: #f7faf8;
  color: var(--soh-ink);
}

.action-list__title {
  font-weight: 650;
}

.action-list__desc {
  color: var(--soh-muted);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.action-list__meta {
  color: var(--soh-primary);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.data-table {
  --soh-table-edge: #b7c5be;
  --soh-table-header: #dce6e1;
  width: 100%;
  margin-bottom: 0;
  background: var(--soh-surface);
  border: 1px solid var(--soh-table-edge);
  border-radius: var(--soh-radius);
  overflow: hidden;
  box-shadow: var(--soh-shadow);
}

.data-table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
  background-color: transparent;
  border-bottom-color: var(--soh-border);
  color: var(--soh-ink);
}

.data-table thead th {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--soh-ink);
  font-weight: 650;
  background: var(--soh-table-header);
  border-bottom: 1px solid var(--soh-table-edge);
}

.data-table tbody tr:hover {
  background: #f7faf8;
}

.data-table tbody tr:last-child > * {
  border-bottom: 0;
}

.table-responsive .data-table {
  margin-bottom: 0;
}

.flash {
  border-radius: var(--soh-radius);
  border: 1px solid transparent;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.flash-success {
  background: #e7f3ee;
  border-color: #b7d9cb;
  color: #1f4d3f;
}

.flash-danger {
  background: #f8eaea;
  border-color: #e3c0c0;
  color: #6e2f2f;
}

.flash-warning {
  background: #f8f0e6;
  border-color: #e5d0b4;
  color: #6b4a22;
}

.flash-info {
  background: #e8eef8;
  border-color: #b8c7e0;
  color: #2a3f66;
}

.empty-state {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--soh-muted);
  background: var(--soh-surface);
  border: 1px dashed var(--soh-border);
  border-radius: var(--soh-radius);
}

.empty-state p {
  margin-bottom: 0.75rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--soh-ink);
  background: #eef1ef;
}

.status-badge--wishlist {
  background: #eef0f5;
  color: #3d4a66;
  border-color: #c8cedc;
}

.status-badge--owned {
  background: #e7f3ee;
  color: #1f4d3f;
  border-color: #b7d4c8;
}

.status-badge--loaned {
  background: #f8eee4;
  color: #7a4a1f;
  border-color: #e2c4a4;
}

.status-badge--removal {
  background: #f6ebe6;
  color: #6e3a28;
  border-color: #dfb9a8;
}

.status-badge--previous {
  background: #eef0ef;
  color: #4f5854;
  border-color: #c9cecb;
}

.status-badge--active {
  background: #e7f3ee;
  color: #1f4d3f;
  border-color: #b7d4c8;
}

.status-badge--disabled {
  background: #ecefed;
  color: var(--soh-muted);
  border-color: var(--soh-border);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--soh-border);
  background: #fff;
  color: var(--soh-ink);
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter-chip:hover {
  background: #e8efeb;
  border-color: #b7c9c0;
  color: var(--soh-ink);
  text-decoration: none;
}

.filter-chip.is-active {
  background: #e7f3ee;
  border-color: var(--soh-primary);
  color: #1f4d3f;
  box-shadow: inset 0 0 0 1px var(--soh-primary);
}

.breadcrumb {
  --bs-breadcrumb-divider-color: var(--soh-border);
  margin-bottom: 1rem;
}

.breadcrumb-item a {
  text-decoration: none;
}

.breadcrumb-item.active {
  color: var(--soh-muted);
}

.text-muted {
  color: var(--soh-muted) !important;
}

/* ----- Login shell ----- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background-color: var(--soh-canvas);
  background-image:
    linear-gradient(160deg, #dfeae4 0%, var(--soh-canvas) 42%, #eef3f0 100%),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 47px,
      rgba(47, 107, 90, 0.04) 47px,
      rgba(47, 107, 90, 0.04) 48px
    );
}

.login-card {
  width: 100%;
  max-width: 26rem;
  background: var(--soh-surface);
  border: 1px solid var(--soh-border);
  border-radius: calc(var(--soh-radius) + 0.1rem);
  box-shadow: var(--soh-shadow);
  padding: 2rem 1.75rem;
}

.login-card .brand-mark {
  display: block;
  text-align: center;
  font-size: clamp(1.75rem, 4vw, 2.15rem);
  font-weight: 700;
  color: var(--soh-primary);
  margin-bottom: 0.35rem;
  line-height: 1.15;
}

.login-card .brand-tagline {
  text-align: center;
  color: var(--soh-muted);
  margin-bottom: 1.5rem;
}

.login-card .btn-primary {
  padding: 0.65rem 1rem;
  font-weight: 650;
}

@media (max-width: 575.98px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions .btn {
    width: 100%;
  }

  .action-list a {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ----- Form validation ----- */

.input-validation-error,
.form-control.input-validation-error,
.form-select.input-validation-error,
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #a35a3a;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23a35a3a'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23a35a3a' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.input-validation-error:focus,
.form-control.input-validation-error:focus,
.form-select.input-validation-error:focus,
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: #a35a3a;
  box-shadow: 0 0 0 0.2rem rgba(163, 90, 58, 0.25);
}

span.field-validation-error {
  display: block;
  color: #a35a3a;
  font-size: 0.875rem;
  margin-top: 0.35rem;
}

span.field-validation-valid {
  display: none;
}

.validation-summary-errors ul {
  margin-bottom: 0;
}

/* Scan HTMX busy indicators */
.htmx-indicator {
  display: none;
}

.htmx-indicator.htmx-request,
.htmx-request .htmx-indicator {
  display: flex;
}

.scan-busy-inline {
  align-items: center;
  gap: 0.5rem;
  color: var(--soh-muted);
  font-size: 0.9375rem;
}

.scan-busy {
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
  background: rgba(26, 46, 40, 0.28);
  pointer-events: all;
}

.scan-busy__panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--soh-radius);
  background: var(--soh-surface);
  box-shadow: var(--soh-shadow);
  color: var(--soh-ink);
  font-weight: 600;
}

.scan-camera-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.scan-camera-reader {
  width: 100%;
  min-height: 280px;
  overflow: hidden;
  border-radius: var(--soh-radius);
  background: #111;
}

.scan-camera-reader video {
  width: 100% !important;
  border-radius: var(--soh-radius);
}

#scan-camera-reader__dashboard_section {
  display: none !important;
}

.shelve-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.shelve-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--soh-ink) 12%, transparent);
}

.shelve-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.shelve-row__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: min(100%, 16rem);
  flex: 1 1 14rem;
}

.shelve-row__thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: calc(var(--soh-radius) * 0.6);
  background: color-mix(in srgb, var(--soh-ink) 8%, transparent);
}

.shelve-row__title {
  font-weight: 600;
}

.shelve-row__sub {
  font-size: 0.875rem;
}

.shelve-row__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 16rem;
  justify-content: flex-end;
}

.shelve-row__actions .shelve-location-select {
  min-width: min(100%, 14rem);
  flex: 1 1 12rem;
}

.shelves-count-link {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.shelves-count-link:hover {
  color: var(--soh-accent);
}

.shelf-label-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
}

.shelf-label {
  border: 1px solid var(--soh-border, #d5d8de);
  border-radius: 0.4rem;
  padding: 0.75rem;
  background: #fff;
  break-inside: avoid;
  page-break-inside: avoid;
}

.shelf-label__path {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.shelf-label__barcode {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.shelf-label__code {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  word-break: break-all;
}

@media print {
  .no-print,
  .navbar,
  .app-footer,
  .footer,
  nav.breadcrumb,
  .page-header__actions,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .shelf-label-sheet {
    gap: 0.5rem;
  }

  .shelf-label {
    border-color: #000;
    border-radius: 0;
  }
}



