/* ══════════════════════════════════════════════════════════════
   KTXD Bình Định - Cosmic / Deep Space Theme
   Brand: Cam (#E65100) × Thiên Hà (#060818) × Cyan (#00e5ff)
   ══════════════════════════════════════════════════════════════ */

:root {
  /* Brand Colors */
  --primary: #E65100;
  --primary-light: #FF8A50;
  --primary-dark: #AC1900;
  --primary-glow: rgba(230, 81, 0, 0.40);

  /* Cosmic Accent */
  --cyan: #00e5ff;
  --cyan-glow: rgba(0, 229, 255, 0.20);
  --nebula-purple: rgba(90, 30, 160, 0.35);
  --nebula-blue: rgba(15, 50, 140, 0.30);

  /* Deep Space Backgrounds */
  --bg-dark: #060818;
  --bg-card: rgba(8, 16, 48, 0.70);
  --bg-card-hover: rgba(12, 24, 72, 0.85);
  --bg-sidebar: rgba(5, 10, 32, 0.92);
  --bg-input: rgba(10, 20, 58, 0.80);
  --border: rgba(80, 130, 255, 0.18);
  --border-light: rgba(100, 180, 255, 0.28);

  /* Text */
  --text-primary: #e8f0fe;
  --text-secondary: #7a9cc8;
  --text-muted: #3d5282;

  /* System Accents */
  --success: #00e676;
  --warning: #ffd740;
  --danger: #ff5252;
  --info: #40c4ff;

  /* Glass */
  --glass-bg: rgba(6, 10, 30, 0.80);
  --glass-border: rgba(80, 140, 255, 0.14);
  --glass-blur: 24px;

  /* Sizing */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 32px var(--primary-glow);
  --shadow-cyan: 0 0 24px var(--cyan-glow);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; scroll-behavior: smooth; }
/* ── Starfield Canvas ───────────────────────────────────── */
#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

body {
  font-family: 'Be Vietnam Pro', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #04060f;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(30, 10, 70, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(8, 25, 80, 0.10) 0%, transparent 45%);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ensure sidebar and main content render above starfield */
.sidebar, .main-content { position: relative; z-index: 1; }
a { color: var(--primary-light); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.93rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
table { border-collapse: collapse; width: 100%; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(5,10,32,0.97) 0%, rgba(8,14,42,0.97) 100%);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 32px rgba(0,0,50,0.6);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.sidebar-banner2-img {
  width: 75%;
  height: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto;
}
.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.4rem;
  color: white;
  box-shadow: var(--shadow-glow);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: 1px; }
.brand-sub { font-size: 0.73rem; color: var(--text-secondary); font-weight: 500; }

.nav-menu {
  list-style: none;
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.93rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover {
  background: rgba(80, 130, 255, 0.10);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(230, 81, 0, 0.18), rgba(0, 229, 255, 0.06));
  color: var(--primary-light);
  font-weight: 600;
  box-shadow: inset 0 0 20px rgba(230,81,0,0.08);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--cyan));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--primary-glow);
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.version-tag {
  font-size: 0.73rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: rgba(6, 8, 24, 0.82);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(80,140,255,0.10), 0 4px 24px rgba(0,0,40,0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0;
  z-index: 500;
}
.topbar-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
/* ── Ticker thông báo sự kiện ─────────────────────────────── */
.topbar-ticker-wrap {
  flex: 0 1 360px;       /* không cho phép tăng quá 360px, có thể co lại */
  max-width: 360px;
  min-width: 0;
  overflow: hidden;
  margin: 0 12px;
  height: 26px;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}
.topbar-ticker {
  display: flex;
  white-space: nowrap;
  will-change: transform;
  animation: tickerScroll 0s linear infinite;
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 0 12px;
  gap: 0;
}
.topbar-ticker .ticker-item {
  display: inline-flex;
  align-items: center;
  padding: 0 24px 0 0;
  gap: 5px;
}
.topbar-ticker .ticker-sep { color: var(--border-light); padding: 0 8px; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@media (max-width: 860px) { .topbar-ticker-wrap { display: none !important; } }
.topbar-banner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100%;
  padding: 6px 20px;
}
.topbar-banner-img {
  height: 100%;
  max-height: 52px;
  width: auto;
  object-fit: contain;
  display: block;
}
.menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
}
.page-title { font-size: 1.3rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.topbar-clock { font-size: 0.87rem; color: var(--text-secondary); font-weight: 500; font-variant-numeric: tabular-nums; }
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; color: white;
}

/* ── Employee Avatars ────────────────────────────────────── */
.emp-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: white;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.emp-avatar-sm img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.emp-avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.4rem; color: white;
  overflow: hidden;
  border: 3px solid var(--primary);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.emp-avatar-lg img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ── Page Container ─────────────────────────────────────── */
