/* SiSuWorkflow – phần riêng trên bộ CSS trang tĩnh dùng chung (sisu-static.css, token --sn-*): chỉ thứ thư viện chưa có. */

/* Thanh trên: tên doanh nghiệp dài không đẩy vỡ thanh */
.wf-tenant { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; }
.wf-user { display: flex; align-items: center; gap: var(--sn-space-2); color: var(--sn-text-secondary) !important; text-decoration: none !important; }
.cx-topbar-user form { margin: 0; }

/* Thẻ biểu mẫu không giãn hết bề ngang màn rộng */
.wf-form-card { max-width: 760px; }

.wf-stat-link { color: var(--sn-text) !important; text-decoration: none !important; transition: border-color var(--sn-dur), background var(--sn-dur); }
.wf-stat-link:hover { border-color: var(--sn-border-strong); background: var(--sn-surface-hover); }

/* Chọn doanh nghiệp: mỗi doanh nghiệp một nút bấm cả dòng */
.wf-choice {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sn-space-3); width: 100%; text-align: left; cursor: pointer;
    padding: var(--sn-space-3) var(--sn-space-4); border: 1px solid var(--sn-border); border-radius: var(--sn-radius); background: var(--sn-surface);
    font: inherit; color: inherit; transition: border-color var(--sn-dur), background var(--sn-dur);
}
.wf-choice:hover:not(:disabled) { border-color: var(--sn-primary); background: var(--sn-primary-soft); }
.wf-choice:disabled { cursor: not-allowed; opacity: .7; }
.wf-choice.is-current { border-color: var(--sn-primary); }
.wf-choice-main { display: flex; flex-direction: column; min-width: 0; }

.wf-actions { white-space: nowrap; }
.wf-actions, .wf-actions form { display: inline-flex; gap: var(--sn-space-2); align-items: center; justify-content: flex-end; margin: 0; }
.cx-task-body a { font-weight: 500; }

/* Bảng thành thẻ trên điện thoại (WF-7: ưu tiên 375px) – ô mang nhãn qua data-label */
@media (max-width: 719.98px) {
    .wf-cards thead { display: none; }
    .wf-cards, .wf-cards tbody, .wf-cards tr, .wf-cards td { display: block; width: 100%; }
    .wf-cards tr { padding: var(--sn-space-3) var(--sn-space-4); border-bottom: 1px solid var(--sn-border); }
    .wf-cards tr:last-child { border-bottom: 0; }
    .wf-cards td { padding: 2px 0; border: 0; text-align: left !important; }
    .wf-cards td[data-label] { display: flex; justify-content: space-between; gap: var(--sn-space-3); font-size: var(--sn-fs-sm); }
    .wf-cards td[data-label]::before { content: attr(data-label); color: var(--sn-text-muted); flex: none; }
    .wf-cards td.wf-actions { display: flex; justify-content: flex-start; padding-top: var(--sn-space-2); }
    .wf-cards td .cx-input { max-width: 60%; }
    .cx-page-head h1 { font-size: var(--sn-fs-xl); }
}

/* Ô số liệu: số trên, nhãn dưới */
.wf-stat-text { display: flex; flex-direction: column; min-width: 0; }
.cx-alert a { margin-left: 4px; font-weight: 500; }

/* Điện thoại: menu thành một hàng – hàng menu không giãn khi nội dung ngắn */
@media (max-width: 959.98px) {
    .cx-shell { grid-template-rows: auto 1fr; }
}

