/* ══════════════════════════════════════════════════════════════
   Aetheris Dashboard v5 — Professional Desktop App CSS
   Dark theme, glassmorphism, micro-animations, desktop-class UX
   ══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
    --bg-dark: #09090B;
    --bg-surface: #0F0F14;
    --bg-card: #16161E;
    --bg-card-hover: #1C1C27;
    --bg-card-active: #22222F;
    --bg-input: #12121A;
    --bg-elevated: #1A1A24;
    --border: #23232F;
    --border-light: #1A1A24;
    --border-focus: #F97316;
    --text-primary: #ECECF1;
    --text-secondary: #A0A0B0;
    --text-muted: #5C5C6F;
    --text-dim: #3A3A4A;
    --accent: #F97316;
    --accent-hover: #EA6C0E;
    --accent-glow: rgba(249, 115, 22, 0.15);
    --accent-soft: rgba(249, 115, 22, 0.08);
    --accent-bright: #FB923C;
    --green: #22C55E;
    --green-soft: rgba(34, 197, 94, 0.1);
    --green-dim: rgba(34, 197, 94, 0.06);
    --red: #EF4444;
    --red-soft: rgba(239, 68, 68, 0.1);
    --blue: #3B82F6;
    --blue-soft: rgba(59, 130, 246, 0.1);
    --yellow: #FBBF24;
    --yellow-soft: rgba(251, 191, 36, 0.1);
    --purple: #A855F7;
    --purple-soft: rgba(168, 85, 247, 0.1);
    --sidebar-width: 250px;
    --sidebar-collapsed: 64px;
    --topbar-height: 52px;
    --radius: 10px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.1);
    --transition-fast: 0.15s ease;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── BODY ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR — Grouped navigation, workspace, user area
   ══════════════════════════════════════════════════════════════ */

.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar__brand,
.sidebar.collapsed .sidebar__workspace-plan,
.sidebar.collapsed .sidebar__workspace-info,
.sidebar.collapsed .sidebar__link span,
.sidebar.collapsed .sidebar__link kbd,
.sidebar.collapsed .sidebar__group-label,
.sidebar.collapsed .sidebar__user-info,
.sidebar.collapsed .sidebar__version { display: none; }
.sidebar.collapsed .sidebar__link { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar__collapse svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar__workspace { justify-content: center; }
.sidebar.collapsed .sidebar__user { justify-content: center; }

/* Header / Workspace */
.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}
.sidebar__workspace {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.sidebar__workspace-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar__brand {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.sidebar__workspace-plan {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar__collapse {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.sidebar__collapse:hover { color: var(--text-primary); background: var(--bg-card); }
.sidebar__collapse svg { transition: transform var(--transition); display: block; }

/* Navigation Groups */
.sidebar__nav {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.sidebar__group {
    margin-bottom: 4px;
}
.sidebar__group-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 12px 6px;
}

/* Navigation Links */
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}
.sidebar__link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.sidebar__link.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.sidebar__link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.sidebar__link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar__link:hover svg, .sidebar__link.active svg { opacity: 1; }
.sidebar__link span { flex: 1; }

/* Keyboard hint badges */
.sidebar__kbd {
    font-size: 0.6rem;
    color: var(--text-dim);
    background: var(--bg-dark);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid var(--border);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.sidebar__link:hover .sidebar__kbd { opacity: 1; }

/* Footer / User */
.sidebar__footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}
.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.sidebar__user:hover { background: var(--bg-card); }
.sidebar__avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}
.sidebar__user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar__user-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { font-size: 0.65rem; color: var(--text-muted); }
.sidebar__version {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════ */

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed); }

/* ══════════════════════════════════════════════════════════════
   TOPBAR — Search, notifications, status
   ══════════════════════════════════════════════════════════════ */

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 40;
    flex-shrink: 0;
}
.topbar__left { display: flex; align-items: center; gap: 12px; }
.topbar__burger {
    display: none;
    background: none; border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}
.topbar__breadcrumb { display: flex; align-items: center; gap: 6px; }
.topbar__breadcrumb-item {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Search trigger button */
.topbar__center { flex: 1; max-width: 480px; margin: 0 24px; }
.topbar__search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}
.topbar__search:hover {
    border-color: var(--text-dim);
    background: var(--bg-card-hover);
}
.topbar__search span { flex: 1; text-align: left; }
.topbar__search kbd {
    font-size: 0.65rem;
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-weight: 600;
    color: var(--text-dim);
}
.topbar__search svg { opacity: 0.5; }

