/* =========================================================
   MLA Ticket – giao diện
   Font: Be Vietnam Pro (lưu cục bộ, hỗ trợ đầy đủ tiếng Việt)
   ========================================================= */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(../lib/fonts/be-vietnam-pro-vietnamese-400.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(../lib/fonts/be-vietnam-pro-latin-400.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(../lib/fonts/be-vietnam-pro-vietnamese-500.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(../lib/fonts/be-vietnam-pro-latin-500.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(../lib/fonts/be-vietnam-pro-vietnamese-600.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(../lib/fonts/be-vietnam-pro-latin-600.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(../lib/fonts/be-vietnam-pro-vietnamese-700.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-display: swap; font-weight: 700;
  src: url(../lib/fonts/be-vietnam-pro-latin-700.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #16834f;
  --brand-600: #12703f;
  --brand-50: #e8f5ee;
  --side-bg: #0f2a1e;
  --side-fg: #b9cdc3;
  --side-active: #1d4a34;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e8ec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sidebar-w: 248px;

  --bs-primary: #16834f;
  --bs-primary-rgb: 22, 131, 79;
  --bs-link-color: #16834f;
  --bs-link-color-rgb: 22, 131, 79;
  --bs-link-hover-color: #12703f;
  --bs-body-font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --bs-body-color: #1f2937;
  --bs-border-color: #e5e8ec;
}

html { font-size: 14px; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600 !important; }

/* ---------- Nút ---------- */
.btn { border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; gap: .4rem; justify-content: center; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: #f3f4f6; --bs-btn-hover-border-color: #d1d5db; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.btn-icon:hover { background: #f1f3f5; color: var(--text); }
.btn-icon.view:hover { background: #e8f1fd; color: #1d5fbf; }
.btn-icon.edit:hover { background: #fff4e0; color: #b45309; }
.btn-icon.del:hover { background: #fdecec; color: #c62828; }
.actions { display: inline-flex; gap: 2px; white-space: nowrap; }

/* ---------- Form ---------- */
.form-control, .form-select { border-radius: 8px; border-color: #d9dee4; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(22, 131, 79, .15); }
.form-label { font-weight: 500; color: #374151; margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
.input-icon > .form-control, .input-icon > .form-select { padding-left: 36px; }
.req::after { content: " *"; color: #dc2626; }

/* ---------- Layout: sidebar + topbar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #22a565, #0f6b3d); display: grid; place-items: center; color: #fff; font-size: 1.1rem; box-shadow: 0 4px 12px rgba(34, 165, 101, .35); }
.brand small { display: block; font-size: .72rem; font-weight: 400; color: var(--side-fg); }
.side-nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.side-nav .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #6f8a7d; padding: 14px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; color: var(--side-fg); border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
.side-nav a i { font-size: 1.1rem; width: 20px; text-align: center; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #34c47c; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: #fff; }
.side-user:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-user .meta { line-height: 1.2; overflow: hidden; }
.side-user .meta small { color: var(--side-fg); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #34c47c, #16834f); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; flex-shrink: 0; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.5rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 28px; }
.topbar .page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.topbar .crumb { font-size: .8rem; color: var(--muted); }
.topbar .crumb a { color: var(--muted); }
.topbar .crumb a:hover { color: var(--brand); }
.topbar .search { width: 280px; }
.topbar .search .form-control { background: #f3f5f7; border-color: transparent; }
.topbar .search .form-control:focus { background: #fff; }
.content { padding: 24px 28px 40px; flex: 1; }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1035; }
  .main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .topbar .search { display: none; }
  .content { padding: 16px; }
}

/* ---------- Card ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 14px 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header .bi { color: var(--brand); }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 18px; }
.section-title { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.section-title .bi { color: var(--brand); }

/* KPI */
.kpi { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 18px; height: 100%; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); color: inherit; }
.kpi .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.kpi .val { font-size: 1.65rem; font-weight: 700; line-height: 1.1; }
.kpi .lbl { color: var(--muted); font-size: .85rem; }
.ic-blue { background: #e8f1fd; color: #1d5fbf; }
.ic-amber { background: #fff4e0; color: #c26a05; }
.ic-red { background: #fdecec; color: #c62828; }
.ic-green { background: #e6f6ed; color: #15803d; }
.ic-purple { background: #f1ebfd; color: #6d28d9; }
.ic-gray { background: #f1f2f4; color: #4b5563; }
.ic-teal { background: #e3f6f5; color: #0f766e; }

/* ---------- Bảng ---------- */
.table { --bs-table-hover-bg: #f7faf8; margin-bottom: 0; }
.table > thead th { background: var(--brand); color: #fff; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 0; white-space: nowrap; padding: 11px 12px; }
.table > tbody td { padding: 11px 12px; vertical-align: middle; border-color: #eef0f3; }
.table .col-stt { width: 56px; text-align: center; color: var(--muted); }
.table .col-act { width: 1%; text-align: right; white-space: nowrap; }
.table .code { font-weight: 600; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85rem; }
.table .title-link { color: var(--text); font-weight: 500; }
.table .title-link:hover { color: var(--brand); }
.row-overdue > td { background: #fff7f7 !important; }
.row-muted > td { color: #9ca3af; }
.table-card .table > :last-child > tr:last-child > td { border-bottom: 0; }
.table-footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; flex-wrap: wrap; gap: 8px; }
.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--text); --bs-pagination-border-radius: 8px; margin: 0; }

/* Trạng thái rỗng */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty > .bi { font-size: 2.6rem; color: #c7cfd6; display: block; margin-bottom: 8px; }

/* ---------- Badge trạng thái / ưu tiên ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.st-1 { background: #e8f1fd; color: #1d5fbf; }
.st-2 { background: #fff4e0; color: #b45309; }
.st-3 { background: #f1ebfd; color: #6d28d9; }
.st-4 { background: #e6f6ed; color: #15803d; }
.st-5 { background: #f1f2f4; color: #4b5563; }
.st-late { background: #fdecec; color: #c62828; }
.pr-1 { background: #f1f2f4; color: #6b7280; }
.pr-2 { background: #e3f6f5; color: #0f766e; }
.pr-3 { background: #fff1e6; color: #c2410c; }
.pr-4 { background: #fdecec; color: #c62828; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f1f3f5; color: #374151; font-size: .78rem; font-weight: 500; }

/* ---------- Bộ lọc ---------- */
.filter-bar .form-control, .filter-bar .form-select { font-size: .875rem; }
.filter-bar .form-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.chip-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: #4b5563; font-size: .85rem; font-weight: 500; }
.chip-tabs a:hover { border-color: var(--brand); color: var(--brand); }
.chip-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Chi tiết / timeline ---------- */
.info-list { display: grid; grid-template-columns: 140px 1fr; row-gap: 10px; column-gap: 12px; margin: 0; }
.info-list dt { color: var(--muted); font-weight: 400; display: flex; align-items: center; gap: 6px; }
.info-list dd { margin: 0; font-weight: 500; }
.text-pre { white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: #eef0f3; }
.timeline li { position: relative; padding-left: 44px; padding-bottom: 16px; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; border: 3px solid #fff; }
.timeline .bubble { background: #f6f8f7; border: 1px solid #e7ece9; border-radius: 10px; padding: 10px 12px; }
.timeline .meta { font-size: .78rem; color: var(--muted); margin-bottom: 3px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.file-item .ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: #e8f1fd; color: #1d5fbf; flex-shrink: 0; }
.file-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1.5px dashed #cdd5dc; border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); background: #fafbfc; }

/* ---------- Biểu đồ ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.bar-list .item { margin-bottom: 12px; }
.bar-list .top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 4px; }
.bar-list .track { height: 8px; border-radius: 99px; background: #eef1f4; overflow: hidden; }
.bar-list .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #34c47c, #16834f); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 20%, #1f9a5f 0, transparent 45%), radial-gradient(circle at 80% 90%, #0b5a33 0, transparent 50%), linear-gradient(135deg, #0f2a1e, #134a30); }
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h1 { font-size: 2.1rem; font-weight: 700; line-height: 1.25; margin-bottom: 14px; }
.auth-hero p { color: #c8dcd1; font-size: 1rem; max-width: 460px; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.auth-feature .ic { width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.auth-feature b { display: block; font-weight: 600; }
.auth-feature span { color: #b9cdc3; font-size: .9rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: 32px; }
.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.auth-card .form-control { height: 46px; }
.auth-card .btn-lg { height: 46px; font-size: 1rem; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #9ca3af; padding: 6px 8px; }
.pw-toggle:hover { color: var(--text); }
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* ---------- Hồ sơ ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-cover { height: 90px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(120deg, #134a30, #22a565); }
.profile-card .avatar.lg { margin-top: -36px; border: 4px solid #fff; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; }
.app-toast { min-width: 300px; max-width: 420px; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, .15); border-left: 4px solid var(--brand); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; animation: toastIn .25s ease; }
.app-toast.err { border-left-color: #dc2626; }
.app-toast .bi { font-size: 1.2rem; }
.app-toast.ok .bi { color: var(--brand); }
.app-toast.err .bi { color: #dc2626; }
.app-toast .close { margin-left: auto; border: 0; background: transparent; color: #9ca3af; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Modal xác nhận */
.modal-content { border: 0; border-radius: 14px; }
.confirm-ic { width: 52px; height: 52px; border-radius: 50%; background: #fdecec; color: #c62828; display: grid; place-items: center; font-size: 1.5rem; margin: 0 auto 12px; }

/* Tiện ích */
.gap-row { row-gap: 1rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sticky-side { position: sticky; top: 84px; }
.btn-check:checked + .btn-light { background: var(--brand-50); border-color: var(--brand); color: var(--brand-600); }
.validation-summary-errors ul, .validation-summary-valid ul { margin: 0; padding-left: 0; list-style: none; }
.validation-summary-valid { display: none; }
.min-w-0 { min-width: 0; }
.table-success > td { --bs-table-bg-state: #eef8f2; }
.form-switch .form-check-input { cursor: pointer; }
/* Flatpickr theo màu thương hiệu */
.flatpickr-calendar { font-family: inherit; border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, .15); border: 0; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--brand); border-color: var(--brand); }
.flatpickr-day.today { border-color: var(--brand); }
.flatpickr-input[readonly] { background-color: #fff; }
.empty .btn .bi { font-size: 1rem; display: inline; margin: 0; color: inherit; }
/* Cột thao tác luôn hiển thị khi bảng cuộn ngang */
.table .col-act { position: sticky; right: 0; background: var(--surface); z-index: 1; box-shadow: -8px 0 8px -8px rgba(16, 24, 40, .12); }
.table > thead th.col-act { background: var(--brand); }
.table-hover > tbody > tr:hover > td.col-act { background: #f7faf8; }
.table .code { white-space: nowrap; }
.table-compact > thead th, .table-compact > tbody td { padding: 8px 6px; }
/* Tiêu đề bảng nền xanh thương hiệu */
.table > thead th.col-stt { color: #fff; }
.table > thead th + th { border-left: 1px solid rgba(255, 255, 255, .12); }
.table-card { overflow: hidden; }
