/* ===== INWARD / OUTWARD (Gate Pass) ===== */
.io-head-search { width: 300px; }
.io-table tbody tr.io-row { cursor: pointer; }
.io-table tbody tr.io-sel td { background: #eef3fb; }
.io-docno { font-family: monospace; font-weight: 700; color: var(--navy2); }
.io-party { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.io-items { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.io-more { color: var(--muted); font-size: 0.78rem; }
.io-qty { font-family: monospace; }
.io-pend { color: var(--muted); font-size: 0.78rem; }
.io-val { text-align: right; font-family: monospace; }
.io-total { text-align: right; font-size: 0.86rem; color: var(--muted); margin-top: 8px; }
.io-total b { color: var(--text); font-family: monospace; font-size: 0.95rem; margin-left: 6px; }
.io-empty { text-align: center; color: var(--muted); padding: 36px 10px !important; }
.io-hint { font-size: 0.75rem; color: var(--muted); margin: 8px 4px 0; }
.io-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.io-b-open { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
.io-b-partial { background: rgba(212, 150, 10, 0.14); color: #a16207; }
.io-b-overdue { background: rgba(185, 28, 28, 0.1); color: var(--red); }
.io-b-closed { background: rgba(10, 107, 58, 0.1); color: var(--green); }

/* right-click menu */
.io-ctx { position: fixed; z-index: 10050; min-width: 230px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 37, 64, 0.18); padding: 6px; }
.io-ctx-head { font-family: monospace; font-size: 0.75rem; color: var(--muted); padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.io-ctx button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 7px; font-family: inherit; font-size: 0.84rem; color: var(--text); cursor: pointer; }
.io-ctx button i { width: 14px; color: var(--muted); }
.io-ctx button:hover:not(:disabled) { background: var(--surface2); }
.io-ctx button.io-ctx-strong { font-weight: 700; }
.io-ctx button:disabled { opacity: 0.45; cursor: not-allowed; }

/* modal — navbar ke neeche, header/footer fixed, beech ka hissa scroll */
.io-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(8, 18, 35, 0.55); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 70px 16px 14px; }
.io-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 760px; max-height: calc(100vh - 84px); display: flex; flex-direction: column; box-shadow: var(--shadow2); animation: fadeIn 0.2s ease-out; }
.io-box.io-wide { max-width: 980px; }
.io-mhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.io-mtitle { font-family: 'Rajdhani', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--navy2); }
.io-msub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.io-mbody { padding: 14px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.io-mfoot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.io-btn { padding: 8px 18px; border-radius: 8px; border: none; font-family: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.io-btn:disabled { opacity: 0.6; cursor: wait; }
.io-btn-save { order: 2; min-width: 130px; color: #fff; background: linear-gradient(135deg, var(--green), var(--green2)); }
.io-btn-primary { color: #fff; background: var(--navy2); }
.io-btn-ghost { background: var(--surface2); color: var(--muted); }
.io-mfoot .io-btn-save + .io-btn-ghost { order: 1; border: 1px solid var(--border); }

.io-form, .io-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.io-form .form-label { margin-bottom: 4px; }
.io-form .form-input { height: 38px; }
.io-span2 { grid-column: span 2; }
.io-span3 { grid-column: span 3; }
.io-req { color: var(--red); }
.io-k { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.io-v { font-size: 0.86rem; color: var(--text); font-weight: 600; word-break: break-word; }
.io-grid .io-span3 { grid-column: span 4; }
.io-mono { font-family: monospace; }

.io-tbl-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.io-tbl { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.io-tbl thead th { position: sticky; top: 0; background: var(--navy); color: #fff; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; padding: 8px 10px; text-align: center; white-space: nowrap; }
.io-tbl tbody td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.io-tbl tbody tr:last-child td { border-bottom: none; }
.io-cell { height: 34px; padding: 4px 8px !important; }
.io-sec { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; color: var(--navy2); margin: 14px 0 6px; }
.io-kids { display: flex; flex-direction: column; gap: 6px; }
.io-kid { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 0.82rem; padding: 7px 10px; background: var(--surface2); border-radius: 8px; }
.io-none { font-size: 0.82rem; color: var(--muted); }
.io-cond { color: var(--red); }
.io-link { background: none; border: none; padding: 0; color: var(--blue2); font-family: monospace; font-weight: 700; font-size: 0.84rem; cursor: pointer; text-decoration: underline; }

/* item grid — PO jaisa */
.io-grid-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.io-grid-tbl { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.io-grid-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--navy); color: #fff; font-size: 0.64rem; font-weight: 700; letter-spacing: .5px; padding: 8px 10px; text-align: center; white-space: nowrap; }
.io-grid-tbl .grid-rownum { width: 34px; text-align: center; font-size: 0.72rem; color: var(--muted); background: #f7f9fc; cursor: context-menu; user-select: none; border-right: 1px solid #e6eaf0; border-bottom: 1px solid #e6eaf0; }
.io-gc { padding: 0; border-right: 1px solid #e6eaf0; border-bottom: 1px solid #e6eaf0; }
.io-gi { width: 100%; height: 32px !important; border: none !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; font-size: 0.8rem; font-family: inherit; outline: none; padding: 0 10px !important; color: var(--text); }
.io-gi:focus { background: #f5f8ff !important; }
.io-gi::-webkit-outer-spin-button, .io-gi::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.io-gi[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.io-gi-sku { font-family: monospace; font-size: 0.76rem; font-weight: 700; }
.io-gs { padding: 0 10px; border-right: 1px solid #e6eaf0; border-bottom: 1px solid #e6eaf0; color: var(--muted); font-size: 0.8rem; }
.io-grid-tbl tr.io-gerr .io-gc { background: #fff1f1; }

@media (max-width: 768px) {
  #view-inward .ims-dash-head .page-header, #view-outward .ims-dash-head .page-header { flex-direction: column !important; align-items: stretch !important; }
  .io-head .po-head-tools { flex-wrap: wrap; }
  .io-head .io-head-search { order: -1; flex: 1 1 100%; width: auto; }
  .io-head .po-head-select { flex: 1; width: auto !important; }
  .io-hint { display: none; }
  /* list → cards */
  #view-inward .overflow-x-auto, #view-outward .overflow-x-auto { overflow: visible !important; }
  .io-table, .io-table tbody { display: block; width: 100%; }
  .io-table thead { display: none; }
  .io-table tbody tr.io-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: normal; }
  .io-table tbody tr.io-row td { padding: 0 !important; border: none !important; font-size: 0.78rem; }
  .io-table td[data-label="Doc No"] { order: 1; font-size: 0.82rem !important; }
  .io-table td[data-label="Status"] { order: 2; margin-left: auto; }
  .io-table td[data-label="Party"] { order: 3; flex-basis: 100%; max-width: none; font-weight: 700; font-size: 0.84rem !important; }
  .io-table td[data-label="Items"] { order: 4; flex-basis: 100%; max-width: none; color: var(--muted); }
  .io-table td[data-label="Date"] { order: 5; }
  .io-table td[data-label="Type"] { order: 6; }
  .io-table td[data-label="Qty"] { order: 7; margin-left: auto; }
  .io-table td[data-label="Value"] { order: 8; }
  .io-table td[data-label="Purpose"], .io-table td[data-label="Against"], .io-table td[data-label="Return By"] { display: none; }
  /* modal */
  .io-overlay { padding: 66px 8px calc(74px + env(safe-area-inset-bottom, 0px)); }
  .io-box { max-height: calc(100vh - 140px); }
  .io-form, .io-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .io-span3, .io-grid .io-span3 { grid-column: span 2; }
  .io-mbody { padding: 12px 14px; }
  .io-grid-tbl { min-width: 760px; }
  .io-mfoot { padding: 10px 14px; }
}