/* ================================================================
   BIMAS — dashboard design system from the approved mockups
   ----------------------------------------------------------------
   SCOPE: main content area only. Everything here lives under .bmv3,
   which is applied to markup rendered into #app-content. The sidebar,
   topbar and every other existing screen are untouched — this cannot
   leak into them, and none of the project's other stylesheets are
   modified.

   A screen opts in by rendering inside <div class="bmv3">.
   ================================================================ */

.bmv3 {
  /* Brand */
  --bmv3-blue:      #1d4ed8;
  --bmv3-blue-600:  #2563eb;
  --bmv3-blue-50:   #eff6ff;
  --bmv3-blue-100:  #dbeafe;

  /* Surfaces */
  --bmv3-bg:        #f4f7fb;
  --bmv3-surface:   #ffffff;
  --bmv3-line:      #dbe3ee;
  --bmv3-line-soft: #eaeff6;

  /* Text */
  --bmv3-ink:       #0f2250;
  --bmv3-ink-2:     #475569;
  --bmv3-ink-3:     #7b8794;

  /* Stock status, as used on the approved screens */
  --bmv3-red:       #dc2626;
  --bmv3-red-bg:    #fdeaea;
  --bmv3-red-row:   #fdf1f1;
  --bmv3-amber-txt: #a16207;
  --bmv3-amber-bg:  #fdf3d4;
  --bmv3-amber-row: #fffbeb;
  --bmv3-green:     #15803d;
  --bmv3-green-bg:  #dcf5e4;

  --bmv3-r:         12px;
  --bmv3-r-sm:      8px;
  --bmv3-shadow:    0 1px 2px rgba(15,34,80,.06), 0 1px 3px rgba(15,34,80,.04);

  color: var(--bmv3-ink);
  font-feature-settings: "tnum" 1;
}

/* ── page header ──────────────────────────────────────────────── */

.bmv3-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.bmv3-head h1 {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em;
  text-transform: uppercase; color: var(--bmv3-ink); margin: 0; line-height: 1.15;
}
.bmv3-head p { margin: .3rem 0 0; font-size: .875rem; color: var(--bmv3-ink-2); }
.bmv3-head__tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.bmv3-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 42px; padding: 0 .85rem;
  background: var(--bmv3-surface); border: 1px solid var(--bmv3-line);
  border-radius: var(--bmv3-r-sm);
  font-size: .8125rem; font-weight: 600; color: var(--bmv3-ink);
  box-shadow: var(--bmv3-shadow);
}
.bmv3-pill .material-symbols-outlined { font-size: 1.125rem; color: var(--bmv3-ink-3); }
.bmv3-pill select, .bmv3-pill input {
  border: 0; background: transparent; font: inherit; color: inherit;
  outline: none; cursor: pointer;
}

.bmv3-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 42px; padding: 0 1.05rem;
  border-radius: var(--bmv3-r-sm); border: 1px solid transparent;
  font-size: .8125rem; font-weight: 700; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.bmv3-btn .material-symbols-outlined { font-size: 1.125rem; }
