@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --brand-primary: #4f46e5;
    --brand-primary-hover: #4338ca;
    --brand-primary-light: #eef2ff;
    --brand-primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    --brand-sidebar: #0f172a;
    --brand-sidebar-dark: #090d16;
    --brand-sidebar-hover: #1e293b;
    --brand-sidebar-active: #312e81;
    --surface-bg: #f8fafc;
    --surface-card: #ffffff;
    --surface-subtle: #f1f5f9;
    --border-subtle: #e2e8f0;
    --border-focus: #818cf8;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --status-success: #059669;
    --status-success-bg: #ecfdf5;
    --status-success-border: #a7f3d0;
    --status-warning: #d97706;
    --status-warning-bg: #fffbeb;
    --status-warning-border: #fde68a;
    --status-danger: #dc2626;
    --status-danger-bg: #fef2f2;
    --status-danger-border: #fecaca;
    --status-info: #0284c7;
    --status-info-bg: #f0f9ff;
    --status-info-border: #bae6fd;
    --status-purple: #7c3aed;
    --status-purple-bg: #f5f3ff;
    --status-purple-border: #ddd6fe;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
    --shadow-hover: 0 10px 20px -5px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-dropdown: 0 12px 28px 0 rgba(15, 23, 42, 0.12), 0 2px 4px 0 rgba(15, 23, 42, 0.04);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--surface-bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.55;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--brand-sidebar) 0%, var(--brand-sidebar-dark) 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1030;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.app-sidebar.collapsed {
    width: 74px;
}

.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .brand-title-wrap,
.app-sidebar.collapsed .sidebar-footer-text,
.app-sidebar.collapsed .badge-pill-nav {
    display: none !important;
}

.sidebar-brand-header {
    height: 68px;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    text-decoration: none;
    color: #ffffff;
}

.brand-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--brand-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
    flex-shrink: 0;
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    padding: 0.85rem 0.65rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #64748b;
    padding: 0.85rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.84rem;
    margin-bottom: 0.15rem;
    transition: all 0.18s ease;
    position: relative;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: #94a3b8;
    transition: color 0.18s ease;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background-color: var(--brand-sidebar-hover);
    color: #f8fafc;
}

.sidebar-link:hover i {
    color: #ffffff;
}

.sidebar-link.active {
    background: var(--brand-primary-gradient);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.sidebar-link.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: #cbd5e1;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1025;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: 68px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    padding: 1.75rem;
    flex: 1;
}

.topbar-switch-box {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.2rem 0.4rem;
}

.topbar-switch-box select {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    outline: none;
}

.quick-search-box {
    position: relative;
    width: 260px;
}

.quick-search-box input {
    padding-left: 2.1rem;
    padding-right: 3.2rem;
    font-size: 0.82rem;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

.quick-search-box input:focus {
    background: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.quick-search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.quick-search-box .search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    background: #e2e8f0;
    color: #64748b;
    font-family: inherit;
    font-weight: 600;
}

.live-clock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-success);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(5, 150, 105, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
    }
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: #ffffff;
    transition: all 0.18s ease;
    cursor: pointer;
}

.user-profile-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.saas-card, .panel-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.saas-card-header, .panel-card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    background: #ffffff;
}

.panel-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.saas-card-body, .panel-card-body {
    padding: 1.4rem;
}

.kpi-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.4rem;
    box-shadow: var(--shadow-card);
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-primary-gradient);
    opacity: 0.9;
}

.kpi-card.kpi-success::before {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.kpi-card.kpi-warning::before {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

.kpi-card.kpi-info::before {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.15;
    margin: 0.4rem 0 0.3rem;
    letter-spacing: -0.03em;
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.table-saas, .table-enterprise {
    width: 100%;
    margin-bottom: 0;
}

.table-saas th, .table-enterprise th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.85rem 1.15rem;
    white-space: nowrap;
}

.table-saas td, .table-enterprise td {
    padding: 0.9rem 1.15rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    font-size: 0.85rem;
}

.table-saas tbody tr:hover, .table-enterprise tbody tr:hover {
    background-color: #f8fafc;
}

.avatar-chip {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    margin-right: 0.6rem;
    flex-shrink: 0;
}

.badge-soft,
.badge-soft-success,
.badge-soft-warning,
.badge-soft-danger,
.badge-soft-info,
.badge-soft-secondary,
.badge-soft-neutral,
.badge-soft-purple {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1;
}

.badge-soft-success {
    background-color: var(--status-success-bg);
    color: var(--status-success);
    border: 1px solid var(--status-success-border);
}

.badge-soft-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning);
    border: 1px solid var(--status-warning-border);
}

.badge-soft-danger {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid var(--status-danger-border);
}

.badge-soft-info {
    background-color: var(--status-info-bg);
    color: var(--status-info);
    border: 1px solid var(--status-info-border);
}

.badge-soft-secondary, .badge-soft-neutral {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.badge-soft-purple {
    background-color: var(--status-purple-bg);
    color: var(--status-purple);
    border: 1px solid var(--status-purple-border);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.bg-success {
    background-color: var(--status-success) !important;
}

.badge-dot.bg-danger {
    background-color: var(--status-danger) !important;
}

.badge-dot.bg-warning {
    background-color: var(--status-warning) !important;
}

.form-control, .form-select {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-main);
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    outline: none;
}

.form-control-sm, .form-select-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.3rem;
}

.btn-primary {
    background: var(--brand-primary-gradient);
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
    transition: all 0.18s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    border-color: #c7d2fe;
    color: var(--brand-primary);
    background-color: #ffffff;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary-light);
    border-color: var(--brand-primary);
    color: var(--brand-primary-hover);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #0f172a 60%, #030712 100%);
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.auth-header {
    padding: 1.75rem 1.75rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    background: #ffffff;
}

.auth-body {
    padding: 1.75rem;
}

.auth-footer {
    padding: 1rem 1.75rem;
    background: #f8fafc;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-muted);
}

.welcome-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: var(--radius-xl);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.live-feed-card .table td {
    padding: 0.75rem 1rem;
}

.live-feed-row {
    transition: background-color 0.15s ease;
}

.live-feed-row:hover {
    background-color: #f8fafc;
}

.action-btn-pill {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-md);
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-backdrop.active {
        display: block;
    }
    .app-topbar {
        padding: 0 1rem;
    }
    .app-content {
        padding: 1rem;
    }
}

@media print {
    .no-print, .app-sidebar, .app-topbar, .sidebar-backdrop {
        display: none !important;
    }
    .app-main {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body {
        background: #ffffff !important;
    }
}