/* Connect29 Hub — Design System */
:root {
    --bg-primary:#0A0E17; --bg-secondary:#111827; --bg-card:#1A1F2E;
    --bg-card-hover:#1F2537; --bg-input:#0D1220; --border:#1E293B;
    --border-focus:#3B82F6; --text-primary:#F1F5F9; --text-secondary:#94A3B8;
    --text-muted:#64748B; --accent:#3B82F6; --accent-glow:rgba(59,130,246,0.15);
    --green:#10B981; --green-bg:rgba(16,185,129,0.1);
    --red:#EF4444; --red-bg:rgba(239,68,68,0.1);
    --purple:#8B5CF6; --purple-bg:rgba(139,92,246,0.1);
    --amber:#F59E0B; --amber-bg:rgba(245,158,11,0.1);
    --font:'DM Sans',-apple-system,sans-serif; --mono:'JetBrains Mono',monospace;
    --radius:12px; --radius-sm:8px; --shadow:0 4px 24px rgba(0,0,0,0.3);
    --sidebar-w:230px; --topbar-h:56px;
}
[data-theme="light"] {
    --bg-primary:#F5F7FA; --bg-secondary:#E8EDF3; --bg-card:#FFFFFF;
    --bg-card-hover:#F8FAFC; --bg-input:#F1F5F9; --border:#E2E8F0;
    --text-primary:#0F172A; --text-secondary:#475569; --text-muted:#94A3B8;
    --accent-glow:rgba(59,130,246,0.1);
    --green-bg:rgba(5,150,105,0.1); --red-bg:rgba(220,38,38,0.1);
    --purple-bg:rgba(124,58,237,0.1); --amber-bg:rgba(217,119,6,0.1);
    --shadow:0 4px 24px rgba(0,0,0,0.08);
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:var(--font); background:var(--bg-primary); color:var(--text-primary); min-height:100vh; overflow-x:hidden; font-size:14px; }
body::before {
    content:''; position:fixed; inset:-50% -50%; width:200%; height:200%;
    background:radial-gradient(ellipse at 20% 50%, rgba(59,130,246,0.04) 0%, transparent 50%),
               radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.03) 0%, transparent 50%),
               radial-gradient(ellipse at 50% 80%, rgba(16,185,129,0.02) 0%, transparent 50%);
    z-index:0; pointer-events:none;
}
[data-theme="light"] body::before { display:none; }
a { color:inherit; }

.app { position:relative; z-index:1; display:flex; flex-direction:column; min-height:100vh; }

/* Topbar */
.topbar { display:flex; align-items:center; border-bottom:1px solid var(--border); background:rgba(10,14,23,0.85); backdrop-filter:blur(20px); position:sticky; top:0; z-index:100; height:var(--topbar-h); }
[data-theme="light"] .topbar { background:rgba(255,255,255,0.9); }
.topbar-logo { display:flex; align-items:center; width:var(--sidebar-w); min-width:var(--sidebar-w); height:100%; border-right:1px solid var(--border); padding:0 20px; }
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--text-primary); }
.brand-mark { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; border-radius:8px; background:linear-gradient(135deg,#3B82F6,#8B5CF6); color:#fff; font-weight:700; font-size:11px; letter-spacing:-0.5px; }
.brand-name { font-weight:600; letter-spacing:-0.3px; font-size:15px; }
.brand-partner-logo { width:44px; height:44px; object-fit:contain; background:#fff; border-radius:6px; padding:4px; }

.topbar-main { flex:1; display:flex; align-items:center; justify-content:space-between; padding:0 24px; height:100%; }
.breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-muted); }
.breadcrumb a { color:var(--text-secondary); text-decoration:none; }
.breadcrumb a:hover { color:var(--text-primary); }
.breadcrumb .bc-sep { font-size:10px; color:var(--text-muted); }
.breadcrumb .bc-current { color:var(--text-primary); font-weight:500; }
.topbar-actions { display:flex; gap:14px; align-items:center; }

/* Theme toggle */
.theme-toggle { position:relative; display:inline-block; width:46px; height:24px; cursor:pointer; }
.theme-toggle input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; inset:0; background:var(--bg-input); border:1px solid var(--border); border-radius:13px; transition:all 0.3s; }
.toggle-slider::before { content:''; position:absolute; height:18px; width:18px; left:2px; top:2px; background:var(--text-muted); border-radius:50%; transition:all 0.3s; }
.theme-toggle input:checked + .toggle-slider { background:var(--accent-glow); border-color:var(--accent); }
.theme-toggle input:checked + .toggle-slider::before { transform:translateX(22px); background:var(--accent); }
.toggle-icon { position:absolute; top:3px; font-size:12px; line-height:18px; transition:opacity 0.2s; }
.toggle-icon.sun { right:6px; opacity:1; }
.toggle-icon.moon { left:6px; opacity:0; }
.theme-toggle input:checked + .toggle-slider .sun { opacity:0; }
.theme-toggle input:checked + .toggle-slider .moon { opacity:1; }

