@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --app-bg:#f4f6fa;
  --app-ink:#101b31;
  --app-muted:#5c6b85;
  --app-nav:#011659;
  --app-border:#d6dce7;
  --app-card:#ffffff;
  --app-primary:#011659;
  --app-primary-hover:#062f7e;
  --app-primary-active:#010a33;
  --app-link:#0a3bb0;
  --app-row-hover:#eef2fa;
  --app-row-selected:#e7edfb;
  --app-grid-line:#e2e7ee;
}
* { box-sizing:border-box; }
body { background:var(--app-bg); color:var(--app-ink); font-family:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif; }
.navbar { background:var(--app-nav); box-shadow:0 2px 14px rgba(15,23,42,.12); }
.navbar-brand { font-weight:800; letter-spacing:.01em; }
.nav-link { font-weight:600; }
a { color:var(--app-link); }
a:not(.btn):hover { color:var(--app-primary-hover); }
.navbar-dark {
  --bs-navbar-color:rgba(255,255,255,.85);
  --bs-navbar-hover-color:#fff;
  --bs-navbar-active-color:#fff;
}
.navbar-dark .navbar-brand,
.navbar-dark .navbar-brand:hover,
.navbar-dark .navbar-brand:focus { color:#fff; }
.navbar-dark a:not(.btn):hover,
.navbar-dark a:not(.btn):focus,
.landing-navbar a:not(.btn):hover,
.landing-navbar a:not(.btn):focus { color:#fff; }
main.container-fluid { padding-inline:1.15rem; }
.card { border:1px solid var(--app-border); border-radius:.75rem; box-shadow:0 1px 3px rgba(15,23,42,.06); }
.card-body { padding:1.25rem; }
.form-label { color:#273244; font-weight:700; }
.form-control,.form-select { border-color:#d6dce7; border-radius:.55rem; }
.form-control:focus,.form-select:focus { border-color:#7f9bd9; box-shadow:0 0 0 .2rem rgba(1,22,89,.12); }
.form-check-input:checked { background-color:var(--app-primary); border-color:var(--app-primary); }
.form-check-input:focus { box-shadow:0 0 0 .2rem rgba(1,22,89,.15); }
.dropdown-menu { --bs-dropdown-link-active-bg:var(--app-primary); }
.btn { border-radius:.55rem; font-weight:700; }
.btn-primary {
  --bs-btn-bg:var(--app-primary);
  --bs-btn-border-color:var(--app-primary);
  --bs-btn-hover-bg:var(--app-primary-hover);
  --bs-btn-hover-border-color:var(--app-primary-hover);
  --bs-btn-active-bg:var(--app-primary-active);
  --bs-btn-active-border-color:var(--app-primary-active);
  --bs-btn-disabled-bg:var(--app-primary);
  --bs-btn-disabled-border-color:var(--app-primary);
}
.btn-outline-primary {
  --bs-btn-color:var(--app-primary);
  --bs-btn-border-color:var(--app-primary);
  --bs-btn-hover-bg:var(--app-primary);
  --bs-btn-hover-border-color:var(--app-primary);
  --bs-btn-active-bg:var(--app-primary);
  --bs-btn-active-border-color:var(--app-primary);
}
.bg-primary { background-color:var(--app-primary) !important; }
.text-bg-primary { background-color:var(--app-primary) !important; color:#fff !important; }
.text-primary { color:var(--app-link) !important; }
.search-card { overflow:hidden; }
.search-box { min-height:15rem; line-height:1.45; }
.search-submit { min-width:10rem; }
.search-actions { align-items:center; }
.results-panel { background:#eef1f5; border:1px solid #cdd4df; border-radius:.5rem; box-shadow:0 1px 3px rgba(15,23,42,.06); padding:.85rem; }
.results-toolbar { gap:1rem; }
.results-summary { color:var(--app-muted); display:flex; flex-wrap:wrap; gap:.4rem .9rem; }
.results-summary strong { color:var(--app-ink); }
.provider-filter-bar { display:flex; justify-content:flex-end; }
.provider-filter-menu { min-width:280px; max-width:min(420px, calc(100vw - 2rem)); }
.provider-filter-options { max-height:18rem; overflow-y:auto; }
.provider-filter-options .dropdown-item { border-radius:.35rem; cursor:pointer; margin:.1rem 0; white-space:normal; }
.provider-filter-options .dropdown-item:active { background:var(--app-row-hover); color:var(--app-ink); }
.table-responsive { max-height:68vh; border-radius:.6rem; }
.table { --bs-table-bg:#fff; }
.table td,.table th { vertical-align:middle; }
.table thead th { color:#0f172a; font-size:.92rem; white-space:nowrap; }
.table tbody tr:hover { --bs-table-hover-bg:var(--app-row-hover); }
.sticky-head th { position:sticky; top:0; background:#fff; z-index:2; box-shadow:inset 0 -1px 0 var(--app-border); }
textarea.form-control { resize:vertical; }
.source-cell { min-width:220px; }
.btn-group { flex-wrap:wrap; }
.alert { border-radius:.65rem; }

.results-table input[type="checkbox"] { width:1.15rem; height:1.15rem; cursor:pointer; margin:0; display:block; }
.results-table td.cb-cell { text-align:center; width:2rem; padding:.45rem .25rem; cursor:pointer; }
.results-table td.cb-cell:hover { background:rgba(0,0,0,.03); }
.qty-input { width:60px; min-width:50px; text-align:center; padding:.15rem .2rem; font-size:.82rem; height:auto; }

@media (min-width:768px) {
.results-table { border-collapse:collapse; }
.results-table td, .results-table th { border:1px solid var(--app-grid-line); }
.results-table tbody tr { border-width:0; }
.results-table tbody tr td:first-child { border-left-color:transparent; }
.results-table tbody tr td:last-child { border-right-color:transparent; }
.results-table thead tr th { border-top-color:transparent; }
.results-table tbody tr.row-selected { background-color:var(--app-row-selected) !important; }
.results-table tbody tr.row-selected:hover { background-color:#dbe4f7 !important; }
}

.results-table tbody tr { transition:background-color .12s ease; }
.results-table tbody tr.row-selected > td { background-color:var(--app-row-selected) !important; }
.results-table tbody tr.row-selected:hover > td { background-color:#dbe4f7 !important; }

.results-table tbody tr td { padding:.4rem .5rem; line-height:1.35; }

.results-table thead tr th { padding:.5rem .5rem; }

.progress { border-radius:.5rem; overflow:hidden; background:#e9ecf2; }
.progress-bar { font-size:.72rem; font-weight:700; }

/* ---- Landing page ---- */
.landing-navbar { background:var(--app-nav); box-shadow:none; }
.landing-hero {
  background:linear-gradient(135deg,#011659 0%,#042a7a 55%,#06308c 100%);
  color:#fff;
  position:relative;
  overflow:hidden;
}
.landing-hero::before,
.landing-hero::after {
  content:'';
  position:absolute;
  border-radius:50%;
  background:rgba(255,255,255,.06);
  pointer-events:none;
}
.landing-hero::before { width:480px; height:480px; top:-190px; right:-140px; }
.landing-hero::after { width:360px; height:360px; bottom:-180px; left:-120px; background:rgba(255,255,255,.05); }
.landing-hero .container { position:relative; z-index:1; }
.landing-hero-badge {
  display:inline-block;
  border:1px solid rgba(255,255,255,.35);
  border-radius:2rem;
  padding:.35rem .85rem;
  font-size:.8rem;
  font-weight:600;
  letter-spacing:.05em;
  text-transform:uppercase;
  color:#dbe6ff;
  background:rgba(255,255,255,.08);
}
.landing-hero-title { font-size:clamp(2rem, 5vw, 3.25rem); font-weight:800; line-height:1.12; }
.landing-hero-sub { font-size:1.1rem; color:#c9d7f5; max-width:640px; }
.landing-feature-icon {
  width:52px; height:52px;
  display:flex; align-items:center; justify-content:center;
  border-radius:.85rem;
  background:var(--app-bg);
  color:var(--app-primary);
  font-size:1.3rem;
  font-weight:800;
  border:1px solid var(--app-border);
}
.landing-feature-card { background:#fff; border:1px solid var(--app-border); border-radius:1rem; box-shadow:0 1px 3px rgba(15,23,42,.06); height:100%; transition:transform .15s ease, box-shadow .15s ease; }
.landing-feature-card:hover { transform:translateY(-3px); box-shadow:0 10px 24px rgba(15,23,42,.10); }
.landing-step-num {
  width:44px; height:44px; flex:0 0 44px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%;
  background:var(--app-primary);
  color:#fff; font-weight:800; font-size:1.1rem;
}
.landing-cta-band { background:linear-gradient(135deg,#011659 0%,#06308c 100%); border-radius:1.25rem; }
.landing-footer { background:var(--app-nav); color:#c9d7f5; }

.landing-body { background:#f5f7fb; min-height:100vh; display:flex; flex-direction:column; }
.landing-body > header, .landing-body > section, .landing-body > .offcanvas-backdrop { flex:1 1 auto; }
.landing-body > footer { flex-shrink:0; }
.landing-cart { border-radius:1rem; box-shadow:0 1px 3px rgba(16,24,40,.08); }
.landing-cart .card-header { background:var(--app-primary); color:#fff; border-radius:1rem 1rem 0 0; }
.landing-cart .card-header .btn { color:#fff; border-color:rgba(255,255,255,.5); }
.landing-cart-count { color:#ffc107; font-weight:800; }
.landing-book-card { border-radius:1rem; border:1px solid var(--app-border); box-shadow:0 1px 3px rgba(16,24,40,.06); transition:transform .15s ease,box-shadow .15s ease; }
.landing-book-card:hover { transform:translateY(-2px); box-shadow:0 6px 16px rgba(16,24,40,.12); }
.landing-book-cover { aspect-ratio:3/4; background:#eef1f5; overflow:hidden; border-radius:1rem 1rem 0 0; }
.landing-book-cover img { width:100%; height:100%; object-fit:cover; display:block; }
.landing-book-price { color:#b12704; font-weight:700; font-size:1.05rem; }
.landing-book-note { font-weight:600; color:#198754 !important; }
.buyer-price { font-weight:700; color:#b12704; white-space:nowrap; }
.landing-cart-item .cover-thumb { flex:0 0 auto; }
.landing-cart-item { align-items:center; }

.landing-search-form { display:flex; gap:.5rem; max-width:640px; }
.landing-search-form .form-control { border-radius:.6rem 0 0 .6rem; font-size:1.05rem; padding:.7rem 1rem; }
.landing-search-form .btn { border-radius:0 .6rem .6rem 0; white-space:nowrap; padding:.7rem 1.5rem; }
.landing-empty { border-radius:1rem; }

#search-suggest { border-radius:.6rem; overflow:hidden; }
#search-suggest .list-group-item { border-left:0; border-right:0; }
#search-suggest .list-group-item:first-child { border-top:0; }
#search-suggest .list-group-item:hover { background:#f0f7ff; }

.book-card { flex-direction:row; align-items:stretch; overflow:hidden; }
.book-card-img-col { flex:0 0 112px; width:112px; display:flex; align-items:stretch; background:#eef1f5; border-right:1px solid var(--app-border); }
.book-card-img { width:100%; height:100%; object-fit:cover; display:block; }
.book-card-body { display:flex; flex-direction:column; gap:.15rem; padding:.85rem; min-width:0; }
.book-card-title { font-weight:700; font-size:.92rem; line-height:1.3; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.book-card-author { font-size:.82rem; }
.book-card-publisher { font-size:.74rem; }
.book-card-price { color:#b12704; font-weight:700; font-size:1.05rem; margin-top:.2rem; }
.book-card .btn { margin-top:auto; }

.cover-thumb { width:44px; height:60px; object-fit:cover; border-radius:.3rem; border:1px solid var(--app-border); background:#eef1f5; }

@media (max-width: 767.98px) {
  .landing-search-form { flex-direction:column; }
  .landing-search-form .form-control { border-radius:.6rem; }
  .landing-search-form .btn { border-radius:.6rem; width:100%; }
  .book-card { flex-direction:row; }
  .landing-footer { padding-bottom:2rem !important; }
}

/* ---- Mobile-first layout (active up to tablet width, any orientation) ---- */
@media (max-width: 1199.98px) {
  .search-box { min-height:12rem; }
}

@media (max-width: 991.98px) {
  main.container-fluid { padding-inline:.9rem; }
  .search-box { min-height:11rem; }
  .search-actions .btn { flex:1 1 0; }
  .search-submit { min-width:0; }
  h1.h3 { font-size:1.5rem; }
  h2.h4 { font-size:1.2rem; }

  .table-responsive { max-height:none; overflow:visible; border:0!important; background:transparent!important; }
  .results-panel { padding:.65rem; }

  .mobile-cards { min-width:0!important; }
  .mobile-cards thead { display:none; }
  .mobile-cards,.mobile-cards tbody,.mobile-cards tr,.mobile-cards td { display:block; width:100%; }
  .mobile-cards tr { background:#fff; border:1px solid var(--app-border); border-radius:.5rem; margin-bottom:.75rem; overflow:hidden; }
  .mobile-cards td { border:0; border-bottom:1px solid #edf0f4; min-height:0; padding:.6rem .75rem; overflow-wrap:anywhere; white-space:normal; }
  .mobile-cards td:last-child { border-bottom:0; }
  .mobile-cards td::before { content:attr(data-label); display:block; margin-bottom:.2rem; color:#5b6472; font-size:.7rem; line-height:1.15; font-weight:700; letter-spacing:.02em; text-transform:uppercase; }
  .mobile-cards td.mobile-select { display:flex; align-items:center; gap:.55rem; min-height:2.75rem; }
  .mobile-cards td.mobile-select::before { content:"Select"; order:2; margin:0; white-space:nowrap; }
  .mobile-cards td.cb-cell { width:auto; padding:.6rem .75rem; }
  .mobile-cards input[type="checkbox"] { width:1.2rem; height:1.2rem; }
  .progress { min-width:0!important; }

  .btn-group { display:flex; flex-wrap:wrap; gap:.35rem; width:100%; }
  .btn-group>.btn { width:auto; flex:0 1 auto; border-radius:.375rem!important; margin:0; }
  .results-summary { display:block; }
  .results-summary span { display:block; margin-top:.25rem; }
  .provider-filter-bar { flex-direction:column; align-items:stretch; }
  .provider-filter-bar .dropdown,.provider-filter-bar .dropdown-toggle { width:100%; }
  .provider-filter-menu { width:100%; max-width:100%; }
  .provider-filter-options { width:100%; max-height:12rem; overflow-y:auto; }
  .provider-filter-options .form-check-label { flex:0 0 auto; max-width:100%; overflow-wrap:anywhere; }
}

@media (max-width: 767.98px) {
  .navbar { margin-bottom:1rem!important; }
  .navbar-brand { font-size:1.05rem; }
  main.container-fluid { padding-inline:.75rem; }
  .card-body { padding:1rem; }
  textarea.form-control { min-height:10rem; }
  .d-flex.justify-content-between.align-items-center { align-items:stretch!important; flex-direction:column; gap:.75rem; }
  .search-actions { flex-direction:column; }
  .search-actions .btn { width:100%; }
  .import-tools { flex-direction:column; align-items:stretch!important; }
  .import-tools .btn { width:100%; }
  .import-tools .form-control { width:100%!important; max-width:100%!important; }
  .results-panel > .d-flex.justify-content-end { justify-content:stretch!important; }
  .results-panel > .d-flex.justify-content-end > .btn { width:100%; }
}

@media (max-width: 420px) {
  .mobile-cards td { padding:.58rem .65rem; }
}

.navbar .dropdown-menu { background-color:#fff; border:1px solid rgba(0,0,0,.15); }
.navbar .dropdown-menu .dropdown-item { color:#000; }
.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus { color:#000; background-color:#f1f1f1; }
.navbar .dropdown-menu .dropdown-item.active { color:#fff; background-color:#0d6efd; }
.navbar .dropdown-menu .dropdown-item .badge { color:#fff; }

.qty-stepper .form-control { min-width: 0; }
.qty-stepper .btn { font-weight: 600; line-height: 1; }
.book-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.landing-cart-drawer { width: 360px; max-width: 100%; }
.landing-cart-drawer .cover-thumb { width: 44px; height: 60px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.landing-book-card .landing-book-cover { aspect-ratio: 3 / 4; background: #f1f3f7; overflow: hidden; }
.landing-book-card .cover-lg { height: 100%; object-fit: cover; }
.landing-book-cover img { transition: opacity .2s ease; }
.landing-book-cover img.cover-loaded { animation: coverIn .25s ease; }
@keyframes coverIn { from { opacity: .35; } to { opacity: 1; } }

.results-wrap { max-width: 1680px; }
.book-isbn { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; letter-spacing: .01em; }
.book-meta { line-height: 1.4; }
.landing-book-card .card-body { padding: .85rem; }
.landing-book-card .add-form .qty-stepper { max-width: 220px; }

.landing-banners { margin: 0 auto; max-width: 1280px; padding: 1rem 1rem 0; }
.landing-banners .carousel { border-radius: 14px; overflow: hidden; box-shadow: 0 .5rem 1.25rem rgba(0,0,0,.12); }
.landing-banners .carousel-item img { width: 100%; height: clamp(180px, 32vw, 420px); object-fit: cover; display: block; }
.landing-banners .carousel-item a { display: block; }
.landing-banners .carousel-indicators { margin-bottom: .4rem; }

@media (max-width: 767.98px) {
  .search-header { flex-direction: column; align-items: stretch !important; }
  .search-actions { flex-direction: column !important; align-items: stretch !important; width: 100%; gap: .5rem !important; }
  .search-actions > form, .search-actions > div { width: 100%; }
  #sale-session-start-form, #sale-session-active { flex-wrap: wrap !important; }
  #sale-session-reference { width: 100% !important; flex: 1 1 auto; }
  #sale-session-start-form .btn { flex: 1 1 auto; }
  .search-actions .input-group { flex-wrap: wrap !important; max-width: 100% !important; width: 100%; }
  .search-actions .input-group > .form-select,
  .search-actions .input-group > .btn { flex: 1 1 100%; width: 100%; }
}