/* DNF CEO Hub — Dark Premium v5 (18/07/2026)
   Ngôn ngữ thiết kế tham chiếu javisos.com: nền xanh đen sâu, tím/cyan nhấn,
   chữ đậm dứt khoát, viền mờ, khoảng thở rộng. Giữ nguyên toàn bộ tên class cũ. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* nền */
  --bg:        #05060f;
  --bg2:       #0a0c1d;
  --surface:   #10122b;
  --surface-2: #151833;

  /* nhấn */
  --vio:       #8b5cf6;
  --vio2:      #6d28d9;
  --vio-soft:  rgba(139,92,246,.13);
  --cyan:      #22d3ee;

  /* chữ */
  --tx:        #e8eaf6;
  --mut:       #9aa0b5;
  --dim:       #6b7189;

  /* đường viền */
  --line:      rgba(139,92,246,.20);
  --line-2:    rgba(255,255,255,.07);

  /* alias giữ tương thích với HTML/JS cũ */
  --cobalt: var(--vio);
  --cobalt-dark: var(--vio2);
  --cobalt-light: var(--vio-soft);
  --white: var(--surface);
  --black: var(--tx);
  --sidebar-bg: #080a18;
  --sidebar-border: rgba(139,92,246,.14);
  --sidebar-text: #8b90a8;
  --gray-50: var(--surface-2);
  --gray-100: rgba(255,255,255,.05);
  --gray-200: var(--line-2);
  --gray-400: var(--mut);
  --gray-600: var(--mut);
  --gray-800: var(--tx);
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(900px 460px at 78% -12%, rgba(139,92,246,.16), transparent 62%),
    radial-gradient(700px 380px at 8% 0%, rgba(34,211,238,.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--tx);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
}

