/* ============================================================================
 * tour.css — Bổ sung cho design system (style.css) các thành phần riêng của
 * ERP Du lịch / Điều hành tour. Không ghi đè token màu của style.css.
 * ==========================================================================*/
.modal.sm { max-width: 460px; }
.modal .modal-foot .left { margin-right: auto; }

.money-pos { color: var(--green); font-weight: 700; }
.money-neg { color: var(--red); font-weight: 700; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--text-3); }

.toast-act { margin-top: 6px; background: none; border: 0; padding: 0; color: var(--primary); font-weight: 700; font-size: 12.3px; cursor: pointer; }
.toast-act:hover { text-decoration: underline; }

/* hàng KPI đầu trang */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }

/* chọn loại tài khoản (cá nhân / công ty) */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { flex: 1 1 0; min-width: 150px; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); transition: .15s;
}
.seg span i { color: var(--text-3); }
.seg input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: var(--ring); }
.seg input:checked + span i { color: var(--primary); }
.field.invalid .seg span { border-color: var(--red); }

/* khối tóm tắt trong form */
.sumbox { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.sumbox .line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; }
.sumbox .line.total { border-top: 1px dashed var(--border-2); margin-top: 5px; padding-top: 8px; font-size: 15px; font-weight: 800; }
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--r); background: var(--primary-soft); color: var(--text); font-size: 12.8px; line-height: 1.55; }
.callout i { color: var(--primary); margin-top: 3px; }
.callout.warn { background: var(--orange-soft); } .callout.warn i { color: var(--orange); }
.callout.ok { background: var(--green-soft); } .callout.ok i { color: var(--green); }

