/* ============================================================
   Dino PR/PO — Reusable UI components (Stage 1)
   Patterns trích từ MVP, map sang token chung. Dùng cho mọi surface.
   ============================================================ */

/* ---- Section label (heading nhỏ in hoa trong card) ---- */
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); font-weight: 700; margin-bottom: 12px; }

/* ---- Card / surface block ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 16px; }

/* ---- Status badge (luôn kèm icon, không chỉ màu) ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.badge .ti { font-size: 14px; }
.badge.approve { background: var(--approve-bg); color: var(--approve-text); }
.badge.pending { background: var(--pending-bg); color: var(--pending-text); }
.badge.reject  { background: var(--reject-bg);  color: var(--reject-text); }
.badge.blocked { background: var(--blocked-bg); color: var(--blocked-text); }
.badge.info    { background: var(--info-bg);    color: var(--info-text); }

/* ---- Scope chip (5 loại) ---- */
.scope-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
}
.scope-chip.creative    { background: var(--scope-creative-bg);    color: var(--scope-creative-text); }
.scope-chip.social      { background: var(--scope-social-bg);      color: var(--scope-social-text); }
.scope-chip.media       { background: var(--scope-media-bg);       color: var(--scope-media-text); }
.scope-chip.gifts       { background: var(--scope-gifts-bg);       color: var(--scope-gifts-text); }
.scope-chip.passthrough { background: var(--scope-passthrough-bg); color: var(--scope-passthrough-text); }

/* ---- Stat card ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-card);
}
.stat-card.urgent { background: var(--warm-accent-bg); border-color: transparent; }
.stat-label { font-size: 13px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card.urgent .stat-label { color: var(--warm-accent); }
.stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 26px; margin-top: 6px; letter-spacing: -0.5px; }
.stat-card.urgent .stat-value { color: var(--warm-accent); }
.stat-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ---- Amount display ---- */
.amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 38px; line-height: 1.05; letter-spacing: -1px; display: inline-block; }
.amount .cur { font-family: var(--font-sans); font-size: 0.5em; font-weight: 600; color: var(--text-2); letter-spacing: 1px; margin-right: 4px; }
.mono { font-family: var(--font-mono); }

/* ---- PR/list item ---- */
.pr-item {
  list-style: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.pr-item + .pr-item { margin-top: 10px; }
.pr-item:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.pr-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pr-item-title { font-weight: 600; font-size: 15px; }
.pr-item-meta { font-size: 13.5px; color: var(--text-2); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pr-vendor { font-size: 15px; font-weight: 600; }
.pr-amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 20px; white-space: nowrap; letter-spacing: -0.4px; }

/* CCV (Client/Campaign/Vendor) grid trong thẻ PR — chữ ký nhận diện của MVP */
.pr-ccv { display: grid; grid-template-columns: 84px 1fr; row-gap: 5px; column-gap: 12px; margin: 12px 0; padding: 10px 12px; background: var(--surface-soft); border-radius: var(--r-sm); }
.pr-ccv-key { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); font-weight: 700; align-self: center; }
.pr-ccv-value { font-size: 13px; color: var(--text-1); font-weight: 500; line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pr-ccv-value.client { font-weight: 600; }

/* Hàng meta + cờ */
.pr-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; font-weight: 500; }
.pr-meta-item { display: flex; align-items: center; gap: 4px; }
.pr-meta .ti { font-size: 14px; }
.pr-meta-sep { color: var(--text-3); }
.pr-meta .id { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.3px; }
.pr-flag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; }
.pr-flag.urgent { background: var(--warm-accent-bg); color: var(--warm-accent); }
.pr-flag.variance { background: var(--reject-bg); color: var(--reject-text); }
.pr-flag.tier { background: var(--surface-deep); color: var(--text-2); }

/* Timeline note (quote) */
.timeline-note { margin-top: 10px; padding: 11px 13px; background: var(--surface-soft); border-radius: var(--r-md); border-left: 2px solid var(--border-strong); font-size: 13.5px; line-height: 1.55; color: var(--text-1); font-weight: 500; }
.timeline-note .quote::before { content: "\201C"; color: var(--text-3); margin-right: 1px; }
.timeline-note .quote::after { content: "\201D"; color: var(--text-3); margin-left: 1px; }

