/* Reasontra — Stock (assets/stock.js). Everything here starts with .st-, so the rest of the app is not touched.
   Phones first; wider screens get the full tables. */

/* ---------- header and tabs ---------- */
.st-ph .ph-tools .st-more-btn .chev { width: 14px; height: 14px; margin-left: -2px; }
.st-tabs { margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.st-tabs::-webkit-scrollbar { display: none; }
.st-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 0 auto; }
.st-n { font-style: normal; font-size: .72rem; font-weight: 700; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.st-tabs button[aria-pressed="true"] .st-n { background: var(--brand-50); color: var(--brand-600); }
@media (max-width: 767px) {
  .st-tabs { margin: 0 -14px 14px; border-radius: 0; border-left: 0; border-right: 0; }
  .st-tabs button { flex: 0 0 auto; }
  .st-ph .ph-tools { width: 100%; }
  .st-ph .ph-tools .btn { flex: 1; }
}

/* ---------- first visit ---------- */
.st-first .card-body { padding: 28px 24px; max-width: 640px; }
.st-first-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 0 0 14px; }
.st-first-ico svg { width: 26px; height: 26px; }
.st-first h2 { margin: 0 0 6px; font-size: 1.2rem; }
.st-first > .card-body > p { margin: 0 0 16px; }
.st-steps { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
.st-steps li { counter-increment: st; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; }
.st-steps li::before { content: counter(st); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--text-2); }
.st-steps b { font-weight: 650; }
.st-steps span { color: var(--muted); font-size: .9rem; }

/* ---------- summary ---------- */
.st-kpis .kpi-ico svg { width: 17px; height: 17px; }
.st-alerts { margin: 0 0 16px; }
.st-alert { align-items: flex-start; }
.st-alert .t { white-space: normal; font-size: .9rem; color: var(--text-2); line-height: 1.45; }
.st-alert .t b { display: inline; white-space: normal; color: var(--text); }
.st-alert .kpi-ico { background: var(--brand-50); color: var(--brand); }
.st-alert.warn .kpi-ico { background: var(--warn-bg); color: var(--warn); }
.st-alert .btn { flex: none; }
.st-pname { display: grid; min-width: 0; }
.st-pname b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.st-pname small, .st-sub { display: block; color: var(--muted); font-size: .78rem; font-weight: 500; }
.st-tbl td.c-main b { font-weight: 650; }
.st-tbl .st-status { white-space: nowrap; }
.st-tbl .st-status .badge + .badge { margin-left: 2px; }
.st-arch td { opacity: .6; }
.st-neg { color: var(--warn); font-weight: 700; }
.st-neg-soft { color: var(--text-2); }
.st-zero { color: var(--muted); }
.st-low { color: var(--brand-600); font-weight: 650; }
.st-foot { margin: 10px 4px 0; }
.st-items { font-size: .85rem; color: var(--text-2); line-height: 1.5; }
.st-linked { display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--muted); font-size: .74rem; font-weight: 500; margin-top: 2px; }
.st-linked svg { width: 12px; height: 12px; }
.st-other-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0 0 14px; }
.st-other-btns svg { width: 16px; height: 16px; }
.empty .st-other-btns { margin: 6px 0 0; }
@media (min-width: 768px) {
  .st-prod-tbl .st-ponly { display: none; }
  .st-other-btns { justify-content: flex-end; }
}
@media (max-width: 767px) {
  .st-tbl .st-linked { justify-content: flex-start; display: inline-flex; margin: 0 0 0 6px; }
  .st-prod-tbl td.c-amt small { color: var(--muted); font-weight: 500; }
  .st-tbl.stack td.st-status { grid-column: 1 / -1; padding-top: 6px; white-space: normal; }
  .st-tbl.stack td.st-items { white-space: normal; }
}

/* loading placeholder while a list is fetched */
.st-loading { height: 160px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: st-shim 1.2s linear infinite; border: 1px solid var(--line-2); }
.st-loading.sm { height: 60px; margin: 8px; }
@keyframes st-shim { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .st-loading { animation: none; } }