/* trang chi tiết tour */
.back-link { display: inline-flex; align-items: center; gap: 7px; font-size: 12.8px; font-weight: 600; color: var(--text-2); cursor: pointer; margin-bottom: 8px; background: none; border: 0; padding: 0; }
.back-link:hover { color: var(--primary); }
.tour-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: 12.8px; color: var(--text-2); }
.tour-meta i { color: var(--text-3); margin-right: 5px; width: 13px; text-align: center; }
.tab-pane { padding: 16px 17px; }
.tfoot-row td { font-weight: 800; background: var(--surface-2); }
table.tbl tfoot td { padding: 11px 14px; border-top: 1px solid var(--border-2); font-weight: 800; background: var(--surface-2); }
.sec-title { font-size: 13.5px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sec-title i { color: var(--primary); }

/* giá tour */
.price-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 16px 18px; border-radius: var(--r-lg); background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); border: 1px solid var(--border); }
.price-hero .big { font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--primary); line-height: 1.1; }
.price-hero .cap { font-size: 12.3px; color: var(--text-2); }
.formula { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

/* quyết toán */
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.check-list .ck { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: 0 0 22px; }
.check-list .ck.ok { background: var(--green); color: #fff; }
.check-list .ck.no { background: var(--orange-soft); color: var(--orange); }

/* thẻ NCC trong tab booking */
.bk-card { border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; background: var(--surface); }
.bk-card + .bk-card { margin-top: 10px; }
.bk-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bk-lines { margin: 9px 0 0; padding: 0; list-style: none; font-size: 12.8px; color: var(--text-2); display: grid; gap: 3px; }

/* khung xem trước tài liệu */
.doc-frame { width: 100%; height: min(68vh, 760px); border: 1px solid var(--border-2); border-radius: 8px; background: #fff; }

/* biểu đồ */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 240px; }
.filter-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 13px 17px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filter-bar .field { margin: 0; }
.filter-bar .inp { height: 34px; }
.preset { display: inline-flex; gap: 4px; }

.page-note { font-size: 12px; color: var(--text-3); margin-top: 10px; }
.status-sel { min-width: 150px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .price-hero .big { font-size: 24px; } }

/* --- tinh chỉnh bảng/KPI --- */
.tbl td.right, .tbl th.right, .tbl td.center, .tbl th.center { white-space: nowrap; }
.mkpi-value { white-space: nowrap; font-size: 19px; }
.kpi-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tbl td.act-col, .tbl th.act-col { position: sticky; right: 0; background: var(--surface); box-shadow: -8px 0 8px -8px rgba(15,23,42,.12); }
.tbl thead th.act-col { background: var(--surface-2); }
.tbl tbody tr:hover td.act-col { background: var(--surface-2); }
#view .tbl th, #view .tbl td { padding-left: 10px; padding-right: 10px; }
.tbl td.act-col .row-actions { gap: 0; }
.tbl td.act-col .btn-icon { width: 28px; height: 28px; }

/* ---- Trang Tính giá tour (báo giá) ---- */
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.q-side { position: sticky; top: 84px; }
.q-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.q-grid .field { margin: 0; } .q-grid .span2 { grid-column: span 2; } .q-grid .span4 { grid-column: 1 / -1; }
.qrow { display: grid; grid-template-columns: minmax(140px, 1.5fr) minmax(140px, 1.5fr) minmax(95px, 1fr) minmax(100px, .9fr) minmax(112px, 1.1fr) 36px; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.qrow + .qrow { margin-top: 10px; }
.qf label { display: block; font-size: 11px; font-weight: 700; color: var(--text-3); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .02em; }
.qf .inp { width: 100%; }
.q-amt { font-weight: 800; font-size: 15px; padding: 9px 0; white-space: nowrap; }
.q-del { margin-top: 20px; }
.q-hint { min-height: 15px; margin-top: 3px; }
.q-sug { position: fixed; z-index: 300; display: none; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(15,27,51,.2); max-height: 320px; overflow: auto; padding: 6px; }
.q-sug-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.q-sug-item:hover { background: var(--primary-soft); }
.q-sug-item b { flex: 1; min-width: 0; font-weight: 600; } .q-sug-item b span { color: var(--text-3); font-size: 12px; font-weight: 500; }
.q-sug-item em { font-style: normal; font-weight: 700; color: var(--primary); white-space: nowrap; }
tr.row-active td { background: var(--primary-soft) !important; }
@media (max-width: 1100px) {
  .q-layout { grid-template-columns: 1fr; } .q-side { position: static; }
  .qrow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qrow .q-name-wrap { grid-column: 1 / -1; } .qrow .q-del { grid-column: 1 / -1; justify-self: end; margin-top: 0; }
}
@media (max-width: 700px) {
  .q-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .q-grid .span2, .q-grid .span4 { grid-column: 1 / -1; }
  .qrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- ô chọn NCC có tìm kiếm (form dự trù) ---- */
.combo { position: relative; }
.combo-list { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px -10px rgba(15, 23, 42, .25); }
.combo-list.open { display: block; }
.combo-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.combo-item:last-child { border-bottom: 0; }
.combo-item:hover { background: var(--surface-2); }
.combo-item .cell-sub { display: block; }
.combo-empty { padding: 12px; font-size: 12.8px; color: var(--text-3); }

/* ---- dự trù / booking ---- */
.btn-booking { margin-top: 4px; color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.row-cancelled td { opacity: .62; }
.row-cancelled td:last-child { opacity: 1; }
.due-over, .due-over b { color: var(--red); font-weight: 700; }
.bk-lines li { margin-bottom: 4px; }

/* ---- bàn giao tour ---- */
.ho-total { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.ho-big { font-size: 24px; font-weight: 800; color: var(--red); letter-spacing: -.02em; }

/* ---- nút “Xem chi tiết” trên thẻ Tổng quan ---- */
.kcard .kc-more { position: relative; z-index: 1; margin-top: 8px; padding: 0; border: 0; background: none; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; opacity: .95; }
.kcard .kc-more:hover { opacity: 1; }

/* ---- logo ---- */
.brand-logo { width: 46px !important; height: 46px; background: #fff !important; border-radius: 12px; padding: 3px; transform: none !important; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.25) !important; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-plate { display: inline-flex; background: #fff; border-radius: 18px; padding: 10px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.logo-plate img { height: 92px; width: auto; display: block; }
.gift-low { color: var(--red); font-weight: 700; }
.brand-name { font-size: 19px !important; white-space: nowrap; letter-spacing: .01em !important; }
.brand-sub { font-size: 9.5px !important; letter-spacing: .08em !important; white-space: nowrap; }

.qf-unit { display: flex; gap: 6px; } .qf-unit .q-unit { width: 74px; flex: 0 0 74px; padding-left: 8px; padding-right: 4px; } .qf-unit input { min-width: 0; flex: 1; }
.q-sug, .combo-list { overscroll-behavior: contain; }


.combo-list.up { top: auto; bottom: calc(100% + 4px); }

.qrow .q-name-wrap { grid-column: 1 / -1; }

/* ===== Cập nhật đợt 4 ===== */
/* tài liệu báo giá NCC */
.doc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; justify-content: flex-end; }
.doc-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 190px; padding: 3px 8px; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface-2); color: var(--primary); font-size: 11.5px; cursor: pointer; }
.doc-chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.doc-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-list { display: flex; flex-direction: column; gap: 6px; }
.qd-row { display: flex; align-items: center; gap: 8px; }
.qd-row .doc-chip { max-width: 100%; flex: 0 1 auto; font-size: 12.5px; }
.doc-view { min-height: 120px; }
.doc-pre { white-space: pre-wrap; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 62vh; overflow: auto; }
.xl-view { overflow: auto; max-height: 56vh; border: 1px solid var(--border); border-radius: 8px; }
.xl-view table { border-collapse: collapse; font-size: 12px; }
.xl-view td, .xl-view th { border: 1px solid var(--border); padding: 3px 8px; white-space: nowrap; }
/* form đơn hàng */
.form-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.oi-head, .oi-row { display: grid; grid-template-columns: 34px minmax(140px, 2.2fr) minmax(100px, 1.1fr) 74px 84px 94px 80px minmax(100px, 1.1fr) 34px; gap: 8px; align-items: center; }
.oi-head { font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 0 0 4px; }
.oi-row { padding: 6px 0; border-top: 1px dashed var(--border); }
.oi-f label { display: none; }
.oi-stt { text-align: center; font-weight: 700; color: var(--text-3); }
.oi-amt { font-weight: 700; text-align: right; font-size: 13px; }
.oi-empty { padding: 12px 2px; font-size: 13px; }
.sum-vat { display: flex; gap: 10px; align-items: center; } .sum-vat .inp { height: 32px; width: auto; }
@media (max-width: 900px) {
  .form-grid.g4, .form-grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oi-head { display: none; }
  .oi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 0; }
  .oi-stt { grid-column: 1 / -1; text-align: left; } .oi-content { grid-column: 1 / -1; }
  .oi-f label { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
  .oi-del { grid-column: 1 / -1; justify-self: end; }
}
/* nhiều dịch vụ trong một dòng dự trù */
.svc-block { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.svc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; } .svc-head .svc-amt { margin-left: auto; font-size: 12.5px; color: var(--text-2); }

/* ===== Cập nhật đợt 5 ===== */
.name-blue { color: var(--blue); font-weight: 600; }
.sup-name { min-width: 260px; max-width: 380px; }
.sup-name .cell-sub { display: flex; gap: 6px; align-items: baseline; white-space: normal; }
.sup-name .cell-sub i { color: var(--text-3); width: 13px; text-align: center; flex: none; }
.sup-tbl td { white-space: nowrap; }
.sup-tbl td:first-child + td { white-space: normal; }
.sup-tbl .ell { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.btn-ho { border: 1px dashed var(--border-2); background: var(--surface); color: var(--text-2); }
.btn-ho.on { border-style: solid; border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 600; }
.combo-item.act { background: var(--primary-soft); }
.mail-prev { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: #fff; color: #1f2937; max-height: 52vh; overflow: auto; outline: none; }
.mail-prev table { width: 100%; }
.ho-tbl td[rowspan] { vertical-align: top; background: var(--surface); }
