/* ===== HỆ THỐNG QUẢN LÝ KHOA HỌC & CÔNG NGHỆ ĐẠI HỌC (KHCN-V2) =====
   DESIGN SYSTEM: DARK GLASSMORPHISM · GRADIENT PURPLE / CYAN · OFFLINE STANDALONE
   DỰA TRÊN THIẾT KẾ GỐC RESEARCH HUB VÀ MỞ RỘNG TOÀN DIỆN CHO CẤP ĐẠI HỌC */

:root {
  color-scheme: dark;
  --font-sans: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Ambient Glassmorphism Tokens */
  --bg: #060913;
  --bg-glow-1: rgba(124, 92, 255, 0.22);
  --bg-glow-2: rgba(34, 211, 238, 0.16);
  --grid-line: rgba(148, 163, 184, 0.05);

  --surface: rgba(15, 20, 36, 0.72);
  --surface-solid: #0f1424;
  --surface-raised: #151b30;
  --surface-hover: rgba(148, 163, 184, 0.08);
  --surface-active: rgba(139, 108, 255, 0.15);

  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.26);
  --border-glow: rgba(139, 108, 255, 0.4);

  --text: #e8ecf8;
  --text-2: #a4aec4;
  --text-3: #6c7692;

  /* Brand Gradients (Purple / Cyan) */
  --brand: #8b6cff;
  --brand-2: #22d3ee;
  --brand-3: #5b8cff;
  --brand-grad: linear-gradient(135deg, #8b6cff 0%, #5b8cff 50%, #22d3ee 100%);
  --brand-soft: rgba(139, 108, 255, 0.15);
  --brand-ring: rgba(139, 108, 255, 0.45);
  --on-brand: #ffffff;

  /* Stage workflow identities */
  --stage-registered: #9085e9;
  --stage-review: #d97706;
  --stage-active: #3b82f6;
  --stage-pending: #ea580c;
  --stage-done: #10b981;
  --stage-delayed: #ef4444;

  /* Status semantic */
  --status-good: #10b981;
  --status-warning: #f59e0b;
  --status-critical: #ef4444;
  --status-info: #06b6d4;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border);
  --shadow-glow: 0 0 0 1px var(--brand-ring), 0 8px 32px -8px rgba(139, 108, 255, 0.55);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 260ms;

  --sidebar-w: 268px;

  --avatar-1: linear-gradient(135deg, #8b6cff, #22d3ee);
  --avatar-2: linear-gradient(135deg, #3b82f6, #06b6d4);
  --avatar-3: linear-gradient(135deg, #f97316, #ec4899);
  --avatar-4: linear-gradient(135deg, #10b981, #3b82f6);
  --avatar-5: linear-gradient(135deg, #a855f7, #ec4899);
  --avatar-6: linear-gradient(135deg, #f59e0b, #ef4444);
}

/* Light Theme Variables */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fc;
  --bg-glow-1: rgba(124, 92, 255, 0.12);
  --bg-glow-2: rgba(8, 145, 178, 0.1);
  --grid-line: rgba(15, 23, 42, 0.045);

  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-raised: #f8fafc;
  --surface-hover: rgba(15, 23, 42, 0.05);
  --surface-active: rgba(98, 70, 234, 0.12);

  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.22);
  --border-glow: rgba(98, 70, 234, 0.4);

  --text: #0b1020;
  --text-2: #3e4862;
  --text-3: #6b758e;

  --brand: #6347ee;
  --brand-2: #0891b2;
  --brand-3: #4f6cf0;
  --brand-grad: linear-gradient(135deg, #6347ee 0%, #4f6cf0 50%, #0891b2 100%);
  --brand-soft: rgba(99, 71, 238, 0.1);
  --brand-ring: rgba(99, 71, 238, 0.35);

  --stage-registered: #5b4db8;
  --stage-review: #b45309;
  --stage-active: #2563eb;
  --stage-pending: #c2410c;
  --stage-done: #059669;
  --stage-delayed: #dc2626;

  --status-good: #059669;
  --status-warning: #d97706;
  --status-critical: #dc2626;
  --status-info: #0284c7;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -20px rgba(15, 23, 42, 0.2);
  --shadow-pop: 0 30px 80px -20px rgba(15, 23, 42, 0.3), 0 0 0 1px var(--border);
  --shadow-glow: 0 0 0 1px var(--brand-ring), 0 8px 28px -10px rgba(99, 71, 238, 0.45);
}

/* Base elements reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }

/* Ambient backdrop */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
}
.backdrop .orb { position: absolute; border-radius: 50%; filter: blur(80px); animation: drift 24s ease-in-out infinite alternate; }
.backdrop .orb-1 { width: 660px; height: 660px; top: -240px; left: 15%; background: var(--bg-glow-1); }
.backdrop .orb-2 { width: 540px; height: 540px; top: 12%; right: -180px; background: var(--bg-glow-2); animation-delay: -9s; }
@keyframes drift { to { transform: translate3d(50px, 40px, 0) scale(1.06); } }

/* App Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* Sidebar Navigation */
.sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: hidden;
}

.brand {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-grad);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px -3px rgba(139, 108, 255, 0.6);
  flex: none;
}
.brand-mark svg.i { width: 20px; height: 20px; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-3); font-weight: 500; }

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.nav-scroll::-webkit-scrollbar { width: 4px; }
.nav-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.nav-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px 4px;
}
.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--dur-fast);
  cursor: pointer;
  position: relative;
}
.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.nav-item.is-active, .nav-item[aria-current="page"] {
  background: var(--surface-active);
  color: var(--brand);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand-grad);
}
.nav-item svg.i { width: 16px; height: 16px; color: inherit; opacity: 0.85; }
.nav-item.is-active svg.i { opacity: 1; color: var(--brand); }

.nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  color: var(--text-3);
  font-weight: 600;
}
.nav-item.is-active .nav-badge {
  background: var(--brand-soft);
  color: var(--brand);
}
.nav-badge.urgent {
  background: rgba(239, 68, 68, 0.18);
  color: var(--status-critical);
}
.nav-badge.highlight {
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
}
.watermark-box {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(234, 88, 12, 0.12);
  border: 1px dashed rgba(234, 88, 12, 0.4);
  color: #fb923c;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 11px;
}
.watermark-box svg.i { width: 15px; height: 15px; flex: none; }

/* Main Section */
.main { display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.menu-toggle { display: none; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
  min-width: 290px;
  transition: all var(--dur-fast);
}
.search-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text-2);
}
.kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-3);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Role Switcher Pill */
.role-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  font-size: 12px;
}
.role-picker label { color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.role-picker select {
  background: transparent;
  border: 0;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}
.role-picker select option { background: var(--surface-solid); color: var(--text); }

.year-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--dur-fast);
  position: relative;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.icon-btn .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-critical);
  box-shadow: 0 0 6px var(--status-critical);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--avatar-1);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--dur-fast);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary {
  background: var(--brand-grad);
  border: 0;
  color: #fff;
  box-shadow: 0 4px 14px -3px rgba(139, 108, 255, 0.5);
}
.btn-primary:hover { opacity: 0.92; box-shadow: 0 6px 18px -3px rgba(139, 108, 255, 0.7); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-block { width: 100%; }

/* Content Area & Views */
.content {
  padding: 24px 32px 64px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}
.view { display: none; }
.view.is-active { display: block; animation: fadeIn var(--dur) var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Page Header */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}
.page-sub {
  font-size: 13.5px;
  color: var(--text-2);
}
.page-actions { display: flex; align-items: center; gap: 10px; }

/* Cards & Containers */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-sub { font-size: 12px; color: var(--text-3); font-weight: normal; }

/* Grid Layouts */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--dur) var(--ease), border-color var(--dur);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-glow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-foot { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.stat-foot .delta { color: var(--status-good); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }

.grid-main {
  display: grid;
  grid-template-columns: 2fr 1.1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

/* Charts */
.chart-box { width: 100%; position: relative; }
.spark { width: 84px; height: 32px; }
.chart-tooltip {
  position: absolute;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  font-size: 11.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast);
  box-shadow: var(--shadow-pop);
}
.chart-tooltip.is-visible { opacity: 1; }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-seg { fill: none; stroke-width: 18; transition: stroke-width var(--dur-fast); cursor: pointer; }
.donut-seg:hover, .donut-seg.is-hot { stroke-width: 22; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 26px; font-weight: 700; line-height: 1; }
.donut-center span { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.legend-row:hover, .legend-row.is-hot { background: var(--surface-hover); color: var(--text); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--tone); flex: none; }
.legend-row .mono { margin-left: auto; color: var(--text); font-weight: 600; }

.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12.5px; }
.hbar-track { grid-column: 1 / -1; height: 8px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: inherit; background: var(--brand-grad); }

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: color-mix(in srgb, var(--tone, var(--brand)) 16%, transparent);
  color: var(--tone, var(--brand));
  border: 1px solid color-mix(in srgb, var(--tone, var(--brand)) 30%, transparent);
  white-space: nowrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--surface-hover);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.flag-late {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.16);
  color: var(--status-critical);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Progress bar */
