/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #242836;
    --bg-hover: #2a2f3e;
    --bg-active: #313750;
    --border: #2a2f3e;
    --border-light: #353a4a;
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3b4;
    --text-muted: #6b7280;
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-green: #10b981;
    --accent-green-dim: rgba(16, 185, 129, 0.15);
    --accent-yellow: #f59e0b;
    --accent-yellow-dim: rgba(245, 158, 11, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-purple: #8b5cf6;
    --accent-purple-dim: rgba(139, 92, 246, 0.15);
    --accent-gold: #d97706;
    --accent-gold-dim: rgba(217, 119, 6, 0.15);
    --accent-pink: #ec4899;
    --accent-pink-dim: rgba(236, 72, 153, 0.15);
    --accent-cyan: #06b6d4;
    --accent-cyan-dim: rgba(6, 182, 212, 0.15);
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --sidebar-width: 240px;
    --transition: 0.2s ease;
}

html { font-size: 14px; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-blue); color: #fff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 40px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.login-logo { margin-bottom: 16px; }
.login-title {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.login-error {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: left;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-dim);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}
.btn-primary:hover {
    background: #2563eb;
}
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
}
.btn-danger {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
}
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== SIDEBAR ===== */
#sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 0 5px;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 12px 14px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    background: var(--accent-blue);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ===== MOBILE ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
}

.mobile-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
}

.notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
}

#mobile-notif-btn { position: relative; }

@media (max-width: 768px) {
    .mobile-header { display: flex; }
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 200;
    }
    #sidebar.open { transform: translateX(0); }
    .main-content { padding-top: 52px !important; }
    .kanban-board { flex-direction: column; }
    .kanban-column { min-width: 100%; }
    .member-detail-layout { flex-direction: column; }
    .member-info-panel { min-width: 100%; max-width: 100%; }
    .team-layout { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-wrap: wrap; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ===== MAIN CONTENT ===== */
.app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 28px 32px;
    overflow-y: auto;
}

