/* Inventory sandbox: shared styles for inventory.shtml, suppliers.shtml and movement.shtml */
html, body { margin: 0; padding: 0; }
body {
  background: #f2f2f4; color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
}
.inv-wrap { max-width: 1120px; margin: 0 auto; padding: 22px 20px 40px; }
.inv-wrap h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.inv-intro { margin: 0 0 18px; max-width: 46rem; font-size: 14.5px; line-height: 1.55; color: #6e6e73; }
.inv-foot { margin: 14px 2px 0; font-size: 12.5px; color: #86868b; }

/* ---------- top bar (same look as the portfolio nav) ---------- */
.inv-bar { background: #fff; border-bottom: 1px solid #e5e5e7; position: sticky; top: 0; z-index: 900; font-family: "Work Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
.inv-bar-in { max-width: 1120px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }
.inv-logo { display: flex; align-items: center; }
.inv-logo img { display: block; height: 64px; width: auto; }
.inv-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.inv-back { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; padding: 12px 22px; background: #9929fb; color: #fff; font-size: 15px; font-weight: 600; text-decoration: none; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: background .2s; }
.inv-back:hover { background: #8416e0; }
.inv-link { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; color: #111; font-size: 16px; font-weight: 500; text-decoration: none; border-radius: 4px; transition: color .2s; }
.inv-link:hover { color: #9929fb; }
.inv-link[aria-current="page"] { color: #9929fb; font-weight: 600; box-shadow: inset 0 -2px 0 #9929fb; }
.inv-back:focus-visible, .inv-link:focus-visible { outline: 2px solid #9929fb; outline-offset: 2px; }
.inv-ico { font-size: 16px; line-height: 1; }
@media (max-width: 760px) {
  .inv-bar-in { justify-content: center; }
  .inv-logo img { height: 48px; }
  .inv-nav { justify-content: center; }
  .inv-back { margin-right: 0; }
  .inv-link { padding: 10px 12px; font-size: 15px; }
}

/* ---------- the window ---------- */
.ea-app, .ea-modal-overlay {
  --ea-line: #e5e5e7; --ea-muted: #86868b; --ea-accent: #0071e3; --ea-danger: #d64545;
  --ea-bg: #ffffff; --ea-row-hover: #f5f6f8; --ea-row-selected: #eaf2fd; --ea-titlebar: #ececec;
}
.ea-app {
  background: var(--ea-bg); border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  overflow: hidden; display: flex; flex-direction: column; height: 72vh; min-height: 500px;
  animation: eaOpen .26s ease-out backwards;
}
@keyframes eaOpen { from { opacity: 0; transform: scale(.975) translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .ea-app { animation: none; } }
.ea-app *, .ea-modal-overlay * { box-sizing: border-box; }
.ea-titlebar { background: var(--ea-titlebar, #ececec); border-bottom: 1px solid var(--ea-line, #e5e5e7); padding: 10px 14px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; user-select: none; }
.ea-traffic { display: flex; gap: 8px; }
.ea-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.12); }
.ea-dot.red { background: #ff5f57; cursor: pointer; }
.ea-dot.yellow { background: #febc2e; }
.ea-dot.green { background: #28c840; }
.ea-titlebar-title { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: #4a4a4c; }
.ea-titlebar-title.ea-offset { margin-right: 52px; }
.ea-body { flex: 1; display: flex; min-height: 0; }

/* list panel */
.ea-list-panel { width: 44%; min-width: 320px; max-width: 540px; border-right: 1px solid var(--ea-line); display: flex; flex-direction: column; min-height: 0; }
.ea-search-bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--ea-line); flex-shrink: 0; }
.ea-search-bar input { flex: 1; min-width: 0; padding: 7px 12px; border: 1px solid var(--ea-line); background: #f5f5f7; border-radius: 7px; font-size: 13px; color: #1d1d1f; }
.ea-search-bar input:focus { outline: none; border-color: var(--ea-accent); background: #fff; }
.ea-list-scroll { flex: 1; overflow-y: auto; }
.ea-app table { width: 100%; border-collapse: collapse; margin: 0; table-layout: fixed; }
.ea-app th, .ea-app td { text-align: left; padding: 8px 14px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ea-app th.ea-num, .ea-app td.ea-num { text-align: right; }
.ea-list-scroll th { position: sticky; top: 0; background: var(--ea-bg); border-bottom: 1px solid var(--ea-line); font-weight: 600; color: var(--ea-muted); font-size: 11.5px; letter-spacing: 0.02em; cursor: pointer; user-select: none; }
.ea-list-scroll th:hover { color: #1d1d1f; }
.ea-list-scroll th .ea-arrow { margin-left: 4px; opacity: 0.5; font-size: 10px; }
.ea-list-scroll th.ea-active-sort .ea-arrow { opacity: 1; color: var(--ea-accent); }
.ea-list-scroll td { border-bottom: 1px solid #f2f2f2; }
.ea-list-scroll td.ea-low { color: var(--ea-danger); font-weight: 600; }
.ea-list-scroll tbody tr { cursor: pointer; }
.ea-list-scroll tbody tr:hover, .ea-list-scroll tbody tr:focus { outline: none; background: var(--ea-row-hover); }
.ea-list-scroll tbody tr.ea-selected { background: var(--ea-row-selected); }
.ea-empty-list { display: none; padding: 30px 20px; text-align: center; color: var(--ea-muted); font-size: 13px; }
.ea-list-footer { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--ea-line); font-size: 12px; color: var(--ea-muted); flex-shrink: 0; }
.cap { text-transform: capitalize; }

/* form panel */
.ea-form-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ea-form-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--ea-line); flex-shrink: 0; }
.ea-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(160deg, #6d84a3, #33465c); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; flex-shrink: 0; }
.ea-title { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--ea-muted); }
.ea-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ea-btn-create { background: #28c840 !important; border-color: #28c840 !important; color: #fff !important; font-weight: 600; }
.ea-btn-create:hover:not(:disabled) { background: #22b038 !important; }
.ea-form-scroll { flex: 1; overflow-y: auto; padding: 18px 22px; }
.ea-row { display: flex; gap: 14px; margin-bottom: 14px; }
.ea-field { flex: 1; min-width: 0; }
.ea-field label { display: block; font-size: 11px; font-weight: 600; color: var(--ea-muted); letter-spacing: 0.02em; margin-bottom: 5px; }
.ea-field input, .ea-field select, .ea-field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--ea-line); background: #f5f5f7; border-radius: 7px; font: inherit; font-size: 13.5px; color: #1d1d1f; }
.ea-field textarea { resize: vertical; min-height: 64px; }
.ea-field input:focus, .ea-field select:focus, .ea-field textarea:focus { outline: none; border-color: var(--ea-accent); background: #fff; }
.ea-field input[readonly], .ea-field input:disabled, .ea-field select:disabled, .ea-field textarea:disabled { background: #ececef; color: #6e6e73; cursor: default; }
.ea-hint { margin: 4px 0 0; font-size: 11.5px; color: var(--ea-muted); }
.ea-form-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--ea-line); flex-shrink: 0; }
.ea-app button, .ea-modal-overlay button { font: inherit; font-size: 13px; padding: 8px 16px; border: 1px solid var(--ea-line); background: #f5f5f7; border-radius: 7px; cursor: pointer; color: #1d1d1f; }
.ea-app button:hover:not(:disabled), .ea-modal-overlay button:hover:not(:disabled) { background: #ebebed; }
.ea-app button:disabled, .ea-modal-overlay button:disabled { opacity: 0.45; cursor: default; }
.ea-app button:focus-visible, .ea-modal-overlay button:focus-visible { outline: 2px solid var(--ea-accent); outline-offset: 2px; }
.ea-btn-primary { background: var(--ea-accent) !important; border-color: var(--ea-accent) !important; color: #fff !important; }
.ea-btn-primary:hover:not(:disabled) { background: #0077ed !important; }
.ea-btn-danger { color: var(--ea-danger) !important; border-color: #f0c4c4 !important; background: #fdf3f3 !important; }
.ea-btn-danger:hover:not(:disabled) { background: #fbe6e6 !important; }
.ea-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 20px; text-align: center; color: var(--ea-muted); font-size: 13.5px; }

/* toast (fixed, above the dialogs) */
.ea-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px); background: rgba(30,30,32,0.92); color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 1200; max-width: 90%; text-align: center; }
.ea-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ea-toast.error { background: rgba(150,30,30,0.94); }

/* dialogs */
.ea-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); align-items: center; justify-content: center; z-index: 1050; }
.ea-modal-overlay.open { display: flex; }
.ea-modal { width: min(380px, calc(100% - 40px)); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 30px 60px rgba(0,0,0,0.35), 0 8px 20px rgba(0,0,0,0.25); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif; }
.ea-modal.wide { width: min(580px, calc(100% - 40px)); }
.ea-modal-body { padding: 20px; font-size: 14px; line-height: 1.5; color: #1d1d1f; }
.ea-modal-body b { display: block; margin-bottom: 4px; }
.ea-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
#itBlockedModal { z-index: 1100; }
#itBlockedModal .ea-modal-body { text-align: center; padding: 24px 22px 10px; }
#itBlockedModal .ea-modal-body b { font-size: 16px; margin-bottom: 8px; }
#itBlockedModal .ea-cat { display: block; font-size: 38px; line-height: 1; margin-bottom: 10px; }
#itBlockedModal .ea-modal-footer { justify-content: center; }
.ea-error { min-height: 20px; margin: -4px 0 6px; font-size: 12.5px; color: #d64545; }

/* stock movement: tabs, status, lines */
.ea-tabs { display: flex; align-items: center; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--ea-line); flex-shrink: 0; }
.ea-app .ea-tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 11px 12px; font-weight: 600; color: var(--ea-muted); }
.ea-app .ea-tab:hover:not(:disabled) { background: none; color: #1d1d1f; }
.ea-app .ea-tab.active { color: var(--ea-accent); border-bottom-color: var(--ea-accent); }
.ea-tabs .ea-tabs-note { margin-left: auto; font-size: 12px; color: var(--ea-muted); }
.ea-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.ea-pill.active { background: #fff4d6; color: #8a6100; }
.ea-pill.posted { background: #dff6e3; color: #1c7a31; }
.ea-pill.canceled { background: #ececee; color: #6b6b70; }
.ea-lock { margin: 0 0 14px; padding: 9px 12px; border-radius: 8px; background: #eef7ef; color: #1c7a31; font-size: 12.5px; }
.ea-lines th, .ea-lines td { padding: 6px 6px; }
.ea-lines th { font-size: 11px; color: var(--ea-muted); font-weight: 600; text-align: left; border-bottom: 1px solid var(--ea-line); }
.ea-lines td { border-bottom: 1px solid #f2f2f2; }
.ea-lines select, .ea-lines input { width: 100%; padding: 6px 8px; border: 1px solid var(--ea-line); background: #f5f5f7; border-radius: 6px; font: inherit; font-size: 13px; }
.ea-lines input[type=number] { text-align: right; }
.ea-lines select:focus, .ea-lines input:focus { outline: none; border-color: var(--ea-accent); background: #fff; }
.ea-lines select:disabled, .ea-lines input:disabled { background: #ececef; color: #6e6e73; }
.ea-lines .ea-x { padding: 4px 8px; line-height: 1; }
.ea-lines-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; }
.ea-lines-foot b { font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .ea-app { height: auto; min-height: 0; }
  .ea-body { flex-direction: column; }
  .ea-list-panel { width: 100%; max-width: none; min-width: 0; border-right: none; border-bottom: 1px solid var(--ea-line); height: 340px; }
  .ea-form-panel { min-height: 360px; }
  .ea-row { flex-direction: column; gap: 10px; }
  .ea-hide-sm { display: none !important; }
}

/* ================= loading indicators ================= */
@keyframes invSlide { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes invSpin { to { transform: rotate(360deg); } }
.inv-loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity .2s; background: rgba(153, 41, 251, .15); }
.inv-loadbar.on { opacity: 1; }
.inv-loadbar::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: #9929fb; animation: invSlide 1.1s ease-in-out infinite; }
.inv-slow { position: fixed; left: 50%; bottom: 18px; z-index: 2000; transform: translate(-50%, 16px); max-width: calc(100% - 32px); padding: 9px 16px; background: #1d1d1f; color: #fff; font-size: 13px; border-radius: 99px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.inv-slow.on { opacity: .94; transform: translate(-50%, 0); }
.ea-form-panel { position: relative; }
.ea-form-panel.is-working::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .6); z-index: 5; }
.ea-form-panel.is-working::before { content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border: 3px solid #e0d4f7; border-top-color: #9929fb; border-radius: 50%; animation: invSpin .8s linear infinite; z-index: 6; }
.ea-empty-list.is-loading { display: block; }
.ea-empty-list.is-loading::before, .lg-msg.is-loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid #ddd0f5; border-top-color: #9929fb; border-radius: 50%; vertical-align: -2px; animation: invSpin .8s linear infinite; }
button.is-busy::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; vertical-align: -1px; opacity: .8; animation: invSpin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .inv-loadbar::before, .ea-form-panel.is-working::before, .ea-empty-list.is-loading::before, .lg-msg.is-loading::before, button.is-busy::before { animation-duration: 2.4s; }
}

/* ================= item ledger tab ================= */
.lg-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.lg-chip { display: flex; flex-direction: column; min-width: 110px; padding: 6px 12px; background: #f4f4f6; border: 1px solid var(--ea-line); border-radius: 8px; }
.lg-chip span { font-size: 11px; color: var(--ea-muted); }
.lg-chip b { font-size: 15px; }
.lg-match { font-size: 12.5px; font-weight: 600; }
.lg-match.ok { color: #1c7a31; }
.lg-match.warn { color: #b25e00; }
.lg-msg { padding: 18px 4px; font-size: 13px; color: var(--ea-muted); text-align: center; }
.lg-scroll { overflow-x: auto; }
.ea-ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ea-ledger th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ea-muted); padding: 6px 8px; border-bottom: 1px solid var(--ea-line); white-space: nowrap; }
.ea-ledger td { padding: 8px; border-bottom: 1px solid #f0f0f2; }
.ea-ledger th.ea-num, .ea-ledger td.ea-num { text-align: right; font-variant-numeric: tabular-nums; }
.ea-ledger td.lg-ref { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ea-ledger tr.lg-add td { color: #1c7a31; }
.ea-ledger tr.lg-deduct td { color: #c0392b; }

/* ================= supplier picker (items page; same look as the movement page) ================= */
.mv-pick { display: flex; gap: 6px; align-items: center; }
.mv-pick input { flex: 1; min-width: 0; }
.mv-pick button { padding: 7px 10px !important; }
.mv-search { width: 100%; padding: 8px 12px; border: 1px solid #e5e5e7; background: #f5f5f7; border-radius: 7px; font: inherit; font-size: 13.5px; }
.mv-search:focus { outline: none; border-color: #0071e3; background: #fff; }
.mv-pickbox { max-height: 320px; overflow: auto; border: 1px solid #e5e5e7; border-radius: 8px; margin-top: 10px; }
.mv-pickbox table { width: 100%; border-collapse: collapse; }
.mv-pickbox th, .mv-pickbox td { padding: 8px 12px; font-size: 13px; text-align: left; border-bottom: 1px solid #f2f2f2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.mv-pickbox th { position: sticky; top: 0; background: #fff; font-size: 11.5px; color: #86868b; }
.mv-pickbox tbody tr { cursor: pointer; }
.mv-pickbox tbody tr:hover { background: #f5f6f8; }
.mv-pickbox tbody tr.sel { background: #eaf2fd; }
.mv-pickempty { display: none; padding: 26px 16px; text-align: center; color: #86868b; font-size: 13px; }
.mv-note { margin: 10px 2px 0; font-size: 12px; color: #86868b; }
#itSupplierModal { z-index: 1050; }

/* ================= tabs that look like tabs ================= */
.ea-tabs { background: #f5f5f7; padding: 8px 20px 0; gap: 6px; }
.ea-app .ea-tab { border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 10px 18px; font-size: 14px; font-weight: 600; color: #4a4a4c; background: #ececef; position: relative; top: 1px; }
.ea-app .ea-tab:hover:not(:disabled) { background: #e2e2e7; color: #1d1d1f; }
.ea-app .ea-tab.active { background: #fff; color: var(--ea-accent); border-color: var(--ea-line); border-bottom: 1px solid #fff; box-shadow: inset 0 3px 0 var(--ea-accent); }