.bmv3-btn--primary { background: var(--bmv3-blue); color: #fff; }
.bmv3-btn--primary:hover { background: #1a43bd; }
.bmv3-btn--ghost { background: var(--bmv3-surface); border-color: var(--bmv3-line); color: var(--bmv3-ink); }
.bmv3-btn--ghost:hover { background: var(--bmv3-blue-50); }
.bmv3-btn--success { background: var(--bmv3-green-bg); color: var(--bmv3-green); border-color: #a9e0bd; }
.bmv3-btn--danger  { background: var(--bmv3-red-bg);   color: var(--bmv3-red);   border-color: #f3bcbc; }
.bmv3-btn--sm { height: 32px; padding: 0 .65rem; font-size: .75rem; }

/* ── KPI tiles ────────────────────────────────────────────────── */

.bmv3-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .9rem; margin-bottom: 1.25rem;
}
.bmv3-kpi {
  display: flex; align-items: center; gap: .85rem;
  background: var(--bmv3-surface); border: 1px solid var(--bmv3-line);
  border-radius: var(--bmv3-r); padding: 1rem 1.1rem; box-shadow: var(--bmv3-shadow);
}
.bmv3-kpi__icon {
  width: 46px; height: 46px; flex: 0 0 46px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 11px;
}
.bmv3-kpi__icon .material-symbols-outlined { font-size: 1.5rem; }
.bmv3-kpi__label { font-size: .75rem; font-weight: 700; color: var(--bmv3-ink-2); line-height: 1.2; }
.bmv3-kpi__value { font-size: 1.6rem; font-weight: 800; color: var(--bmv3-ink); line-height: 1.15; margin-top: .1rem; }
.bmv3-kpi__sub   { font-size: .6875rem; color: var(--bmv3-ink-3); margin-top: .15rem; }

.bmv3-tint-blue   { background: #e3edfd; color: var(--bmv3-blue); }
.bmv3-tint-red    { background: var(--bmv3-red-bg); color: var(--bmv3-red); }
.bmv3-tint-amber  { background: var(--bmv3-amber-bg); color: var(--bmv3-amber-txt); }
.bmv3-tint-green  { background: var(--bmv3-green-bg); color: var(--bmv3-green); }
.bmv3-tint-violet { background: #ece7fd; color: #6d28d9; }
.bmv3-tint-slate  { background: #e8edf5; color: var(--bmv3-ink-2); }

/* ── cards ────────────────────────────────────────────────────── */

.bmv3-card {
  background: var(--bmv3-surface); border: 1px solid var(--bmv3-line);
  border-radius: var(--bmv3-r); box-shadow: var(--bmv3-shadow);
  overflow: hidden; margin-bottom: 1.25rem;
}
.bmv3-card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--bmv3-line-soft);
}
.bmv3-card__title {
  font-size: 1rem; font-weight: 800; color: var(--bmv3-blue);
  margin: 0; display: flex; align-items: center; gap: .45rem;
}
.bmv3-card__body { padding: 1.1rem; }

/* ── filters ──────────────────────────────────────────────────── */

.bmv3-field {
  display: inline-flex; align-items: center; gap: .45rem;
  height: 38px; padding: 0 .7rem; min-width: 12rem;
  background: var(--bmv3-surface); border: 1px solid var(--bmv3-line);
  border-radius: var(--bmv3-r-sm);
}
.bmv3-field .material-symbols-outlined { font-size: 1.05rem; color: var(--bmv3-ink-3); }
.bmv3-field input, .bmv3-field select {
  border: 0; outline: none; background: transparent;
  font: inherit; font-size: .8125rem; color: var(--bmv3-ink); width: 100%;
}
.bmv3-field input::placeholder { color: var(--bmv3-ink-3); }

.bmv3-legend { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-left: auto; }
.bmv3-legend span {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .6875rem; font-weight: 600; color: var(--bmv3-ink-2);
}
.bmv3-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ── tables ───────────────────────────────────────────────────── */

.bmv3-tablewrap { overflow-x: auto; }
.bmv3-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.bmv3-table thead th {
  background: var(--bmv3-blue-50); color: var(--bmv3-ink);
  font-weight: 700; text-align: left; padding: .7rem .8rem;
  white-space: nowrap; border-bottom: 1px solid var(--bmv3-line);
}
.bmv3-table tbody td {
  padding: .65rem .8rem; border-bottom: 1px solid var(--bmv3-line-soft);
  color: var(--bmv3-ink); vertical-align: middle;
}
.bmv3-table tbody tr:last-child td { border-bottom: 0; }
.bmv3-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* An item code must never wrap — it is an identifier, and ADH-GLUE-0001
   broken over three lines is unreadable and uncopyable. */
.bmv3-table .code, .bmv3-table tbody td:first-child { white-space: nowrap; }
.bmv3-table .mid { text-align: center; }
.bmv3-table a, .bmv3-link { color: var(--bmv3-blue); text-decoration: none; font-weight: 600; }
.bmv3-table a:hover, .bmv3-link:hover { text-decoration: underline; }

.bmv3-table tbody tr.is-below  { background: var(--bmv3-red-row); }
.bmv3-table tbody tr.is-near   { background: var(--bmv3-amber-row); }
.bmv3-table tbody tr:hover     { background: #f7faff; }
.bmv3-table tbody tr.is-below:hover { background: #fce9e9; }
.bmv3-table tbody tr.is-near:hover  { background: #fff6da; }
.bmv3-table td.qty-below { color: var(--bmv3-red); font-weight: 700; }
.bmv3-table td.qty-near  { color: var(--bmv3-amber-txt); font-weight: 700; }

/* ── pills ────────────────────────────────────────────────────── */

.bmv3-pill-tag {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .3rem .75rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.bmv3-pill-tag.below   { background: var(--bmv3-red-bg);   color: var(--bmv3-red); }
.bmv3-pill-tag.near    { background: var(--bmv3-amber-bg); color: var(--bmv3-amber-txt); }
.bmv3-pill-tag.normal  { background: var(--bmv3-green-bg); color: var(--bmv3-green); }
.bmv3-pill-tag.info    { background: var(--bmv3-blue-100); color: var(--bmv3-blue); }
.bmv3-pill-tag.neutral { background: #e8edf5; color: var(--bmv3-ink-2); }
.bmv3-pill-tag.t-receipt { background: var(--bmv3-green-bg); color: var(--bmv3-green); }
.bmv3-pill-tag.t-issue   { background: var(--bmv3-blue-100); color: var(--bmv3-blue); }
.bmv3-pill-tag.t-adjust  { background: #fde8cf; color: #b45309; }

.bmv3-qty-in  { color: var(--bmv3-green); font-weight: 700; }
.bmv3-qty-out { color: var(--bmv3-red);   font-weight: 700; }

/* ── pagination ───────────────────────────────────────────────── */

.bmv3-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding: .85rem 1.1rem;
  border-top: 1px solid var(--bmv3-line-soft);
  font-size: .8125rem; color: var(--bmv3-ink-2);
}
.bmv3-pager__pages { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.bmv3-pager__pages button {
  min-width: 34px; height: 34px; padding: 0 .5rem;
  border: 1px solid var(--bmv3-line); background: var(--bmv3-surface);
  border-radius: var(--bmv3-r-sm); font-size: .8125rem; font-weight: 600;
  color: var(--bmv3-ink); cursor: pointer;
}
.bmv3-pager__pages button:hover:not(:disabled) { background: var(--bmv3-blue-50); }
.bmv3-pager__pages button[aria-current="page"] {
  background: var(--bmv3-blue); border-color: var(--bmv3-blue); color: #fff;
}
.bmv3-pager__pages button:disabled { opacity: .45; cursor: not-allowed; }

/* ── information panel ────────────────────────────────────────── */

.bmv3-note {
  display: flex; align-items: flex-start; gap: .85rem;
  background: var(--bmv3-blue-50); border: 1px solid #cfe0f7;
  border-radius: var(--bmv3-r); padding: 1rem 1.15rem;
}
.bmv3-note__icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bmv3-blue); color: #fff;
}
.bmv3-note h3 { margin: 0 0 .25rem; font-size: .9375rem; font-weight: 800; color: var(--bmv3-blue); }
.bmv3-note p  { margin: 0; font-size: .8125rem; color: var(--bmv3-ink-2); line-height: 1.55; }

.bmv3-notes-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .9rem; }
.bmv3-notes-row .bmv3-note { background: var(--bmv3-surface); border-color: var(--bmv3-line); }
.bmv3-notes-row .bmv3-note h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── tabs ─────────────────────────────────────────────────────── */

.bmv3-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.bmv3-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 40px; padding: 0 1rem;
  border: 1px solid var(--bmv3-line); background: var(--bmv3-surface);
  border-radius: var(--bmv3-r-sm);
  font-size: .8125rem; font-weight: 700; color: var(--bmv3-ink-2); cursor: pointer;
}
.bmv3-tab:hover { background: var(--bmv3-blue-50); }
.bmv3-tab[aria-selected="true"] { background: var(--bmv3-blue); border-color: var(--bmv3-blue); color: #fff; }
.bmv3-tab__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 .3rem; border-radius: 999px;
  background: rgba(255,255,255,.22); font-size: .6875rem;
}
.bmv3-tab:not([aria-selected="true"]) .bmv3-tab__count { background: var(--bmv3-blue-100); color: var(--bmv3-blue); }

/* ── misc ─────────────────────────────────────────────────────── */

.bmv3-crumb { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--bmv3-ink-3); margin-bottom: .2rem; }
.bmv3-crumb a { color: var(--bmv3-blue); text-decoration: none; font-weight: 600; }

.bmv3-empty { padding: 3rem 1.5rem; text-align: center; color: var(--bmv3-ink-3); }
.bmv3-empty .material-symbols-outlined { font-size: 2.5rem; opacity: .35; }
.bmv3-empty p { margin: .65rem 0 0; font-size: .875rem; }

.bmv3-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }

/* A wide working list beside a narrower basket or detail panel. Collapses
   to one column below 1100px so the basket never becomes unusably narrow. */
.bmv3-split { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.bmv3-split > * { min-width: 0; }
@media (max-width: 1100px) { .bmv3-split { grid-template-columns: 1fr; } }
.bmv3-label  { display: block; font-size: .75rem; font-weight: 700; color: var(--bmv3-ink-2); margin-bottom: .3rem; }
.bmv3-label .req { color: var(--bmv3-red); }
.bmv3-input {
  width: 100%; height: 40px; padding: 0 .7rem;
  border: 1px solid var(--bmv3-line); border-radius: var(--bmv3-r-sm);
  background: var(--bmv3-surface); font: inherit; font-size: .8125rem;
  color: var(--bmv3-ink); outline: none;
}
.bmv3-input:focus { border-color: var(--bmv3-blue); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
textarea.bmv3-input { height: auto; padding: .55rem .7rem; resize: vertical; }
.bmv3-hint { font-size: .6875rem; color: var(--bmv3-ink-3); margin-top: .25rem; }

@media (max-width: 860px) {
  .bmv3-head h1 { font-size: 1.25rem; }
  .bmv3-head__tools { width: 100%; }
  .bmv3-kpi__value { font-size: 1.35rem; }
  .bmv3-legend { margin-left: 0; width: 100%; }
}

/* The app carries a dark theme; keep these screens legible under it rather
   than forcing a white card onto a dark page. */
:root[data-theme="dark"] .bmv3 {
  --bmv3-surface:   #131c33;
  --bmv3-line:      #24304d;
  --bmv3-line-soft: #1c2740;
  --bmv3-ink:       #e6edf8;
  --bmv3-ink-2:     #a6b3c9;
  --bmv3-ink-3:     #7d8aa3;
  --bmv3-blue-50:   #17233f;
  --bmv3-blue-100:  #1d2d50;
  --bmv3-red-row:   #2a1618;
  --bmv3-amber-row: #2a2213;
  --bmv3-red-bg:    #3a1b1e;
  --bmv3-amber-bg:  #3a2e13;
  --bmv3-green-bg:  #14301f;
}
:root[data-theme="dark"] .bmv3-table tbody tr:hover { background: #18233d; }

@media (prefers-reduced-motion: reduce) { .bmv3 * { transition: none !important; } }
