/* HQ-30: đề xuất chi + nhà cung cấp + lãi lỗ dự án (views/expenses.js). Tách file khỏi app.css để nhánh song song không đụng nhau.
   Chỉ dùng biến màu của app.css (sáng / tối). */
.ex-s { font-size: 12px; }
.ex-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); }
.ex-chip.s-submitted { background: var(--warn-soft); color: var(--warn); }
.ex-chip.s-returned { background: var(--err-soft); color: var(--err); }
.ex-chip.s-approved { background: var(--brand-soft); color: var(--brand-dark); }
.ex-chip.s-paid { background: var(--ok-soft); color: var(--ok-text); }
.ex-chip.s-cancelled { text-decoration: line-through; }

.ex-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 0 0 10px; }
.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.ex-val { font-size: 18px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ex-card.neg .ex-val { color: var(--err); }
.ex-legacy { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 8px; }
.ex-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.ex-sum { margin: 8px 0 0; }
.ex-queues .ex-search, .chips .ex-search { margin-left: auto; min-width: 220px; }
.ex-head { flex-wrap: wrap; gap: 8px; }
.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.ex-note { margin: 10px 0; padding: 10px 14px; }
.ex-lines-view { margin: 12px 0; }
.ex-lines-view tfoot td { font-weight: 600; border-top: 2px solid var(--line); }

/* Modal tạo / sửa: rộng hơn modal mặc định; mỗi dòng chi = lưới ô, màn hẹp xếp dọc */
.modal.ex-wide { max-width: 1080px; }
.modal-bg:has(.ex-wide) { align-items: flex-start; overflow-y: auto; }
.ex-lines { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 4px 0 12px; background: var(--surface-2); }
.ex-lines-head { display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.ex-line { display: grid; gap: 6px 8px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--line);
  grid-template-columns: 22px minmax(110px, 1fr) minmax(130px, 1.2fr) minmax(220px, 1.9fr) 60px 112px 88px 104px 30px; }
.ex-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-f > span { font-size: 11px; color: var(--muted); }
.ex-f input, .ex-f select { width: 100%; min-width: 0; }
.ex-no { align-self: center; font-weight: 700; color: var(--muted); }
.ex-amt strong { font-variant-numeric: tabular-nums; padding: 7px 0; display: block; }
.ex-sup-box { position: relative; display: flex; gap: 4px; }
.ex-sup-box input { flex: 1; }
.ex-del { align-self: center; font-size: 18px; }
.ex-totals { display: flex; justify-content: flex-end; gap: 6px 18px; flex-wrap: wrap; margin-top: 10px; font-variant-numeric: tabular-nums; }
.ex-grand strong { font-size: 16px; }
.ex-dup { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .ex-line { grid-template-columns: 22px repeat(2, minmax(0, 1fr)) 30px; }
  .ex-line .ex-item { grid-column: 2 / 4; }
  .ex-line .ex-desc, .ex-line .ex-sup { grid-column: 2 / 4; }
  .ex-line .ex-del { grid-column: 4; grid-row: 1; }
  .ex-line .ex-qty, .ex-line .ex-vat { grid-column: 2; }
  .ex-line .ex-price, .ex-line .ex-amt { grid-column: 3; }
}
@media (max-width: 760px) {
  .ex-queues .ex-search, .chips .ex-search { margin-left: 0; min-width: 0; width: 100%; }
  .ex-actions { margin-left: 0; }
  .ex-head { flex-direction: column; align-items: flex-start; }
  .ex-val { font-size: 16px; }
}

/* In / lưu PDF trang chi tiết: bỏ menu, thanh trên, nút, tab; hiện ô ký */
.print-only { display: none; }
.ex-sign { grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; margin: 28px 0; }
@media print {
  *, .main > * { animation: none !important; transition: none !important; opacity: 1 !important; }
  .ex-sign { color: #000 !important; }
  .topbar, .sidenav, .ex-actions, .tabs, [data-panel], .crumb, #toasts, .path-guide { display: none !important; }
  .layout, .main { display: block !important; padding: 0 !important; margin: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .print-only { display: grid !important; }
  .highlights, .table-wrap, .card { box-shadow: none !important; border-color: #999 !important; }
}
.ex-code { white-space: nowrap; }