/* ---- Budget bar (segmented) ---- */
.budget-bar { height: 10px; border-radius: var(--r-pill); background: var(--surface-deep); overflow: hidden; display: flex; }
.budget-bar .seg { height: 100%; }
.budget-bar .seg.spent { background: var(--text-1); }
.budget-bar .seg.this-pr { background: var(--warm-accent); }
.budget-bar .seg.pending { background: var(--warm-accent); opacity: 0.55; }
.budget-bar .seg.planned { background: var(--border-strong); }
.budget-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.budget-legend-item { display: flex; align-items: center; gap: 5px; }
.budget-legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.budget-legend-dot.spent { background: var(--text-1); }
.budget-legend-dot.this-pr { background: var(--warm-accent); }
.budget-legend-dot.planned { background: var(--border-strong); }
.budget-legend-dot.remaining { background: var(--surface-deep); border: 1px solid var(--border-strong); }

/* ---- Bảng phân tích ngân sách (trích MVP: số mono tabular + % + hàng "PR này" highlight) ---- */
.budget-breakdown { margin-top: 16px; }
.budget-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); }
.budget-row + .budget-row { margin-top: 2px; }
.budget-row-label { font-size: 14.5px; color: var(--text-2); }
.budget-row.highlight { background: var(--warm-accent-bg); }
.budget-row.highlight .budget-row-label { color: var(--warm-accent); font-weight: 700; }
.budget-row.highlight .budget-row-amount { color: var(--warm-accent); }
.budget-row-val { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.budget-row-amount { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text-1); letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.budget-row-amount .budget-cur { font-size: 11px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.budget-row-pct { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-3); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Dải tiến trình mốc thanh toán (read-only: đã chi / khả dụng / sắp tới) ---- */
.ms-track { display: flex; flex-direction: column; }
.ms-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 4px; }
.ms-row + .ms-row { border-top: 1px solid var(--border); }
.ms-row-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ms-row-main .ti { font-size: 17px; color: var(--text-3); flex: none; }
.ms-row.ms-paid .ms-row-main .ti { color: var(--approve-text); }
.ms-row.ms-pending .ms-row-main .ti { color: var(--warm-accent); }
.ms-row-label { font-size: 14px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-row.ms-upcoming .ms-row-label { color: var(--text-3); }
.ms-row.ms-paid .ms-row-label { color: var(--text-2); }
.ms-row-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; flex: none; }
.ms-amount { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ms-status { font-size: 12.5px; font-weight: 700; min-width: 56px; text-align: right; }
.ms-row.ms-paid .ms-status { color: var(--approve-text); }
.ms-row.ms-pending .ms-status { color: var(--warm-accent); }
.ms-row.ms-upcoming .ms-status { color: var(--text-3); }

/* ---- Campaign (project) card + segmented budget bar (Đã chi / Đang chờ / Còn lại) ---- */
.campaign-card { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); cursor: pointer; transition: background var(--t-fast); }
.campaign-card + .campaign-card { margin-top: 10px; }
.campaign-card:hover { background: var(--surface-soft); }
.campaign-card.at-risk { background: var(--warm-accent-bg); border-color: transparent; }
.campaign-name { font-size: 16px; font-weight: 600; }
.campaign-seg-bar { height: 10px; border-radius: var(--r-pill); background: var(--surface-deep); overflow: hidden; display: flex; margin: 12px 0 8px; }
.campaign-seg-bar .seg { height: 100%; }
.campaign-seg-bar .seg.spent { background: var(--text-1); }
.campaign-seg-bar .seg.pending { background: var(--warm-accent); opacity: 0.55; }
.budget-legend-dot.pending { background: var(--warm-accent); opacity: 0.55; }
.budget-warning { display: flex; align-items: center; gap: 8px; background: var(--warm-accent-bg); color: var(--warm-accent); border-radius: var(--r-md); padding: 10px 13px; font-size: 13px; font-weight: 600; }
.budget-warning .ti { font-size: 16px; }
.campaign-context-card { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 15px; cursor: pointer; transition: background var(--t-fast); position: relative; }
.campaign-context-card:hover { background: var(--surface-deep); }
.campaign-context-arrow { position: absolute; right: 14px; top: 14px; color: var(--text-3); font-size: 16px; }

/* ---- Approval timeline (dot + line) ---- */
.timeline { display: flex; flex-direction: column; }
.timeline-step { display: flex; gap: 14px; position: relative; }
.timeline-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-deep); border: 2px solid var(--border-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; z-index: 1; }
.timeline-dot .ti { font-size: 13px; color: var(--text-2); }
.timeline-step.done .timeline-dot { background: var(--approve-text); border-color: var(--approve-text); }
.timeline-step.done .timeline-dot .ti { color: var(--on-warm); }
.timeline-step.current .timeline-dot { background: var(--warm-accent); border-color: var(--warm-accent); }
.timeline-step.current .timeline-dot .ti { color: var(--on-warm); }
.timeline-line { position: absolute; left: 10px; top: 22px; bottom: -6px; width: 2px; background: var(--border-strong); }
.timeline-step:last-child .timeline-line { display: none; }
.timeline-content { flex: 1; min-width: 0; padding-bottom: 20px; }
.timeline-step:last-child .timeline-content { padding-bottom: 0; }
.timeline-role { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-3); font-weight: 700; }
.timeline-step.current .timeline-role { color: var(--warm-accent); }
.timeline-action { font-size: 15px; color: var(--text-1); }
.timeline-action .name { font-weight: 600; }
.timeline-time { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ---- Bank card (+ copy) ---- */
.bank-card { background: var(--surface-deep); border-radius: var(--r-md); padding: 14px 16px; }
.bank-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bank-row + .bank-row { margin-top: 6px; }
.bank-key { font-size: 13px; color: var(--text-2); }
.bank-val { font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.copy-btn { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 4px 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.copy-btn:hover { color: var(--text-1); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: none; align-items: center; justify-content: center; z-index: var(--z-modal); padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--r-xl); padding: 24px; max-width: 420px; width: 100%; box-shadow: var(--shadow-float); animation: modal-in 0.18s ease; }
@keyframes modal-in { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.modal-icon.info { background: var(--approve-bg); color: var(--approve-text); }
.modal-icon.danger { background: var(--reject-bg); color: var(--reject-text); }
.modal-title { font-family: var(--font-serif); font-variation-settings: "opsz" 40, "SOFT" 30; font-weight: 500; font-size: 22px; margin-bottom: 8px; }
.modal-body { color: var(--text-2); font-size: 15px; margin-bottom: 16px; }
.modal textarea { width: 100%; font-family: inherit; font-size: 15px; border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 10px; resize: vertical; min-height: 70px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---- Form inputs ---- */
.wire-input, .form-input { width: 100%; font-family: inherit; font-size: 15px; color: var(--text-1); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 11px 13px; margin-top: 6px; }
.wire-input:focus, .form-input:focus { outline: none; border-color: var(--warm-accent); }
textarea.wire-input { resize: vertical; min-height: 64px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 14px; }
.form-label:first-child { margin-top: 0; }
.ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.ms-cell { display: flex; flex-direction: column; }
.ms-cap { font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 3px; line-height: 1.3; }
.ms-cap small { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.ms-grid .form-input { margin-top: 0; }
.file-field { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.file-field input[type="file"] { font-size: 13px; max-width: 60%; }
.file-name { font-size: 13px; color: var(--text-3); font-style: italic; }
.amount-words { font-size: 14.5px; font-weight: 600; color: var(--warm-accent); margin-top: 6px; min-height: 18px; line-height: 1.35; }
@media (max-width: 600px) { .amount { font-size: 33px; } }

/* ---- Buttons ---- */
.btn { padding: 11px 18px; border: none; border-radius: var(--r-lg); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform var(--t-press); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--surface); }
.btn-warm { background: var(--warm-accent); color: var(--on-warm); }
.btn-ghost { background: transparent; color: var(--reject-text); border: 1px solid var(--border-strong); }
.btn-soft { background: var(--surface-deep); color: var(--text-1); }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--accent); color: var(--surface); padding: 12px 20px; border-radius: var(--r-pill); font-size: 15px; font-weight: 500; box-shadow: var(--shadow-float); opacity: 0; pointer-events: none; transition: all var(--t-fast); z-index: var(--z-toast); display: flex; align-items: center; gap: 8px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 40px 24px; color: var(--text-2); }
.empty-state .ti { font-size: 36px; color: var(--text-3); }
.empty-state-title { font-weight: 600; font-size: 17px; margin-top: 10px; color: var(--text-1); }
.empty-state-sub { font-size: 14px; margin-top: 4px; }

/* ---- SoD block note ---- */
.sod-note { display: flex; align-items: center; gap: 8px; background: var(--blocked-bg); color: var(--blocked-text); border-radius: var(--r-md); padding: 9px 13px; font-size: 14px; font-weight: 500; }
.sod-note .ti { font-size: 17px; }
