/**
 * HQ batch transactions, drafts, stock-out modals (legacy-ui screens).
 * Loaded after app.css — see docs/TABLER-MIGRATION.md Phase 6.
 */

.hq-batch-card {
  max-width: 820px;
}
.hq-batch-card-stock-out-po {
  max-width: min(100%, 1280px);
}
.hq-batch-card-in-split {
  max-width: none;
}
.hq-stock-out-split {
  display: grid;
  grid-template-columns: minmax(0, 820px) minmax(280px, 1fr);
  gap: 1.25rem;
  align-items: start;
  max-width: 1400px;
}
.hq-stock-out-main,
.hq-po-reference {
  align-self: start;
  min-width: 0;
}
.hq-stock-out-main > .card,
.hq-po-reference-shell {
  margin-top: 0;
}
.hq-po-reference-shell {
  position: sticky;
  top: 0;
}
.hq-po-reference-head {
  margin-bottom: 1rem;
}
.hq-po-reference-head .hq-muted {
  margin-bottom: 0.35rem;
}
.hq-po-reference-back {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}
.hq-po-reference-table .col-name {
  max-width: 160px;
}
.hq-batch-section-po-ref .hq-po-reference-table .col-name {
  max-width: 280px;
}
.hq-batch-card-stock-out-po .data-table .col-name {
  max-width: 280px;
}
.hq-batch-section-po-ref .hq-po-reference-table-wrap {
  margin-top: 0;
}
.hq-po-given-qty {
  width: 4.5rem;
  max-width: 100%;
  text-align: right;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
}
.hq-po-given-cell {
  white-space: nowrap;
}
.hq-po-given-cell .hq-po-given-label {
  display: inline-block;
  min-width: 5rem;
  margin-right: 0.35rem;
  text-align: right;
}
.hq-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(23, 43, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.hq-modal-backdrop.hidden {
  display: none !important;
}
.hq-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  max-width: 420px;
  width: 100%;
  padding: 1.25rem 1.35rem 1.35rem;
}
.hq-modal.hq-modal-po-given {
  max-width: 600px;
  padding: 1.5rem 1.75rem 1.35rem;
  border-radius: 12px;
}
.hq-modal-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: #172b4a;
}
.hq-modal-po-given .hq-modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}
.hq-po-given-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e8eaed;
}
.hq-po-given-modal-head-text {
  flex: 1;
  min-width: 0;
}
.hq-po-given-modal-sub {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.hq-modal-close {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: #f1f3f4;
  color: #3c4043;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.hq-modal-close:hover {
  background: #e8eaed;
  color: #172b4a;
}
.hq-po-given-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}
.hq-po-given-stat {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.hq-po-given-stat-k {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5f6368;
}
.hq-po-given-stat-v {
  font-size: 1rem;
  font-weight: 600;
  color: #172b4a;
  line-height: 1.3;
  word-break: break-word;
}
.hq-po-given-modal-body {
  margin-bottom: 0.25rem;
}
.hq-po-given-body-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5f6368;
}
.hq-po-given-out-panel {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 1rem 1.15rem 0.85rem;
}
.hq-po-given-line-fields label {
  margin-bottom: 0.65rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.hq-po-given-line-fields input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}