.page-container {
  padding: 28px;
  flex: 1;
  animation: fadeIn 0.35s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: linear-gradient(135deg, rgba(6,10,28,0.88), rgba(4,7,20,0.92));
  border: 1px solid rgba(50, 90, 180, 0.15);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.35s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  opacity: 0;
  transition: opacity 0.3s;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230,81,0,0.08) 0%, transparent 70%);
  transition: opacity 0.3s;
  opacity: 0;
}
.stat-card:hover { border-color: rgba(230,81,0,0.45); transform: translateY(-4px); box-shadow: 0 8px 40px rgba(0,0,60,0.5), 0 0 20px rgba(230,81,0,0.12); }
.stat-card:hover::before { opacity: 1; }
.stat-card:hover::after { opacity: 1; }
/* HR status card — click-to-filter */
.hr-status-card { cursor: pointer; }
.hr-status-card.hr-card-active {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary), 0 6px 24px rgba(230,81,0,0.18) !important;
  transform: translateY(-3px);
}
.hr-status-card.hr-card-active::before { opacity: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.stat-value { font-size: 2.2rem; font-weight: 900; color: var(--text-primary); }
.stat-value.orange {
  color: var(--primary-light);
  text-shadow: 0 0 12px rgba(230,81,0,0.30);
}

/* ── Section Card ───────────────────────────────────────── */
.section-card {
  background: linear-gradient(135deg, rgba(6,10,28,0.88), rgba(4,7,20,0.92));
  border: 1px solid rgba(50, 90, 180, 0.15);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 32px rgba(0,0,20,0.5);
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  width: 4px; height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

/* ── Table ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table th {
  background: var(--bg-input);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
  transition: background 0.15s;
}
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.87rem;
  border: none;
  transition: all 0.25s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 25px var(--primary-glow); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success   { background: rgba(0, 200, 83, 0.15); color: var(--success); }
.badge-warning   { background: rgba(255, 214, 0, 0.15); color: var(--warning); }
.badge-danger    { background: rgba(255, 23, 68, 0.12); color: var(--danger); }
.badge-info      { background: rgba(68, 138, 255, 0.15); color: var(--info); }
.badge-primary   { background: rgba(230, 81, 0, 0.15); color: var(--primary-light); }
.badge-secondary { background: rgba(120, 120, 140, 0.18); color: var(--text-secondary); }

/* ── Online/Offline indicator ────────────────────────── */
.online-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: rgba(120, 120, 140, 0.5); margin-right: 5px; vertical-align: middle;
}
.online-dot.online {
  background: #2ecc71;
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.8);
}
.online-label { font-size: 0.72rem; color: var(--text-secondary); vertical-align: middle; }
.online-label.online { color: #2ecc71; font-weight: 600; }

/* ── Trình sửa ảnh avatar ────────────────────────────── */
.imgedit-toggle.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Bảng công tháng ─────────────────────────────────── */
.bc-table th.bc-day { width: 30px; min-width: 30px; padding: 4px 2px; text-align: center; font-size: 0.68rem; line-height: 1.2; }
.bc-table td.bc-cell { width: 30px; min-width: 30px; padding: 4px 2px; text-align: center; font-size: 0.72rem; font-weight: 600; }
.bc-table .bc-sun { background: rgba(255, 214, 0, 0.07); }
.bc-table th.bc-today { background: rgba(230, 81, 0, 0.25); border-radius: 4px; }
.bc-table td.bc-edit { cursor: pointer; }
.bc-table td.bc-edit:hover { background: rgba(230, 81, 0, 0.18); outline: 1px solid var(--primary); }
.bc-table td.bc-p { color: var(--info); }
.bc-table td.bc-o { color: var(--danger); }

/* ── HR filter active button ─────────────────────────── */
#hrSubTabs .active-filter {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Settings sidebar button hover ───────────────────── */
.settings-cat-btn:hover { background: var(--bg-card-hover) !important; color: var(--text-primary) !important; }

/* Settings table — dòng đang chỉnh sửa */
tr.editing-row { background: rgba(230, 81, 0, 0.06); }
.sval-input:focus { outline: none; }

/* Drag-and-drop Settings */
tr[draggable="true"] { cursor: default; }
tr[draggable="true"] td:first-child { cursor: grab; }
tr[draggable="true"]:active td:first-child { cursor: grabbing; }
tr.dnd-over { outline: 2px solid var(--primary); outline-offset: -2px; background: rgba(230,81,0,0.08); }

/* Toast */
#toastContainer { pointer-events: none; }
#toastContainer > div { pointer-events: auto; }

/* ── Tabs within modal (emp detail) ──────────────────── */
#empDetailTabs { border-bottom: 1px solid var(--border); margin-bottom: 0; }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal có thể kéo mở rộng */
.modal-resizable {
  resize: horizontal;
  overflow: auto;
  min-width: 640px;
  max-width: min(860px, 92vw) !important;
  width: min(860px, 92vw);
}
.modal-resizable::-webkit-resizer {
  background: var(--primary);
  border-radius: 0 0 var(--radius-sm) 0;
}
/* Sub-modal (level 2) */
#modalAddDoc.modal-overlay { z-index: 2100; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 1.15rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px; }
.tab-btn {
  padding: 8px 18px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600;
  background: none; border: none;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ── Chat AI ────────────────────────────────────────────── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-height) - 80px); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-msg {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.93rem;
  line-height: 1.6;
  animation: fadeIn 0.3s;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai {
  align-self: flex-start;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-input-bar {
  display: flex; gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 0 0 var(--radius) var(--radius);
}
.chat-input-bar input { flex: 1; }

/* ── Utility App Cards ──────────────────────────────────── */
.util-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.util-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}
.util-card:hover { border-color: var(--primary); transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.util-card .icon { font-size: 2.5rem; margin-bottom: 12px; }
.util-card .title { font-weight: 700; margin-bottom: 6px; }
.util-card .desc { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Loading Spinner ────────────────────────────────────── */
.loading-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px; color: var(--text-secondary); }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search Bar ─────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-bar input { max-width: 320px; }

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }

/* ── Charts ─────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; margin-top: 8px; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  width: 100%; height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-container { padding: 16px; }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Drop Zone ──────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text-secondary);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(230, 81, 0, 0.05);
  color: var(--primary-light);
}

/* ── Login Modal & Dropdown ────────────────────────────── */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 950;
  color: white;
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
}
.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.login-desc {
  font-size: 0.87rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.login-form-group {
  margin-bottom: 18px;
  text-align: left;
}
.login-form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 6px;
}
/* ── Auth Overlay ───────────────────────────────────────────── */
@keyframes authFadeIn {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes authFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-primary, #f4f6f9);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: authFadeIn 0.25s ease;
  /* Chặn tương tác phía sau */
  pointer-events: all;
}

.auth-card {
  background: var(--bg-card, #fff);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: authCardIn 0.35s ease;
}

.auth-welcome-card {
  max-width: 440px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 6px;
}

.auth-company {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 8px;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-bottom: 28px;
}

.auth-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* Welcome state */
.auth-avatar-wrap {
  margin: 20px 0 16px;
}

.auth-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light, #e64a19));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(230,81,0,0.25);
}

.auth-welcome-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.auth-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-role-dept {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-countdown-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 16px;
}