.topbar__right { display: flex; align-items: center; gap: 8px; }

/* Icon button (notifications, etc.) */
.topbar__icon-btn {
    position: relative;
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar__icon-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.topbar__badge {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 16px;
    height: 16px;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Status */
.topbar__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot--online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot--offline { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot--checking { background: var(--yellow); animation: pulse 1.5s infinite; }
.status-dot--degraded { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse 2s infinite; }
.status-dot--unknown { background: var(--text-muted); animation: pulse 1s infinite; }

/* ══════════════════════════════════════════════════════════════
   PAGE CONTENT — Animated transitions
   ══════════════════════════════════════════════════════════════ */

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Page enter animation */
.page-content.page-enter {
    animation: pageEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card stagger animation */
.page-content .card,
.page-content .stat-card,
.page-content .table-wrap {
    animation: cardEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.page-content .stats-grid > *:nth-child(1) { animation-delay: 0.03s; }
.page-content .stats-grid > *:nth-child(2) { animation-delay: 0.06s; }
.page-content .stats-grid > *:nth-child(3) { animation-delay: 0.09s; }
.page-content .stats-grid > *:nth-child(4) { animation-delay: 0.12s; }
.page-content .stats-grid > *:nth-child(5) { animation-delay: 0.15s; }
.page-content .stats-grid > *:nth-child(6) { animation-delay: 0.18s; }

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   CARDS — Glass effect, refined hover
   ══════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition-fast);
}
.card--hover:hover,
.card--clickable:hover {
    border-color: rgba(249, 115, 22, 0.2);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}
.card--clickable { cursor: pointer; }
.card--glass {
    background: rgba(22, 22, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ══════════════════════════════════════════════════════════════
   STAT CARDS — With sparkline support
   ══════════════════════════════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-glow);
}
.stat-card__label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.stat-card__value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.stat-card__change {
    font-size: 0.72rem;
    margin-top: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.stat-card__change--up { color: var(--green); }
.stat-card__change--down { color: var(--red); }

/* Mini sparkline in stat card */
.stat-card__sparkline {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 80px;
    height: 32px;
    opacity: 0.3;
}

/* ══════════════════════════════════════════════════════════════
   DATA GRID
   ══════════════════════════════════════════════════════════════ */

.data-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}
.data-grid--2 { grid-template-columns: repeat(2, 1fr); }
.data-grid--3 { grid-template-columns: repeat(3, 1fr); }
.data-grid--2-1 { grid-template-columns: 2fr 1fr; }
.data-grid--1-2 { grid-template-columns: 1fr 2fr; }

/* ══════════════════════════════════════════════════════════════
   TABLE — Professional data table
   ══════════════════════════════════════════════════════════════ */

.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.table-header h3 { font-size: 0.9rem; font-weight: 600; }
.table-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 10px 18px;
    text-align: left;
    font-size: 0.82rem;
}
th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    user-select: none;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text-secondary); }
th.sorted { color: var(--accent); }
th.sorted::after {
    content: ' \25B2';
    font-size: 0.6rem;
}
th.sorted.desc::after {
    content: ' \25BC';
}
td { border-bottom: 1px solid var(--border-light); }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr:hover td { background: var(--bg-card-hover); }
tr.selected td { background: var(--accent-soft); }