/* ── RESET (tự gánh, thay cho Tailwind preflight đã gỡ) ── */
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
code, pre { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: .92em; }
code { background: rgba(139,92,246,.13); border: 1px solid rgba(139,92,246,.20); color: #c4b5fd; padding: 1.5px 6px; border-radius: 6px; }
details > summary { cursor: pointer; list-style: none; color: var(--vio); font-weight: 600; font-size: 12.5px; }
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { color: #c4b5fd; }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); color: var(--tx); vertical-align: top; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(139,92,246,.06); }
tbody tr:last-child td { border-bottom: none; }

/* ── LAYOUT ── */
.sidebar { width: 232px; min-height: 100vh; background: var(--sidebar-bg); position: fixed; left: 0; top: 0; display: flex; flex-direction: column; border-right: 1px solid var(--sidebar-border); z-index: 10; }
.main { margin-left: 232px; min-height: 100vh; }
.section { display: none; padding: 34px 36px; }
.section.active { display: block; animation: fadeUp .3s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── SIDEBAR ── */
.nav-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--sidebar-border); }
.nav-logo .brand { color: #fff; font-weight: 800; font-size: 15.5px; letter-spacing: -.3px; }
.nav-logo .sub { color: var(--dim); font-size: 11px; margin-top: 3px; }
.nav-body { flex: 1; overflow-y: auto; padding: 6px 0 10px; }
.nav-group-label { padding: 16px 20px 6px; font-size: 9.5px; font-weight: 800; color: var(--dim); letter-spacing: 1.3px; text-transform: uppercase; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 1px 10px; border-radius: 9px; color: var(--sidebar-text); cursor: pointer; font-size: 13px; font-weight: 500; transition: background .16s, color .16s; user-select: none; }
.nav-item:hover { background: rgba(139,92,246,.10); color: var(--tx); }
.nav-item.active { background: linear-gradient(90deg, rgba(139,92,246,.26), rgba(139,92,246,.10)); color: #fff; font-weight: 600; }
.nav-item.active::before { content:''; position:absolute; left:-10px; top:6px; bottom:6px; width:3px; border-radius:0 3px 3px 0; background: var(--vio); box-shadow: 0 0 12px var(--vio); }
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-footer { padding: 14px 20px; border-top: 1px solid var(--sidebar-border); font-size: 11px; color: var(--dim); }
.nav-footer .clock { color: var(--mut); margin-top: 3px; font-size: 12px; font-weight: 500; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; gap: 12px; }
.page-header-left h1 { font-size: 25px; font-weight: 800; color: var(--tx); letter-spacing: -.5px; line-height: 1.25; }
.page-header-left p { font-size: 13px; color: var(--mut); margin-top: 4px; }
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ── CARDS ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; transition: border-color .18s, box-shadow .18s; }
.card:hover { border-color: rgba(139,92,246,.34); box-shadow: 0 10px 30px rgba(0,0,0,.35); }

.stat-card { position: relative; background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; overflow: hidden; transition: transform .18s ease, border-color .18s, box-shadow .18s; }
.stat-card::after { content:''; position:absolute; left:0; right:0; top:0; height:2px; background: linear-gradient(90deg, var(--vio), var(--cyan)); opacity: .85; }
.stat-card:hover { transform: translateY(-3px); border-color: rgba(139,92,246,.40); box-shadow: 0 14px 34px rgba(109,40,217,.22); }
.stat-card.green::after  { background: linear-gradient(90deg,#22c55e,#4ade80); }
.stat-card.amber::after  { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.stat-card.purple::after { background: linear-gradient(90deg,#8b5cf6,#c084fc); }
.stat-card.pink::after   { background: linear-gradient(90deg,#ec4899,#f472b6); }
.stat-val { font-size: 29px; font-weight: 800; color: #fff; line-height: 1.1; letter-spacing: -.6px; }
.stat-label { font-size: 12px; color: var(--mut); margin-top: 6px; font-weight: 500; }

/* ── BADGES ── */
/* Mặc định phải đọc được: badge có biến thể lạ (vd b-abs1) sẽ dùng bộ này thay vì thừa kế màu cha */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.08); color: #cbd5e1; border: 1px solid rgba(255,255,255,.14); }
.badge.dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.b-active, .b-online, .b-done, .b-learned, .b-skill, .b-valid, .b-own, .b-active-gh, .b-lark
                   { background: rgba(34,197,94,.13);  color: #4ade80; border-color: rgba(34,197,94,.26); }
.b-building, .b-medium, .b-ops, .b-tool, .b-snippet, .b-running, .b-in_progress-kb
                   { background: rgba(245,158,11,.13); color: #fbbf24; border-color: rgba(245,158,11,.26); }
.b-paused, .b-low, .b-pending, .b-unknown, .b-todo, .b-archived-gh, .b-idle
                   { background: rgba(255,255,255,.08); color: #cbd5e1; border-color: rgba(255,255,255,.14); }
.b-offline, .b-archived, .b-high, .b-expired, .b-error, .b-competitor
                   { background: rgba(239,68,68,.13);  color: #f87171; border-color: rgba(239,68,68,.26); }
.b-in_progress, .b-tech, .b-concept, .b-library
                   { background: rgba(139,92,246,.15); color: #c4b5fd; border-color: rgba(139,92,246,.30); }
.b-idea, .b-product, .b-code, .b-template
                   { background: rgba(192,132,252,.13); color: #d8b4fe; border-color: rgba(192,132,252,.26); }
.b-marketing, .b-framework
                   { background: rgba(236,72,153,.13); color: #f9a8d4; border-color: rgba(236,72,153,.26); }
.b-telegram        { background: rgba(34,211,238,.13); color: #67e8f9; border-color: rgba(34,211,238,.26); }

/* ── PROGRESS ── */
.progress-bar { height: 6px; background: rgba(255,255,255,.07); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--vio), var(--cyan)); border-radius: 99px; transition: width .4s; box-shadow: 0 0 12px rgba(139,92,246,.5); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all .16s; line-height: 1.2; font-family: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--vio), var(--vio2)); color: #fff; box-shadow: 0 4px 16px rgba(109,40,217,.38); }
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 6px 22px rgba(109,40,217,.52); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,.05); color: var(--tx); border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(139,92,246,.14); border-color: var(--line); }
.btn-danger { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.30); }
.btn-danger:hover { background: rgba(239,68,68,.24); }
.btn-sm { padding: 5px 11px; font-size: 11px; border-radius: 8px; }
.btn-icon { padding: 7px 9px; background: rgba(255,255,255,.05); border: 1px solid var(--line-2); border-radius: 9px; color: var(--mut); }
.btn-icon:hover { background: rgba(139,92,246,.14); color: var(--tx); }
.btn-active-tab { background: linear-gradient(135deg, var(--vio), var(--vio2)) !important; color: #fff !important; }

/* ── INPUTS ── */
input, textarea, select { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; font-size: 13px; outline: none; transition: border .16s, box-shadow .16s; background: var(--bg2); color: var(--tx); font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { border-color: var(--vio); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
select option { background: var(--bg2); color: var(--tx); }
label { font-size: 12px; font-weight: 600; color: var(--mut); display: block; margin-bottom: 5px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-stack { display: flex; flex-direction: column; gap: 13px; }

/* ── MODAL ── */
.modal { display: none; position: fixed; inset: 0; background: rgba(3,4,10,.78); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: 540px; max-width: 96vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.modal-title { font-size: 18px; font-weight: 800; color: #fff; margin-bottom: 20px; letter-spacing: -.3px; }

/* ── TABS ── */
.tab-bar { display: flex; gap: 4px; background: rgba(255,255,255,.05); border: 1px solid var(--line-2); border-radius: 11px; padding: 4px; margin-bottom: 22px; width: fit-content; }
.tab-btn { padding: 7px 17px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--mut); transition: all .16s; font-family: inherit; }
.tab-btn:hover { color: var(--tx); }
.tab-btn.active { background: linear-gradient(135deg, var(--vio), var(--vio2)); color: #fff; }

/* ── FILTER TABS ── */
.filter-tabs { display: flex; gap: 7px; margin-bottom: 18px; flex-wrap: wrap; }

/* ── TAG ── */
.tag { display: inline-block; background: rgba(139,92,246,.12); color: #c4b5fd; font-size: 10.5px; padding: 3px 8px; border-radius: 6px; font-weight: 500; border: 1px solid rgba(139,92,246,.20); }

/* ── CALLOUT ── */
.callout { border-radius: 11px; padding: 13px 15px; font-size: 12.5px; line-height: 1.65; }
.callout-warning { background: rgba(245,158,11,.10); border-left: 3px solid #f59e0b; color: #fcd34d; }
.callout-info { background: rgba(139,92,246,.10); border-left: 3px solid var(--vio); color: #c4b5fd; }

/* ── LINK CHIP ── */
.link-chip { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 15px 17px; text-decoration: none; color: var(--tx); transition: all .16s; }
.link-chip:hover { border-color: rgba(139,92,246,.40); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.34); }

/* ── BOT / AGENT / PROJECT / KB / GH CARDS ── */
.bot-card, .gh-card { background: var(--surface); border-radius: 14px; padding: 17px 19px; border: 1px solid var(--line-2); display: flex; align-items: flex-start; gap: 14px; transition: all .18s; }
.agent-card, .project-row, .kb-card { background: var(--surface); border-radius: 14px; padding: 19px 21px; border: 1px solid var(--line-2); transition: all .18s; }
.bot-card:hover, .gh-card:hover, .agent-card:hover, .project-row:hover, .kb-card:hover {
  border-color: rgba(139,92,246,.36); transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.36);
}
.bot-avatar { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; border: 1px solid var(--line-2); }
.bot-avatar.tg { background: rgba(34,211,238,.13); }
.bot-avatar.lark { background: rgba(34,197,94,.13); }

/* ── BOT MAP ── */
#map-outer { overflow-x: auto; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); padding: 0; }
#map-container { position: relative; min-height: 500px; min-width: 1100px; }
#map-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.map-node { position: absolute; }
.map-node-inner { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid; border-radius: 11px; padding: 9px 13px; font-size: 12px; font-weight: 600; color: var(--tx); box-shadow: 0 4px 14px rgba(0,0,0,.4); cursor: default; line-height: 1.35; width: 160px; }
.map-node-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.map-legend { display: flex; gap: 20px; margin-top: 18px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--mut); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.map-col-label { position: absolute; top: 16px; font-size: 9.5px; font-weight: 800; color: var(--dim); letter-spacing: 1.3px; text-transform: uppercase; text-align: center; }

/* ── DIVIDER ── */
hr { border: none; border-top: 1px solid var(--line-2); }

/* ── TOAST ── */
.toast { position: fixed; bottom: 26px; right: 26px; background: var(--surface); color: var(--tx); padding: 12px 20px; border-radius: 11px; font-size: 13px; z-index: 999; opacity: 0; transition: opacity .25s, transform .25s; transform: translateY(8px); pointer-events: none; border: 1px solid var(--line); border-left: 3px solid var(--vio); box-shadow: 0 14px 40px rgba(0,0,0,.5); font-family: inherit; }
.toast.show { opacity: 1; transform: none; }

/* ── SCROLL ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.30); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,.50); }

/* ── GRID HELPERS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.grid-links { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.flex-col-gap { display: flex; flex-direction: column; gap: 11px; }

/* ── DASHBOARD BLOCKS ── */
.dash-block-title { display:flex; align-items:center; gap:9px; font-size:13px; font-weight:800; color:var(--tx); margin-bottom:15px; letter-spacing:.2px; text-transform:uppercase; }
.dash-block-title::after { content:''; flex:1; height:1px; background:linear-gradient(90deg,var(--line),transparent); }
.dash-mini { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--line-2); }
.dash-mini:last-child { border-bottom:none; }

/* ── MOBILE TOP BAR + DRAWER ── */
.mobile-bar { display:none; }
.sidebar-overlay { display:none; }
.hamburger { width:38px; height:38px; border:none; background:transparent; color:#fff; font-size:20px; border-radius:9px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.hamburger:active { background:rgba(139,92,246,.20); }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-links { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 860px) {
  .mobile-bar { display:flex; align-items:center; gap:10px; position:fixed; top:0; left:0; right:0; height:56px;
    background:rgba(8,10,24,.92); backdrop-filter:blur(10px); border-bottom:1px solid var(--sidebar-border); z-index:8; padding:0 12px; }
  .mobile-bar .mb-brand { color:#fff; font-weight:800; font-size:14.5px; letter-spacing:-.3px; }
  .sidebar { transform: translateX(-105%); transition: transform .26s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 50px rgba(0,0,0,.7); width:80vw; max-width:300px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display:block; position:fixed; inset:0; background:rgba(3,4,10,.66); backdrop-filter:blur(2px); z-index:9; }
  .main { margin-left:0; padding-top:56px; }
  .section { padding:20px 16px; }
  .grid-2, .grid-3, .grid-4, .grid-links { grid-template-columns: 1fr; }
  .page-header { flex-direction:column; align-items:stretch; }
  .page-header-actions { justify-content:flex-start; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .modal-box { width:94vw; padding:22px; border-radius:16px; }
  .modal { align-items:flex-end; }
  .modal.open { align-items:center; }
  .tab-bar { width:100%; overflow-x:auto; }
  .toast { left:16px; right:16px; bottom:16px; text-align:center; }
}
@media (max-width: 420px) {
  .stat-val { font-size:25px; }
  .page-header-left h1 { font-size:21px; }
}