.auth-countdown-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.auth-countdown-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.auth-proceed-btn {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

/* No account / No access states */
.auth-icon-wrap {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.auth-icon-warn { filter: none; }
.auth-icon-deny { filter: none; }

.auth-status-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 8px 0 12px;
}

.auth-status-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Dropdown Container */
.user-dropdown-container {
  position: relative;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 0;
  display: none;
  z-index: 1000;
  animation: dropdownFade 0.2s ease;
}
.user-dropdown.show {
  display: block;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-header {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  text-align: left;
}
.dropdown-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.dropdown-user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}
.dropdown-item:hover {
  background: var(--bg-card-hover);
  color: var(--primary-light);
}
.dropdown-item.logout {
  color: var(--danger);
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
}
.dropdown-item.logout:hover {
  background: rgba(255, 23, 68, 0.05);
  color: var(--danger);
}

/* ── Personal Profile ──────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}
.profile-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  position: sticky;
  top: calc(var(--topbar-height) + 28px);
}
.profile-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.profile-avatar-container {
  width: 180px;
  height: 240px;
  margin: 0 auto 16px;
  position: relative;
}
.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
  border: 4px solid var(--border);
  object-fit: cover;
}
.profile-details-name {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.profile-details-role {
  font-size: 0.87rem;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 20px;
}
.profile-meta-list {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.profile-meta-item {
  margin-bottom: 12px;
}
.profile-meta-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}
.profile-meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-all;
}
.profile-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.profile-skills .tag {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.profile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.profile-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-card-title::before {
  content: '';
  width: 4px; height: 16px;
  background: var(--primary);
  border-radius: 2px;
}
.profile-cert-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.profile-cert-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.profile-cert-name {
  font-weight: 600;
  font-size: 0.93rem;
  text-align: left;
}
.profile-cert-date {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
  text-align: left;
}
.profile-project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-project-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
}
.profile-project-code {
  font-size: 0.78rem;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 4px;
}
.profile-project-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.profile-project-role {
  font-size: 0.83rem;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-sidebar {
    position: static;
  }
  .profile-project-grid {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════════════════════════
   NOTIFICATION BELL
══════════════════════════════════════════════════════════════ */
.notif-bell-container {
  position: relative;
  display: flex;
  align-items: center;
}
.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.notif-bell:hover { background: var(--bg-input); color: var(--text-primary); }
.notif-bell.has-notif { color: var(--primary-light); }
.notif-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 16px; height: 16px;
  background: #E65100;
  color: white;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  overflow: hidden;
  max-height: 420px;
  display: flex;
  flex-direction: column;
}
.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.notif-list {
  overflow-y: auto;
  flex: 1;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.notif-item:hover { background: var(--bg-input); }
.notif-item.notif-deadline_overdue { border-left: 3px solid #C62828; }
.notif-item.notif-deadline_approaching { border-left: 3px solid #F57F17; }
.notif-item.notif-doc_assigned { border-left: 3px solid #1565C0; }
.notif-item.notif-system { border-left: 3px solid #555; }
.notif-icon { font-size: 18px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   VĂN BẢN — Priority & Deadline badges
══════════════════════════════════════════════════════════════ */
.vb-priority {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}
.priority-hot    { background: #3a0800; color: #FF5722; border: 1px solid #FF5722; }
.priority-urgent { background: #2a1500; color: #FF9800; border: 1px solid #FF9800; }
.priority-normal { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }
.priority-archive{ background: #0a0a1a; color: #607D8B; border: 1px solid #37474F; }

.vb-deadline {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}
.vb-deadline.overdue { background: #3a0000; color: #EF9A9A; }
.vb-deadline.soon    { background: #2a1500; color: #FFD580; }
.vb-deadline.ok      { background: #001a0a; color: #A5D6A7; }

/* ── File status badges ─────────────────────────────────────── */
.vb-file-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.file-ok       { background: #001a0a; color: #A5D6A7; }
.file-missing  { background: #2a0000; color: #EF9A9A; }
.file-modified { background: #2a2000; color: #FFF176; }
.file-none     { background: var(--bg-input); color: #555; }

/* ── Filename preview ─────────────────────────────────────── */
.filename-preview {
  margin-top: 4px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg-input);
  border-radius: 4px;
  min-height: 22px;
  transition: color 0.2s;
}

/* ══ MODULE TRỢ LÝ AI ═══════════════════════════════════════ */
.ai-quota-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; margin-bottom: 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
}
.ai-quota-label { white-space: nowrap; color: var(--text-secondary); }
.ai-quota-bar {
  flex: 1; height: 10px; min-width: 120px;
  background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden;
}
.ai-quota-fill {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  transition: width 0.4s;
}
.ai-quota-fill.warn   { background: linear-gradient(90deg, #f39c12, #e67e22); }
.ai-quota-fill.danger { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.ai-quota-pct { font-weight: 700; min-width: 40px; }
.ai-quota-detail { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

.ai-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ai-tab {
  padding: 8px 14px; cursor: pointer; user-select: none;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  transition: all 0.15s;
}
.ai-tab:hover { border-color: var(--accent, #4a90d9); }
.ai-tab.active {
  background: var(--accent, #4a90d9); color: #fff;
  border-color: var(--accent, #4a90d9); font-weight: 600;
}
.ai-tab-settings { margin-left: auto; }

.ai-layout { display: flex; gap: 14px; align-items: stretch; }
.ai-sidebar { width: 230px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }
.ai-convo-list {
  flex: 1; overflow-y: auto; max-height: 60vh;
  display: flex; flex-direction: column; gap: 4px;
}
.ai-convo-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 10px; cursor: pointer; font-size: 12.5px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ai-convo-item:hover { border-color: var(--accent, #4a90d9); }
.ai-convo-item.active { border-color: var(--accent, #4a90d9); background: rgba(74,144,217,0.15); }
.ai-convo-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ai-convo-del { opacity: 0.4; cursor: pointer; }
.ai-convo-del:hover { opacity: 1; }
.ai-chat-panel { flex: 1; min-width: 0; }

.ai-attach-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 8px 16px; border-top: 1px solid var(--border);
}
.ai-file-chip {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 10px; font-size: 12px;
}
.ai-file-chip b { cursor: pointer; margin-left: 4px; color: #e74c3c; }
.ai-msg-files { margin-top: 6px; font-size: 11.5px; opacity: 0.75; }
.ai-gen-img {
  display: block; max-width: 320px; max-height: 240px;
  margin-top: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.ai-muted { color: var(--text-secondary); font-size: 12.5px; }
.ai-pre {
  background: rgba(0,0,0,0.35); padding: 10px; border-radius: 6px;
  overflow-x: auto; font-size: 12px; margin: 6px 0; white-space: pre-wrap;
}
.ai-code { background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-li { display: block; padding-left: 10px; }
.ai-h { display: block; margin-top: 6px; }

.ai-settings-grid { display: flex; flex-direction: column; gap: 14px; }
.ai-key-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 6px;
  background: var(--bg-input); border-radius: var(--radius-sm); font-size: 13px;
}

/* ── Tab Chuyển đổi file ───────────────────────────────────── */
.ai-convert-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  align-items: start;
}
.ai-check-row { display: flex; gap: 28px; flex-wrap: wrap; }
.ai-check-row label, .ai-check-col label {
  cursor: pointer; font-size: 13px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  justify-content: flex-start;
}
.ai-check-col { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
/* Ghi đè CSS toàn cục (input width 100%) — checkbox/radio phải nằm sát text */
.ai-check-row input[type="radio"],
.ai-check-col input[type="checkbox"] {
  width: auto !important; min-width: 0 !important; flex: 0 0 auto; margin: 0;
}
.ai-cv-note {
  padding: 7px 12px; margin-top: 6px; font-size: 12.5px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.ai-cv-note.ok   { border-color: rgba(46,204,113,0.5); }
.ai-cv-note.warn { border-color: rgba(243,156,18,0.6); }
.ai-red { color: #e74c3c; font-size: 12.5px; line-height: 1.5; margin-top: 4px; }

@media (max-width: 860px) {
  .ai-layout { flex-direction: column; }
  .ai-sidebar { width: 100%; }
  .ai-convo-list { max-height: 180px; }
  .ai-quota-detail { display: none; }
  .ai-convert-grid { grid-template-columns: 1fr; }
}

/* ── Widget chúc mừng sinh nhật (topbar — mọi trang) ───────── */
.bday-topbar {
  display: flex; align-items: center;
  max-width: 320px; min-width: 0; margin-right: 14px;
  overflow: hidden; /* che hiệu ứng trượt vào */
}
.bday-inner { display: flex; align-items: center; gap: 9px; min-width: 0; animation: bdaySlideIn 0.5s ease; }
.bday-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #FF8A50);
  color: #fff; font-weight: 700; font-size: 13px;
  border: 2px solid var(--border);
}
.bday-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bday-avatar span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.bday-bounce { animation: bdayBounce 0.9s ease-in-out infinite; }
.bday-today .bday-avatar { border-color: #FFD54F; box-shadow: 0 0 10px rgba(255, 213, 79, 0.5); }
.bday-text { min-width: 0; }
.bday-title {
  font-size: 10.5px; color: var(--text-secondary); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bday-today .bday-title { color: #FFD54F; font-weight: 700; }
.bday-name {
  font-weight: 700; font-size: 12.5px; color: var(--text-primary); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bday-date { font-size: 11px; color: var(--text-secondary); font-weight: 400; }
@keyframes bdaySlideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes bdayBounce {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(-5px) scale(1.07); }
  60%      { transform: translateY(-2px); }
}
@media (max-width: 860px) {
  .bday-topbar { display: none; } /* màn hình hẹp: topbar không đủ chỗ */
}

/* ══════════════════════════════════════════════════════════════
   MODULE ĐÀO TẠO (LMS nội bộ)
══════════════════════════════════════════════════════════════ */

/* Trang chính */
.dt-page { display: flex; flex-direction: column; gap: 0; height: 100%; }

/* Tabs điều hướng */
.dt-tabs {
  display: flex; gap: 4px; padding: 4px 0 0;
  border-bottom: 2px solid var(--border); margin-bottom: 24px;
}
.dt-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.2s;
}
.dt-tab:hover { color: var(--accent); background: rgba(99,102,241,0.06); }
.dt-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(99,102,241,0.08); }

/* Loading */
.dt-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px; color: var(--text-muted); }

/* Trạng thái rỗng */
.dt-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 24px; text-align: center; color: var(--text-secondary);
}
.dt-empty h3 { margin: 0; font-size: 1.1rem; color: var(--text-primary); }
.dt-empty p { margin: 0; font-size: 0.9rem; }

/* Thanh thống kê */
.dt-stats-bar {
  display: flex; gap: 12px; padding: 20px 24px;
  background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: 20px;
}
.dt-stat { flex: 1; text-align: center; }
.dt-stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.dt-stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Filter tabs */
.dt-filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.dt-filter-btn {
  padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-secondary); font-size: 0.84rem;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.dt-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.dt-filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge-sm {
  background: rgba(255,255,255,0.2); border-radius: 10px;
  padding: 1px 7px; font-size: 0.75rem; font-weight: 600;
}
.dt-filter-btn:not(.active) .badge-sm { background: var(--border); color: var(--text-muted); }

/* Grid khoá học */
.dt-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Thẻ khoá học */
.dt-course-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: all 0.25s; display: flex; flex-direction: column;
}
.dt-course-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); border-color: var(--accent-dark); }
.dt-card-thumb {
  height: 140px; position: relative; display: flex;
  align-items: flex-end; padding: 12px;
}
.dt-card-icon {
  font-size: 2.5rem; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-60%);
}
.dt-card-status-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 600;
  backdrop-filter: blur(8px);
}
.dt-card-status-badge.done { background: rgba(16,185,129,0.85); color: #fff; }
.dt-card-status-badge.inprogress { background: rgba(245,158,11,0.85); color: #fff; }
.dt-card-status-badge.new { background: rgba(0,0,0,0.5); color: rgba(255,255,255,0.8); }
.dt-required-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 600;
  background: rgba(239,68,68,0.85); color: #fff;
}
.dt-card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dt-card-category { font-size: 0.72rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.dt-card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.dt-card-desc { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.dt-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.dt-deadline { padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 500; background: rgba(99,102,241,0.12); color: var(--accent); }
.dt-deadline.urgent { background: rgba(245,158,11,0.12); color: var(--warning); }
.dt-deadline.overdue { background: rgba(239,68,68,0.12); color: var(--danger); }
.dt-progress-wrap { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.dt-progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dt-progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.dt-progress-fill.done { background: var(--success); }
.dt-progress-fill.inprogress { background: var(--warning); }
.dt-progress-fill.new { background: var(--border); }
.dt-progress-pct { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); min-width: 32px; text-align: right; }
.dt-card-btn { margin-top: 8px; width: 100%; }

/* ── Player ─────────────────────────────────────────────────── */
.dt-player-wrap {
  display: flex; height: calc(100vh - 0px); overflow: hidden;
}

.dt-player-sidebar {
  width: 320px; min-width: 280px; max-width: 320px; flex-shrink: 0;
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}

.dt-player-course-header {
  padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dt-back-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.82rem; cursor: pointer; margin-bottom: 12px;
  transition: all 0.2s;
}
.dt-back-btn:hover { color: var(--accent); border-color: var(--accent); }
.dt-player-course-title {
  font-size: 0.92rem; font-weight: 600; color: var(--text-primary);
  line-height: 1.3; margin-bottom: 12px;
}
.dt-player-stats {
  display: flex; gap: 0; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.dt-player-stat {
  flex: 1; padding: 8px 4px; text-align: center; border-right: 1px solid var(--border);
}
.dt-player-stat:last-child { border-right: none; }
.dt-player-stat span { display: block; font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.dt-player-stat small { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; }
.dt-sidebar-progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.dt-sidebar-progress-fill { height: 100%; background: var(--success); border-radius: 2px; transition: width 0.5s ease; }

.dt-lesson-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.dt-lesson-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px;
  cursor: pointer; transition: background 0.15s; border-left: 3px solid transparent;
}
.dt-lesson-item:hover { background: rgba(255,255,255,0.04); }
.dt-lesson-item.active { background: rgba(99,102,241,0.1); border-left-color: var(--accent); }
.dt-lesson-item.done { opacity: 0.8; }
.dt-lesson-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-input); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0; color: var(--text-muted);
}
.dt-lesson-item.done .dt-lesson-check {
  background: var(--success); border-color: var(--success); color: #fff; font-size: 0.8rem;
}
.dt-lesson-item.active .dt-lesson-check { border-color: var(--accent); color: var(--accent); }
.dt-lesson-info { flex: 1; min-width: 0; }
.dt-lesson-title { font-size: 0.86rem; font-weight: 500; color: var(--text-primary); line-height: 1.3; }
.dt-lesson-type { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.dt-player-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-primary);
}
.dt-player-topbar {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.dt-player-lesson-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.dt-player-content { flex: 1; overflow-y: auto; padding: 24px; }

/* Nội dung video */
.dt-video-wrap {
  border-radius: var(--radius); overflow: hidden; background: #000;
  aspect-ratio: 16/9; max-height: 72vh; width: 100%;
}
.dt-video-wrap video, .dt-video-wrap iframe {
  width: 100%; height: 100%; display: block; border: none;
  /* contain: luôn hiện trọn khung video gốc, không cắt với mọi tỉ lệ */
  object-fit: contain; background: #000;
}

/* Nội dung tài liệu */
.dt-doc-wrap { display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 500px; }
.dt-doc-actions { display: flex; justify-content: flex-end; }
.dt-doc-frame { flex: 1; border: none; border-radius: var(--radius); background: var(--bg-card); min-height: 500px; width: 100%; }

/* Nội dung text */
.dt-text-content {
  max-width: 800px; line-height: 1.8; color: var(--text-primary);
  font-size: 0.95rem; padding: 8px 0;
}
.dt-text-content h2, .dt-text-content h3 { color: var(--accent); margin-top: 24px; }
.dt-text-content p { margin-bottom: 12px; }

/* Nav bài học */
.dt-player-nav {
  padding: 12px 24px; border-top: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ── Quiz ────────────────────────────────────────────────────── */
.dt-quiz-wrap { max-width: 700px; }
.dt-quiz-header { margin-bottom: 24px; }
.dt-quiz-header h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.dt-quiz-header p { color: var(--text-muted); font-size: 0.88rem; margin: 0; }
.dt-quiz-question {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.dt-quiz-q-num { font-size: 0.75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.dt-quiz-q-text { font-size: 0.95rem; font-weight: 500; margin-bottom: 14px; line-height: 1.4; }
.dt-quiz-options { display: flex; flex-direction: column; gap: 8px; }
.dt-quiz-option {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
}
.dt-quiz-option:hover { border-color: var(--accent); background: rgba(99,102,241,0.06); }
.dt-quiz-option input[type=radio]:checked + span { color: var(--accent); font-weight: 500; }
.dt-quiz-footer { padding-top: 8px; }

.dt-quiz-result {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center; gap: 12px;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.dt-quiz-score { font-size: 4rem; font-weight: 800; line-height: 1; }
.dt-quiz-score small { font-size: 1.5rem; font-weight: 400; color: var(--text-muted); }
.dt-quiz-result.passed { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.05); }
.dt-quiz-result.passed .dt-quiz-score { color: var(--success); }
.dt-quiz-result.failed { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.dt-quiz-result.failed .dt-quiz-score { color: var(--danger); }
.dt-quiz-result.done { border-color: var(--border); }
.dt-quiz-result.done .dt-quiz-score { color: var(--accent); }
.dt-quiz-result-label { font-size: 1.3rem; font-weight: 600; }

/* Quiz editor */
.dt-quiz-q-editor {
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* ── Manage ──────────────────────────────────────────────────── */
.dt-manage-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.dt-manage-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.dt-manage-list { overflow-x: auto; }

/* ── Báo cáo ────────────────────────────────────────────────── */
.dt-report { }
.dt-activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.dt-activity-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px;
  border-radius: var(--radius-sm); background: var(--bg-input);
}
.dt-activity-icon {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(16,185,129,0.15);
  color: var(--success); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; flex-shrink: 0; font-weight: 700;
}

/* ── Trang chi tiết khoá học (v2) ───────────────────────────── */
.dt-detail-head-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.dt-detail-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.dt-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dt-detail-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

/* Danh sách bài giảng kéo-thả */
.dt-lesson-reorder { display: flex; flex-direction: column; gap: 8px; }
.dt-reorder-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.dt-reorder-item.dragging { opacity: 0.5; border-style: dashed; }
.dt-drag-handle { cursor: grab; color: var(--text-muted); font-size: 1.1rem; }
.dt-reorder-idx { width: 22px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.dt-reorder-icon { width: 24px; text-align: center; }
.dt-reorder-info { flex: 1; min-width: 0; }
.dt-reorder-title { font-weight: 600; font-size: 0.92rem; }
.dt-reorder-type { font-size: 0.78rem; color: var(--text-muted); }
.dt-reorder-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ── Lesson Builder ─────────────────────────────────────────── */
.dt-type-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.dt-type-opt {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.88rem; transition: all 0.15s; user-select: none;
}
.dt-type-opt:hover { border-color: var(--accent); }
.dt-type-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.dt-panel { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-top: 6px; }
.dt-radio-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; }
.dt-radio-row label { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; cursor: pointer; }
.dt-radio-row input[type=radio] { width: auto !important; }
.dt-doc-list { display: flex; flex-direction: column; gap: 6px; }
.dt-doc-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.86rem; }
.dt-quick summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.dt-qedit { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.dt-qedit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dt-qedit textarea { margin-bottom: 8px; }
.qe-options { display: flex; flex-direction: column; gap: 6px; }
.qe-opt { display: flex; align-items: center; gap: 8px; }
.qe-opt .qe-correct { width: auto !important; flex-shrink: 0; }
.qe-opt .qe-opt-text { flex: 1; }
.qe-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.9rem; }

/* ── Player: media + toàn màn hình ──────────────────────────── */
.dt-media-wrap { position: relative; width: 100%; }
.dt-media-wrap:fullscreen { background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.dt-media-wrap:fullscreen .dt-video-wrap,
.dt-media-wrap:fullscreen .dt-doc-frame-wrap { max-height: 92vh; height: 92vh; width: 100%; aspect-ratio: auto; }
.dt-fs-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 0.8rem; cursor: pointer;
}
.dt-fs-btn:hover { background: rgba(0,0,0,0.85); }
.dt-doc-frame-wrap { position: relative; display: flex; flex-direction: column; min-height: 520px; }
.dt-doc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dt-doc-tab { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); cursor: pointer; font-size: 0.84rem; }
.dt-doc-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.dt-doc-dl { position: absolute; bottom: 8px; right: 8px; z-index: 3; }

/* Quiz: xem lại đáp án */
.dt-quiz-option.correct { border-color: var(--success); background: rgba(16,185,129,0.1); color: var(--success); font-weight: 600; }
.dt-quiz-explain { margin-top: 10px; padding: 10px 12px; background: rgba(99,102,241,0.06); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); font-size: 0.86rem; }

/* Tự luận */
.dt-essay-wrap { max-width: 760px; }
.dt-essay-prompt { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; line-height: 1.6; white-space: pre-wrap; }
.dt-essay-answer { background: var(--bg-input); border-radius: var(--radius-sm); padding: 10px; margin-top: 6px; font-size: 0.86rem; white-space: pre-wrap; }
.dt-note { padding: 10px 12px; background: rgba(245,158,11,0.1); border-radius: var(--radius-sm); font-size: 0.86rem; }

/* Cột nội dung player (canh giữa, giới hạn bề ngang cho gọn) */
.dt-content-col { max-width: 960px; margin: 0 auto; }

/* Khối thông tin + ghi chú dưới video */
.dt-extras { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
.dt-extras-tabs { display: flex; border-bottom: 1px solid var(--border); }
.dt-ex-tab { padding: 10px 18px; background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 0.9rem; border-bottom: 2px solid transparent; }
.dt-ex-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dt-ex-pane { padding: 16px; }
.dt-ex-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.dt-ex-chip { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; min-width: 110px; }
.dt-ex-chip span { display: block; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dt-ex-chip b { font-size: 0.95rem; }
.dt-ex-hint { padding: 10px 12px; background: rgba(99,102,241,0.06); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); font-size: 0.86rem; margin-bottom: 12px; }
.dt-ex-next { font-size: 0.9rem; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Responsive player */
@media (max-width: 860px) {
  .dt-player-wrap { flex-direction: column; }
  .dt-player-sidebar { width: 100%; max-width: none; height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .dt-lesson-list { max-height: 120px; }
  .dt-course-grid { grid-template-columns: 1fr 1fr; }
  .dt-detail-head-row { flex-direction: column; }
}
@media (max-width: 600px) {
  .dt-course-grid { grid-template-columns: 1fr; }
  .dt-stats-bar { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   LOẠI BÀI HỢP NHẤT 'bai' — player 2 cột + builder
   ══════════════════════════════════════════════════════════════ */
.dt-bai { display:grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,1fr); gap:16px; align-items:start; }
.dt-bai-left { min-width:0; }
.dt-bai-right { display:flex; flex-direction:column; gap:14px; position:sticky; top:8px; }
.dt-bai-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }
.dt-bai-tab { padding:8px 14px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; color:var(--text-secondary); font-size:.88rem; }
.dt-bai-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }
.dt-bai-filebar { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; }
.dt-bai-filebar:empty { display:none; }
.dt-bai-file { padding:5px 10px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; font-size:.82rem; color:var(--text-secondary); }
.dt-bai-file.active { border-color:var(--accent); color:var(--accent); font-weight:600; }
.dt-bai-viewer { border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-card); min-height:440px; padding:10px; }
.dt-bai-article { max-height:580px; overflow:auto; padding:8px 14px; line-height:1.6; }
.dt-bai-status { margin-top:12px; }
.dt-bai-stbar { display:flex; flex-wrap:wrap; gap:8px; }
.dt-bai-st { font-size:.82rem; padding:5px 11px; border-radius:20px; background:var(--bg-input); border:1px solid var(--border); color:var(--text-secondary); }
.dt-bai-st.ok { background:rgba(16,185,129,.12); border-color:var(--success); color:var(--success); }
/* Trình xem PDF phân trang */
.dt-pdf-wrap { display:flex; flex-direction:column; align-items:center; }
.dt-pdf-canvas-wrap { width:100%; overflow:auto; text-align:center; background:#1f2330; border-radius:var(--radius-sm); }
#dtPdfCanvas { max-width:100%; height:auto; box-shadow:0 2px 12px rgba(0,0,0,.35); margin:8px auto; display:block; }
.dt-pdf-bar { display:flex; gap:8px; align-items:center; justify-content:center; margin-top:10px; flex-wrap:wrap; }
.dt-pdf-count { font-size:.85rem; color:var(--text-secondary); min-width:96px; text-align:center; }
.dt-pdf-loading { padding:40px; text-align:center; color:var(--text-muted); }
.dt-pdf-fallbar { display:flex; gap:8px; justify-content:center; margin-top:8px; flex-wrap:wrap; }
.dt-doc-frame { width:100%; height:540px; border:none; border-radius:var(--radius-sm); background:#fff; }
/* Toàn màn hình cho viewer Bài giảng/Slide */
.dt-bai-viewer:fullscreen, .dt-bai-viewer:-webkit-full-screen { background:var(--bg-dark); padding:10px; overflow:auto; display:flex; flex-direction:column; }
.dt-bai-viewer:fullscreen .dt-media-wrap, .dt-bai-viewer:-webkit-full-screen .dt-media-wrap { flex:1; }
.dt-bai-viewer:fullscreen .dt-doc-frame, .dt-bai-viewer:-webkit-full-screen .dt-doc-frame { height:94vh; }
.dt-bai-viewer:fullscreen .dt-pdf-canvas-wrap, .dt-bai-viewer:-webkit-full-screen .dt-pdf-canvas-wrap { flex:1; }
.dt-bai-viewer:fullscreen #dtPdfCanvas, .dt-bai-viewer:-webkit-full-screen #dtPdfCanvas { max-height:90vh; }
/* Panel phải */
.dt-bai-panel { border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-card); padding:14px; }
.dt-bai-quiz { border-top:3px solid #3b82f6; max-height:540px; overflow:auto; }
.dt-bai-essay { border-top:3px solid #f59e0b; }
.dt-bai-panel-head { font-weight:600; margin-bottom:10px; display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.dt-bai-panel-head small { color:var(--text-muted); font-weight:400; font-size:.78rem; }
/* Builder */
.dt-bai-ftabs { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0 10px; }
.dt-bai-ftab { padding:7px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; font-size:.85rem; color:var(--text-secondary); }
.dt-bai-ftab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.dt-bai-fpanel { border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; margin-bottom:8px; background:var(--bg-input); }
.dt-check-row { display:flex; align-items:center; gap:8px; padding:6px 0; font-size:.9rem; cursor:pointer; }
.dt-check-row input { width:auto !important; }
.bq-q { border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px; margin-bottom:10px; background:var(--bg-card); }
.bq-opts { display:flex; flex-direction:column; gap:6px; margin:6px 0; }
.bq-opt { display:flex; align-items:center; gap:8px; }
.bq-opt-text { flex:1; }
.bq-opt .qe-del { background:none; border:none; color:var(--danger); cursor:pointer; font-size:1rem; }
/* Kết quả admin */
.dt-res-bai { border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px; margin-bottom:8px; }
.dt-res-bai summary { cursor:pointer; font-size:.92rem; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
@media (max-width: 980px){ .dt-bai { grid-template-columns:1fr; } .dt-bai-right { position:static; } }

/* ══════════════════════════════════════════════════════════════
   THƯ VIỆN PHÁP LUẬT v2
   ══════════════════════════════════════════════════════════════ */
.tv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tv-tab {
  padding: 10px 20px; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 0.95rem; font-weight: 500;
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.tv-tab:hover { color: var(--primary-light); }
.tv-tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* Badge trạng thái */
.tv-badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.tv-st-active  { background: rgba(0, 230, 118, 0.15); color: var(--success); }
.tv-st-pending { background: rgba(255, 215, 64, 0.15); color: var(--warning); }
.tv-st-expired { background: rgba(255, 82, 82, 0.15); color: var(--danger); }
.tv-st-draft   { background: rgba(122, 156, 200, 0.15); color: var(--text-secondary); }
.tv-status-live { font-size: 0.84rem; margin: -4px 0 4px; }
.tv-status-note { font-size: 0.74rem; color: var(--text-secondary); }

/* Khối thông báo */
.tv-alert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tv-alert { margin-bottom: 0; }
.tv-alert-row { padding: 8px 0; border-top: 1px solid var(--border); cursor: pointer; transition: background 0.12s; }
.tv-alert-row:hover { background: var(--bg-card-hover); }
.tv-alert-title { font-size: 0.9rem; font-weight: 500; }
.tv-alert-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.tv-alert-empty { font-size: 0.84rem; color: var(--text-secondary); padding: 10px 0 2px; }
@media (max-width: 760px) { .tv-alert-grid { grid-template-columns: 1fr; } }

/* Ghi chú / bài viết */
.tv-notes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tv-notes-list { display: flex; flex-direction: column; gap: 14px; }
.tv-note { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--bg-input); }
.tv-note-title { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; }
.tv-note-meta { font-size: 0.76rem; color: var(--text-secondary); margin-bottom: 8px; }
.tv-note-body { font-size: 0.92rem; line-height: 1.65; }

/* Chi tiết văn bản */
.tv-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.tv-detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.tv-detail-lbl { font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.tv-detail-extra { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.tv-detail-extra-head {
  font-size: 0.95rem; font-weight: 600; margin-bottom: 10px;
  padding-left: 10px; border-left: 3px solid var(--primary);
}
.tv-detail-extra-empty { font-size: 0.86rem; color: var(--text-secondary); }
@media (max-width: 600px) { .tv-detail-grid { grid-template-columns: 1fr; } }

/* Quản lý bài viết (kéo-thả) */
.tv-reorder { display: flex; flex-direction: column; gap: 8px; }
.tv-reorder-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input);
}
.tv-reorder-item.dragging { opacity: 0.5; border-color: var(--primary); }
.tv-reorder-grip { cursor: grab; color: var(--text-secondary); font-size: 1.1rem; letter-spacing: -3px; }
.tv-reorder-idx {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--text-secondary); font-size: 0.78rem;
}
.tv-reorder-info { flex: 1; min-width: 0; }
.tv-reorder-title { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-reorder-meta { font-size: 0.74rem; color: var(--text-secondary); }
.tv-hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 12px; }

/* Trình soạn thảo rich-text */
.tv-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tv-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 8px; background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.tv-tb-btn {
  min-width: 30px; height: 30px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.tv-tb-btn:hover { background: var(--bg-input); color: var(--primary-light); border-color: var(--border); }
.tv-tb-sep { width: 1px; height: 18px; background: var(--border-light); margin: 0 4px; }
.tv-editarea {
  min-height: 180px; max-height: 50vh; overflow-y: auto; padding: 14px;
  background: var(--bg-input); font-size: 0.92rem; line-height: 1.7; outline: none;
}
.tv-editarea:focus { box-shadow: inset 0 0 0 2px var(--primary-glow); }

/* Nội dung rich-text khi render */
.rich-content h2 { font-size: 1.15rem; font-weight: 600; margin: 14px 0 6px; }
.rich-content h3 { font-size: 1.02rem; font-weight: 600; margin: 12px 0 5px; }
.rich-content p { margin: 6px 0; }
.rich-content ul, .rich-content ol { margin: 6px 0 6px 22px; }
.rich-content li { margin: 3px 0; }
.rich-content blockquote {
  margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--primary);
  background: rgba(230, 81, 0, 0.06); color: var(--text-secondary);
}
.rich-content a { color: var(--primary-light); text-decoration: underline; }
.rich-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 6px 0; }
.tv-embed-wrap { margin: 10px 0; }
.tv-embed-pdf { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.rich-content table, .tv-ct { border-collapse: collapse; margin: 8px 0; width: auto; }
.rich-content table td, .tv-ct td { border: 1px solid var(--border-light); padding: 6px 10px; min-width: 60px; }
.tv-file-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; margin: 2px 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.84rem; color: var(--primary-light); text-decoration: none;
}

/* Phụ lục đính kèm */
.tv-att-add { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.tv-att-add input { flex: 1; }
.tv-att-add .btn { white-space: nowrap; flex-shrink: 0; }
.tv-att-hint { font-size: 0.76rem; color: var(--text-secondary); margin-top: 6px; }
.tv-name-preview { font-size: 0.78rem; color: var(--cyan); margin-top: 6px; font-family: var(--font-mono, monospace); word-break: break-all; }
.tv-att-list { display: flex; flex-direction: column; gap: 6px; }
.tv-att-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); }
.tv-att-name { flex: 1; min-width: 0; font-size: 0.86rem; color: var(--primary-light); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-att-name:hover { text-decoration: underline; }
.tv-att-empty { font-size: 0.82rem; color: var(--text-secondary); padding: 4px 0; }
.tv-att-badge { font-size: 0.7rem; background: rgba(0,229,255,0.18); color: var(--cyan); border-radius: 8px; padding: 0 5px; }
.tv-att-block { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.tv-att-head { font-size: 0.86rem; font-weight: 500; margin-bottom: 8px; }

/* Bảng chọn file (văn bản chính + phụ lục) */
.tv-file-list { display: flex; flex-direction: column; gap: 8px; }
.tv-file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); }
.tv-file-ic { font-size: 1.1rem; flex-shrink: 0; }
.tv-file-info { flex: 1; min-width: 0; }
.tv-file-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-file-tag { font-size: 0.74rem; color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════
   KTXD HOUSE STYLE — Lớp vỏ thẩm mỹ (chắt lọc từ taste-skill)
   Chỉ tinh chỉnh hình ảnh. KHÔNG đổi cấu trúc/HTML/JS/tính năng,
   không thêm font/CDN, không thêm animation chạy liên tục.
   Tôn trọng bản sắc Cosmic (cam × navy × cyan).
   ══════════════════════════════════════════════════════════════ */

/* 1. Đổ bóng theo tông nền (navy sâu thay đen thuần) + phân lớp tạo chiều sâu */
:root {
  --shadow-sm: 0 1px 2px rgba(2,6,23,0.35), 0 2px 10px rgba(2,6,23,0.42);
  --shadow-md: 0 2px 6px rgba(2,6,23,0.42), 0 10px 30px rgba(2,6,23,0.52);
  --shadow-lg: 0 8px 24px rgba(2,6,23,0.46), 0 24px 60px rgba(2,6,23,0.62);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Legibility: kerning, làm mượt chữ, cân chỉnh số trong bảng/đồng hồ */
body { text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; }
.data-table td, .dt-pdf-count, .topbar-clock, .dt-player-stat span { font-variant-numeric: tabular-nums; }

/* 3. Phân cấp typography sắc hơn: tracking âm nhẹ cho tiêu đề */
h1, h2, .page-title, .section-title, .dt-detail-title, .modal-title { letter-spacing: -0.012em; }
h1, .page-title, .dt-detail-title { letter-spacing: -0.02em; line-height: 1.16; }
.rich-content, .dt-bai-article { line-height: 1.7; }
.rich-content p, .dt-bai-article p { max-width: 72ch; }

/* 4. Phản hồi chạm tinh tế — chỉ transform (GPU, không tốn hiệu năng) */
.btn { transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out), background 0.18s var(--ease-out); }
.btn:active { transform: translateY(0) scale(0.975); }

/* 5. Focus a11y cho thao tác bàn phím (không ảnh hưởng dùng chuột) */
.btn:focus-visible, a:focus-visible, .dt-bai-tab:focus-visible, .dt-bai-file:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* 6. Bảng dữ liệu: chuyển nền hover mượt hơn */
.data-table tr { transition: background 0.15s var(--ease-out); }

/* 7. Thanh cuộn theo tông thương hiệu (tăng cảm giác chỉn chu) */
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); background-clip: content-box; }

/* 8. Bôi chọn chữ theo thương hiệu */
::selection { background: rgba(230,81,0,0.32); color: #fff; }

/* 9. Bo góc nhất quán cho ảnh/PDF nhúng */
.dt-doc-frame, .tv-embed-pdf, .dt-bai-viewer img, .rich-content img { border-radius: var(--radius-sm); }

/* 10. Tôn trọng người dùng tắt hiệu ứng + đảm bảo không phát sinh chuyển động ngoài ý muốn */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ── Dashboard mở rộng (Việc của tôi · Cảnh báo · Bảng tin · Châm ngôn) ── */
.dash-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,1fr); gap: 20px; margin-bottom: 24px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-sub { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin-bottom: 8px; font-weight: 600; }
.dash-list { display: flex; flex-direction: column; gap: 6px; }
.dash-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); position: relative; }
.dash-item-body { flex: 1; min-width: 0; }
.dash-item-title { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item-sub { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }
.dash-item-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.dash-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; box-shadow: 0 0 8px var(--primary-glow); }
.dash-ic { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.dash-empty { font-size: 0.86rem; color: var(--text-secondary); padding: 18px 4px; text-align: center; }
.dash-quote-card { display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.dash-quote { font-size: 1.05rem; line-height: 1.55; font-style: italic; color: var(--text-primary); border-left: 3px solid var(--primary); padding: 4px 0 4px 14px; }
.dash-quote-author { font-size: 0.82rem; font-style: normal; color: var(--text-secondary); margin-top: 8px; }
.dash-tip { display: flex; gap: 10px; align-items: flex-start; background: rgba(0,229,255,0.06); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.dash-tip-ic { font-size: 1.1rem; }
.dash-tip b { font-size: 0.86rem; }
/* Tick ẩn bài giảng trong danh sách quản lý */
.dt-hide-chk { display:inline-flex; align-items:center; gap:4px; font-size:.78rem; color:var(--text-secondary); cursor:pointer; margin-left:4px; white-space:nowrap; }
.dt-hide-chk input { width:auto !important; }