/* Row checkbox */
.row-check {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge--hot { background: var(--red-soft); color: var(--red); }
.badge--warm { background: var(--yellow-soft); color: var(--yellow); }
.badge--cold { background: var(--blue-soft); color: var(--blue); }
.badge--new { background: var(--green-soft); color: var(--green); }
.badge--contacted { background: var(--blue-soft); color: var(--blue); }
.badge--qualified { background: var(--purple-soft); color: var(--purple); }
.badge--won { background: var(--green-soft); color: var(--green); }
.badge--lost { background: var(--red-soft); color: var(--red); }
.badge--open { background: var(--accent-soft); color: var(--accent); }
.badge--active { background: var(--green-soft); color: var(--green); }
.badge--nurturing { background: var(--purple-soft); color: var(--purple); }
.badge--converted { background: var(--green-soft); color: var(--green); }
.badge--inactive { background: rgba(92, 92, 111, 0.1); color: var(--text-muted); }

/* Pulsing badge for real-time */
.badge--pulse::before {
    content: '';
    width: 6px; height: 6px;
    background: currentColor;
    border-radius: 50%;
    margin-right: 5px;
    animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
    user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(249, 115, 22, 0.3);
}
.btn--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}
.btn--secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn--secondary:hover { border-color: var(--text-dim); background: var(--bg-card-hover); }
.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 7px 10px;
}
.btn--ghost:hover { color: var(--text-primary); background: var(--bg-card); }
.btn--danger { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn--danger:hover { background: rgba(239,68,68,0.15); }
.btn--success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.btn--success:hover { background: rgba(34,197,94,0.15); }
.btn--sm { padding: 5px 10px; font-size: 0.75rem; }
.btn--lg { padding: 10px 20px; font-size: 0.9rem; }
.btn--icon { padding: 7px; }

/* Button group */
.btn-group { display: flex; gap: 1px; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }

/* ══════════════════════════════════════════════════════════════
   INPUTS
   ══════════════════════════════════════════════════════════════ */

.input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-dim); }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235C5C6F' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.input--sm { padding: 5px 10px; font-size: 0.78rem; }

/* ══════════════════════════════════════════════════════════════
   KANBAN — Improved with drag & drop visual cues
   ══════════════════════════════════════════════════════════════ */

.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
}
.kanban__column {
    min-width: 280px;
    max-width: 300px;
    flex-shrink: 0;
    scroll-snap-align: start;
}
.kanban__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.kanban__header h4 { font-size: 0.8rem; font-weight: 600; }
.kanban__count {
    background: var(--bg-dark);
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}
.kanban__value {
    font-size: 0.68rem;
    color: var(--text-dim);
    font-weight: 600;
}
.kanban__body {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 8px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background var(--transition-fast);
}
.kanban__body.drag-over {
    background: var(--accent-soft);
    border-color: var(--accent);
}

/* Kanban card */
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}
.kanban-card:hover {
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: var(--shadow-sm);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}
.kanban-card__top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.kanban-card__avatar {
    width: 24px; height: 24px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.kanban-card__title { font-size: 0.82rem; font-weight: 600; flex: 1; line-height: 1.3; }
.kanban-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kanban-card__value { font-size: 0.78rem; color: var(--accent); font-weight: 700; }
.kanban-card__date { font-size: 0.68rem; color: var(--text-muted); }
.kanban-card__stalled {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--red);
    font-weight: 600;
}
.kanban-card__stalled::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--red);
    border-radius: 50%;
    animation: badgePulse 1.5s infinite;
}

/* Add deal button in column */
.kanban__add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    width: 100%;
}
.kanban__add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* ══════════════════════════════════════════════════════════════
   MODAL SYSTEM
   ══════════════════════════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
    overflow-y: auto;
}
.modal-backdrop.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 8vh;
}
.modal--sm { max-width: 420px; }
.modal--lg { max-width: 800px; }
.modal--xl { max-width: 960px; }
.modal--full { max-width: 90vw; width: 90vw; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal__header h2 { font-size: 1rem; font-weight: 700; }
.modal__close {
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
    transition: all var(--transition-fast);
    display: flex;
}
.modal__close:hover { color: var(--text-primary); background: var(--bg-card); }
.modal__body { padding: 20px; }
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   COMMAND PALETTE
   ══════════════════════════════════════════════════════════════ */

.cmd-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}
.cmd-backdrop.open {
    display: flex;
    animation: fadeIn 0.15s ease;
}

.cmd-palette {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.cmd-palette__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.cmd-palette__search svg { color: var(--text-muted); flex-shrink: 0; }
.cmd-palette__search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}
.cmd-palette__search input::placeholder { color: var(--text-dim); }

.cmd-palette__results {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}
.cmd-palette__group-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px 4px;
}
.cmd-palette__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 0.85rem;
}
.cmd-palette__item:hover,
.cmd-palette__item.selected {
    background: var(--bg-card);
}
.cmd-palette__item.selected {
    background: var(--accent-soft);
    color: var(--accent);
}
.cmd-palette__item svg { color: var(--text-muted); flex-shrink: 0; }
.cmd-palette__item span { flex: 1; }
.cmd-palette__item kbd {
    font-size: 0.6rem;
    color: var(--text-dim);
    background: var(--bg-dark);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: inherit;
    font-weight: 600;
    border: 1px solid var(--border);
}

