/* Enterprise tokens — بوابة كلية الشمال (northern-college-portal) */
:root {
  --primary: #072C2C;
  --secondary: #FF5F03;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --surface: #EDEADE;
  --text: #111827;
  --text-muted: #4B5563;
  --border: #D1D5DB;
  --card-bg: #FFFFFF;
  --radius: 8px;
  --logo-filter-dark: brightness(0) invert(1);

  /* توافق مع الأسماء السابقة في القوالب */
  --primary-50: #e8f0f0;
  --primary-100: #d4e3e3;
  --primary-200: #a8c5c5;
  --primary-500: #0a3d3d;
  --primary-600: #072C2C;
  --primary-700: #052222;
  --primary-800: #072C2C;
  --secondary-50: #fff4ed;
  --secondary-100: #ffe4d4;
  --secondary-500: #FF5F03;
  --secondary-600: #e55502;
  --secondary-700: #c44802;
  --page: var(--surface);
  --ink: var(--text);
  --muted: var(--text-muted);
  --line: var(--border);
  --font: Almarai, "Segoe UI", Tahoma, Arial, sans-serif;
  --radius-lg: var(--radius);
  --ease: ease;
  --glass: #fff;
  --glass-border: var(--border);
  --shadow: none;
  --shadow-hover: none;
  --grad-btn: var(--secondary);
}
html[data-font="almarai"] { --font: Almarai, "Segoe UI", Tahoma, Arial, sans-serif; }
html[data-font="estedad"] { --font: Estedad, Almarai, "Segoe UI", Tahoma, Arial, sans-serif; }
html[data-font="playpen"] { --font: "Playpen Sans Arabic", Almarai, "Segoe UI", Tahoma, Arial, sans-serif; }

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font: 14px/1.8 var(--font);
  background: var(--page);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.5; font-weight: 700; }