/* ---------- Phiếu (WF-b) ---------- */
.wf-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: var(--sn-radius-pill); background: var(--sn-warning-fill, var(--sn-warning)); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }
.wf-tabs a .wf-badge { margin-left: 6px; }
.wf-tabs { display: flex; gap: var(--sn-space-1); border-bottom: 1px solid var(--sn-border); overflow-x: auto; }
.wf-tabs a { display: inline-flex; align-items: center; padding: 10px var(--sn-space-3); color: var(--sn-text-secondary) !important; font-weight: 500; font-size: var(--sn-fs-sm); text-decoration: none !important; border-bottom: 2px solid transparent; white-space: nowrap; }
.wf-tabs a.is-active { color: var(--sn-primary-text) !important; border-bottom-color: var(--sn-primary); }
.wf-process-grid { display: grid; gap: var(--sn-space-3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-width: 760px; }
.wf-pair { display: flex; align-items: center; gap: var(--sn-space-2); }
.wf-pair .cx-input { flex: 1; min-width: 0; }
.wf-lines { display: flex; flex-direction: column; gap: var(--sn-space-2); }
.wf-line { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px; gap: var(--sn-space-2); }
.wf-line-head { font-size: var(--sn-fs-xs); color: var(--sn-text-muted); }
.wf-thumbs { display: flex; flex-wrap: wrap; gap: var(--sn-space-2); }
.wf-thumb { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wf-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--sn-radius-sm); border: 1px solid var(--sn-border); display: block; }
.wf-pre { white-space: pre-line; overflow-wrap: anywhere; }
.wf-event-note { display: block; color: var(--sn-text-secondary); margin-top: 2px; }
.wf-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sn-space-3); }
.wf-step { display: flex; flex-direction: column; gap: 2px; padding-left: var(--sn-space-3); border-left: 3px solid var(--sn-border); }
.wf-step.is-pending { border-left-color: var(--sn-primary); }
.wf-step.is-approved { border-left-color: var(--sn-success); }
.wf-step.is-rejected { border-left-color: var(--sn-error); }
.wf-step.is-skipped { opacity: .65; }
.wf-line-table { font-size: var(--sn-fs-sm); }
.wf-line-table th, .wf-line-table td { padding: 6px 8px; }
.wf-act { border-color: var(--sn-primary); }
.wf-row { border: 1px solid var(--sn-border); border-radius: var(--sn-radius); padding: var(--sn-space-3); margin: 0; display: flex; flex-direction: column; gap: var(--sn-space-3); min-width: 0; }
.wf-row-foot { gap: var(--sn-space-3) var(--sn-space-4); }
.wf-sticky-foot { position: sticky; bottom: 0; display: flex; gap: var(--sn-space-2); padding: var(--sn-space-3) 0; background: var(--sn-page-bg); }
.wf-plain-list { list-style: none; margin: 0; padding: 0; }
.cx-push { margin-left: auto; }

@media (max-width: 719.98px) {
    .wf-line { grid-template-columns: 1fr 1fr; }
    .wf-line > :first-child { grid-column: span 2; }
    .wf-line-head { display: none; }
    .wf-line-table th:nth-child(3), .wf-line-table td:nth-child(3) { display: none; }
}

/* Menu ngang trên màn hẹp: thanh cuộn mảnh */
.cx-nav { scrollbar-width: thin; }

/* Thông báo (WF-c) */
.wf-center { text-align: center !important; }
.wf-prefs td, .wf-prefs th { padding-left: var(--sn-space-3); padding-right: var(--sn-space-3); }
[hidden] { display: none !important; }

/* Gói, bảng kê (WF-d) */
.wf-meter { flex-direction: column; align-items: stretch; }
.wf-bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--sn-surface-muted); overflow: hidden; }
.wf-bar-fill { display: block; height: 100%; background: var(--sn-primary); }
.wf-bar-fill.is-warning { background: var(--sn-warning); }
.wf-bar-fill.is-danger { background: var(--sn-error); }
.wf-plans th.is-current { color: var(--sn-primary-text); background: var(--sn-primary-soft); }
.wf-plans td:first-child { color: var(--sn-text-muted); }
.wf-plans { min-width: 560px; }
.wf-pay { display: flex; flex-wrap: wrap; gap: var(--sn-space-4); align-items: flex-start; }
.wf-qr { width: 200px; max-width: 100%; background: #fff; padding: 8px; border-radius: var(--sn-radius); border: 1px solid var(--sn-border); }
.wf-qr svg { display: block; width: 100%; height: auto; }
.wf-pay .cx-kv { flex: 1 1 240px; }
.wf-total td { font-weight: 600; background: var(--sn-surface-muted); }
.wf-sums { display: flex; flex-wrap: wrap; gap: var(--sn-space-2); padding: var(--sn-space-3) var(--sn-space-4); border-bottom: 1px solid var(--sn-border); }
.wf-month { width: auto; }
.cx-card-body.cx-flush:has(.wf-plans) { overflow-x: auto; }
