/* BOOK-R2-A4 repair: one scoped, validated inventory stylesheet. */
.book-stock-page {
  --stock-ink:#18352b; --stock-gold:#d4a95a; --stock-muted:#627568;
  --stock-border:#dfe6df; --stock-cream:#faf6ec;
  direction:rtl; display:grid; gap:16px; min-width:0;
}
.book-stock-page *, .book-stock-page *::before, .book-stock-page *::after { box-sizing:border-box; }
.book-stock-page button, .book-stock-page input, .book-stock-page select { font:inherit; }
.book-stock-page .book-stock-workspace {
  display:grid; gap:13px; min-width:0; padding:16px;
  background:#fff; border:1px solid var(--stock-border);
  border-radius:22px; box-shadow:0 12px 32px rgba(24,53,43,.06);
}
.book-stock-page .stock-summary-grid {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px;
}
.book-stock-page .stock-kpi {
  display:grid; grid-template-rows:minmax(2.4em,auto) auto minmax(2.2em,auto);
  align-content:center; align-items:center;
  min-width:0; min-height:74px; gap:2px; padding:9px 13px;
  border:1px solid #e8dfca; border-radius:14px;
  background:linear-gradient(160deg,#fcf8ef,#f8f1e4);
  color:var(--stock-ink); text-align:right; cursor:pointer;
  transition:background .16s,border-color .16s,box-shadow .16s;
}
.book-stock-page .stock-kpi span { display:flex; align-items:center; font-size:.81rem; line-height:1.25; font-weight:800; color:#526357; }
.book-stock-page .stock-kpi strong { display:block; font-size:1.5rem; line-height:1.08; font-weight:900; font-variant-numeric:tabular-nums; }
.book-stock-page .stock-kpi small { display:flex; align-items:center; font-size:.71rem; line-height:1.25; color:#896823; }
.book-stock-page .stock-kpi:hover, .book-stock-page .stock-kpi:focus-visible {
  border-color:#bb9343; box-shadow:0 0 0 3px rgba(212,169,90,.16); outline:0;
}
.book-stock-page .stock-kpi.is-active { background:#e8efe8; border-color:#255740; box-shadow:inset 0 0 0 1px #255740; }
.book-stock-page .smart-stock-filters {
  display:grid; grid-template-columns:minmax(190px,1.5fr) repeat(3,minmax(125px,1fr)) auto;
  gap:9px; align-items:center; min-width:0; padding:11px;
  border:1px solid #e3e8e2; border-radius:15px; background:#fafbf9;
}
.book-stock-page .stock-search-field {
  display:flex; align-items:center; gap:8px; min-width:0; height:43px;
  padding:0 11px; background:#fff; color:var(--stock-muted);
  border:1px solid #d6dfd5; border-radius:11px;
}
.book-stock-page .stock-search-field:focus-within { border-color:#caa153; box-shadow:0 0 0 3px rgba(212,169,90,.14); }
.book-stock-page .stock-search-field input { min-width:0; width:100%; height:100%; border:0; outline:0; background:transparent; color:var(--stock-ink); }
.book-stock-page .smart-stock-filters select {
  min-width:0; width:100%; height:43px; padding:0 10px;
  border:1px solid #d6dfd5; border-radius:11px; background:#fff; color:var(--stock-ink);
}
.book-stock-page .smart-stock-filters button, .book-stock-page .stock-action {
  min-height:42px; padding:8px 13px; border:0; border-radius:11px;
  background:var(--stock-gold); color:var(--stock-ink); font-weight:850; cursor:pointer; white-space:nowrap;
}
.book-stock-page .smart-stock-filters button:hover, .book-stock-page .stock-action:hover { background:#e1b963; }
.book-stock-page .stock-table-wrap {
  width:100%; min-width:0; max-height:min(67vh,720px); overflow:auto;
  border:1px solid var(--stock-border); border-radius:15px;
  overscroll-behavior:contain; scrollbar-gutter:stable;
}
.book-stock-page .stock-table {
  width:100%; min-width:980px; border-collapse:separate; border-spacing:0;
  background:#fff; color:var(--stock-ink);
}
.book-stock-page .stock-table th, .book-stock-page .stock-table td {
  padding:9px 10px; text-align:right; vertical-align:middle; font-size:.87rem;
}
.book-stock-page .stock-table thead th {
  position:sticky; top:0; z-index:3; background:var(--stock-ink);
  color:#fff; white-space:nowrap; font-weight:850;
}
.book-stock-page .stock-table tbody td { border-bottom:1px solid #e9eee9; background:#fff; }
.book-stock-page .stock-table tbody tr.has-shortage td { background:#fff8e7; }
.book-stock-page .stock-table th:first-child {
  position:sticky; right:0; z-index:5; min-width:220px; background:var(--stock-ink);
  box-shadow:-5px 0 9px rgba(22,52,41,.10);
}
.book-stock-page .stock-table td:first-child {
  position:sticky; right:0; z-index:2; min-width:220px; background:#fff;
  box-shadow:-7px 0 10px rgba(22,52,41,.11);
}
.book-stock-page .stock-table tr.has-shortage td:first-child { background:#fff8e7; border-right:3px solid #c35645; }
.book-stock-page .stock-table td small { display:block; margin-top:3px; color:#7c766a; font-size:.75rem; }
.book-stock-page .stock-grade-line { color:#4d685c; font-weight:700; line-height:1.5; }
.book-stock-page .stock-division-badge {
  display:inline-flex; align-items:center; border-radius:7px; padding:2px 7px;
  margin-inline-start:5px; font-size:.72rem; font-weight:850; white-space:nowrap;
}
.book-stock-page .stock-division-badge.scientific { color:#14636c; background:#e0f4f5; }
.book-stock-page .stock-division-badge.literary { color:#7b3c83; background:#f2e9f5; }
.book-stock-page .stock-division-badge.both { color:#825611; background:#fff0cc; }
.book-stock-page .stock-division-badge.baccalaureate { color:#286344; background:#e5f3e9; }
.book-stock-page .stock-edit-cell {
  display:grid; grid-template-columns:minmax(72px,96px); justify-content:center;
  gap:5px; align-items:center;
}
.book-stock-page .stock-edit-cell input { width:100%; min-width:0; height:38px; border:1px solid #d6dfd5; border-radius:9px; background:#fff; padding:6px; }
.book-stock-page .stock-edit-cell button {
  width:100%; min-height:31px; padding:4px 8px; border:0; border-radius:8px;
  background:var(--stock-ink); color:#fff; font-size:.78rem; font-weight:800; cursor:pointer;
}
.book-stock-page .stock-edit-cell button:disabled {
  opacity:.5; cursor:not-allowed; background:#edf1ed; color:#697a6e;
}
.book-stock-page .stock-edit-cell input:focus-visible {
  outline:2px solid #cda957; outline-offset:1px;
}
.book-stock-page .stock-danger-number { color:#b22222; }
.book-stock-page .stock-print-number { color:#966917; }
.book-stock-page .stock-empty-row { padding:28px; text-align:center; }
.book-stock-page .stock-report-meta { margin:0; font-size:.75rem; color:var(--stock-muted); }
.book-stock-page .stock-message { padding:13px; background:#fff; border:1px solid var(--stock-border); border-radius:12px; }
.book-stock-page .stock-message.error { background:#fff3f0; color:#a32121; }
@media(max-width:1120px) {
  .book-stock-page .smart-stock-filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .book-stock-page .stock-search-field { grid-column:1/-1; }
}
@media(max-width:700px) {
  .book-stock-page .book-stock-workspace { padding:11px; border-radius:16px; }
  .book-stock-page .stock-summary-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .book-stock-page .stock-kpi {
    padding:8px 7px; min-height:105px; gap:3px; align-items:stretch;
    grid-template-rows:minmax(2.8em,auto) auto minmax(2.9em,auto);
  }
  .book-stock-page .stock-kpi span { font-size:.69rem; line-height:1.32; overflow-wrap:anywhere; }
  .book-stock-page .stock-kpi strong { font-size:1.32rem; }
  .book-stock-page .stock-kpi small { font-size:.66rem; line-height:1.32; overflow-wrap:anywhere; }
  .book-stock-page .smart-stock-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .book-stock-page .stock-search-field { grid-column:1/-1; }
  .book-stock-page .stock-table-wrap { max-height:65vh; }
  .book-stock-page .stock-table { min-width:900px; }
  .book-stock-page .stock-table th:first-child,
  .book-stock-page .stock-table td:first-child { min-width:168px; width:168px; max-width:168px; overflow-wrap:anywhere; white-space:normal; }
  .book-stock-page .stock-table td:first-child strong { display:block; line-height:1.3; }
  .book-stock-page .stock-table td:first-child .stock-grade-line { font-size:.68rem; line-height:1.32; }
  .book-stock-page .stock-grade-line .stock-division-badge { display:table; width:max-content; max-width:100%; margin:4px 0 0; padding:1px 5px; font-size:.67rem; }
  .book-stock-page .stock-table td:first-child small:not(.stock-grade-line) { font-size:.67rem; margin-top:3px; }
}
@media(max-width:350px) {
  .book-stock-page .stock-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .book-stock-page .stock-kpi:last-child { grid-column:1/-1; min-height:64px; }
  .book-stock-page .stock-table th:first-child,
  .book-stock-page .stock-table td:first-child { min-width:150px; width:150px; max-width:150px; }
}

/* BOOK-R2-A8: a single inline movements section below the stock table (not a dialog). */
.book-stock-page #stockMovementBox:empty { display:none; }
.book-stock-page #stockMovementBox { min-width:0; scroll-margin-block-start:24px; }
.book-stock-page .stock-movement-panel { border:1px solid #e1e5dc; border-radius:19px; overflow:hidden; background:#fff; box-shadow:0 7px 28px rgba(20,54,39,.065); outline:none; }
.book-stock-page .stock-movement-head { padding:17px 20px; display:flex; align-items:center; justify-content:space-between; gap:15px; background:linear-gradient(110deg,#1b382d,#335547); color:#fff; }
.book-stock-page .stock-movement-head small { display:block; color:#e1b962; font-size:.73rem; font-weight:800; margin-bottom:5px; }
.book-stock-page .stock-movement-head h2 { margin:0; font-size:1.06rem; line-height:1.5; color:#fff; }
.book-stock-page .stock-movement-head p { margin:5px 0 0; color:#dce9e1; font-size:.75rem; }
.book-stock-page .stock-movement-status { color:#263f33; background:#f5e7c6; border-radius:30px; padding:6px 11px; white-space:nowrap; font-size:.77rem; font-weight:800; }
.book-stock-page .stock-movement-list { display:block; padding:5px 18px; overflow-x:auto; overscroll-behavior-x:contain; }
.book-stock-page .stock-movement-row { display:grid; grid-template-columns:minmax(190px,1.4fr) minmax(175px,1fr) minmax(66px,.3fr) minmax(105px,.7fr); min-width:600px; align-items:center; gap:12px; padding:11px 3px; border-bottom:1px solid #e8ece8; }
.book-stock-page .stock-movement-row:last-child { border-bottom:0; }
.book-stock-page .stock-movement-info, .book-stock-page .stock-movement-quantities { display:contents; }
.book-stock-page .stock-movement-info strong { color:#19392c; font-size:.86rem; font-weight:800; white-space:nowrap; }
.book-stock-page .stock-movement-info time { color:#76867b; font-size:.77rem; white-space:nowrap; font-variant-numeric:tabular-nums; }
.book-stock-page .stock-movement-quantities b { display:inline-flex; width:max-content; align-items:center; justify-content:center; border-radius:7px; padding:3px 9px; background:#f3f5f1; font-size:.9rem; font-variant-numeric:tabular-nums; }
.book-stock-page .stock-movement-quantities b.is-positive { color:#16744e; background:#e8f5ed; }
.book-stock-page .stock-movement-quantities b.is-negative { color:#b63d36; background:#fbecea; }
.book-stock-page .stock-movement-quantities b.is-neutral { color:#647468; }
.book-stock-page .stock-movement-quantities span { color:#576b5e; font-size:.78rem; white-space:nowrap; font-variant-numeric:tabular-nums; }
.book-stock-page .stock-movement-empty, .book-stock-page .stock-movement-loading { padding:27px 18px; text-align:center; color:#6b796d; }
@media (max-width:700px) {
 .book-stock-page .stock-movement-head { padding:14px; align-items:start; }
 .book-stock-page .stock-movement-head h2 { font-size:.95rem; }
 .book-stock-page .stock-movement-list { padding:3px 11px; }
 .book-stock-page .stock-movement-row { padding:10px 0; gap:9px; }

}
