:root {
    /* Brand Colors */
    --color-brand: #1D9E75;
    --color-brand-dark: #0F6E56;
    --color-brand-subtle: #E1F5EE;
    
    /* Functional Colors */
    --color-danger: #D85A30;
    --color-warning: #BA7517;
    --color-info: #185FA5;
    --color-success: #1D9E75;
    
    /* UI Neutrals (Premium Glassmorphism) */
    --bg-app: #F9FAFB;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-sidebar: #FFFFFF;
    --border-light: rgba(0, 0, 0, 0.05);
    --border-medium: rgba(0, 0, 0, 0.1);
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    /* Effects */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.06);
    --radius-lg: 16px;
    --radius-md: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(29, 158, 117, 0.2); /* Oga Green subtle */
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 158, 117, 0.5); /* Oga Green active */
}

body {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: #1F2937;
    overflow: hidden;
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    overflow-y: auto;
}

/* Workspace */
.workspace {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 0 24px 32px;
}

.logo {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.logo span { color: var(--color-brand); }

.nav-section { margin-bottom: 24px; }
.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9CA3AF;
    padding: 0 24px 8px;
}

.nav-item {
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--color-brand);
    background: var(--color-brand-subtle);
}

.nav-item.active {
    color: var(--color-brand-dark);
    background: var(--color-brand-subtle);
    font-weight: 600;
    border-right: 3px solid var(--color-brand);
}