.cmd-palette__footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.68rem;
    color: var(--text-dim);
}
.cmd-palette__footer kbd {
    background: var(--bg-dark);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid var(--border);
    font-family: inherit;
    margin: 0 2px;
}
.cmd-palette__empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ══════════════════════════════════════════════════════════════
   NOTIFICATION PANEL
   ══════════════════════════════════════════════════════════════ */

.notif-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 360px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 80;
    transform: translateX(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0,0,0,0.3);
}
.notif-panel.open { transform: translateX(0); }

.notif-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.notif-panel__header h3 { font-size: 0.9rem; font-weight: 700; }
.notif-panel__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}
.notif-item:hover { background: var(--bg-card); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.notif-item__icon--lead { background: var(--blue-soft); color: var(--blue); }
.notif-item__icon--deal { background: var(--green-soft); color: var(--green); }
.notif-item__icon--alert { background: var(--red-soft); color: var(--red); }
.notif-item__icon--system { background: var(--yellow-soft); color: var(--yellow); }
.notif-item__content { flex: 1; min-width: 0; }
.notif-item__title { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }
.notif-item__desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.notif-item__time { font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS OVERLAY
   ══════════════════════════════════════════════════════════════ */

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}
.shortcuts-overlay.open { display: flex; }

.shortcuts-overlay__content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
}
.shortcuts-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.shortcuts-overlay__header h2 { font-size: 1rem; font-weight: 700; }
.shortcuts-overlay__body { padding: 16px 20px; }
.shortcuts-overlay__group { margin-bottom: 16px; }
.shortcuts-overlay__group-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}
.shortcut-row__label { font-size: 0.82rem; color: var(--text-secondary); }
.shortcut-row__keys {
    display: flex;
    gap: 4px;
}
.shortcut-row__keys kbd {
    font-size: 0.7rem;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state__icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.empty-state p { font-size: 0.85rem; margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   LOADING / SPINNER
   ══════════════════════════════════════════════════════════════ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}
.spinner {
    width: 28px; height: 28px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.82rem;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--red); }
.toast--info { border-left: 3px solid var(--blue); }
.toast--warning { border-left: 3px solid var(--yellow); }

