/* PTIT AI SME - style bổ sung cho Skodash (tabular-menu) */

:root {
  --ptit-primary: #3461ff;
  --ptit-border: #e7eaf0;
  --ptit-muted: #6c757d;
  --ptit-chat-bg: #f5f7fb;
}

.fw-500 { font-weight: 500; }
.fs-13 { font-size: 13px; }
.fs-12 { font-size: 12px; }
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- header ---------- */
.top-header .page-title { font-size: 15px; font-weight: 500; color: #32393f; }
.top-header .page-title small { color: var(--ptit-muted); font-weight: 400; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ptit-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: 13px; flex-shrink: 0;
}
.user-avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.top-header .user-setting .user-name { line-height: 1.15; text-align: left; }
.top-header .user-setting .user-name small { display: block; font-size: 11px; color: var(--ptit-muted); }
.sidebar-wrapper .textmenu .list-group-item.muted { color: #adb5bd; pointer-events: none; }

/* ---------- page blocks ---------- */
.page-content .card { border-radius: 10px; }
.kpi-card .kpi-value { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.kpi-card .kpi-label { color: var(--ptit-muted); font-size: 13px; }
.kpi-card .kpi-sub { font-size: 12.5px; }
.card-header h6 { font-weight: 600; margin: 0; }
.card-header .sub { font-size: 12px; color: var(--ptit-muted); }
.table-sm-text td, .table-sm-text th { font-size: 13px; }
.table > :not(caption) > * > * { vertical-align: middle; }
.badge-soft { font-weight: 500; }
.filter-bar .form-select, .filter-bar .form-control { font-size: 13.5px; }
.empty-state { text-align: center; color: var(--ptit-muted); padding: 40px 12px; }
.empty-state i { font-size: 34px; display: block; margin-bottom: 8px; color: #c3c8d1; }
.skeleton { background: linear-gradient(90deg, #eef1f5 25%, #f6f8fa 37%, #eef1f5 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- DataTables ---------- */
table.dataTable tbody tr { cursor: pointer; }
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_length { font-size: 13px; color: var(--ptit-muted); }
.dataTables_wrapper .dataTables_processing { background: rgba(255, 255, 255, .85); border: 0; box-shadow: none; }

/* ---------- chat ---------- */
.chat-shell { height: calc(100vh - 150px); min-height: 520px; display: flex; overflow: hidden; }
.cv-list { width: 340px; flex-shrink: 0; border-right: 1px solid var(--ptit-border); display: flex; flex-direction: column; background: #fff; }
.cv-list .chat-tabs { flex-wrap: nowrap; }
.cv-list .chat-tabs .nav-link { font-size: 12.5px; padding: 5px 8px; color: #495057; white-space: nowrap; }
.cv-list .chat-tabs .nav-link.active { background: var(--ptit-primary); color: #fff; }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #f1f3f6; cursor: pointer; position: relative; }
.chat-item:hover { background: #f8f9fc; }
.chat-item.active { background: rgba(52, 97, 255, .08); }
.chat-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ptit-primary); }
.chat-item img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.av-wrap { position: relative; flex-shrink: 0; line-height: 0; }
.presence { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #12bf24; border: 2px solid #fff; }
.chat-item .name { font-weight: 500; font-size: 14px; }
.chat-item .time { font-size: 11.5px; color: var(--ptit-muted); white-space: nowrap; }
.chat-item .preview { font-size: 12.5px; color: var(--ptit-muted); }
.chat-item .unread { background: #e72e2e; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--ptit-chat-bg); }
.chat-head { background: #fff; border-bottom: 1px solid var(--ptit-border); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.chat-head img { width: 44px; height: 44px; border-radius: 50%; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.msg { display: flex; gap: 8px; margin-bottom: 14px; max-width: 78%; }
.msg .bubble { padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { font-size: 11px; color: var(--ptit-muted); margin-top: 3px; }
.msg .av { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.msg.in .bubble { background: #fff; border: 1px solid #e6e9ef; border-top-left-radius: 4px; }
.msg.out { margin-left: auto; flex-direction: row-reverse; }
.msg.out .meta { text-align: right; }
.msg.out.ai .bubble { background: #e9efff; color: #1f2d5c; border-top-right-radius: 4px; }
.msg.out.agent .bubble { background: var(--ptit-primary); color: #fff; border-top-right-radius: 4px; }
.msg.system { max-width: 100%; justify-content: center; }
.msg.system .bubble { background: transparent; color: var(--ptit-muted); font-size: 12px; padding: 2px 10px; border: 1px dashed #d5dae3; }
.day-sep { text-align: center; margin: 10px 0 16px; }
.day-sep span { font-size: 11.5px; color: var(--ptit-muted); background: #e8ebf1; padding: 2px 10px; border-radius: 10px; }
.chat-compose { background: #fff; border-top: 1px solid var(--ptit-border); padding: 10px 14px; }
.chat-compose textarea { resize: none; font-size: 14px; }
.suggest-box { background: #fffaf0; border: 1px solid #ffe3a8; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; }
.chat-info { width: 290px; flex-shrink: 0; border-left: 1px solid var(--ptit-border); background: #fff; overflow-y: auto; padding: 16px; }
.chat-info dt { font-size: 12px; color: var(--ptit-muted); font-weight: 400; }
.chat-info dd { font-size: 13.5px; margin-bottom: 10px; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--ptit-muted); }
.chat-shell.expanded { position: fixed; inset: 0; z-index: 1050; height: 100vh; border-radius: 0; }
.chat-shell.expanded .cv-list { display: none; }
@media (max-width: 1399.98px) { .chat-info { display: none; } }
@media (max-width: 991.98px) {
  .cv-list { width: 100%; }
  .chat-shell.has-active .cv-list { display: none; }
  .chat-shell:not(.has-active) .chat-main { display: none; }
}

/* ---------- timeline ---------- */
.tl { position: relative; padding-left: 28px; }
.tl::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: #eceff4; }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item .dot { position: absolute; left: -28px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.tl-item .when { font-size: 12px; color: var(--ptit-muted); }
.tl-item .what { font-size: 13.5px; }
.tl-day { font-size: 12px; font-weight: 600; color: #495057; margin: 4px 0 10px -28px; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- login (bố cục hai cột: ảnh nền đỏ PTIT bên trái, form bên phải) ---------- */
.login-split { display: flex; min-height: 100vh; background: #fff; }
.login-hero { flex: 0 0 64%; position: relative; background: #a30f14 url("../images/brand/login-bg.jpg") center / cover no-repeat; }
.login-panel { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 420px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { height: 52px; width: auto; }
.login-brand .t1 { font-size: 17px; font-weight: 700; color: #c4161c; line-height: 1.2; }
.login-brand .t2 { font-size: 12.5px; color: #495057; }
.login-hero .login-brand { position: absolute; top: 34px; left: 44px; }
.login-brand.light img { height: 58px; }
.login-brand.light .t1 { font-size: 22px; color: #fff; }
.login-brand.light .t2 { font-size: 15px; color: rgba(255, 255, 255, .92); }
.login-hint { margin: 32px 0 16px; text-align: center; font-size: 13.5px; color: #495057; }
.login-box .form-label { font-size: 13px; margin-bottom: 4px; }
.login-box .form-control { height: 44px; }
.login-box .form-control:focus { border-color: #e39a9d; box-shadow: 0 0 0 .2rem rgba(196, 22, 28, .12); }
.login-box .form-check-input:checked { background-color: #c4161c; border-color: #c4161c; }
.login-box .form-check-label { font-size: 13px; }
.login-link { font-size: 13px; color: #c4161c; text-decoration: none; }
.login-link:hover { text-decoration: underline; color: #a30f14; }
.btn-ptit { background: #c4161c; border-color: #c4161c; color: #fff; height: 44px; font-weight: 500; }
.btn-ptit:hover, .btn-ptit:focus { background: #a30f14; border-color: #a30f14; color: #fff; }
.btn-ptit:disabled { background: #d9777a; border-color: #d9777a; color: #fff; }
.login-notes { margin: 22px 0 0; padding-left: 18px; font-size: 12.5px; color: #6c757d; }
.login-notes li { margin-bottom: 5px; }
.login-notes b { color: #c4161c; font-weight: 500; }
.login-foot { margin-top: 28px; font-size: 12px; color: #adb5bd; }
.pw-toggle { cursor: pointer; }
@media (max-width: 991.98px) { .login-panel { justify-content: flex-start; padding-top: 48px; } }
/* trang 403 dùng khung thẻ đơn giản */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f3f5f9; padding: 16px; }
.login-card { width: 100%; border: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px rgba(20, 30, 60, .08); }

/* ---------- misc ---------- */
.toast-container { z-index: 1100; }
.module-chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: rgba(52, 97, 255, .1); color: #2f55d4; margin: 0 4px 4px 0; }
.offcanvas.offcanvas-end.w-lg { width: 640px; max-width: 100%; }
.stat-inline { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-inline .it { font-size: 13px; color: var(--ptit-muted); }
.stat-inline .it b { color: #212529; font-size: 15px; margin-right: 4px; }

html.dark-theme .cv-list, html.dark-theme .chat-head, html.dark-theme .chat-compose, html.dark-theme .chat-info, html.dark-theme .login-form { background: #1e2227; }
html.dark-theme .chat-main { background: #16191d; }
html.dark-theme .msg.in .bubble { background: #262b31; border-color: #333a42; color: #e9ecef; }

.bg-light-secondary { background-color: rgba(108, 117, 125, .14) !important; }
.bg-light-purple { background-color: rgba(137, 50, 255, .14) !important; }

/* ---------- trợ lý AI ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; width: 52px; height: 52px; border-radius: 50%; border: 0; z-index: 1040;
  background: var(--ptit-primary); color: #fff; font-size: 22px; box-shadow: 0 6px 18px rgba(52, 97, 255, .35); }
.ai-fab:hover { background: #2448d8; }
.ai-panel { position: fixed; right: 22px; bottom: 86px; width: 400px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(20, 30, 60, .2); z-index: 1040; display: flex; flex-direction: column; overflow: hidden; }
.ai-panel.d-none { display: none !important; }
.ai-head { background: linear-gradient(135deg, #1e2761, #3461ff); color: #fff; padding: 12px 14px; display: flex; align-items: center; }
.ai-body { flex: 1; overflow-y: auto; padding: 14px; background: var(--ptit-chat-bg); }
.ai-msg { display: flex; margin-bottom: 10px; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.ai-msg.bot .ai-bubble { background: #fff; border: 1px solid #e6e9ef; border-top-left-radius: 4px; }
.ai-msg.user .ai-bubble { background: var(--ptit-primary); color: #fff; border-top-right-radius: 4px; }
.ai-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ai-chip { border: 1px solid #cfd8f5; background: #fff; color: #2f55d4; border-radius: 14px; font-size: 12.5px; padding: 5px 10px; text-align: left; }
.ai-chip:hover { background: #eef2ff; }
.ai-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--ptit-border); background: #fff; }
.ai-input textarea { resize: none; font-size: 13.5px; }
.ai-typing i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: #9aa3b2; animation: aiDot 1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* ---------- chuông việc chờ duyệt (header) ---------- */
.top-header .bell { position: relative; font-size: 20px; color: #5b6270; padding: 6px 10px; }
.top-header .bell .badge { position: absolute; top: 2px; right: 2px; font-size: 10px; }
