/* Global Sharp Corners Constraint - Zero Border Radius Across All Components */
*,
*::before,
*::after,
.card,
.btn,
.btn-group,
.form-control,
.form-select,
.badge,
.modal-content,
.dropdown-menu,
.kpi-tile,
.input-group,
.input-group-text,
.nav-link,
.ms-sidebar,
.ms-navbar {
    border-radius: 0 !important;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);

    --secondary-color: #0d9488;
    --secondary-hover: #0f766e;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
    --bg-sidebar-active: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0.02) 100%);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #64748b;
    --text-light: #f8fafc;

    --border-color: #e2e8f0;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --card-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
    --sidebar-shadow: 4px 0 24px 0 rgba(15, 23, 42, 0.08);
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Mobile First Layout (Mobile & Tablet) */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Wrapper - Hidden off-screen on mobile by default */
.ms-sidebar-wrapper {
    position: fixed;
    left: -265px;
    top: 0;
    bottom: 0;
    width: 265px;
    background: #0f172a;
    box-shadow: var(--sidebar-shadow);
    z-index: 1050;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slide in sidebar when toggled active */
.app.show-sidebar .ms-sidebar-wrapper {
    transform: translateX(265px);
}

.ms-sidebar {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.5rem;
    overflow-y: auto;
}

.sidebar-brand-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #f8fafc !important;
}

/* Sidebar Accordion Navigation */
.sidebar-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-accordion .collapse:not(.show) {
    display: none !important;
}

.sidebar-accordion .collapse.show {
    display: block !important;
}

.sidebar-menu-item {
    border-radius: 6px;
    overflow: hidden;
}

.sidebar-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-menu-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu-btn.active,
.sidebar-menu-btn[aria-expanded="true"] {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-menu-btn .menu-chevron {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.65;
}

.sidebar-menu-btn[aria-expanded="true"] .menu-chevron {
    transform: rotate(90deg);
    opacity: 1;
    color: #38bdf8;
}

.sidebar-submenu {
    padding-left: 0.75rem;
    margin: 0.25rem 0 0.35rem 1rem;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    color: #94a3b8;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sidebar-sublink svg {
    opacity: 0.75;
    transition: stroke 0.15s ease;
}

.sidebar-sublink:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-sublink:hover svg {
    opacity: 1;
}

.sidebar-sublink.active {
    color: #38bdf8 !important;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.12);
    border-left: 2px solid #38bdf8;
    padding-left: calc(0.75rem - 2px);
}

.sidebar-sublink.active svg {
    stroke: #38bdf8;
    opacity: 1;
}

.sidebar-sublink-locked {
    opacity: 0.65;
    color: #64748b !important;
    cursor: pointer;
}

.sidebar-sublink-locked:hover {
    opacity: 0.95;
    color: #cbd5e1 !important;
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-sublink-locked .sidebar-lock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    color: #94a3b8;
    opacity: 0.75;
}

.sidebar-sublink-locked:hover .sidebar-lock-badge {
    opacity: 1;
    color: #cbd5e1;
}

/* Sidebar Backdrop Overlay on mobile */
.ms-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.app.show-sidebar .ms-sidebar-overlay {
    display: block;
    opacity: 1;
}

/* Main Content Layout */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.ms-navbar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    z-index: 5;
}

.navbar-title-text {
    font-size: 0.9rem;
}

.navbar-brand-center {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #0f172a !important;
    display: inline-block;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.navbar-username {
    font-size: 0.85rem;
}


.page {
    flex: 1 0 auto;
    padding: 1.25rem;
}

/* Responsive overrides for large screens (Desktop) */
@media (min-width: 992px) {
    .app {
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }

    .ms-sidebar-wrapper {
        position: static;
        left: 0;
        transform: none !important;
        z-index: 10;
        height: 100vh;
        width: 265px;
        min-width: 265px;
        flex-shrink: 0;
    }

    .ms-sidebar-overlay {
        display: none !important;
    }

    .app-content {
        height: 100vh;
        overflow-y: auto;
    }

    .ms-navbar {
        padding: 0.75rem 2rem;
    }

    .page {
        padding: 2rem;
    }
}

.page-body {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 1rem 2rem;
    font-size: 0.85rem;
}

/* Cards & Containers Overhaul */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    border-radius: 6px;
    gap: 0.35rem;
}