@keyframes toastIn {
    from { transform: translateX(100%) scale(0.95); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION TITLE
   ══════════════════════════════════════════════════════════════ */

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-title h2 { font-size: 0.95rem; font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   FILTER BAR
   ══════════════════════════════════════════════════════════════ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-bar .input { max-width: 260px; }
.filter-bar select.input { max-width: 180px; }

/* Filter chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.filter-chip__remove {
    background: none; border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.7;
}
.filter-chip__remove:hover { opacity: 1; }

/* View toggle */
.view-toggle {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
.view-toggle__btn {
    background: none; border: none;
    color: var(--text-muted);
    padding: 5px 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}
.view-toggle__btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.view-toggle__btn:hover:not(.active) { color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════════
   ACTIVITY FEED (Timeline)
   ══════════════════════════════════════════════════════════════ */

.activity-feed { padding: 4px 0; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    position: relative;
}
.activity-item::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: -10px;
    width: 1px;
    background: var(--border);
}
.activity-item:last-child::before { display: none; }

.activity-item__dot {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    z-index: 1;
}
.activity-item__dot--lead { background: var(--blue-soft); color: var(--blue); }
.activity-item__dot--deal { background: var(--green-soft); color: var(--green); }
.activity-item__dot--alert { background: var(--red-soft); color: var(--red); }
.activity-item__dot--system { background: var(--yellow-soft); color: var(--yellow); }

.activity-item__content { flex: 1; min-width: 0; }
.activity-item__text { font-size: 0.82rem; line-height: 1.4; }
.activity-item__text strong { font-weight: 600; }
.activity-item__time { font-size: 0.68rem; color: var(--text-dim); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════════ */

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar__fill--accent { background: var(--accent); }
.progress-bar__fill--green { background: var(--green); }
.progress-bar__fill--red { background: var(--red); }
.progress-bar__fill--blue { background: var(--blue); }

/* Inline score bar */
.score-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}
.score-bar__track {
    width: 48px;
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
}
.score-bar__fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* ══════════════════════════════════════════════════════════════
   INSIGHT CARDS
   ══════════════════════════════════════════════════════════════ */

.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.insight-card:hover { border-color: var(--text-dim); }
.insight-card__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.insight-card__content { flex: 1; }
.insight-card__title { font-size: 0.82rem; font-weight: 600; margin-bottom: 2px; }
.insight-card__desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* ══════════════════════════════════════════════════════════════
   LEAD CARD (Grid view alternative)
   ══════════════════════════════════════════════════════════════ */

.leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.lead-card:hover {
    border-color: rgba(249, 115, 22, 0.3);
    box-shadow: var(--shadow-sm);
}
.lead-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.lead-card__avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.lead-card__name { font-size: 0.85rem; font-weight: 600; }
.lead-card__channel { font-size: 0.7rem; color: var(--text-muted); }
.lead-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lead-card__score {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}
.lead-card__date { font-size: 0.68rem; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════
   SKELETON LOADERS
   ══════════════════════════════════════════════════════════════ */

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-xs);
}
.skeleton--text { height: 14px; margin-bottom: 8px; }
.skeleton--text.skeleton--sm { width: 60%; }
.skeleton--text.skeleton--md { width: 80%; }
.skeleton--text.skeleton--lg { width: 100%; height: 20px; }
.skeleton--block { height: 60px; margin-bottom: 8px; border-radius: var(--radius-xs); }
.skeleton-card { padding: 20px; }
.stat-card.skeleton-card .skeleton--sm { width: 50%; height: 12px; }
.stat-card.skeleton-card .skeleton--lg { width: 70%; height: 28px; margin-top: 8px; }
.kanban-col.skeleton-card {
    min-width: 220px; flex-shrink: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }

/* ══════════════════════════════════════════════════════════════
   PARTIAL FAILURE + OFFLINE BANNERS
   ══════════════════════════════════════════════════════════════ */

.partial-failure-banner,
.offline-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    margin-bottom: 14px;
}
.partial-failure-banner { background: var(--yellow-soft); border: 1px solid rgba(251, 191, 36, 0.15); color: var(--yellow); }
.offline-banner { background: var(--red-soft); border: 1px solid rgba(239, 68, 68, 0.15); color: var(--red); }
.partial-failure-banner svg, .offline-banner svg { flex-shrink: 0; }
.partial-failure-banner .btn, .offline-banner .btn { margin-left: auto; }

/* ══════════════════════════════════════════════════════════════
   ERROR STATE
   ══════════════════════════════════════════════════════════════ */

.error-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.error-state__icon { margin-bottom: 14px; color: var(--red); opacity: 0.5; }
.error-state__code {
    display: inline-block;
    background: var(--red-soft);
    color: var(--red);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.error-state__message { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.error-state__action { font-size: 0.85rem; margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   HEALTH INDICATORS
   ══════════════════════════════════════════════════════════════ */

.health-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 4px;
}
.health-dot--healthy { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health-dot--degraded { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse 2s infinite; }
.health-dot--offline { background: var(--red); box-shadow: 0 0 6px var(--red); }
.health-dot--unknown { background: var(--text-muted); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ══════════════════════════════════════════════════════════════
   BODY STATE CLASSES
   ══════════════════════════════════════════════════════════════ */

body.api-offline .topbar { border-bottom-color: var(--red); }
body.api-degraded .topbar { border-bottom-color: var(--yellow); }

/* ══════════════════════════════════════════════════════════════
   LOGO
   ══════════════════════════════════════════════════════════════ */

.logo-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #F97316, #FB923C);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}
.logo-mark--sm { width: 26px; height: 26px; border-radius: 7px; font-size: 0.8rem; }

/* ══════════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════════ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.tab {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
    font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); }
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px 1px 0 0;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .main { margin-left: 0 !important; }
    .topbar__burger { display: block; }
    .topbar__center { display: none; }
    .page-content { padding: 14px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .data-grid--2, .data-grid--3, .data-grid--2-1, .data-grid--1-2 { grid-template-columns: 1fr; }
    .kanban { flex-direction: column; }
    .kanban__column { min-width: 100%; max-width: 100%; }
    .notif-panel { width: 100%; }
    .modal { width: 95%; }
    .cmd-palette { width: 95%; }
    .leads-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   AUTH & RBAC STYLES — Login, access denied, role badges, audit
   ══════════════════════════════════════════════════════════════ */

/* ── LOGIN SCREEN ── */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(249, 115, 22, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(168, 85, 247, 0.03) 0%, transparent 50%);
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}

.login-card__header {
    text-align: center;
    margin-bottom: 32px;
}

.login-card__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 22px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-card__title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.login-card__subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-card__form .form-group {
    margin-bottom: 16px;
}

.login-card__form label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-dim); }

.login-card__error {
    font-size: 13px;
    color: var(--red);
    padding: 8px 12px;
    background: var(--red-soft);
    border-radius: var(--radius-xs);
    margin-bottom: 12px;
    display: none;
}

.login-card__error--visible { display: block; }

.login-card__footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.login-card__version {
    font-size: 11px;
    color: var(--text-dim);
}

.btn--full { width: 100%; }

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── ACCESS DENIED ── */
.access-denied {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--text-secondary);
}

.access-denied__icon {
    color: var(--text-dim);
    margin-bottom: 16px;
}

.access-denied h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.access-denied p {
    margin: 0 0 4px;
    font-size: 14px;
}

.access-denied__hint {
    color: var(--text-muted);
    font-size: 13px;
}

/* ── ROLE BADGES ── */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge--user {
    background: var(--blue-soft);
    color: var(--blue);
}

.role-badge--admin {
    background: var(--purple-soft);
    color: var(--purple);
}

.role-badge--owner {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ── AUDIT LOG ── */
.audit-row--fail { border-left: 3px solid var(--red); }
.audit-row--ok { border-left: 3px solid var(--green); }
.audit-row--rate { border-left: 3px solid var(--yellow); }

.audit-event-badge {
    font-family: 'Inter', monospace;
    font-size: 12px;
    font-weight: 500;
}

.btn--active {
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* ── AUDIT TIMELINE ── */
.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audit-timeline__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.audit-timeline__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.audit-timeline__content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.audit-timeline__event {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.audit-timeline__time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* ── USER MANAGEMENT ── */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.btn--danger { color: var(--red) !important; }
.btn--danger:hover { background: var(--red-soft) !important; }

/* ── SETTINGS PAGE ── */
.settings-page {
    max-width: 700px;
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.settings-card__row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.settings-card__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-card__email {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-card__meta {
    margin-top: 4px;
}

/* ── PERMISSIONS GRID ── */
.permissions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.perm-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-family: monospace;
    color: var(--text-secondary);
}

/* ── MODAL FORM ── */
.modal-form .form-group {
    margin-bottom: 16px;
}

.modal-form label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-form select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235C5C6F' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.modal-form__error {
    font-size: 13px;
    color: var(--red);
    padding: 8px 12px;
    background: var(--red-soft);
    border-radius: var(--radius-xs);
    margin-bottom: 12px;
    display: none;
}

.modal-form__success {
    font-size: 13px;
    color: var(--green);
    padding: 8px 12px;
    background: var(--green-soft);
    border-radius: var(--radius-xs);
    margin-bottom: 12px;
    display: none;
}

/* ── SYSTEM HEALTH ── */
.system-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.system-status--ok { border-left: 4px solid var(--green); }
.system-status--degraded { border-left: 4px solid var(--yellow); }

.system-status__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.system-status--ok .system-status__dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.system-status--degraded .system-status__dot { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }

.system-status__text h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.health-checks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.health-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-card--sm {
    padding: 12px 16px;
}

.stat-card--sm .stat-card__value {
    font-size: 18px;
}

/* ── SECTION BAR ── */
.section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.section-bar__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-bar__filters {
    display: flex;
    gap: 4px;
}

/* ── SIDEBAR USER (click to settings) ── */
.sidebar__user {
    cursor: pointer;
}

.sidebar__user:hover .sidebar__user-name {
    color: var(--accent);
}

/* ── LOGIN RESPONSIVE ── */
@media (max-width: 480px) {
    .login-card {
        margin: 16px;
        padding: 28px 20px;
    }
}