/* ---------- "Add to stock" menu ---------- */
.st-menu { margin: 0 -20px; border-top: 1px solid var(--line-2); }
.st-menu-row { width: 100%; border: 0; border-bottom: 1px solid var(--line-2); background: none; text-align: left; color: inherit; font: inherit; }
.st-menu-row .kpi-ico svg { width: 17px; height: 17px; }
.st-menu-row > svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- forms ---------- */
.st-intro { margin: -6px 0 14px; line-height: 1.45; }
.st-mseg { margin: 0; }
.st-mseg button { flex: 1 1 0; }
.st-line { display: grid; grid-template-columns: minmax(0, 1fr) 96px 36px; gap: 8px; align-items: center; margin: 0 0 8px; }
.st-line .field { margin: 0; }
.st-line .icon-btn { width: 36px; height: 42px; }
.st-addline { margin-top: 2px; }

/* a cost made of this book's records plus another amount */
.st-cost { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 12px 0; margin: 0 0 14px; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.st-cost-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.st-cost-head > span { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.st-cost-head .btn svg { width: 15px; height: 15px; }
.st-cost-none { margin: 0 0 10px; }
.st-chosen { display: grid; gap: 6px; margin: 0 0 12px; }
.st-chosen-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2); }
.st-chosen-row .t { flex: 1; min-width: 0; display: grid; }
.st-chosen-row .t b { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-chosen-row .t small { color: var(--muted); font-size: .76rem; }
.st-chosen-row > b { font-size: .9rem; white-space: nowrap; }
.st-chosen-row .icon-btn { width: 30px; height: 30px; }
.st-picker { margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.st-pick-search { position: relative; border-bottom: 1px solid var(--line-2); }
.st-pick-search > span svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.st-pick-search input { width: 100%; min-height: 40px; border: 0; padding: 8px 10px 8px 34px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; }
.st-pick-search input:focus { outline: none; background: var(--surface-2); }
.st-pick-list { max-height: 260px; overflow: auto; overscroll-behavior: contain; }
.st-pick-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.st-pick-row:last-child { border-bottom: 0; }
.st-pick-row:hover { background: var(--surface-2); }
.st-pick-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.st-pick-row .t { flex: 1; min-width: 0; display: grid; }
.st-pick-row .t b { font-weight: 600; font-size: .86rem; overflow-wrap: anywhere; }
.st-pick-row .t small { color: var(--muted); font-size: .75rem; }
.st-pick-row .t small.st-used { color: var(--debt); font-weight: 600; }
.st-pick-amt { font-size: .88rem; white-space: nowrap; }
.st-cost-total b { display: flex; align-items: center; min-height: 42px; font-size: 1.05rem; }
.st-cost-total small { margin-top: -4px; }

/* received by Amazon */
.st-recv { display: grid; gap: 8px; margin: 0 0 14px; }
.st-recv-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.st-recv-row .t { display: grid; min-width: 0; }
.st-recv-row .t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-recv-row .t small { color: var(--muted); font-size: .78rem; }
.st-recv-row input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); text-align: right; font: inherit; }
.st-recv-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.sheet .banner .link { background: none; border: 0; padding: 0; color: var(--brand-600); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- one product ---------- */
.st-places { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.st-place { display: grid; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.st-place span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.st-place b { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.st-place small { font-size: .74rem; color: var(--muted); }
.st-facts { display: grid; gap: 0; margin: 0 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.st-facts > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); font-size: .88rem; }
.st-facts > div:last-child { border-bottom: 0; }
.st-facts span { color: var(--muted); }
.st-facts small { color: var(--muted); font-weight: 500; }
.st-costs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.st-costs > div { display: grid; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.st-costs span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.st-costs b { font-size: 1.05rem; overflow-wrap: anywhere; }
.st-costs small { font-size: .72rem; color: var(--muted); }
.st-costs .st-landed { background: var(--brand-50); }
.st-costs .st-landed b { color: var(--brand-600); }
.st-qbtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.st-qbtns .btn svg { width: 15px; height: 15px; }
.st-h3 { font-size: .95rem; margin: 0 0 8px; }
.st-hist { border-top: 1px solid var(--line-2); }
.st-hrow { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: .86rem; }
.st-hd { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.st-hrow .t { min-width: 0; color: var(--text-2); }
.st-hrow .t small { display: block; color: var(--muted); font-size: .76rem; }
.st-hrow .badge { margin-left: 4px; }
.st-hrow > b { white-space: nowrap; }

/* ---------- "Units for Stock" on an expense record (Add record sheet, assets/app.js) ---------- */
.st-qa-lbl { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.st-qa-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.st-qa-row .field { margin: 0; }
.st-qa-hint { display: block; color: var(--muted); font-size: .78rem; margin-top: 6px; line-height: 1.4; }