.topbar-user { display:flex; align-items:center; gap:10px; }
.topbar-user-info { display:flex; flex-direction:column; line-height:1.2; }
.topbar-user-name { font-size:13px; font-weight:500; }
.topbar-user-role { font-size:11px; color:var(--text-muted); }
.avatar-sm { width:30px; height:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-size:12px; font-weight:600; }

.app-body { display:flex; flex:1; }

/* Sidebar */
.sidebar { width:var(--sidebar-w); min-width:var(--sidebar-w); border-right:1px solid var(--border); background:transparent; display:flex; flex-direction:column; padding:18px 12px 14px; }
/* Partner logos */
.partner-logo-lg { width:64px; height:64px; object-fit:contain; background:#fff; border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px; flex-shrink:0; }
.partner-logo-sm { width:28px; height:28px; object-fit:contain; background:#fff; border:1px solid var(--border); border-radius:4px; padding:2px; flex-shrink:0; }
.partner-logo-placeholder { width:64px; height:64px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#3B82F6,#8B5CF6); color:#fff; font-weight:700; font-size:18px; letter-spacing:-0.5px; border-radius:var(--radius-sm); flex-shrink:0; }
.partner-logo-placeholder-sm { width:28px; height:28px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#3B82F6,#8B5CF6); color:#fff; font-weight:700; font-size:10px; letter-spacing:-0.3px; border-radius:4px; flex-shrink:0; }

.sidebar-scope { padding:2px 4px 16px; margin-bottom:12px; border-bottom:1px solid var(--border); }
.scope-select { width:100%; padding:9px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:6px; color:var(--text-primary); font-family:var(--font); font-size:12px; font-weight:500; outline:none; cursor:pointer; transition:border-color 0.15s; }
.scope-select:hover { border-color:var(--text-muted); }
.scope-select:focus { border-color:var(--accent); }
.scope-banner { padding:8px 14px; margin-bottom:16px; background:var(--accent-glow); border:1px solid var(--accent); border-radius:var(--radius-sm); font-size:12px; color:var(--accent); display:flex; align-items:center; gap:8px; }
.scope-banner strong { color:var(--text-primary); font-weight:600; }
.sidebar-nav { flex:1; display:flex; flex-direction:column; gap:28px; }
.nav-section { display:flex; flex-direction:column; gap:1px; }
.nav-title { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.14em; color:var(--text-muted); padding:0 12px 10px; opacity:0.7; }

.nav-link {
    position:relative;
    display:flex; align-items:center; gap:11px;
    padding:7px 12px;
    border-radius:6px;
    text-decoration:none;
    color:var(--text-secondary); font-size:13px; font-weight:500;
    transition:color 0.15s, background-color 0.15s;
}
.nav-link:hover { background:var(--bg-card-hover); color:var(--text-primary); }
.nav-link.active { background:transparent; color:var(--text-primary); font-weight:600; }
.nav-link.active::before {
    content:''; position:absolute;
    left:-12px; top:7px; bottom:7px; width:3px;
    background:var(--accent);
    border-radius:0 3px 3px 0;
}
.nav-link.active .nav-icon { color:var(--accent); opacity:1; }

.nav-icon { width:16px; height:16px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; opacity:0.6; transition:opacity 0.15s; }
.nav-link:hover .nav-icon { opacity:0.95; }
.nav-icon .ico { width:16px; height:16px; display:block; }
.nav-count { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:18px; padding:0 6px; border-radius:999px; font-size:10px; font-weight:700; color:#fff; line-height:1; flex-shrink:0; }
.sidebar-footer { padding:14px 12px 0; font-size:10px; color:var(--text-muted); border-top:1px solid var(--border); margin-top:16px; opacity:0.55; }
.app-tag { font-family:var(--mono); letter-spacing:0.1em; text-transform:uppercase; }

/* Main content */
.main-content { flex:1; padding:28px; overflow-y:auto; height:calc(100vh - var(--topbar-h)); }
.page-header { display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:24px; gap:16px; flex-wrap:wrap; }
.page-title { font-size:22px; font-weight:700; letter-spacing:-0.5px; }
.page-subtitle { font-size:13px; color:var(--text-secondary); margin-top:4px; }
.page-actions { display:flex; gap:8px; }

/* Flash */
.flash { padding:10px 14px; border-radius:8px; margin-bottom:18px; font-size:13px; }
.flash-ok { background:var(--green-bg); color:var(--green); border:1px solid rgba(16,185,129,0.3); }
.flash-err { background:var(--red-bg); color:var(--red); border:1px solid rgba(239,68,68,0.3); }

/* Buttons */
.btn { font-family:var(--font); font-size:13px; font-weight:500; padding:8px 14px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg-card); color:var(--text-primary); cursor:pointer; transition:all 0.2s; display:inline-flex; align-items:center; gap:6px; white-space:nowrap; text-decoration:none; }
.btn:hover { background:var(--bg-card-hover); border-color:var(--text-muted); }
.btn-primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn-primary:hover { background:#2563EB; border-color:#2563EB; }
.btn-danger { color:var(--red); } .btn-danger:hover { background:var(--red-bg); border-color:var(--red); }
.btn-success { color:var(--green); } .btn-success:hover { background:var(--green-bg); border-color:var(--green); }
.btn-sm { padding:5px 10px; font-size:12px; }
.btn-icon { width:34px; height:34px; padding:0; justify-content:center; }
.btn:disabled { opacity:0.5; cursor:not-allowed; }

/* Cards */
.card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-title { font-size:14px; font-weight:600; color:var(--text-secondary); }

/* Stats */
.stats-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:28px; }
.stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; }
.stat-label { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:8px; font-weight:600; }
.stat-value { font-size:26px; font-weight:700; letter-spacing:-0.5px; }
.stat-sub { font-size:12px; color:var(--text-secondary); margin-top:4px; }

/* Tables */
.table-wrap { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; padding:11px 16px; font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.06em; border-bottom:1px solid var(--border); background:var(--bg-input); }
td { padding:13px 16px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tr:hover td { background:var(--bg-card-hover); }
.table-empty { padding:60px 20px; text-align:center; color:var(--text-muted); font-size:14px; background:linear-gradient(180deg, rgba(59,130,246,0.03), transparent 80%); border-radius:var(--radius-sm); }
.table-empty p:first-child { color:var(--text-secondary); }

/* Forms */
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:12px; font-weight:600; color:var(--text-secondary); margin-bottom:6px; text-transform:uppercase; letter-spacing:0.04em; }
.form-input, .form-select, .form-textarea {
    width:100%; padding:10px 12px; background:var(--bg-input); border:1px solid var(--border);
    border-radius:var(--radius-sm); color:var(--text-primary); font-family:var(--font); font-size:13px;
    outline:none; transition:border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color:var(--accent); }
.form-select { cursor:pointer; }
.form-textarea { resize:vertical; min-height:80px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-row-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.form-hint { font-size:11px; color:var(--text-muted); margin-top:4px; }

/* Badges */
.badge { display:inline-flex; align-items:center; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-blue { background:var(--accent-glow); color:var(--accent); }
.badge-green { background:var(--green-bg); color:var(--green); }
.badge-red { background:var(--red-bg); color:var(--red); }
.badge-amber { background:var(--amber-bg); color:var(--amber); }
.badge-purple { background:var(--purple-bg); color:var(--purple); }
.badge-gray { background:rgba(100,116,139,0.15); color:var(--text-muted); }

/* Progress bar */
.progress { width:100%; height:6px; background:var(--bg-input); border-radius:3px; overflow:hidden; }
.progress-fill { height:100%; background:linear-gradient(90deg,var(--accent),#60A5FA); transition:width 0.3s; }
.progress-complete .progress-fill { background:var(--green); }

/* Modal */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); backdrop-filter:blur(4px); z-index:200; align-items:center; justify-content:center; }
.modal-overlay.show { display:flex; }
.modal { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:28px; width:560px; max-width:92vw; max-height:85vh; overflow-y:auto; }
.modal-lg { width:720px; }
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.modal-title { font-size:17px; font-weight:600; }
.modal-close { background:none; border:none; color:var(--text-muted); font-size:22px; cursor:pointer; padding:4px; line-height:1; }
.modal-close:hover { color:var(--text-primary); }
.modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:24px; }

/* Toast */
.toast-container { position:fixed; top:20px; right:20px; z-index:300; display:flex; flex-direction:column; gap:8px; }
.toast { padding:12px 18px; border-radius:var(--radius-sm); font-size:13px; font-weight:500; animation:slideIn 0.3s ease; min-width:250px; }
.toast-success { background:rgba(16,185,129,0.15); border:1px solid rgba(16,185,129,0.3); color:#6EE7B7; }
.toast-error { background:rgba(239,68,68,0.15); border:1px solid rgba(239,68,68,0.3); color:#FCA5A5; }
@keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* Filters bar */
.filters-bar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:18px; }
.filter-select, .search-input { padding:8px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text-primary); font-family:var(--font); font-size:12px; outline:none; }
.filter-select:focus, .search-input:focus { border-color:var(--accent); }
.search-input { width:240px; }
.search-input::placeholder { color:var(--text-muted); }

/* Two-column */
.two-col { display:grid; grid-template-columns:2fr 1fr; gap:20px; }

/* Project card grid */
.project-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; }
.project-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:18px; transition:all 0.2s; text-decoration:none; color:inherit; display:block; }
.project-card:hover { border-color:var(--accent); transform:translateY(-2px); box-shadow:var(--shadow); }
.project-card-head { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:10px; gap:10px; }
.project-card-title { font-size:15px; font-weight:600; letter-spacing:-0.2px; line-height:1.3; }
.project-card-client { font-size:12px; color:var(--text-muted); margin-bottom:12px; }
.project-card-desc { font-size:13px; color:var(--text-secondary); line-height:1.5; margin-bottom:14px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.project-card-meta { display:flex; align-items:center; justify-content:space-between; margin-top:12px; font-size:12px; color:var(--text-muted); }

/* Training docs */
.doc-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:12px; }
.doc-card { display:block; padding:16px; background:var(--bg-input); border:1px solid var(--border); border-radius:8px; text-decoration:none; color:inherit; transition:all 0.15s; }
.doc-card:hover { border-color:var(--accent); background:var(--bg-card-hover); transform:translateY(-1px); }
.doc-card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.doc-file-badge { display:inline-flex; align-items:center; justify-content:center; padding:3px 8px; background:rgba(239,68,68,0.1); color:var(--red); font-size:10px; font-weight:700; letter-spacing:0.05em; border-radius:4px; font-family:var(--mono); }
.doc-card-title { font-size:14px; font-weight:600; line-height:1.3; margin-bottom:6px; color:var(--text-primary); }
.doc-card-excerpt { font-size:12px; color:var(--text-muted); line-height:1.5; margin-bottom:10px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.doc-card-meta { display:flex; align-items:center; justify-content:space-between; font-size:11px; }

.doc-viewer { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; height:calc(100vh - 260px); min-height:500px; }
.doc-viewer iframe { width:100%; height:100%; border:0; background:#fff; }

.doc-body { padding:36px 44px; max-width:820px; font-size:15px; line-height:1.7; color:var(--text-primary); }
.doc-body h1 { font-size:24px; font-weight:700; letter-spacing:-0.5px; margin:0 0 16px; padding-bottom:10px; border-bottom:1px solid var(--border); }
.doc-body h2 { font-size:19px; font-weight:600; letter-spacing:-0.3px; margin:28px 0 12px; }
.doc-body h3 { font-size:16px; font-weight:600; margin:22px 0 10px; color:var(--text-secondary); }
.doc-body p { margin:0 0 14px; }
.doc-body ul, .doc-body ol { margin:0 0 16px; padding-left:24px; }
.doc-body li { margin-bottom:6px; }
.doc-body li::marker { color:var(--text-muted); }
.doc-body a { color:var(--accent); text-decoration:none; border-bottom:1px dashed rgba(59,130,246,0.4); }
.doc-body a:hover { border-bottom-style:solid; }
.doc-body strong { color:var(--text-primary); font-weight:600; }
.doc-body em { color:var(--text-primary); }
.doc-body code.md-inline { font-family:var(--mono); font-size:0.9em; padding:2px 6px; background:var(--bg-input); border:1px solid var(--border); border-radius:4px; color:var(--accent); }
.doc-body pre.md-code { font-family:var(--mono); font-size:12px; padding:14px 16px; background:var(--bg-primary); border:1px solid var(--border); border-radius:6px; overflow-x:auto; margin:0 0 16px; }
.doc-body pre.md-code code { background:none; border:0; padding:0; color:var(--text-primary); }
.doc-body img.md-img { max-width:100%; border-radius:6px; border:1px solid var(--border); margin:10px 0; }

/* Timeline for communications */
.timeline { list-style:none; position:relative; padding-left:28px; }
.timeline::before { content:''; position:absolute; left:10px; top:8px; bottom:8px; width:2px; background:var(--border); }
.timeline-item { position:relative; padding:12px 0 14px; }
.timeline-item::before { content:''; position:absolute; left:-24px; top:18px; width:10px; height:10px; border-radius:50%; background:var(--accent); box-shadow:0 0 0 4px var(--bg-primary); }
.timeline-item.type-call::before { background:var(--green); }
.timeline-item.type-email::before { background:var(--purple); }
.timeline-item.type-meeting::before { background:var(--amber); }
.timeline-item.type-note::before { background:var(--text-muted); }
.timeline-head { display:flex; align-items:center; gap:10px; margin-bottom:4px; }
.timeline-title { font-size:13px; font-weight:600; }
.timeline-time { font-size:11px; color:var(--text-muted); }
.timeline-body { font-size:13px; color:var(--text-secondary); line-height:1.55; white-space:pre-wrap; }

/* Login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:36px; max-width:400px; width:100%; box-shadow:var(--shadow); }
.login-brand { display:flex; align-items:center; gap:12px; margin-bottom:24px; }

/* Responsive */
@media (max-width:1024px) {
    .stats-grid { grid-template-columns:repeat(2,1fr); }
    .two-col { grid-template-columns:1fr; }
    .form-row, .form-row-3 { grid-template-columns:1fr; }
}
@media (max-width:768px) {
    .sidebar { display:none; }
    .main-content { padding:18px; }
    .stats-grid { grid-template-columns:1fr; }
    .page-header { flex-direction:column; align-items:flex-start; }
    .topbar-user-info { display:none; }
}