.progress { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.progress-track { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--brand-grad); }
.progress-val { font-size: 11.5px; color: var(--text-2); width: 36px; text-align: right; }

/* Filter Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }
.input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  transition: all var(--dur-fast);
}
.input:focus-within { border-color: var(--brand-ring); box-shadow: 0 0 0 3px var(--brand-soft); }
.input input, .input select, .input textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
}
.input select option { background: var(--surface-solid); }

.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all var(--dur-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active, .chip[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
}

.segmented {
  display: flex;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}
.segmented button {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--dur-fast);
}
.segmented button.is-active, .segmented button[aria-pressed="true"] {
  background: var(--surface-active);
  color: var(--brand);
  font-weight: 600;
}

/* Data Table */
.table-wrap { overflow-x: auto; padding: 0; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-hover);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }

.topic-cell { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.topic-name { font-weight: 600; color: var(--text); line-height: 1.4; }
.topic-meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.person { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Kanban Board */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
}
.kanban-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.k-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--dur) var(--ease);
}
.k-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-ring);
  box-shadow: var(--shadow-glow);
}
.k-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--text); }
.k-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
}

/* =====================================================================
   CRITICAL "TIẾN ĐỘ ĐỀ TÀI" (GANTT & ENRICHED TIMELINE)
   GIỮ NGUYÊN THIẾT KẾ & TƯƠNG TÁC GỐC, LÀM GIÀU MẠNH MẼ VỚI MILESTONES
   ===================================================================== */
.timeline-hub { display: flex; flex-direction: column; gap: 20px; }

.timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gantt { overflow-x: auto; }
.gantt-grid { display: grid; grid-template-columns: 320px 1fr; min-width: 1080px; }
.gantt-head {
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 16px;
  background: var(--surface-hover);
}
.gantt-track { position: relative; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.gantt-months { display: grid; grid-template-columns: repeat(12, 1fr); background: var(--surface-hover); }
.gantt-months span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 12px 0 12px 8px;
  border-left: 1px solid var(--border);
}
.gantt-months span:first-child { border-left: 0; }

.gantt-row {
  display: contents;
}
.gantt-row:hover .gantt-label, .gantt-row:hover .gantt-body {
  background: rgba(148, 163, 184, 0.03);
}

.gantt-label {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  cursor: pointer;
}
.gantt-label:hover .list-title { color: var(--brand); }

.gantt-body { position: relative; min-height: 64px; }
.gantt-bar {
  position: absolute;
  top: 50%;
  height: 28px;
  transform: translateY(-50%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone, var(--brand)) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--brand)) 60%, transparent);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all var(--dur-fast);
  z-index: 2;
}
.gantt-bar:hover { box-shadow: 0 0 0 2px var(--tone, var(--brand)); z-index: 3; }
.gantt-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--tone, var(--brand)) 55%, transparent);
}
.gantt-bar span { position: relative; z-index: 2; }