.page {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.6rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.breadcrumbs a {
    color: var(--text-secondary);
}
.breadcrumbs a:hover {
    color: var(--accent-blue);
    text-decoration: none;
}

/* ===== STATS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color var(--transition);
}
.stat-card:hover {
    border-color: var(--border-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.stat-icon-green { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-icon-purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.stat-icon-red { background: var(--accent-red-dim); color: var(--accent-red); }

.stat-info { display: flex; flex-direction: column; }
.stat-value {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dash-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.dash-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.funnel-overview {
    display: flex;
    gap: 12px;
}

.funnel-card {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
}
.funnel-card .funnel-count {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    display: block;
}
.funnel-card .funnel-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.activity-feed {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-info { flex: 1; min-width: 0; }
.activity-info .activity-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}
.activity-info .activity-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.my-tasks {
    max-height: 300px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.task-item:hover { background: var(--bg-hover); }

.task-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

.task-info { flex: 1; min-width: 0; }
.task-info .task-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-info .task-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
}

/* ===== CHARTS ===== */
.chart-container {
    min-height: 180px;
}

.chart-bar-group {
    margin-bottom: 10px;
}

.chart-bar-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.chart-bar-track {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex: 1;
    max-width: 280px;
}
.search-box input {
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    flex: 1;
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.filter-select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color var(--transition);
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

.data-table thead th.sortable {
    cursor: pointer;
}
.data-table thead th.sortable:hover {
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}
.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}

.member-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

.member-cell-info .member-cell-name {
    font-weight: 500;
    display: block;
}
.member-cell-info .member-cell-username {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-green { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-yellow { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.badge-red { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.badge-gray { background: var(--bg-tertiary); color: var(--text-muted); }

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 16px;
}
.empty-state p {
    font-size: 0.9rem;
}

/* ===== MEMBER DETAIL ===== */
.member-detail-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.member-info-panel {
    width: 320px;
    min-width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.member-header-card {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.member-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    color: #fff;
    margin: 0 auto 12px;
}

.member-header-card h2 {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.member-badges {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.member-fields {
    padding: 16px;
}

.field-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.field-row:last-child { border-bottom: none; }
.field-label { color: var(--text-muted); }
.field-value { color: var(--text-primary); font-weight: 500; text-align: right; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

.field-value select {
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-body);
}

.member-actions {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== PANEL TABS ===== */
.member-activity-panel {
    flex: 1;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
}

.panel-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.panel-tab:hover { color: var(--text-primary); }
.panel-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.panel-content {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}
.panel-content.active {
    display: flex;
}

/* ===== TIMELINE ===== */
.timeline-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.timeline-entry {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 0.2s ease;
}
.timeline-entry:last-child { border-bottom: none; }

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.timeline-icon-note { background: var(--accent-blue-dim); color: var(--accent-blue); }
.timeline-icon-call { background: var(--accent-green-dim); color: var(--accent-green); }
.timeline-icon-meeting { background: var(--accent-purple-dim); color: var(--accent-purple); }
.timeline-icon-message_in { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.timeline-icon-message_out { background: var(--accent-gold-dim); color: var(--accent-gold); }
.timeline-icon-audio { background: var(--accent-pink-dim); color: var(--accent-pink); }
.timeline-icon-system { background: var(--bg-tertiary); color: var(--text-muted); }

.timeline-body { flex: 1; min-width: 0; }

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.timeline-author {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-type-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.timeline-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}

.timeline-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.timeline-audio {
    margin-top: 8px;
}
.timeline-audio audio {
    height: 32px;
    width: 100%;
    max-width: 300px;
}

.timeline-channel {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Timeline Input */
.timeline-input {
    border-top: 1px solid var(--border);
    padding: 14px 16px;
}

.timeline-input-header {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.timeline-input-body textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    resize: vertical;
    min-height: 60px;
}
.timeline-input-body textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.timeline-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-upload {
    cursor: pointer;
}
.btn-upload:hover {
    color: var(--accent-blue);
}

.audio-filename {
    font-size: 0.75rem;
    color: var(--accent-blue);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-input-actions .btn {
    margin-left: auto;
}

/* ===== POSTS ===== */
#tab-posts, #tab-notes {
    padding: 16px;
    overflow-y: auto;
}

.post-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 12px;
}

.post-card h4 {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.post-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.post-meta {
    display: flex;
    gap: 12px;
    font-size: 0.73rem;
    color: var(--text-muted);
}

.notes-area {
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    min-height: 80px;
}

/* ===== KANBAN ===== */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-column {
    flex: 1;
    min-width: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.kanban-col-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-column-header h3 {
    font-size: 0.9rem;
    flex: 1;
}

.kanban-count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    padding: 0 6px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 60px;
}

.kanban-cards.drag-over {
    background: var(--accent-blue-dim);
    border-radius: var(--radius-sm);
}

.kanban-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all var(--transition);
}
.kanban-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}
.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.kanban-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.kanban-card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.65rem;
    color: #fff;
    flex-shrink: 0;
}

.kanban-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-details {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kanban-card-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.kanban-card-footer {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kanban-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.kanban-filter-chips {
    display: flex;
    gap: 6px;
}

.filter-chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.filter-chip.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ===== TEAM ===== */
.team-layout {
    display: flex;
    gap: 24px;
}

.team-compose {
    width: 340px;
    min-width: 340px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.team-compose h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.team-messages-list {
    flex: 1;
    min-width: 0;
}

.team-msg-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    transition: border-color var(--transition);
}
.team-msg-card.unread {
    border-left: 3px solid var(--accent-blue);
}
.team-msg-card:hover {
    border-color: var(--border-light);
}

.team-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.team-msg-from {
    font-weight: 600;
    font-size: 0.85rem;
}
.team-msg-dir {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.team-msg-time {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.team-msg-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.team-msg-context {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.team-msg-context a { color: var(--accent-blue); }

.team-msg-actions {
    margin-top: 8px;
}

/* ===== IMPORT ===== */
.import-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.import-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}
.import-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}
.import-card p {
    font-size: 0.82rem;
    margin-bottom: 16px;
}

.import-drop {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.import-drop:hover, .import-drop.drag-over {
    border-color: var(--accent-blue);
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.import-result {
    margin-top: 12px;
    font-size: 0.85rem;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}
.import-result.success {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}
.import-result.error {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

/* ===== SETTINGS ===== */
.settings-layout {
    max-width: 700px;
}

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}
.settings-section h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}
.settings-section > p {
    font-size: 0.82rem;
    margin-bottom: 20px;
}

.users-list {
    margin-bottom: 24px;
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.user-list-item:last-child { border-bottom: none; }

.user-list-item .user-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.85rem;
}

.user-list-info { flex: 1; }
.user-list-info .user-list-name {
    font-weight: 600;
    font-size: 0.88rem;
}
.user-list-info .user-list-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.user-list-role {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 12px;
}

.settings-add-user {
    border-top: 1px solid var(--border);
    padding-top: 20px;
}
.settings-add-user h4 {
    font-size: 0.95rem;
    margin-bottom: 16px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-size: 1.05rem;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    max-width: 380px;
}
.toast-success { background: #065f46; color: #a7f3d0; }
.toast-error { background: #7f1d1d; color: #fca5a5; }
.toast-info { background: #1e3a5f; color: #93c5fd; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Skool JSON Import ─── */
.import-card-wide { grid-column: 1 / -1; }
.import-json-textarea {
    width: 100%; box-sizing: border-box;
    padding: 12px 14px; border: 1px solid var(--border-light, #2a2f3a);
    border-radius: 8px; background: var(--bg-secondary, #131620);
    color: var(--text-primary, #e2e8f0); font-family: 'DM Sans', monospace;
    font-size: 13px; resize: vertical; min-height: 120px;
    transition: border-color 0.2s;
}
.import-json-textarea:focus { outline: none; border-color: #3b82f6; }
.import-paste-actions { display: flex; gap: 8px; margin-top: 10px; }
.import-progress { margin-top: 12px; }
.import-progress-bar { height: 6px; background: var(--bg-secondary, #1a1f2e); border-radius: 3px; overflow: hidden; }
.import-progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #10b981); border-radius: 3px; width: 0%; transition: width 0.3s; }
.import-progress-text { font-size: 12px; color: var(--text-muted, #94a3b8); margin-top: 4px; display: block; }

/* ─── Community Toggle ─── */
.import-community-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toggle-label { font-size: 13px; color: var(--text-muted, #94a3b8); font-weight: 500; }
.btn-community { padding: 6px 16px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; opacity: 0.5; transition: all 0.2s; }
.btn-community.active { opacity: 1; border-color: #fff; transform: scale(1.05); box-shadow: 0 0 12px rgba(255,255,255,0.15); }
.btn-community:hover { opacity: 0.85; }
.import-log { max-height: 200px; overflow-y: auto; background: var(--bg-secondary, #131620); border: 1px solid var(--border-light, #2a2f3a); border-radius: 8px; padding: 10px; margin-top: 10px; font-size: 12px; font-family: monospace; color: var(--text-muted, #94a3b8); }
.import-log .log-line { padding: 2px 0; }
.import-log .log-ok { color: #10b981; }
.import-log .log-warn { color: #f59e0b; }
.import-log .log-err { color: #ef4444; }
.import-log .log-info { color: #3b82f6; }