/* Topbar */
.topbar {
    height: 64px;
    border-bottom: 1px solid var(--border-light);
    background: #FFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

@media (max-width: 768px) {
    .topbar { padding: 0 16px; }
    .search-bar { display: none; } /* Hide search on small mobile to save space */
}

.search-bar {
    display: flex;
    align-items: center;
    background: #F3F4F6;
    border-radius: 8px;
    padding: 8px 16px;
    width: 400px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    margin-left: 8px;
    width: 100%;
    font-size: 14px;
}

/* Role Switcher in Topbar */
.role-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-brand-subtle);
    color: var(--color-brand-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.role-badge:hover { transform: translateY(-1px); }

/* Main Content Area */
.main-viewport {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-section.active { display: block; }

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

/* Cards & Stats */
.card {
    background: #FFF;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .stat-grid { grid-template-columns: 1fr; }
    .main-viewport { padding: 16px; }
}

.stat-card .label { font-size: 12px; color: #6B7280; margin-bottom: 4px; }
.stat-card .value { font-size: 24px; font-weight: 700; color: #111827; }
.stat-card .trend { font-size: 12px; margin-top: 4px; }
.trend.up { color: var(--color-brand); }
.trend.down { color: var(--color-danger); }

/* --- Workflow Builder Styles --- */
.wf-template-card {
    background: #FFF; border: 1px solid var(--border-medium); border-radius: 12px; padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-soft);
}
.wf-template-card:hover {
    border-color: var(--color-brand); transform: translateY(-2px); box-shadow: var(--shadow-hover);
}
.wf-tc-icon {
    width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; border: 1px solid;
}
.wf-template-card h3 { font-size: 15px; color: #374151; font-weight: 600; }

.wf-layout {
    display: grid; grid-template-columns: 240px 1fr 280px; min-height: 600px; background: #FFF; border: 1px solid var(--border-medium); border-radius: var(--radius-lg); overflow: hidden;
}
.wf-left { border-right: 1px solid var(--border-medium); padding: 20px; background: #F9FAFB; }
.wf-right { border-left: 1px solid var(--border-medium); padding: 20px; background: #F9FAFB; }
.wf-canvas { background: #F3F4F6; padding: 40px; position: relative; overflow-y: auto; display: flex; flex-direction: column; align-items: center; }

.wf-panel-title { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #6B7280; letter-spacing: 0.5px; margin-bottom: 16px; }
.wf-block { padding: 10px 14px; border: 1px solid var(--border-medium); border-radius: 8px; font-size: 13px; cursor: grab; background: #FFF; display: flex; align-items: center; gap: 10px; color: #374151; margin-bottom: 8px; transition: border-color 0.2s; }
.wf-block:hover { border-color: var(--color-brand); }
.wf-block .ic { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic-trigger { background: #E1F5EE; color: #0F6E56; }
.ic-cond { background: #E6F1FB; color: #185FA5; }
.ic-approver { background: #EEEDFE; color: #3C3489; }
.ic-action { background: #FAEEDA; color: #854F0B; }

.canvas-flow { display: flex; flex-direction: column; align-items: center; }
.cn-node { background: #FFF; border: 1px solid var(--border-medium); border-radius: 12px; padding: 16px 20px; width: 300px; position: relative; cursor: pointer; box-shadow: var(--shadow-soft); transition: all 0.2s; }
.cn-node:hover { border-color: var(--color-brand); }
.cn-node.selected { border-color: var(--color-brand); outline: 2px solid var(--color-brand-subtle); }
.cn-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.cn-trigger .cn-label { color: #0F6E56; }
.cn-action .cn-label { color: #854F0B; }
.cn-title { font-size: 14px; font-weight: 600; color: #111827; }
.cn-sub { font-size: 12px; color: #6B7280; margin-top: 4px; }
.cn-arrow { width: 2px; height: 32px; background: #D1D5DB; margin: 0 auto; position: relative; }
.cn-arrow::after { content: ''; position: absolute; bottom: -6px; left: -4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid #D1D5DB; }

.prop-title { font-size: 16px; font-weight: 600; color: #111827; margin-bottom: 4px; }
.prop-sub { font-size: 12px; color: #6B7280; margin-bottom: 24px; }
.prop-field { margin-bottom: 16px; }
.prop-label { font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 6px; display: block; }
.prop-select { width: 100%; padding: 10px; border: 1px solid var(--border-medium); border-radius: 8px; font-size: 13px; background: #FFF; outline: none; }
.prop-save { width: 100%; padding: 12px; background: var(--color-brand); color: #FFF; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 16px; transition: background 0.2s; }
.prop-save:hover { background: var(--color-brand-dark); }

/* --- HR Module Styles --- */
.hr-tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: #6B7280; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
.hr-tab:hover { color: #374151; }
.hr-tab.active { color: var(--color-brand); border-bottom-color: var(--color-brand); font-weight: 600; }
.hr-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.hr-table { width: 100%; border-collapse: collapse; margin-top: 10px; min-width: 600px; }
.hr-table th { text-align: left; padding: 12px; font-size: 12px; color: #6B7280; text-transform: uppercase; border-bottom: 1px solid var(--border-medium); }
.hr-table td { padding: 14px 12px; border-bottom: 1px solid var(--border-light); font-size: 14px; color: #374151; }
.hr-status { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.hr-status.active { background: var(--color-brand-subtle); color: var(--color-brand-dark); }

/* ===== STOREFRONT MODULE STYLES ===== */
.sf-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 600px;
    background: #FFF;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.sf-sidebar {
    border-right: 1px solid var(--border-light);
    padding: 20px;
    background: #FAFBFC;
}

.sf-main {
    padding: 24px;
    background: #FFF;
    overflow-y: auto;
}

.sf-section-label {
    font-size: 10px;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 20px 0 8px;
    font-weight: 700;
}

.sf-nav-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #4B5563;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.sf-nav-item:hover {
    background: #F3F4F6;
    color: #111827;
}

.sf-nav-item.active {
    background: var(--color-brand-subtle);
    color: var(--color-brand-dark);
    font-weight: 600;
}

.sf-count {
    font-size: 10px;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 10px;
    color: #6B7280;
}

.sf-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.prod-card {
    background: #FFF;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

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

.prod-img {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border-light);
}

.prod-body { padding: 12px; }
.prod-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #111827; }
.prod-price { font-size: 14px; color: var(--color-brand-dark); font-weight: 700; }
.prod-stock { font-size: 11px; color: #6B7280; margin-top: 4px; }

/* ===== WORKFLOW BUILDER STYLES ===== */
.wf-layout {
    display: grid;
    grid-template-columns: 220px 1fr 240px;
    min-height: 600px;
    background: #F3F4F6;
}

.wf-left, .wf-right {
    background: #FFF;
    padding: 20px;
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
}

.wf-right {
    border-right: none;
    border-left: 1px solid var(--border-light);
}

.wf-canvas {
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wf-block {
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 12px;
    cursor: grab;
    background: #FFF;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    transition: border 0.2s;
}

.wf-block:hover { border-color: var(--color-brand); }

.wf-block .ic {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.cn-node {
    border-radius: 12px;
    padding: 16px;
    width: 260px;
    border: 1px solid;
    background: #FFF;
    box-shadow: var(--shadow-soft);
}

.cn-node.selected {
    ring: 2px solid var(--color-brand);
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.cn-arrow {
    width: 2px;
    height: 32px;
    background: #D1D5DB;
    position: relative;
}

.cn-arrow::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: -4px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #D1D5DB;
}
/* ========== PODS STYLES ========== */
.pod-card {
    background: #FFF;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

.pod-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--color-brand);
}

.pod-card h3 {
    font-weight: 700;
    font-size: 16px;
    margin: 0;
    margin-bottom: 4px;
    color: #111827;
}

.pod-card p {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

.pod-members-avatars {
    display: flex;
    gap: -4px;
    align-items: center;
    margin-top: 12px;
}

.pod-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #FFF;
    margin-left: -10px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    background: #E5E7EB;
}

.pod-avatar:hover {
    transform: translateY(-2px);
    z-index: 20 !important;
}

.pod-avatar:first-child {
    margin-left: 0;
}

.pod-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}