/* ============================================================================
   PURCHASE-ORDERS.CSS — scoped styles for js/purchase-orders.js
   Money-section PO list. Uses the shared design tokens; only the table,
   badges, tags and the expandable detail row are defined here.
   ============================================================================ */

.po-wrap { padding: 4px 0 32px; }

.po-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.po-title { margin: 0; font-size: 22px; font-weight: 650; color: var(--text); }
.po-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); max-width: 60ch; }

.po-controls { display: flex; gap: 8px; align-items: center; margin: 16px 0 12px; flex-wrap: wrap; }
.po-input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-size: 13px; min-width: 240px;
}
.po-select { min-width: 160px; }
.po-btn {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer;
}
.po-btn:hover { background: var(--surface-alt, #f1f5f9); }

.po-summary { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }

.po-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.po-table thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.po-table tbody td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.po-row { cursor: pointer; }
.po-row:hover { background: var(--surface-alt, #f8fafc); }
.po-right { text-align: right; }
.po-mono { font-family: var(--font-mono); font-size: 12px; }
.po-num { font-weight: 600; }
.po-muted { color: var(--text-muted); font-size: 13px; }
.po-muted-inline { color: var(--text-muted); }
.po-error { color: var(--danger, #dc2626); font-size: 13px; }

.po-ref { font-family: var(--font-mono); font-size: 12px; }

/* linked = resolved to a vendors row (unlocks send-to-vendor); unlinked = free text */
.po-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600;
}
.po-tag-linked { background: rgba(34,197,94,.14); color: var(--success, #16a34a); }
.po-tag-unlinked { background: var(--surface-alt, #f1f5f9); color: var(--text-muted); }

.po-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.po-badge-draft    { background: var(--surface-alt, #f1f5f9); color: var(--text-muted); }
.po-badge-pending  { background: rgba(234,179,8,.16);  color: #a16207; }
.po-badge-approved { background: rgba(34,197,94,.14);  color: var(--success, #16a34a); }
.po-badge-sent     { background: rgba(59,130,246,.14); color: #1d4ed8; }
.po-badge-rejected { background: rgba(239,68,68,.13);  color: var(--danger, #dc2626); }

.po-actions { white-space: nowrap; text-align: right; }
.po-link {
  background: none; border: none; padding: 2px 6px; margin-left: 4px;
  color: var(--accent, #2563eb); font-size: 12px; cursor: pointer; border-radius: 4px;
}
.po-link:hover { text-decoration: underline; }
.po-link:disabled { opacity: .6; cursor: default; text-decoration: none; }

/* expandable detail row */
.po-detail-row > td { background: var(--surface-alt, #f8fafc); padding: 0 !important; }
.po-detail { padding: 14px 16px; }
.po-detail-grid { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 20px; }
@media (max-width: 780px) { .po-detail-grid { grid-template-columns: 1fr; } }

.po-meta { margin: 0; }
.po-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 12px; }
.po-meta dt { color: var(--text-muted); }
.po-meta dd { margin: 0; color: var(--text); text-align: right; }

.po-items { width: 100%; border-collapse: collapse; font-size: 12px; }
.po-items th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 4px 8px; border-bottom: 1px solid var(--border);
}
.po-items td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.po-items tfoot td { border-bottom: none; padding-top: 8px; }

.po-notes { margin-top: 12px; font-size: 12px; color: var(--text); }

/* issued = complete, no approval was required (distinct from draft = unfinished) */
.po-badge-issued { background: rgba(20,184,166,.15); color: #0f766e; }

.po-btn-on { background: var(--surface-alt, #e2e8f0); font-weight: 600; }
.po-link-danger { color: var(--danger, #dc2626); }
