/* ==========================================================================
   GLOBAL MOBILYA — Enterprise Design System
   Modular Operations Management Platform (v0.1)
   ========================================================================== */

:root {
    /* Color Palette: Warm Architectural Neutrals & Restrained Accents */
    --bg-base: #0c0f14;
    --bg-surface: #141820;
    --bg-elevated: #1a202c;
    --bg-hover: #222a3a;
    --border-subtle: #242c3d;
    --border-strong: #333d52;

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Accents (Warm Walnut Wood & Industrial Slate Accents) */
    --accent: #d97706; /* Warm Amber / Teak */
    --accent-light: #f59e0b;
    --accent-dim: rgba(217, 119, 6, 0.15);
    
    --primary: #3b82f6; /* Enterprise Blue */
    --primary-dim: rgba(59, 130, 246, 0.15);

    --success: #10b981;
    --success-dim: rgba(16, 185, 129, 0.15);

    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.15);

    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.15);

    /* Typography */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Layout & Geometry */
    --sidebar-collapsed-width: 68px;
    --sidebar-width: 272px;
    --topbar-height: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* Reset & Box Sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* App Shell Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR (Collapsed by Default, Auto-Expands on Hover)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-collapsed-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 16px 10px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.26s cubic-bezier(0.22, 1, 0.36, 1), padding 0.26s ease, box-shadow 0.26s ease, transform 0.25s ease;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar:hover {
    width: var(--sidebar-width);
    padding: 16px 14px;
    box-shadow: 16px 0 42px rgba(0, 0, 0, 0.65);
    border-right-color: var(--border-strong);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 3px 16px 3px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    white-space: nowrap;
}

.brand-logo {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #d97706, #92400e);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
    flex-shrink: 0;
}