.hq-po-given-line-fields input[readonly] {
  background: #fff;
  color: #172b4a;
  cursor: default;
}
.hq-po-given-line-fields .hq-qty-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.hq-po-given-line-fields .hq-qty-input-wrap input {
  margin-top: 0;
  flex: 1 1 6rem;
  min-width: 0;
}
.hq-po-given-modal-warn {
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}
.hq-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e8eaed;
}
@media (max-width: 520px) {
  .hq-po-given-summary {
    grid-template-columns: 1fr;
  }
  .hq-po-given-line-fields.hq-form-grid {
    grid-template-columns: 1fr;
  }
}
.hq-batch-section-po-ref .hq-batch-table td.num {
  vertical-align: middle;
}
.hq-po-reference-table th.hq-po-remarks,
.hq-po-reference-table td.hq-po-remarks {
  vertical-align: middle;
  text-align: left;
}
@media (max-width: 1100px) {
  .hq-stock-out-split {
    grid-template-columns: 1fr;
  }
  .hq-po-reference {
    position: static;
  }
}
.hq-batch-form .hq-page-head .hq-muted {
  margin-bottom: 0;
}
.hq-batch-section {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 1rem 1.15rem 1.15rem;
  margin-bottom: 1rem;
}
.hq-batch-section-cart {
  background: #fff;
}
.hq-batch-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hq-batch-section-head-row {
  align-items: center;
  flex-wrap: wrap;
}
.hq-batch-section-head-text {
  flex: 1;
  min-width: 0;
}
.hq-batch-step {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--tblr-primary, #4263eb);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hq-batch-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #172b4a;
}
.hq-batch-desc {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #5f6368;
  line-height: 1.4;
}
.hq-batch-desc code {
  font-size: 0.8rem;
  background: #e8f0fe;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}
.hq-batch-meta label {
  margin-bottom: 0.65rem;
}
.hq-batch-meta input[type="date"],
.hq-batch-line-fields input[type="date"] {
  max-width: 14rem;
}
.hq-form-uppercase input[type="text"],
.hq-form-uppercase textarea {
  text-transform: uppercase;
}

.hq-stock-in-invoice {
  text-transform: uppercase;
}
.hq-form-uppercase input[type="email"] {
  text-transform: none;
}
#hqStaffName,
#stockOutStaffName,
#poStaffName,
#lineRemark,
input[name="staffName"] {
  text-transform: uppercase;
}

.hq-inline-form {
  display: inline;
  margin: 0;
}
.hq-active-toggle {
  border: 1px solid #dadce0;
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: #f1f3f4;
  color: #5f6368;
}
.hq-active-toggle.is-on {
  background: #e6f4ea;
  border-color: #34a853;
  color: #137333;
}
.hq-active-toggle:hover {
  filter: brightness(0.97);
}

.hq-user-password-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hq-user-password-modal-sub {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}
.hq-user-password-modal-form label {
  margin-bottom: 0;
}
.hq-user-password-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.hq-form textarea,
.hq-textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
  min-height: 4.5rem;
  box-sizing: border-box;
}
.hq-supplier-receipt-section .hq-batch-step {
  background: #5f6368;
  font-size: 0.7rem;
}
.hq-supplier-receipt-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.hq-supplier-receipt-file {
  max-width: 100%;
  font-size: 0.85rem;
}
.hq-supplier-receipt-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.hq-supplier-receipt-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #e8eaed;
  font-size: 0.9rem;
}
.hq-supplier-receipt-item:last-child {
  border-bottom: none;
}
.hq-supplier-receipt-block {
  margin-top: 1.25rem;
}
.hq-field-error {
  color: #c5221f;
}
.hq-field-success {
  color: #137333;
  font-weight: 500;
}
.hq-invoice-receipts {
  min-width: 2.5rem;
  max-width: 6rem;
  font-size: 0.85rem;
  vertical-align: middle;
}
.hq-invoice-receipt-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.hq-invoice-receipt-links li {
  margin: 0;
  line-height: 1;
}
.hq-receipt-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  color: #1a73e8;
  background: #e8f0fe;
  text-decoration: none;
}
.hq-receipt-icon-link:hover {
  background: #d2e3fc;
  color: #1557b0;
}
.hq-receipt-icon {
  display: block;
  flex-shrink: 0;
}
.hq-subhead {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: #172b4a;
}
.hq-batch-badge {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #172b4a;
  background: #e8f0fe;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}
.hq-batch-picker {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}
.hq-field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #172b4a;
  margin: 0;
}
.hq-field-hint {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.8rem;
  color: #80868b;
}
.hq-batch-search {
  display: block;
  width: 100%;
  margin: 0;
  max-width: none;
}
.hq-batch-selected {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #e8f0fe;
  border: 1px solid #c6dafc;
  border-radius: 6px;
}
.hq-batch-selected-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.hq-batch-selected-main strong {
  font-size: 0.95rem;
  color: #172b4a;
}
.hq-batch-line-fields {
  margin-bottom: 0;
}
.hq-batch-line-fields label {
  margin-bottom: 0.65rem;
}
.hq-batch-line-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #dadce0;
}
.hq-input-readonly {
  background: #f1f3f4;
  color: #172b4a;
  cursor: default;
}
.hq-batch-table .hq-batch-empty-row td {
  text-align: center;
  color: #80868b;
  padding: 1.25rem 1rem;
  font-size: 0.875rem;
  background: #fafafa;
}
.hq-batch-line-name {
  font-weight: 600;
  color: #172b4a;
}
.hq-batch-line-sub {
  font-size: 0.8rem;
  color: #5f6368;
  margin-top: 0.15rem;
}
.hq-batch-line-meta {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: #5f6368;
  line-height: 1.45;
}
.hq-batch-line-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}
.hq-batch-line-meta-k {
  font-weight: 600;
  color: #3c4043;
  min-width: 4.75rem;
}
.hq-batch-footer {
  margin-top: 0.5rem;
  border-top: none;
  padding-top: 0;
}

.hq-draft-panel {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e8eaed;
}
.hq-draft-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.hq-draft-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #172b4a;
}
.hq-draft-empty {
  margin: 0;
  font-size: 0.875rem;
  color: #80868b;
}
.hq-draft-table {
  font-size: 0.8125rem;
}
.hq-draft-row-active td {
  background: #e8f0fe;
}
.hq-draft-status {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #137333;
  min-height: 1.1rem;
}
.hq-draft-status-err {
  color: #c5221f;
}
