:root {
  --library-ink: #18202a;
  --library-accent: #0f766e;
  --library-soft: #f6f8fb;
}

body {
  background: var(--library-soft);
}

.app-header,
.app-sidebar {
  --bs-primary-rgb: 15, 118, 110;
}

.brand-link .brand-text {
  display: block;
  font-weight: 700;
  line-height: 1.15;
  white-space: normal;
}

.public-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

.catalog-hero {
  background: #18202a;
  color: #fff;
  padding: 44px 0 34px;
}

.catalog-hero h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.05;
}

.book-cover {
  width: 52px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: #e9eef5;
}

.empty-cover {
  align-items: center;
  background: #dfe7ef;
  color: #657282;
  display: flex;
  font-weight: 700;
  justify-content: center;
  text-transform: uppercase;
}

.stat-card {
  border-left: 4px solid var(--library-accent);
}

.table td,
.table th {
  vertical-align: middle;
}

.card {
  border: 1px solid #dfe6ee;
}

.card-header {
  background: #fff;
}

.card-header .row {
  width: 100%;
}

.form-label {
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.15);
}

.form-text {
  color: #64748b;
}

.table thead th {
  color: #475569;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.table-hover tbody tr:hover {
  background-color: #f8fbfd;
}

.card-footer .btn-group {
  flex-wrap: wrap;
}

.scan-input {
  font-size: 1.2rem;
  min-height: 48px;
}

.table .d-inline-flex form {
  margin: 0;
}

.table .text-end .btn {
  white-space: nowrap;
}

.user-reset-input {
  max-width: 140px;
  min-width: 120px;
}

.app-sidebar .menu-group {
  margin: 2px 8px;
}

.app-sidebar .menu-group-link {
  border-radius: 6px;
  font-weight: 700;
}

.app-sidebar .menu-group.menu-open > .menu-group-link,
.app-sidebar .menu-group-link.active {
  background: #0f766e;
  color: #fff;
}

.app-sidebar .submenu-block {
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid #14b8a6;
  border-radius: 0 0 6px 6px;
  margin: 0 0 6px 12px;
  padding: 5px 0 5px 6px;
}

.app-sidebar .submenu-link {
  border-radius: 5px;
  font-size: 0.92rem;
  margin: 1px 6px 1px 0;
  padding-left: 18px;
}

.app-sidebar .submenu-link.active {
  background: #e0f2f1;
  color: #0f3f3a;
  font-weight: 700;
}

.app-sidebar .submenu-link:not(.active) {
  color: rgba(255, 255, 255, 0.82);
}

.app-sidebar .submenu-link:not(.active):hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.header-catalog-btn {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.header-catalog-icon {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 17px;
}

.user-menu {
  position: relative;
}

.user-menu-toggle {
  align-items: center;
  background: #f3f6fa;
  border: 1px solid #d8e1ea;
  border-radius: 50%;
  color: #18202a;
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  list-style: none;
  width: 36px;
}

.user-menu-toggle::-webkit-details-marker {
  display: none;
}

.user-menu[open] .user-menu-toggle,
.user-menu-toggle:hover {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.user-menu-icon {
  fill: none;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 19px;
}

.user-menu-panel {
  background: #fff;
  border: 1px solid #d8e1ea;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(24, 32, 42, 0.16);
  min-width: 230px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1000;
}

.user-menu-name {
  color: #18202a;
  font-weight: 800;
}

.user-menu-role {
  border-bottom: 1px solid #edf1f5;
  color: #6b7684;
  font-size: 0.88rem;
  margin-bottom: 6px;
  padding-bottom: 8px;
}

.user-menu-panel a {
  border-radius: 6px;
  color: #18202a;
  display: block;
  padding: 8px 9px;
  text-decoration: none;
}

.user-menu-panel a:hover {
  background: #eef7f6;
  color: #0f766e;
}

@media (max-width: 575.98px) {
  .header-catalog-btn span:last-child {
    display: none;
  }

  .card-header {
    align-items: stretch !important;
    flex-direction: column;
  }

  .card-header .btn,
  .card-header form {
    width: 100%;
  }
}

.print-card-body {
  background: #eef2f6;
}

.print-toolbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d9e0e8;
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.membership-sheet {
  display: grid;
  gap: 12mm;
  grid-template-columns: repeat(2, 86mm);
  justify-content: center;
  padding: 14mm;
}

.membership-card {
  background: #fff;
  border: 1px solid #c9d4df;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(24, 32, 42, 0.12);
  color: #18202a;
  height: 54mm;
  overflow: hidden;
  padding: 8mm;
  position: relative;
  width: 86mm;
}

.membership-card::before {
  background: #0f766e;
  content: "";
  height: 5mm;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.membership-card__top {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-top: 3mm;
}

.membership-school {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.membership-library {
  color: #5d6877;
  font-size: 11px;
}

.membership-type {
  border: 1px solid #0f766e;
  border-radius: 999px;
  color: #0f766e;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  text-transform: uppercase;
}

.membership-name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 8mm;
}

.membership-meta {
  color: #5d6877;
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  margin-top: 2mm;
}

.membership-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  margin-top: 5mm;
}

.membership-barcode {
  align-items: stretch;
  display: flex;
  gap: 1px;
  height: 11mm;
  margin-top: 2mm;
}

.membership-barcode span {
  background: #18202a;
  display: block;
}

@media print {
  @page {
    margin: 10mm;
    size: A4;
  }

  body.print-card-body {
    background: #fff;
  }

  .print-toolbar {
    display: none;
  }

  .membership-sheet {
    gap: 8mm;
    grid-template-columns: repeat(2, 86mm);
    padding: 0;
  }

  .membership-card {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