h1 { font-size: 28px; color: var(--primary); }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
a { color: var(--primary); text-decoration: none; }
svg { flex-shrink: 0; vertical-align: middle; }
bdi { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.skip:focus { position: fixed; top: 12px; right: 16px; width: auto; height: auto; clip: auto; z-index: 100; background: #fff; padding: 12px; border: 2px solid var(--secondary); }
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

.academic-header {
  height: 90px; position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px; padding: 10px 26px;
  background: var(--primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
}
.academic-header.public-header { justify-content: space-between; }
.header-brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; color: #fff; }
.header-brand img { width: 96px; height: 65px; object-fit: contain; filter: var(--logo-filter-dark); transition: filter 0.2s; }
.header-brand strong { display: block; font-size: 16px; color: #fff; }
.header-brand small { display: block; font-size: 10px; color: rgba(255, 255, 255, 0.72); margin-top: 5px; }
.header-search {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 4px 14px; flex: 1; max-width: 640px; margin-inline: auto; color: rgba(255, 255, 255, 0.75);
}
.header-search input { border: 0; background: transparent; padding: 8px 0; min-width: 0; font-size: 12px; min-height: 40px; color: #fff; }
.header-search input::placeholder { color: rgba(255, 255, 255, 0.55); }
.header-search input:focus { box-shadow: none; outline: none; }
.header-search:focus-within { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 2px rgba(255, 95, 3, 0.35); }
.header-search button {
  background: var(--secondary); border: 0; border-radius: var(--radius); padding: 8px 14px; color: #fff; font-size: 11px; font-weight: 700;
}
.header-search button:hover { background: var(--secondary-600); }
.header-search .scan-btn {
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff; min-height: 36px; height: 36px; min-width: 36px; padding: 0; flex-shrink: 0;
}
.header-search .scan-btn:hover { background: rgba(255, 255, 255, 0.2); }
.header-tools { display: flex; align-items: center; gap: 14px; flex-shrink: 0; color: #fff; }
.header-tools strong { font-size: 12px; display: block; color: #fff; }
.header-tools small { display: flex; align-items: center; gap: 5px; font-size: 10px; color: rgba(255, 255, 255, 0.7); }
.header-tools .icon-btn {
  background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.22); color: #fff;
}
.header-tools .icon-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.35); }
.header-tools .btn.compact {
  background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.22); color: #fff;
}
.dot { height: 6px; width: 6px; border-radius: 50%; background: var(--secondary); display: inline-block; }

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - 90px); }
.sidebar {
  color: #fff; position: sticky; top: 90px; height: calc(100dvh - 90px);
  display: flex; flex-direction: column; padding: 28px 16px; gap: 24px; z-index: 20;
  border-inline-start: 4px solid var(--secondary);
  background: var(--primary);
}
.sidebar-brand { display: flex; justify-content: center; padding: 0 8px 8px; }
.sidebar-brand .college-logo-white { width: 140px; height: 78px; }
.sidebar-heading { font-size: 10px; color: rgba(255, 255, 255, 0.55); padding-inline: 12px; margin: 0; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a {
  font-size: 13px; color: rgba(255, 255, 255, 0.85); min-height: 50px; padding: 12px 14px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav a[aria-current=page] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff; font-weight: 700;
  box-shadow: inset -3px 0 var(--secondary);
}
.nav-count { margin-inline-start: auto; font-size: 11px; padding: 0 8px; border-radius: var(--radius); background: #ffffff18; }
.side-bottom {
  margin-top: auto; border-top: 1px solid #ffffff20; padding: 20px 10px 0; font-size: 12px; color: rgba(255, 255, 255, 0.55);
}
.side-bottom strong { color: #fff; display: block; font-weight: 700; margin: 6px 0; }

.workspace { min-width: 0; }
.content { padding: 26px 30px; max-width: 1580px; margin: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.eyebrow { font-size: 11px; font-weight: 700; color: var(--secondary); margin-bottom: 4px; }
.dashboard-content > .page-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 14px 28px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card-bg); color: var(--text); font-weight: 700; font-size: 13px; white-space: nowrap;
}
.btn:hover, .icon-btn:hover {
  background: #fff; border-color: var(--primary-200);
}
.btn.primary {
  background: var(--secondary); color: #fff; border-color: var(--secondary);
}
.btn.primary:hover { background: var(--secondary-600); color: #fff; border-color: var(--secondary-600); }
.btn.welcome-secondary {
  background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); color: #fff;
}
.btn.welcome-secondary:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f5c2c7; background: #fff7f8; }
.btn.compact { padding: 8px 14px; min-height: 40px; font-size: 12px; border-radius: var(--radius); }
.icon-btn { height: 44px; min-width: 44px; padding: 0; border-radius: var(--radius); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nowrap { flex-wrap: nowrap; }
.actions-cell { width: 1%; white-space: nowrap; vertical-align: middle; }
.action-menu { position: relative; display: inline-flex; }
.action-menu-toggle { gap: 6px; }
.action-menu-toggle .icon { transition: transform .15s ease; }
.action-menu.is-open .action-menu-toggle .icon { transform: rotate(180deg); }
.action-menu-panel {
  position: fixed; z-index: 80; min-width: 168px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; display: grid; gap: 2px;
  box-shadow: 0 10px 28px rgba(7, 44, 44, 0.12);
}
.action-menu-panel[hidden] { display: none !important; }
.action-menu-item {
  display: block; width: 100%; text-align: start; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 12px; font-weight: 700;
  padding: 10px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; line-height: 1.3;
}
.action-menu-item:hover { background: var(--primary-50); color: var(--primary); }
.action-menu-item.danger { color: var(--danger); }
.action-menu-item.danger:hover { background: #fff3f4; color: var(--danger); }
.action-menu-form { margin: 0; }

.notice {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; background: var(--card-bg); font-size: 12px; margin-bottom: 18px;
}
.notice.error { background: #fff3f4; border-color: #ecc8cd; color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  border: 1px solid var(--line); background: var(--card-bg); border-radius: var(--radius);
  padding: 20px 22px;
}
.stat-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary);
}
.stat strong { display: block; font-size: 34px; line-height: 1.3; margin-top: 10px; color: var(--primary); font-weight: 700; }
.stat small { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; }

.panel {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 24px; }
.academic-overview {
  background: var(--primary); border-radius: var(--radius);
  padding: 26px 28px; color: #fff;
  margin-bottom: 24px; position: relative; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.academic-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; z-index: 1; }
.welcome-brand { display: flex; gap: 18px; align-items: center; min-width: 0; }
.college-logo-white,
.logo-img { filter: var(--logo-filter-dark); width: 94px; height: 74px; object-fit: contain; flex-shrink: 0; transition: filter 0.2s; }
.logo-img.on-light { filter: none; }
.header-brand picture,
.sidebar-brand picture,
.welcome-brand picture,
.receipt-header picture,
.login-card picture { display: inline-flex; flex-shrink: 0; line-height: 0; }
.header-brand picture img,
.sidebar-brand picture img,
.welcome-brand picture img,
.receipt-header picture img,
.login-card picture img { display: block; object-fit: contain; }
.academic-kicker {
  font-size: 11px; color: #fff; background: rgba(255, 95, 3, 0.2);
  padding: 4px 10px; border-radius: var(--radius); border: 1px solid rgba(255, 95, 3, 0.45);
}
.welcome-brand h2 { font-size: 23px; line-height: 1.6; margin: 8px 0; color: #fff; }
.welcome-brand p { font-size: 11px; color: rgba(255, 255, 255, 0.7); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.academic-overview .stats {
  margin: 24px 0 0; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius); padding: 20px 16px; gap: 16px; position: relative; z-index: 1;
}
.academic-overview .stat {
  background: transparent; border: 0; border-inline-end: 1px solid #ffffff16; border-radius: 0;
  padding: 0 12px; display: flex; align-items: center; gap: 14px;
}
.academic-overview .stat:last-child { border: 0; }
.academic-overview .stat strong { margin: 0; font-size: 32px; color: #fff; }
.academic-overview .stat-head { display: block; font-size: 11px; color: rgba(255, 255, 255, 0.75); margin-top: 5px; }
.academic-overview .stat small { color: rgba(255, 255, 255, 0.55); }
.academic-overview .stat-icon { width: 43px; height: 46px; background: #ffffff10; color: #fff; }
.academic-overview .stat:nth-child(2) .stat-icon { color: var(--secondary); }
.academic-overview .stat:nth-child(3) .stat-icon { color: #6ee7b7; }

.public-home { max-width: 1100px; }
.public-home.has-results { max-width: 1580px; }
.public-banner {
  position: relative; overflow: hidden; color: #fff;
  border-radius: var(--radius); margin-bottom: 18px; min-height: 0;
  display: flex; align-items: center;
  background: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.public-banner-bg {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 55%, rgba(255, 95, 3, 0.12));
  pointer-events: none;
}
.public-banner-inner {
  position: relative; z-index: 1; width: 100%;
  display: block;
  padding: 18px 24px 20px;
}
.public-banner-copy { min-width: 0; }
.public-banner-brand {
  margin: 0 0 6px; font-size: 12px; letter-spacing: 0.02em;
  color: var(--secondary); font-weight: 700;
}
.public-banner-copy h1 {
  margin: 0; font-size: clamp(20px, 3vw, 28px); line-height: 1.35;
  color: #fff; font-weight: 700; max-width: 28ch;
}
.public-banner-text {
  margin: 8px 0 0; max-width: 48ch;
  font-size: 14px; line-height: 1.6; color: rgba(255, 255, 255, 0.72);
}
.public-search { padding: 28px 30px; margin-bottom: 26px; margin-top: -28px; position: relative; z-index: 2; }
.public-search-head {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; color: var(--primary);
}
.public-search-head h2 { margin: 0; font-size: 20px; color: var(--ink); }
.public-search-head p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.public-search-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(160px, 0.9fr) auto;
  gap: 12px; align-items: stretch;
}
.public-search-row input,
.public-search-row select {
  min-height: 52px; border-radius: var(--radius); background: #f7f7f4;
}
.public-search-row .btn { min-height: 52px; padding-inline: 28px; }
.search-with-scan {
  display: flex; align-items: stretch; gap: 8px; min-width: 0; flex: 1;
}
.search-with-scan input,
.search-with-scan select { flex: 1; min-width: 0; }
.search-with-scan .scan-btn {
  flex-shrink: 0; align-self: stretch; min-height: 48px; height: auto;
  background: var(--primary-50); border-color: var(--border); color: var(--primary);
}
.search-with-scan .scan-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.public-search-row .search-with-scan .scan-btn { min-height: 52px; }
.public-search-hint { margin: 14px 0 0; font-size: 13px; }
.public-search-hint a { color: var(--secondary); text-decoration: underline; text-underline-offset: 3px; }
.public-results { margin-top: 8px; }

/* بنر الصور المتكدسة — بعد صندوق البحث */
.home-stack-banner.banner {
  width: min(94%, 640px);
  margin: 36px auto 28px;
}
.home-stack-banner .card-stack {
  --duration: 12s;
  position: relative;
  width: 100%;
  height: 400px;
  perspective: 1200px;
  transform-style: preserve-3d;
}
.home-stack-banner .stack-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(7, 44, 44, 0.16);
  transform-style: preserve-3d;
  pointer-events: none;
  animation-duration: var(--duration);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.home-stack-banner .stack-media {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(7, 44, 44, 0.04), rgba(7, 44, 44, 0.08)),
    var(--surface);
  padding: 10px 10px 0;
}
.home-stack-banner .stack-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-position: center center;
  background: transparent;
}
.home-stack-banner .stack-img.fit-contain { object-fit: contain; }
.home-stack-banner .stack-img.fit-cover { object-fit: cover; }
.home-stack-banner .stack-img.fit-fill { object-fit: fill; }
.home-stack-banner .stack-img.is-broken {
  opacity: 0.35;
  object-fit: contain;
}
.home-stack-banner .caption {
  flex: 0 0 auto;
  position: relative;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-stack-banner .stack-card:nth-child(1) {
  --angle: -6deg;
  z-index: 1;
  animation-name: home-stack-1;
}
.home-stack-banner .stack-card:nth-child(2) {
  --angle: -3deg;
  z-index: 2;
  animation-name: home-stack-2;
}
.home-stack-banner .stack-card:nth-child(3) {
  --angle: 0deg;
  z-index: 3;
  animation-name: home-stack-3;
}
.home-stack-banner .stack-card:nth-child(4) {
  --angle: 3deg;
  z-index: 4;
  animation-name: home-stack-4;
}
@keyframes home-stack-1 {
  0%, 23%, 100% { transform: translateY(0) translateZ(0) rotate(var(--angle)); }
  25%, 47% { transform: translateY(25px) translateZ(-80px) rotate(var(--angle)); }
  50%, 72% { transform: translateY(18px) translateZ(-60px) rotate(var(--angle)); }
  75%, 97% { transform: translateY(10px) translateZ(-30px) rotate(var(--angle)); }
}
@keyframes home-stack-2 {
  0%, 22%, 100% { transform: translateY(10px) translateZ(-30px) rotate(var(--angle)); }
  25%, 47% { transform: translateY(0) translateZ(0) rotate(var(--angle)); }
  50%, 72% { transform: translateY(25px) translateZ(-80px) rotate(var(--angle)); }
  75%, 97% { transform: translateY(18px) translateZ(-60px) rotate(var(--angle)); }
}
@keyframes home-stack-3 {
  0%, 22%, 100% { transform: translateY(18px) translateZ(-60px) rotate(var(--angle)); }
  25%, 47% { transform: translateY(10px) translateZ(-30px) rotate(var(--angle)); }
  50%, 72% { transform: translateY(0) translateZ(0) rotate(var(--angle)); }
  75%, 97% { transform: translateY(25px) translateZ(-80px) rotate(var(--angle)); }
}
@keyframes home-stack-4 {
  0%, 22%, 100% { transform: translateY(25px) translateZ(-80px) rotate(var(--angle)); }
  25%, 47% { transform: translateY(18px) translateZ(-60px) rotate(var(--angle)); }
  50%, 72% { transform: translateY(10px) translateZ(-30px) rotate(var(--angle)); }
  75%, 97% { transform: translateY(0) translateZ(0) rotate(var(--angle)); }
}
[dir="rtl"] .home-stack-banner .stack-card:nth-child(1) { --angle: 6deg; }
[dir="rtl"] .home-stack-banner .stack-card:nth-child(2) { --angle: 3deg; }
[dir="rtl"] .home-stack-banner .stack-card:nth-child(4) { --angle: -3deg; }
@media (max-width: 600px) {
  .home-stack-banner .card-stack { height: 300px; }
  .home-stack-banner.banner { margin: 28px auto 20px; width: min(96%, 640px); }
}
@media (prefers-reduced-motion: reduce) {
  .home-stack-banner .stack-card {
    animation: none;
    transform: rotate(var(--angle));
  }
}
.checkline {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--secondary); }

.discovery-search { padding: 22px 24px; margin-bottom: 26px; }
.discovery-search form, .discovery-input { display: flex; align-items: center; gap: 12px; flex: 1; }
.discovery-title { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.discovery-title h2 { font-size: 15px; }
.discovery-input input { background: #f7f7f4; border-radius: var(--radius); }
.discovery-input .btn { background: var(--primary); color: #fff; border-color: var(--primary); }
.category-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.category-links a {
  background: var(--surface); color: var(--text-muted); border-radius: var(--radius); padding: 7px 14px; font-size: 10px;
  border: 1px solid var(--border);
}
.category-links a:hover, .category-links a[aria-current=page] {
  background: var(--primary-50); color: var(--primary); border-color: var(--primary-200);
}

.academic-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(250px, 1fr); gap: 24px; margin-bottom: 26px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.catalog-grid, .reference-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.reference-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column;
}
.reference-card:hover { border-color: var(--primary-200); }
.reference-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.reference-main { display: flex; align-items: flex-start; gap: 14px; flex: 1; }
.reference-book-icon {
  display: grid; place-items: center; width: 72px; height: 100px; flex-shrink: 0;
  background: var(--primary-50); color: var(--primary-200);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.book-cover {
  width: 72px; height: 100px; object-fit: cover; border-radius: var(--radius);
  flex-shrink: 0; background: var(--primary-50); border: 1px solid var(--line);
}
.book-cover-lg { width: 140px; height: 200px; border-radius: var(--radius); }
.book-cover-sm { width: 44px; height: 60px; border-radius: var(--radius); object-fit: contain; background: #f8fafc; }
.shelf-gallery-panel { margin-bottom: 0; }
.shelf-gallery { position: relative; }
.shelf-gallery-viewport {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--primary);
  min-height: 280px; aspect-ratio: 16 / 9; max-height: 520px;
}
.shelf-gallery-track { position: absolute; inset: 0; }
.shelf-gallery-slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.shelf-gallery-slide.is-active {
  opacity: 1; pointer-events: auto; z-index: 1;
}
.shelf-gallery-slide img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: #041818;
}
.shelf-gallery-slide img.is-broken {
  opacity: 0.35;
}
.shelf-gallery-slide figcaption {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 14px 18px; font-size: 13px; color: #fff;
  background: rgba(7, 44, 44, 0.88);
}
.shelf-gallery-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px;
}
.shelf-gallery-dots { display: flex; gap: 8px; align-items: center; justify-content: center; flex: 1; }
.shelf-gallery-dots button {
  width: 10px; height: 10px; border-radius: 999px; border: 0;
  padding: 0; background: #cbd5e1; cursor: pointer;
}
.shelf-gallery-dots button[aria-current="true"] {
  background: var(--secondary);
}
.gallery-edit-row {
  display: grid; gap: 10px; padding: 14px; margin-bottom: 10px;
  border: 1px dashed var(--border); border-radius: var(--radius); background: #f8fafc;
}
@media (prefers-reduced-motion: reduce) {
  .shelf-gallery-slide { transition: none; }
}
.shelf-guide .lead { font-size: 14px; color: #334155; margin-bottom: 16px; }
.shelf-equation {
  display: grid; gap: 6px; padding: 14px 16px; margin-bottom: 20px;
  background: var(--primary-50); border-radius: var(--radius); border: 1px solid var(--line);
}
.shelf-equation bdi { font-size: 18px; font-weight: 700; color: var(--secondary); }
.shelf-rows { display: grid; gap: 16px; }
.shelf-row-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden;
}
.shelf-row-card > header {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--primary); color: #fff;
}
.shelf-row-card > header bdi {
  font-size: 18px; font-weight: 800; background: var(--secondary); color: #fff;
  padding: 6px 10px; border-radius: var(--radius);
}
.shelf-row-card > header strong { display: block; font-size: 15px; }
.shelf-row-card > header small { color: rgba(255, 255, 255, 0.7); font-size: 12px; }
.shelf-faces { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.shelf-face { padding: 14px 16px; border-top: 1px solid var(--line); }
.shelf-face:first-child { border-inline-end: 1px solid var(--line); }
.shelf-face h3 { font-size: 13px; margin-bottom: 8px; color: var(--primary); }
.shelf-face ul { margin: 0; padding: 0 18px; display: grid; gap: 8px; }
.shelf-face li { font-size: 12px; }
.shelf-edit-block {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 12px;
}
.shelf-edit-block.new-row { border-style: solid; border-color: var(--primary-200); background: var(--primary-50); }
@media (max-width: 900px) {
  .shelf-faces, .shelf-edit-block { grid-template-columns: 1fr; }
  .shelf-face:first-child { border-inline-end: 0; }
}
.reference-main h3, .reference-card h3 { font-size: 14px; line-height: 1.8; color: var(--text); }
.reference-main p, .reference-card p { font-size: 11px; color: var(--muted); margin: 5px 0 10px; }
.reference-location {
  background: var(--surface); border-radius: var(--radius); padding: 8px;
  display: grid; gap: 4px; font-size: 10px; color: var(--muted);
  border: 1px solid var(--border);
}
.reference-location span { display: flex; justify-content: space-between; gap: 8px; }
.reference-location bdi { font-weight: 700; color: #334155; }
.reference-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--border); margin-top: 18px; padding-top: 12px; color: var(--muted); font-size: 10px;
}

.attention {
  background: #fff; border: 1px solid var(--border); padding: 20px; margin-bottom: 12px;
  border-radius: var(--radius);
}
.attention-title { color: var(--warning); display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.attention strong { font-size: 28px; color: var(--primary); display: block; }
.attention p { color: var(--muted); font-size: 11px; margin: 8px 0 16px; }
.attention .btn { font-size: 12px; background: var(--secondary-50); border-color: #ffd4b8; color: #9a3412; width: 100%; }
.support-actions { display: grid; gap: 12px; }
.support-actions a {
  display: flex; align-items: center; gap: 12px; padding: 18px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--primary);
}
.support-actions a:hover { border-color: var(--secondary); }
.support-actions strong { display: block; font-size: 12px; }
.support-actions small { display: block; font-size: 10px; color: var(--muted); margin-top: 5px; }
.shelf-tip {
  padding: 20px; background: var(--primary-50); margin-top: 12px; border-radius: var(--radius);
  font-size: 11px; border: 1px solid var(--border);
}
.shelf-tip strong { color: var(--secondary); }
.shelf-tip p { margin: 10px 0 6px; color: var(--muted); }
.shelf-tip > bdi { display: block; font-size: 15px; font-weight: 700; color: var(--text); margin: 8px 0; }
.shelf-tip small { display: block; font-size: 10px; color: var(--muted); line-height: 1.9; margin-top: 6px; }

.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; }
th { font-weight: 700; font-size: 11px; color: var(--muted); background: var(--surface); }
th, td { text-align: start; padding: 16px 20px; border-bottom: 1px solid var(--border); }
td { font-size: 12px; }
tbody tr:hover { background: #f7f7f4; }
.title-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-cell-text { min-width: 0; max-width: 280px; }
.book-icon {
  width: 34px; height: 42px; display: grid; place-items: center; color: var(--primary);
  background: var(--primary-50); border: 1px solid var(--border); border-inline-start: 3px solid var(--secondary); border-radius: 4px 7px 7px 4px;
  flex: 0 0 auto;
}
.title-cell strong { display: block; font-size: 12px; }
.title-cell small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.books-table th, .books-table td {
  white-space: nowrap; vertical-align: middle; padding-block: 12px;
}
.books-table .title-cell strong,
.books-table .title-cell small,
.books-table .cell-clip {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.books-table .title-cell small { max-width: 280px; }
.books-table .cell-clip { display: inline-block; max-width: 140px; vertical-align: middle; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius); padding: 5px 10px;
  background: var(--primary-50); color: var(--primary); font-size: 10px; font-weight: 700; white-space: nowrap;
}
.pill.overdue { background: #fee2e2; color: #991b1b; }
.pill.today { background: #fef3c7; color: #92400e; }
.pill.returned { background: #f1f5f9; color: #475569; }
.pill.available { background: #dcfce7; color: #166534; }
.pill.out { background: #fff7ed; color: #9a3412; }
.pill.pending { background: #f1f5f9; color: #475569; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.search { position: relative; flex: 1; min-width: 180px; display: flex; align-items: stretch; gap: 8px; }
.search > .search-with-scan { flex: 1; }
input, select, textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); border-radius: var(--radius); padding: 11px 14px; font-size: 13px;
}
input:focus, select:focus, textarea:focus { border-color: var(--secondary); box-shadow: 0 0 0 2px rgba(255, 95, 3, 0.2); outline: none; }
.filter { width: auto; min-width: 145px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: #fff; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--primary); margin: 8px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: block; min-width: 0; }
.field > span { display: block; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.field small { font-size: 11px; color: var(--muted); display: block; margin-top: 6px; }
.span-2 { grid-column: 1 / -1; }
.form-help { font-size: 11px; color: var(--muted); margin-bottom: 18px; }
.settings-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.settings-grid .field { margin-bottom: 18px; }
.settings-shell { display: grid; gap: 18px; max-width: 1100px; }
.settings-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius);
}
.settings-tab {
  border: 1px solid transparent; background: transparent; color: var(--text-muted);
  border-radius: var(--radius); padding: 10px 16px; font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer;
}
.settings-tab:hover { background: var(--surface); color: var(--text); }
.settings-tab[aria-selected="true"] {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.settings-panel h2 { margin: 0 0 8px; font-size: 18px; }
.settings-panel > .muted.small { margin-bottom: 18px; }
.settings-fields { display: grid; gap: 16px; margin-bottom: 20px; max-width: 640px; }
.role-cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px;
}
.role-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface);
}
.role-card strong { display: block; font-size: 14px; color: var(--primary); }
.role-card small { display: block; color: var(--muted); margin: 6px 0 10px; font-size: 11px; }
.role-card p { margin: 0; font-size: 11px; line-height: 1.7; color: #334155; }
@media (max-width: 900px) {
  .role-cards { grid-template-columns: 1fr; }
}
.font-picker { display: grid; gap: 10px; margin: 8px 0 18px; }
.font-option {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; cursor: pointer;
}
.font-option:hover { border-color: var(--primary-200); }
.font-option:has(input:checked) {
  border-color: var(--secondary); background: var(--secondary-50); box-shadow: 0 0 0 2px rgba(255, 95, 3, 0.2);
}
.font-option strong { display: block; font-size: 14px; }
.font-option small { color: var(--muted); font-size: 11px; }
.font-option[data-font="almarai"] strong { font-family: Almarai, Arial, sans-serif; }
.font-option[data-font="estedad"] strong { font-family: Estedad, Almarai, Arial, sans-serif; }
.font-option[data-font="playpen"] strong { font-family: "Playpen Sans Arabic", Almarai, Arial, sans-serif; }
.role-picker, .perm-grid { display: grid; gap: 10px; margin-top: 6px; }
.role-option, .perm-option {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer;
}
.role-option:has(input:checked), .perm-option:has(input:checked) {
  border-color: var(--secondary); background: var(--secondary-50);
}
.role-option strong, .perm-option span { display: block; font-size: 13px; }
.role-option small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.perm-grid { grid-template-columns: 1fr 1fr; }
.check-line {
  display: flex !important; align-items: flex-start; gap: 10px; padding: 12px 0 0;
}
.check-line input { margin-top: 3px; }
.check-line > span { font-weight: 600; font-size: 13px; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0; }
.details div { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.details .span-2 { grid-column: 1 / -1; }
.details dt { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.details dd { margin: 0; font-size: 13px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 8px; }

.location-picker {
  margin: 0; padding: 16px; border: 1px solid var(--primary-200); border-radius: var(--radius);
  background: var(--surface);
}
.location-picker legend { font-size: 13px; font-weight: 700; color: var(--primary); padding-inline: 6px; }
.location-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.location-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-block: 16px 0; }
.location-preview > bdi { font-weight: 700; color: var(--secondary); font-size: 16px; }
.shelf-description { font-size: 10px; color: var(--muted); max-width: 260px; white-space: normal; line-height: 1.8; margin-top: 5px; }

.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--primary);
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius); padding: 32px 28px; color: #fff; display: grid; gap: 14px;
}
.login-card h1 { color: #fff; font-size: 22px; }
.login-card .field span { color: rgba(255, 255, 255, 0.85); }
.login-card a { color: #ffd4b8; text-align: center; }
.login-card input {
  background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.22); color: #fff;
}
.login-card input::placeholder { color: rgba(255, 255, 255, 0.45); }
.login-card .college-logo-white { margin-inline: auto; }

.book-detail { max-width: 860px; }
.back-link { display: inline-block; margin-bottom: 16px; font-size: 13px; }
.detail-card { padding: 28px; }
.detail-hero { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 12px; }
.detail-hero h1 { font-size: 22px; margin: 8px 0; }
.site-footer {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding: 28px 30px; margin-top: 24px;
  background: var(--primary); color: rgba(255, 255, 255, 0.75); font-size: 12px;
  border-top: 4px solid var(--secondary);
}
.site-footer span { display: block; }
.site-footer strong { display: block; color: #fff; margin-bottom: 6px; font-size: 13px; }
.site-footer a { color: #ffd4b8; }
.toast {
  position: fixed; bottom: 24px; left: 24px; z-index: 99; padding: 14px 20px;
  background: var(--primary); color: #fff; border-radius: var(--radius);
  border-inline-start: 4px solid var(--secondary);
}
.receipt {
  background: #fff; color: #111; max-width: 80mm; margin: 20px auto;
  font: 12px/1.8 "Courier New", Courier, monospace; padding: 16px;
  border: 1px dashed #ddd; border-radius: var(--radius);
}
.receipt h2 { text-align: center; font-size: 18px; font-family: var(--font); }
.receipt-header { border-bottom: 2px solid #222; padding-bottom: 12px; margin-bottom: 12px; text-align: center; }
.receipt-header img { display: block; margin: 0 auto 8px; height: 54px; width: auto; object-fit: contain; filter: none; }
.receipt-kind { text-align: center; margin: 6px 0 18px; font-family: var(--font); }
.receipt-row { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed #ddd; padding: 8px 0; }
.receipt-barcode {
  display: flex; justify-content: center; align-items: center;
  margin: 12px 0 2px; padding: 8px 0 2px;
  border-top: 1px dashed #ddd;
}
.receipt-barcode svg { max-width: 100%; height: auto; }
.loan-book-results {
  display: grid; gap: 8px; margin-top: 12px; max-height: 280px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff;
}
.loan-book-results[hidden], .loan-book-picked[hidden], [data-loan-copies-wrap][hidden] { display: none !important; }
.combo-pick { display: grid; gap: 10px; }
.combo-pick > input[type="search"] { width: 100%; }
.loan-book-option {
  display: grid; gap: 4px; width: 100%; text-align: start; border: 1px solid var(--border);
  background: var(--surface); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  font: inherit; color: var(--text);
}
.loan-book-option:hover, .loan-book-option.is-active {
  border-color: var(--secondary); background: var(--secondary-50);
}
.loan-book-option strong { font-size: 13px; color: var(--primary); }
.loan-book-option small { color: var(--muted); font-size: 11px; }
.loan-book-picked {
  margin-top: 12px; border: 1px solid var(--primary-200); background: var(--primary-50);
  border-radius: var(--radius); padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.loan-book-picked strong { display: block; color: var(--primary); }
.loan-book-picked small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.loan-copy-list { display: grid; gap: 8px; margin-top: 10px; }
.loan-copy {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: #fff;
  cursor: pointer;
}
.loan-copy input { margin: 0; }
.loan-copy-meta { display: grid; gap: 2px; min-width: 0; }
.loan-copy-meta bdi { font-weight: 700; font-size: 13px; }
.loan-copy-meta small { color: var(--muted); font-size: 11px; }
.loan-copy.is-available:hover, .loan-copy.is-available:has(input:checked) {
  border-color: var(--secondary); background: var(--secondary-50);
}
.loan-copy.is-on-loan {
  border-color: #f5c2c7; background: #fff3f4; color: var(--danger); cursor: not-allowed;
}
.loan-copy.is-on-loan bdi, .loan-copy.is-on-loan small { color: var(--danger); }
.loan-copy-badge {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px;
  background: #dcfce7; color: #166534;
}
.loan-copy.is-on-loan .loan-copy-badge { background: #fee2e2; color: #991b1b; }
.loan-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 12px; }
.receipt-id { text-align: center; font: 10px/1.7 monospace; direction: ltr; border-block: 1px dashed #666; padding: 12px 0; margin: 18px 0; }
.receipt-footer { text-align: center; font-size: 10px; margin-top: 20px; font-family: var(--font); }
.receipt-actions { display: flex; gap: 8px; margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1150px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  .stats, .academic-overview .stats { grid-template-columns: 1fr 1fr; }
  .academic-grid, .settings-grid { grid-template-columns: 1fr; }
  .header-tools > div { display: none; }
  .site-footer { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .academic-header { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  .header-brand img { width: 66px; height: 46px; }
  .header-search { order: 3; max-width: none; flex-basis: 100%; }
  .shell { display: block; }
  .sidebar {
    position: relative; top: auto; height: auto; padding: 10px 12px;
    border-inline-start: 0; border-top: 4px solid var(--secondary);
  }
  .sidebar-heading, .side-bottom { display: none; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { min-height: 42px; font-size: 11px; flex-shrink: 0; }
  .nav-count { display: none; }
  .content { padding: 18px 14px; }
  .form-grid, .catalog-grid, .reference-cards, .details, .perm-grid { grid-template-columns: 1fr; }
  .academic-welcome { flex-wrap: wrap; }
  .college-logo-white { width: 66px; height: 58px; }
  .academic-overview .stat-icon { display: none; }
  .public-banner { min-height: 0; }
  .public-banner-inner { padding: 16px 18px 18px; }
  .public-banner-copy h1 { max-width: none; font-size: 22px; }
  .public-search { padding: 20px 18px; margin-top: -20px; }
  .public-search-row { grid-template-columns: 1fr; }
  .public-search-row .btn { width: 100%; }
  .public-search-row .search-with-scan .scan-btn { width: 52px; }
  .shelf-gallery-viewport { min-height: 200px; aspect-ratio: 4 / 3; }
  .site-footer { padding: 22px 16px; }
}
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.report-page { max-width: 1200px; }
.report-actions { margin-bottom: 16px; }
.report-sheet {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 30px;
}
.report-head {
  display: flex; align-items: center; gap: 18px;
  border-bottom: 2px solid var(--primary); padding-bottom: 16px; margin-bottom: 18px;
}
.report-head strong { display: block; color: var(--primary); font-size: 14px; }
.report-head h1 { margin: 6px 0; font-size: 20px; color: var(--ink); }
.report-head p { margin: 0; color: var(--muted); font-size: 12px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th, .report-table td {
  border: 1px solid var(--border); padding: 8px 10px; text-align: right; vertical-align: top;
}
.report-table th { background: var(--primary-50); color: var(--primary); font-weight: 700; }
.report-table tr:nth-child(even) td { background: #fafaf8; }
.report-foot {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: 11px;
}

.barcode-page { max-width: 1100px; }
.barcode-hint { margin: 0 0 16px; font-size: 13px; }
.barcode-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.barcode-label {
  border: 1px solid #111;
  background: #fff;
  border-radius: 2px;
  padding: 10px 12px 8px;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
  width: 100%;
  max-width: 260px;
}
.barcode-label-title {
  font-size: 11px; font-weight: 700; color: #111; line-height: 1.4;
  margin-bottom: 4px; min-height: 2.8em;
}
.barcode-label-meta { font-size: 10px; color: #333; margin-bottom: 6px; }
.barcode-svg { display: flex; justify-content: center; overflow: hidden; }
.barcode-svg svg { max-width: 100%; height: auto; }
.barcode-label-code {
  margin-top: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #111;
}

body.modal-open { overflow: hidden; }
.ui-modal {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.ui-modal.is-open { display: flex; }
.ui-modal-backdrop {
  position: absolute; inset: 0; background: rgba(7, 44, 44, 0.55);
}
.ui-modal-dialog {
  position: relative; z-index: 1; width: min(820px, 100%);
  max-height: min(92vh, 920px); overflow: auto;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}
.ui-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card-bg); z-index: 2;
}
.ui-modal-head h2 { margin: 0; font-size: 20px; color: var(--primary); }
.ui-modal-body { padding: 18px 20px 22px; }
.ui-modal-body .form-grid { margin: 0; }
.ui-modal-body .cover-preview img { display: block; }
.book-card-dialog { max-width: 720px; }
.book-card-body .detail-hero h3 { margin: 8px 0; font-size: 18px; color: var(--primary); }
.book-card-body .shelf-tip { margin-top: 8px; }
.book-card-body .modal-actions { margin-top: 18px; }
.book-card-loans {
  margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 14px 16px;
}
.book-card-loans-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px;
}
.book-card-loans-head strong { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); }
.book-card-loans .btn { margin-top: 10px; }

/* ماسح باركود البحث */
.barcode-scan-modal.ui-modal { z-index: 90; }
.barcode-scan-dialog { width: min(440px, 100%); }
.barcode-scan-body { display: grid; gap: 12px; }
.barcode-scan-viewport {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background: #041818; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.barcode-scan-viewport video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.barcode-scan-reticle {
  position: absolute; inset: 18% 10%;
  border: 2px solid var(--secondary); border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(7, 44, 44, 0.35);
  pointer-events: none;
}
.barcode-scan-reticle::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%;
  height: 2px; background: var(--secondary); opacity: 0.85;
  animation: barcodeLaser 1.2s ease-in-out infinite alternate;
}
@keyframes barcodeLaser {
  from { transform: translateY(-18px); opacity: 0.45; }
  to { transform: translateY(18px); opacity: 1; }
}
.barcode-scan-hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.barcode-scan-status { margin: 0; font-size: 12px; color: var(--primary); text-align: center; font-weight: 700; }
.barcode-scan-status.is-error { color: var(--danger); }
.barcode-scan-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  .barcode-scan-reticle::after { animation: none; }
}

@media print {
  .academic-header, .sidebar, .page-head, .receipt-actions, .report-actions, .toast, .site-footer, .skip, .barcode-hint, .ui-modal { display: none !important; }
  .shell, .workspace, .content, .report-page, .barcode-page { display: block; padding: 0; max-width: none; margin: 0; }
  .report-sheet { border: 0; border-radius: 0; padding: 0; }
  .report-table th, .report-table td { border-color: #999; }
  .receipt { border: 0; max-width: 72mm; }
  .barcode-sheet { gap: 8px; grid-template-columns: repeat(3, 1fr); }
  .barcode-label { max-width: none; }
}