/* Sub-milestone inside Gantt */
.gantt-milestone-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--brand-2);
  border: 2px solid #fff;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: transform var(--dur-fast);
}
.gantt-milestone-marker:hover { transform: translate(-50%, -50%) scale(1.4); }

.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--status-critical);
  pointer-events: none;
  z-index: 5;
}
.gantt-today::before {
  content: "Hôm nay (09/10/2026)";
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--status-critical);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

/* Dual Progress Comparison: Planned vs Actual */
.dual-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.dual-bar {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  position: relative;
  overflow: hidden;
}
.dual-bar-plan { background: repeating-linear-gradient(45deg, #64748b, #64748b 6px, #475569 6px, #475569 12px); height: 100%; }
.dual-bar-actual { background: var(--brand-grad); height: 100%; }
.dual-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); }

/* Milestone Detailed Cards / List View */
.milestones-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.milestone-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--dur-fast);
}
.milestone-card:hover { border-color: var(--border-strong); }
.milestone-card.is-late { border-left: 4px solid var(--status-critical); }
.milestone-card.is-done { border-left: 4px solid var(--status-good); }
.milestone-card.is-review { border-left: 4px solid var(--stage-review); }

.milestone-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.milestone-title-wrap { display: flex; align-items: center; gap: 10px; }
.milestone-weight {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 11px;
}
.milestone-title { font-size: 14px; font-weight: 600; color: var(--text); }

.milestone-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 10px;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.meta-item span { color: var(--text-3); display: block; font-size: 10.5px; margin-bottom: 2px; }
.meta-item strong { color: var(--text); font-weight: 600; }

.evidence-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.evidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
}
.evidence-badge.approved { border-color: var(--status-good); color: var(--status-good); }
.evidence-badge.pending { border-color: var(--status-warning); color: var(--status-warning); }

.milestone-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Project Detail Tabs */
.tabs-header {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  transition: all var(--dur-fast);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.tab-pane { display: none; }
.tab-pane.is-active { display: block; animation: fadeIn var(--dur-fast) var(--ease); }

/* Key-Value Lists */
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
.kv-item { font-size: 13px; }
.kv-item span { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 3px; }
.kv-item b { font-weight: 600; color: var(--text); }

/* Modals & Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur) var(--ease);
  overflow: hidden;
}
.modal.is-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-head-row { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-hover);
}

/* Wizard Stepper */
.wizard-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wizard-step {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
}
.wizard-step.is-reached {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-ring);
}
.wizard-panel { display: none; }
.wizard-panel.is-active { display: flex; flex-direction: column; gap: 16px; animation: fadeIn var(--dur-fast) var(--ease); }

/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(600px, 100vw);
  background: var(--surface-solid);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head { padding: 24px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.drawer-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.drawer-foot { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

/* Command Palette (Cmd + K) */
.palette {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  width: min(640px, calc(100vw - 32px));
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  z-index: 50;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-fast) var(--ease);
  overflow: hidden;
}
.palette.is-open {
  transform: translateX(-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.palette-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.palette-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--text);
}
.palette-list { max-height: 380px; overflow-y: auto; padding: 8px; }
.palette-group { font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; padding: 8px 12px 4px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.palette-item:hover, .palette-item.is-active {
  background: var(--surface-hover);
  color: var(--text);
}
.palette-item.is-active { background: var(--surface-active); color: var(--brand); }

/* Toasts */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toastIn var(--dur) var(--ease);
}
.toast svg.i { color: var(--status-good); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Form Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-error { font-size: 11.5px; color: var(--status-critical); display: none; }
.field.has-error .input { border-color: var(--status-critical); }
.field.has-error .field-error { display: block; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Responsive */
@media (max-width: 1080px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
  .grid-three { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    z-index: 45;
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-toggle { display: grid; place-items: center; }
  .search-trigger { min-width: 180px; }
  .content { padding: 16px; }
}
