/* =====================================================================
   Diem thuong: trang Tai khoan > Diem thuong va o dung diem o thanh toan.
   Mau lay tu theme neu co bien --k-* (KAIDEV), khong thi dung gia tri du phong.
   ===================================================================== */
.aitp, .aitp-checkout {
    --p-primary: var(--k-primary, #2f6b45);
    --p-primary-fg: var(--k-primary-fg, #fff);
    --p-primary-soft: var(--k-primary-soft, #eef5f0);
    --p-fg: var(--k-fg, #232323);
    --p-muted: var(--k-muted, #6b6b6b);
    --p-border: var(--k-border, #ececea);
    --p-border-strong: var(--k-border-strong, #dcdcd8);
    --p-hover: var(--k-hover, #f3f3f0);
    --p-soft: var(--k-bg-soft, #f6f6f4);
    --p-surface: var(--k-surface, #fff);
    --p-plus: var(--k-ok, #047857);
    --p-minus: var(--k-sale, #c81e3a);
    --p-radius: var(--k-radius, 12px);
    --p-radius-lg: var(--k-radius-lg, 16px);
    color: var(--p-fg);
}
.aitp *, .aitp-checkout * { box-sizing: border-box; }
.aitp { display: flex; flex-direction: column; gap: 24px; }
.aitp-muted { color: var(--p-muted); }

.aitp-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--p-radius); background: var(--p-primary); color: var(--p-primary-fg); font-size: 14px; font-weight: 500; text-decoration: none; }
.aitp-btn:hover { filter: brightness(1.08); color: var(--p-primary-fg); }
.aitp-btn--outline { border-color: var(--p-border-strong); background: var(--p-surface); color: var(--p-fg); }
.aitp-btn--outline:hover { background: var(--p-hover); color: var(--p-fg); filter: none; }
.aitp-link { padding: 0; border: 0; background: none; color: var(--p-primary); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.aitp-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Tong quan: so du + thong ke + cach tinh */
.aitp-summary { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--p-border); border-radius: var(--p-radius-lg); background: var(--p-surface); }
.aitp-balance { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.aitp-balance__label { color: var(--p-muted); font-size: 14px; }
.aitp-balance__value { color: var(--p-primary); font-size: 34px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.aitp-balance__value small { color: var(--p-muted); font-size: 15px; font-weight: 500; }
.aitp-balance__money { color: var(--p-muted); font-size: 14px; }
.aitp-balance__money .amount { color: var(--p-fg); font-weight: 600; }
.aitp-balance .aitp-btn { margin-top: 10px; }
.aitp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.aitp-stats > div { padding: 12px 14px; border-radius: var(--p-radius); background: var(--p-soft); }
.aitp-stats dt { color: var(--p-muted); font-size: 13px; }
.aitp-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aitp-rules { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--p-border); list-style: none; color: var(--p-muted); font-size: 14px; }
.aitp-rules li { position: relative; padding-left: 16px; }
.aitp-rules li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--p-primary); }
.aitp-rules b, .aitp-rules .amount { color: var(--p-fg); font-weight: 600; }
@media (min-width: 900px) {
    .aitp-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; padding: 24px; }
}

.is-plus { color: var(--p-plus); }
.is-minus { color: var(--p-minus); }

/* Lich su */
.aitp-history__title { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.aitp-empty { padding: 28px 20px; border: 1px dashed var(--p-border-strong); border-radius: var(--p-radius-lg); color: var(--p-muted); text-align: center; }
.aitp-empty p { margin: 0; }
.aitp-table { width: 100%; margin: 0; border: 1px solid var(--p-border); border-collapse: separate; border-spacing: 0; overflow: hidden; border-radius: var(--p-radius-lg); background: var(--p-surface); font-size: 14px; }
.aitp-table th { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--p-border); background: var(--p-soft); color: var(--p-muted); font-size: 13px; font-weight: 600; text-align: left; }
.aitp-table td { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--p-border); vertical-align: middle; }
.aitp-table tbody tr:last-child td { border-bottom: 0; }
.aitp-table .aitp-num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aitp-time { color: var(--p-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.aitp-order { white-space: nowrap; }
.aitp-order a { margin-right: 8px; color: var(--p-fg); font-weight: 600; text-decoration: none; }
.aitp-order a:hover { color: var(--p-primary); text-decoration: underline; }
.aitp-status { color: var(--p-muted); font-size: 13px; }
.aitp-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-size: 14px; }

/* Di dong: moi dong thanh mot the */
@media (max-width: 767px) {
    .aitp-summary { padding: 16px; }
    .aitp-balance__value { font-size: 30px; }
    .aitp-table, .aitp-table tbody { display: block; }
    .aitp-table thead { display: none; }
    .aitp-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--p-border); }
    .aitp-table tbody tr:last-child { border-bottom: 0; }
    .aitp-table td { display: block; padding: 0; border: 0; }
    .aitp-table .aitp-what { grid-column: 1; grid-row: 1; font-weight: 500; }
    .aitp-table .aitp-num { grid-column: 2; grid-row: 1; font-size: 15px; }
    .aitp-table .aitp-time { grid-column: 1 / -1; grid-row: 2; font-size: 13px; }
    .aitp-table .aitp-order { grid-column: 1 / -1; grid-row: 3; }
    .aitp-table .aitp-order:has(.aitp-muted) { display: none; }
}

/* Thanh toan: o dung diem (cung dang voi o ma giam gia) */
.aitp-checkout { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 14px 16px 16px; border: 1px solid var(--p-border); border-radius: var(--p-radius); background: var(--p-surface); }
.aitp-checkout__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; width: 100%; }
.aitp-checkout__title { font-weight: 600; }
.aitp-checkout__balance { color: var(--p-muted); font-size: 14px; }
.aitp-checkout__balance b { color: var(--p-fg); }
.aitp-checkout__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; }
.aitp-checkout__form .input-text { width: 100%; height: 46px; margin: 0; }
body .aitp-checkout .aitp-checkout__form .button { height: 46px; min-height: 46px; margin: 0; padding: 0 18px; border-color: transparent; background: var(--k-fg, #232323); color: #fff; white-space: nowrap; }
body .aitp-checkout .aitp-checkout__form .button:hover { background: #3a3a3a; }
.aitp-checkout__form .button:disabled { opacity: .6; cursor: progress; }
.aitp-checkout__applied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; width: 100%; padding: 10px 12px; border-radius: var(--p-radius); background: var(--p-primary-soft); color: var(--p-primary); font-size: 14px; }
.aitp-checkout__applied b, .aitp-checkout__applied .amount { font-weight: 700; }