.logo-mark {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.brand-text {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.sidebar:hover .brand-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.brand-text h2 {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-tag {
    font-size: 11px;
    color: var(--accent-light);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    padding: 0 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-height 0.2s ease, opacity 0.18s ease, padding 0.2s ease;
}

.sidebar:hover .nav-section-title {
    max-height: 32px;
    opacity: 1;
    padding: 10px 10px 5px 10px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
}

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

.nav-item.active {
    background-color: var(--accent-dim);
    color: var(--accent-light);
    font-weight: 600;
    border-color: rgba(217, 119, 6, 0.35);
}

.nav-icon {
    font-size: 17px;
    width: 22px;
    min-width: 22px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.nav-label {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.sidebar:hover .nav-label {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
    white-space: nowrap;
}

.role-badge-box {
    background-color: var(--bg-elevated);
    padding: 0 12px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.sidebar:hover .role-badge-box {
    padding: 8px 12px;
    max-height: 44px;
    opacity: 1;
    border-color: var(--border-subtle);
}

.role-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.user-profile-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
}

.avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background-color: var(--border-strong);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-info {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s;
}

.sidebar:hover .profile-info {
    opacity: 1;
    visibility: visible;
}

.profile-info strong {
    display: block;
    font-size: 12.5px;
    line-height: 1.2;
}

.profile-info small {
    font-size: 10.5px;
    color: var(--text-muted);
}

/* ==========================================================================
   MAIN WRAPPER & TOPBAR
   ========================================================================== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-collapsed-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.topbar {
    height: var(--topbar-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

.global-search-wrap {
    display: flex;
    align-items: center;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 7px 14px;
    gap: 10px;
    width: 380px;
    max-width: 100%;
}

.global-search-wrap input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}

.global-search-wrap input::placeholder {
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.role-switcher-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.role-select-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.form-select-sm {
    background-color: transparent;
    border: none;
    color: var(--accent-light);
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.form-select-sm option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.icon-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
}

.icon-btn:hover {
    background-color: var(--bg-elevated);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--accent);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edge-status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* ==========================================================================
   MAIN CONTENT AREA & PAGE HEADERS
   ========================================================================== */
.main-content {
    padding: 32px 36px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(17, 27, 46, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(212, 175, 55, 0.32);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    margin-bottom: 24px;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title-group h1 {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.6px;
    margin: 4px 0 6px 0;
    color: var(--text-primary);
}

.page-title-group .subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
}

.breadcrumbs {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.breadcrumbs span {
    cursor: pointer;
}

.breadcrumbs span:hover {
    color: var(--accent-light);
}

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

/* Section Title Row */
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 32px 0 16px 0;
}

.section-title-row h2,
.section-title-row h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37, #b8860b);
    color: #0b1120;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background-color: var(--bg-elevated);
    border-color: var(--border-strong);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-light);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-action {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-action:hover {
    background-color: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent-light);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-accent {
    background-color: var(--accent-dim);
    color: var(--accent-light);
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.badge-primary {
    background-color: var(--primary-dim);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-success {
    background-color: var(--success-dim);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background-color: var(--warning-dim);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.tag {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

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

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* ==========================================================================
   METRICS GRID & CARDS
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
    border-color: var(--border-strong);
}

.metric-card .metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.8px;
    margin-bottom: 6px;
}

.metric-value .sub-val {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.metric-meta {
    font-size: 12px;
    font-weight: 500;
}

.text-success { color: #34d399 !important; }
.text-warning { color: #fbbf24 !important; }
.text-primary { color: #60a5fa !important; }
.text-muted { color: var(--text-muted) !important; }

/* ==========================================================================
   THE SIX MODULES GRID
   ========================================================================== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.module-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.module-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.module-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.module-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.module-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 16px;
}

.module-stats {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    border: 1px solid var(--border-subtle);
}

.module-stats .stat-item {
    font-size: 12px;
    color: var(--text-muted);
}

.module-stats .stat-item strong {
    color: var(--text-primary);
    margin-left: 4px;
}

.module-footer-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   PANELS, SPLIT VIEWS, TABLES
   ========================================================================== */
.content-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

@media (max-width: 1080px) {
    .content-split {
        grid-template-columns: 1fr;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    padding: 10px 14px;
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background-color: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

/* Table Toolbars */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 14px;
    flex-wrap: wrap;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    gap: 8px;
    flex: 1;
    min-width: 240px;
}

.search-input-wrap input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    width: 100%;
}

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

.form-select,
.form-input {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.form-input-sm {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-family: inherit;
    outline: none;
}

/* ==========================================================================
   TABS
   ========================================================================== */
.tab-container {
    margin-top: 20px;
}

.tab-nav {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================================================
   MODULE SPECIFIC COMPONENTS
   ========================================================================== */

/* Progress Bars */
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-bar {
    height: 6px;
    background-color: var(--accent);
    border-radius: var(--radius-sm);
    flex: 1;
}

.progress-bar.bg-primary {
    background-color: var(--primary);
}

/* Channel & CNC Grid */
.channel-grid,
.cnc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.channel-card,
.cnc-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px;
}

.channel-header,
.cnc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.channel-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.channel-icon {
    font-size: 24px;
}

.channel-stats {
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 12px;
}

.channel-stat-item {
    font-size: 12px;
    color: var(--text-muted);
}

.channel-stat-item strong {
    color: var(--text-primary);
    margin-left: 4px;
}

.channel-bot-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.channel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11.5px;
    color: var(--text-muted);
}

.cnc-code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.cnc-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    margin-bottom: 6px;
}

/* Pipeline Stages Bar */
.pipeline-stages-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.stage-bar-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
}

.stage-count {
    background-color: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
}

.stage-val {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Queue, Comments, Activity Lists */
.queue-list,
.notification-list,
.comments-stream {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.queue-thumb {
    font-size: 20px;
}

.queue-info {
    flex: 1;
}

.queue-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.comment-item {
    padding: 12px;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.comment-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12.5px;
}

.comment-text {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.bot-reply-bubble {
    background-color: var(--bg-surface);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent-light);
    border-left: 3px solid var(--accent);
}

.bot-badge {
    font-weight: 700;
    margin-right: 4px;
}

/* Notification Items */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background-color: var(--bg-elevated);
    border-left: 4px solid var(--primary);
}

.notification-item.warning { border-left-color: var(--warning); }
.notification-item.success { border-left-color: var(--success); }

.notif-content {
    flex: 1;
}

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

.notif-header strong {
    font-size: 13px;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notif-content p {
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* Activity Stream */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding-left: 14px;
}

.activity-item {
    display: flex;
    gap: 12px;
    position: relative;
}

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

.dot-success { background-color: var(--success); }
.dot-primary { background-color: var(--primary); }
.dot-warning { background-color: var(--warning); }
.dot-info { background-color: var(--accent); }

.activity-text strong {
    display: block;
    font-size: 13px;
}

.activity-text span {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: block;
}

.activity-text small {
    font-size: 11px;
}

/* Alert Banners */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid transparent;
}

.alert-banner.warning {
    background-color: var(--warning-dim);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fde68a;
}

.alert-banner.info {
    background-color: var(--primary-dim);
    border-color: rgba(59, 130, 246, 0.4);
    color: #bfdbfe;
}

.alert-icon {
    font-size: 22px;
}

.alert-content p {
    font-size: 13px;
    margin-top: 2px;
}

/* Terminal / Log Window */
.terminal-window {
    background-color: #05070a;
    border: 1px solid #1a2333;
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    word-break: break-all;
    line-height: 1.6;
}

.log-line.info { color: #94a3b8; }
.log-line.success { color: #34d399; }
.log-line.warning { color: #fbbf24; }

/* Info Lists */
.info-metric-list,
.cost-list,
.channel-distribution-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-metric-item,
.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

/* Charts */
.chart-container {
    padding: 16px 0;
}

.bar-chart-visual {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 180px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-strong);
    gap: 12px;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.chart-col:hover .bar-tooltip {
    display: block;
}

.bar-tooltip {
    display: none;
    position: absolute;
    top: -30px;
    background-color: #000000;
    color: #ffffff;
    font-size: 10.5px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 20;
    border: 1px solid var(--border-strong);
}

.chart-bar-wrap {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.chart-bar-actual {
    width: 14px;
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

.chart-bar-target {
    width: 14px;
    background-color: var(--border-strong);
    border-radius: 4px 4px 0 0;
}

.chart-label {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-box.actual { background-color: var(--accent); }
.legend-box.target { background-color: var(--border-strong); }

.empty-state-box {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

/* RBAC Active Card & Restricted View */
.active-role-card {
    border-color: var(--accent) !important;
    background: linear-gradient(180deg, var(--bg-surface), rgba(217, 119, 6, 0.05));
}

.restricted-box {
    background-color: var(--bg-elevated);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}

.restricted-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

/* ==========================================================================
   MODAL & DETAIL DRAWER
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background-color: #111B2E;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 18px;
    width: 600px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.detail-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-price-box {
    background-color: var(--bg-elevated);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    border: 1px solid var(--border-subtle);
}

.step-badge {
    background-color: var(--bg-elevated);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    color: var(--text-muted);
}

.step-badge.done {
    background-color: var(--success-dim);
    color: #34d399;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    font-weight: 500;
    z-index: 2000;
    display: none;
    animation: fadeIn 0.2s ease;
}

.toast.show {
    display: flex;
    align-items: center;
}

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

/* ==========================================================================
   RESPONSIVE LAYOUT (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: var(--sidebar-width);
        padding: 16px 14px;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .profile-info {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }

    .sidebar.mobile-open .nav-section-title {
        max-height: 32px;
        opacity: 1;
        padding: 10px 10px 5px 10px;
    }

    .sidebar.mobile-open .role-badge-box {
        padding: 8px 12px;
        max-height: 44px;
        opacity: 1;
        border-color: var(--border-subtle);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-toggle-btn {
        display: block;
    }

    .topbar {
        padding: 0 16px;
    }

    .global-search-wrap {
        display: none;
    }

    .main-content {
        padding: 20px 16px;
    }

    .role-select-label {
        display: none;
    }
}

/* ==========================================================================
   INTEGRATED MODULE 1 (WEBSITE CMS) & MODULE 4 (PRODUCTION) SHELL
   & IN-APP FULLSCREEN MODE
   ========================================================================== */
body.module-immersive-view .topbar {
    display: none;
}

.main-content.full-bleed-module {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.module-embed-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    flex: 1;
    background-color: var(--bg-base);
}

.module-embed-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #f8fafc;
    display: block;
}

/* In-App Fullscreen Mode (100% viewport inside general control panel) */
body.in-app-fullscreen .sidebar {
    transform: translateX(-100%);
    box-shadow: none !important;
}

body.in-app-fullscreen .main-wrapper {
    margin-left: 0 !important;
}

body.in-app-fullscreen .topbar {
    display: none !important;
}

body.in-app-fullscreen .main-content.full-bleed-module {
    height: 100vh !important;
}

/* Floating exit fullscreen button (always accessible when in fullscreen) */
.in-app-fs-exit-btn {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.in-app-fs-exit-btn:hover {
    background: var(--accent);
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

body.in-app-fullscreen .in-app-fs-exit-btn {
    display: inline-flex;
}


