/* DNF CEO Hub — Styles v3 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cobalt: #1A56DB;
  --cobalt-dark: #1040B0;
  --cobalt-light: #EBF0FF;
  --bg: #F0F3FA;
  --white: #FFFFFF;
  --black: #08101F;
  --sidebar-bg: #070D1E;
  --sidebar-border: #111C33;
  --sidebar-text: #6A85AA;
  --gray-50: #F8FAFC;
  --gray-100: #F0F4F8;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-600: #475569;
  --gray-800: #1E293B;
}

body { background: var(--bg); color: var(--black); font-family: 'Inter', sans-serif; }

/* ── LAYOUT ── */
.sidebar { width: 224px; 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: 224px; min-height: 100vh; }
.section { display: none; padding: 32px; }
.section.active { display: block; }

/* ── SIDEBAR ── */
.nav-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--sidebar-border); }
.nav-logo .brand { color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.3px; }
.nav-logo .sub { color: #2D4A72; font-size: 11px; margin-top: 3px; }
.nav-body { flex: 1; overflow-y: auto; padding: 4px 0 8px; }
.nav-group-label { padding: 14px 20px 5px; font-size: 9.5px; font-weight: 700; color: #1E3050; letter-spacing: 1.2px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 7px 12px; margin: 1px 8px; border-radius: 7px; color: var(--sidebar-text); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; user-select: none; }
.nav-item:hover { background: #0F1B30; color: #A0B8D8; }
.nav-item.active { background: var(--cobalt); color: #fff; }
.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: #1E3050; }
.nav-footer .clock { color: var(--sidebar-text); 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: 24px; gap: 12px; }
.page-header-left h1 { font-size: 22px; font-weight: 800; color: var(--black); }
.page-header-left p { font-size: 13px; color: var(--gray-400); margin-top: 3px; }
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ── CARDS ── */
.card { background: var(--white); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-card { background: var(--white); border-radius: 12px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); border-top: 3px solid var(--cobalt); }
.stat-card.green { border-color: #22C55E; }
.stat-card.amber { border-color: #F59E0B; }
.stat-card.purple { border-color: #8B5CF6; }
.stat-card.pink { border-color: #EC4899; }
.stat-val { font-size: 26px; font-weight: 800; color: var(--black); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-400); margin-top: 5px; font-weight: 500; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; }
.b-active, .b-online { background: #DCFCE7; color: #15803D; }
.b-building        { background: #FEF9C3; color: #92400E; }
.b-paused          { background: #F1F5F9; color: #475569; }
.b-offline, .b-archived { background: #FEE2E2; color: #B91C1C; }
.b-in_progress     { background: var(--cobalt-light); color: var(--cobalt-dark); }
.b-idea            { background: #F3E8FF; color: #7C3AED; }
.b-done, .b-learned { background: #DCFCE7; color: #15803D; }
.b-pending         { background: #F1F5F9; color: #64748B; }
.b-high            { background: #FEE2E2; color: #B91C1C; }
.b-medium          { background: #FEF9C3; color: #92400E; }
.b-low             { background: #F1F5F9; color: #475569; }
.b-tech            { background: var(--cobalt-light); color: var(--cobalt-dark); }
.b-product         { background: #F3E8FF; color: #7C3AED; }
.b-ops             { background: #FEF9C3; color: #92400E; }
.b-marketing       { background: #FCE7F3; color: #9D174D; }
.b-skill           { background: #DCFCE7; color: #15803D; }
.b-concept         { background: var(--cobalt-light); color: var(--cobalt-dark); }
.b-code            { background: #F3E8FF; color: #7C3AED; }
.b-tool            { background: #FEF9C3; color: #92400E; }
.b-library         { background: var(--cobalt-light); color: var(--cobalt-dark); }
.b-template        { background: #F3E8FF; color: #7C3AED; }
.b-snippet         { background: #FEF9C3; color: #92400E; }
.b-framework       { background: #FCE7F3; color: #9D174D; }
.b-valid           { background: #DCFCE7; color: #15803D; }
.b-expired         { background: #FEE2E2; color: #B91C1C; }
.b-unknown         { background: #F1F5F9; color: #64748B; }
.b-telegram        { background: #E0F4FF; color: #0369A1; }
.b-lark            { background: #F0FFF4; color: #15803D; }
.b-in_progress-kb  { background: #FEF9C3; color: #92400E; }
.b-todo            { background: #F1F5F9; color: #64748B; }
.b-active-gh       { background: #DCFCE7; color: #15803D; }
.b-archived-gh     { background: #F1F5F9; color: #64748B; }

/* ── PROGRESS ── */
.progress-bar { height: 5px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--cobalt), #3B73F6); border-radius: 99px; transition: width .4s; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; line-height: 1; font-family: inherit; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-dark); }
.btn-ghost { background: var(--gray-100); color: var(--gray-800); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger { background: #FEE2E2; color: #B91C1C; }
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-icon { padding: 6px 8px; background: var(--gray-100); border-radius: 7px; color: var(--gray-600); }
.btn-icon:hover { background: var(--gray-200); }
.btn-active-tab { background: var(--cobalt) !important; color: #fff !important; }

/* ── INPUTS ── */
input, textarea, select { width: 100%; border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 11px; font-size: 13px; outline: none; transition: border .15s, box-shadow .15s; background: #fff; color: var(--black); font-family: inherit; }
input:focus, textarea:focus, select:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(26,86,219,.08); }
label { font-size: 12px; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 4px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }

/* ── MODAL ── */
.modal { display: none; position: fixed; inset: 0; background: rgba(7,13,30,.65); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 28px; width: 520px; max-width: 96vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.modal-title { font-size: 17px; font-weight: 800; color: var(--black); margin-bottom: 20px; }

/* ── TABS ── */
.tab-bar { display: flex; gap: 4px; background: var(--gray-100); border-radius: 9px; padding: 3px; margin-bottom: 20px; width: fit-content; }
.tab-btn { padding: 6px 16px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--gray-600); transition: all .15s; font-family: inherit; }
.tab-btn.active { background: var(--cobalt); color: #fff; }

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

/* ── TAG ── */
.tag { display: inline-block; background: var(--gray-100); color: var(--gray-600); font-size: 10px; padding: 2px 7px; border-radius: 5px; font-weight: 500; }

/* ── CALLOUT ── */
.callout { border-radius: 9px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }
.callout-warning { background: #FEF9C3; border-left: 3px solid #F59E0B; color: #78350F; }
.callout-info { background: var(--cobalt-light); border-left: 3px solid var(--cobalt); color: #1E3A8A; }

/* ── LINK CHIP ── */
.link-chip { display: flex; align-items: center; gap: 12px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: var(--black); transition: all .15s; }
.link-chip:hover { border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(26,86,219,.07); }

/* ── BOT CARD ── */
.bot-card { background: var(--white); border-radius: 12px; padding: 16px 18px; border: 1px solid var(--gray-200); display: flex; align-items: flex-start; gap: 14px; transition: border-color .15s; }
.bot-card:hover { border-color: #C5D5F5; }
.bot-avatar { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.bot-avatar.tg { background: #E0F4FF; }
.bot-avatar.lark { background: #DCFCE7; }

/* ── AGENT CARD ── */
.agent-card { background: var(--white); border-radius: 12px; padding: 18px 20px; border: 1px solid var(--gray-200); transition: all .15s; }
.agent-card:hover { border-color: #C5D5F5; box-shadow: 0 3px 12px rgba(26,86,219,.07); }

/* ── PROJECT ROW ── */
.project-row { background: var(--white); border-radius: 12px; padding: 16px 20px; border: 1px solid var(--gray-200); transition: border-color .15s; }
.project-row:hover { border-color: #C5D5F5; }

/* ── KB CARD ── */
.kb-card { background: var(--white); border-radius: 12px; padding: 16px 18px; border: 1px solid var(--gray-200); transition: border-color .15s; }
.kb-card:hover { border-color: #C5D5F5; }

/* ── GH CARD ── */
.gh-card { background: var(--white); border-radius: 12px; padding: 16px 18px; border: 1px solid var(--gray-200); display: flex; align-items: flex-start; gap: 14px; transition: border-color .15s; }
.gh-card:hover { border-color: #C5D5F5; }

/* ── BOT MAP ── */
#map-outer { overflow-x: auto; border-radius: 12px; background: var(--white); border: 1px solid var(--gray-200); padding: 0; }
#map-container { position: relative; min-height: 500px; min-width: 900px; }
#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(--white); border: 1.5px solid; border-radius: 9px; padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--gray-800); box-shadow: 0 2px 6px rgba(0,0,0,.06); cursor: default; line-height: 1.3; width: 160px; }
.map-node-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.map-legend { display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.map-col-label { position: absolute; top: 16px; font-size: 9.5px; font-weight: 700; color: #94A3B8; letter-spacing: 1.2px; text-transform: uppercase; text-align: center; }

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

/* ── TOAST ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--black); color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13px; z-index: 999; opacity: 0; transition: opacity .25s; pointer-events: none; border-left: 3px solid var(--cobalt); font-family: inherit; }
.toast.show { opacity: 1; }

/* ── SCROLL ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

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