.status-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

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

.status-badge-success::before {
    background-color: var(--success);
}

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

.status-badge-warning::before {
    background-color: var(--warning);
}

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

.status-badge-danger::before {
    background-color: var(--danger);
}

/* Live Indicators & Pulsing Dots */
.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

.pulse-dot-warning {
    background-color: var(--warning);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Tables Redesign */
.table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table th {
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.table td {
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Custom terminal console style for execution logs */
.terminal-console {
    background: #0f172a;
    border-radius: 8px;
    color: #38bdf8;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    padding: 1.25rem;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #1e293b;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.terminal-line {
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.terminal-line .timestamp {
    color: #64748b;
    margin-right: 0.75rem;
}

.terminal-line .info {
    color: #38bdf8;
}

.terminal-line .success {
    color: #34d399;
}

.terminal-line .warning {
    color: #fbbf24;
}

.terminal-line .danger {
    color: #f87171;
}

/* Custom form elements styling */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Responsive utilities for page layouts */
@media (min-width: 992px) {
    .border-end-lg {
        border-right: 1px solid var(--border-color) !important;
    }
}

/* Sleek Compact SaaS User Menu Dropdown Styling */
.user-dropdown-menu {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.04) !important;
    padding: 0 !important;
    min-width: 175px !important;
    width: auto !important;
    overflow: hidden;
}

.user-dropdown-item {
    padding: 0.5rem 0.95rem !important;
    font-size: 0.84rem !important;
    font-weight: 500 !important;
    color: #334155 !important;
    transition: all 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.55rem !important;
    border-radius: 0 !important;
}

.user-dropdown-item:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

.user-dropdown-item.danger-item:hover {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
}

/* ==========================================================================
   PREMIUM LOCKED PREVIEW PROMOTION & OVERLAY STYLES
   ========================================================================== */

.ms-premium-locked-page {
    position: relative;
    overflow: hidden;
}

.ms-premium-locked-content {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    filter: blur(0.4px);
    opacity: 0.52;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.ms-premium-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 560px;
    z-index: 40;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4.5rem 1.5rem 2.5rem 1.5rem;
    background: rgba(248, 250, 252, 0.35);
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
    border-radius: 8px;
}

.ms-premium-overlay-card {
    max-width: 440px;
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(226, 232, 240, 0.8);
    padding: 2.25rem 2rem 1.75rem 2rem;
    text-align: center;
    animation: msFadeScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: sticky;
    top: 4.5rem;
    margin: 1.5rem auto 2rem auto;
}

@keyframes msFadeScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ms-premium-lock-icon-wrap {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 10px 25px -4px rgba(124, 58, 237, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    margin-top: -3.85rem;
    margin-bottom: 1.15rem;
    position: relative;
}

.ms-premium-overlay-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    margin-bottom: 0.45rem;
}

.ms-premium-overlay-subtitle {
    font-size: 0.84rem;
    color: #64748b;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}

.ms-premium-benefits-box {
    background: #fbf9ff;
    border: 1px solid #f3e8ff;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.35rem;
    text-align: left;
}

.ms-premium-benefit-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: #334155;
}

.ms-premium-benefit-item:last-child {
    padding-bottom: 0;
}

.ms-premium-benefit-item svg {
    flex-shrink: 0;
}

.ms-premium-cta-btn {
    background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.72rem 1.25rem !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    width: 100% !important;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #ffffff !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.ms-premium-cta-btn:hover {
    background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.42) !important;
    color: #ffffff !important;
}

.ms-premium-secondary-link {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #2563eb !important;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.ms-premium-secondary-link:hover {
    color: #1d4ed8 !important;
    text-decoration: underline;
}

#menuPremium .sidebar-sublink.active {
    color: #c084fc !important;
    background: rgba(168, 85, 247, 0.12) !important;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    border-radius: 6px !important;
}

#menuPremium .sidebar-sublink.active svg {
    stroke: #c084fc !important;
}