/* Modern Premium Styling for Srinithi Garments ERP Dashboard */
:root {
    /* Color Palette - Premium Linear-Inspired Dark Workspace */
    --bg-primary: #111827;
    /* Page background */
    --bg-sidebar: #171923;
    /* Sidebar background */
    --bg-secondary: #1C1F2B;
    /* Header & container background */
    --bg-card: #202433;
    /* Card background */
    --border-color: rgba(255, 255, 255, 0.08);
    /* Thin border */
    --text-primary: #F8FAFC;
    /* High contrast text */
    --text-secondary: #94A3B8;
    /* Muted text */

    /* Accents & States */
    --accent-blue: #3b82f6;
    --accent-purple: #6366F1;
    /* Primary accent */
    --accent-purple-glow: rgba(99, 102, 241, 0.15);
    /* Subtle highlight */
    --accent-green: #22C55E;
    /* Success */
    --accent-orange: #F59E0B;
    /* Warning */
    --accent-red: #EF4444;
    /* Danger */

    /* Hover state colors */
    --bg-card-hover: rgba(255, 255, 255, 0.02);
    --btn-primary-hover: #4f46e5;

    /* Border Radius & Transitions (Linear style: 10-12px) */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --transition-smooth: all 200ms ease;

    /* Font family */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background shapes disabled for clean flat Linear aesthetic */
.bg-shape {
    display: none !important;
}

/* Loader Styles */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-blue);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px var(--accent-blue-glow);
}

.spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
    margin-bottom: 0;
    margin-right: 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-block {
    width: 100%;
    padding: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), #4f46e5);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    background: var(--btn-primary-hover);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #047857);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* AUTHENTICATION VIEW */
#auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #2563eb, var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.logo i {
    color: var(--accent-purple);
    -webkit-text-fill-color: initial;
}

.auth-header h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 16px;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    transition: var(--transition-smooth);
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 1px var(--accent-purple);
    background: var(--bg-secondary);
}

/* Notifications */
.notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    animation: shake 0.4s ease-out;
}

.notification.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.notification.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

/* DASHBOARD VIEW */
#dashboard-view {
    padding: 0 0 60px 0;
    min-height: 100vh;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-brand .logo {
    margin-bottom: 0;
    font-size: 22px;
}

.badge {
    background: var(--accent-purple-glow);
    color: var(--accent-purple);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.user-info .avatar {
    font-size: 20px;
    color: var(--accent-purple);
}

.logout-btn i {
    font-size: 12px;
}

/* Main Content Layout */
.dashboard-content {
    max-width: 1400px;
    margin: 40px auto 0 auto;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
    transition: var(--transition-smooth);
}

.kpi-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: var(--accent-purple);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.08);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.icon-purple {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.icon-green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.icon-orange {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Visualization Panel */
.charts-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.span-two {
    grid-column: span 2;
}

.span-three {
    grid-column: span 3;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
}

.chart-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.chart-header h4 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h4 i {
    color: var(--accent-blue);
}

.chart-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.chart-body {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-body-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    min-height: 220px;
}

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
}

.status-summary-cards {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.status-pill {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.status-pill:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.status-pill-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
}

.status-running {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green-glow);
}

.status-stopped {
    background-color: var(--accent-red);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.status-pill-name {
    font-size: 14px;
    font-weight: 700;
}

.status-pill-value {
    font-size: 16px;
    font-weight: 800;
}

/* Filters & Table Data */
.table-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.section-title h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-title h3 i {
    color: var(--accent-blue);
}

.section-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.filters-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.filters-bar input,
.filters-bar select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}

.filters-bar input {
    padding-left: 36px;
}

.filters-bar input:focus,
.filters-bar select:focus {
    border-color: var(--accent-purple);
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--accent-purple);
}

.filters-bar select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

.btn-reset-filters {
    padding: 11px;
    font-size: 16px;
}

/* Table Card styling */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    min-height: 180px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

th {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 700;
    padding: 16px 20px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
}

th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.sort-indicator {
    font-size: 11px;
    margin-left: 6px;
    color: var(--text-secondary);
}

th.sortable:hover .sort-indicator {
    color: var(--accent-purple);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: var(--transition-smooth);
}

tr:hover td {
    background: var(--bg-card-hover);
}

/* Badge values in table */
.table-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.table-badge.running {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.table-badge.stopped {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

/* Overlays (Loader / Empty) */
.table-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    gap: 16px;
    width: 100%;
}

.table-overlay span {
    font-size: 14px;
    font-weight: 600;
}

.empty-icon {
    font-size: 40px;
    color: rgba(255, 255, 255, 0.1);
}

/* Table Footer & Pagination */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.records-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.records-info span {
    font-weight: 700;
    color: var(--text-primary);
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.page-size-selector select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 4px 8px;
    outline: none;
    cursor: pointer;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.page-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Media Queries for Responsiveness */
@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }

    .span-two,
    .span-three {
        grid-column: span 1;
    }

    .chart-body-row {
        grid-template-columns: 1fr;
    }

    .status-summary-cards {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .status-pill {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 16px 20px;
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .nav-user {
        justify-content: space-between;
    }

    .dashboard-content {
        padding: 0 20px;
        margin-top: 20px;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: 100%;
    }

    .table-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Actions Buttons in Table */
.actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition-smooth);
}

.btn-edit {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.btn-edit:hover {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.btn-delete:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
    transform: translateY(-1px);
}

/* Modals styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.modal-header h3 i {
    color: var(--accent-blue);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-smooth);
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.span-full {
    grid-column: span 2;
}

.modal-select {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 44px;
}

.modal-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* Tab panel show/hide rules */
.tab-panel {
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.hidden {
    display: none !important;
}

/* Header Nav Tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin: 0 20px;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.nav-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Contribution Filter Bar */
.contribution-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.period-selectors {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.period-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.period-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.period-group select {
    background: rgba(10, 15, 29, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    min-width: 140px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

.period-group select:focus {
    border-color: var(--accent-blue);
}

.btn-apply-contrib {
    padding: 11px 24px;
}

/* Contribution Workspace 3-Column Layout */
.contribution-workspace {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: stretch;
}

.contrib-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 650px;
    /* Fixed height for workspace alignment */
}

.contrib-card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.contrib-card-header h4 {
    font-size: 16px;
    font-weight: 700;
}

.contrib-card-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.contrib-list-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.contrib-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

/* Custom Scrollbar for lists */
.contrib-list::-webkit-scrollbar {
    width: 6px;
}

.contrib-list::-webkit-scrollbar-track {
    background: transparent;
}

.contrib-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
}

.contrib-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Contribution Interactive Row Items */
.contrib-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 10px;
    user-select: none;
}

.contrib-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.contrib-item.active {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.contrib-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.contrib-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 70%;
}

.contrib-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.contrib-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contrib-item-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.contrib-item-qty {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.contrib-item-qty strong {
    color: var(--text-primary);
}

.contrib-item-pct {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent-blue);
}

.contrib-item.active .contrib-item-pct {
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Contribution Custom Progress Bar */
.contrib-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.contrib-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    box-shadow: 0 0 8px var(--accent-blue-glow);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.contrib-item.active .contrib-progress-bar {
    background: linear-gradient(90deg, #60a5fa, var(--accent-green));
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Loading & Empty placeholders overlays */
.contrib-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.contrib-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    color: var(--text-secondary);
    gap: 16px;
    margin: auto;
}

.placeholder-icon {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.05);
}

.contrib-placeholder p {
    font-size: 13px;
    line-height: 1.5;
}

/* Responsive adjustment for contribution workspace */
@media (max-width: 1024px) {
    .contribution-workspace {
        grid-template-columns: 1fr;
    }

    .contrib-card {
        height: 500px;
    }
}

/* Planning Navigation Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-secondary);
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    z-index: 100;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-smooth);
    padding: 6px 0;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.dropdown-content a:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.caret {
    font-size: 10px;
    margin-left: 4px;
    transition: var(--transition-smooth);
}

.nav-dropdown:hover .caret {
    transform: rotate(180deg);
}

/* Planning Wizard Grid */
.methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.method-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.method-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--accent-purple-glow);
    background: var(--bg-card-hover);
}

.method-card.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.04);
    box-shadow: 0 4px 15px var(--accent-blue-glow);
}

.method-card.active::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.08);
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.method-card-icon {
    font-size: 24px;
    color: var(--accent-purple);
}

.method-card.active .method-card-icon {
    color: var(--accent-blue);
}

.method-card h5 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.method-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    flex-grow: 1;
}

.method-example {
    font-size: 10px;
    font-family: monospace;
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--accent-orange);
    align-self: flex-start;
    border: 1px solid var(--border-color);
}

/* Method-Specific Parameters Area */
.method-params-box {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.method-param-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.method-param-group .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

/* Spreadsheet-like Table Interface */
.spreadsheet-table {
    border-collapse: collapse;
    width: 100%;
}

.spreadsheet-table th,
.spreadsheet-table td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.spreadsheet-table tbody tr {
    transition: var(--transition-smooth);
}

.spreadsheet-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

/* Row states */
.spreadsheet-table tr.row-locked {
    background-color: rgba(255, 255, 255, 0.015);
    opacity: 0.85;
}

.spreadsheet-table tr.totals-row {
    background-color: var(--bg-card);
    font-weight: 700;
    border-top: 2px solid var(--border-color);
}

/* Cell Inputs */
.spreadsheet-cell-input {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
}

.spreadsheet-cell-input:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: var(--border-color);
}

.spreadsheet-cell-input:focus:not(:disabled) {
    outline: none;
    background-color: var(--bg-primary);
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 1px var(--accent-purple);
}

.spreadsheet-cell-input.text-right {
    text-align: right;
}

.spreadsheet-cell-input:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Corner indicator for edited cells */
.cell-edited {
    position: relative;
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.cell-edited::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    border-width: 0 6px 6px 0;
    border-color: transparent var(--accent-orange) transparent transparent;
    border-style: solid;
    pointer-events: none;
}

/* Cell highlights for lock */
.cell-lock-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 6px;
    border-radius: var(--radius-sm);
}

.cell-lock-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.cell-lock-btn.locked {
    color: var(--accent-orange);
}

/* Editor Toolbar adjustments */
.editor-toolbar-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 16px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-xs {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

/* Modal Sizes */
.modal-lg {
    max-width: 90%;
    width: 900px;
}

.modal-sm {
    max-width: 420px;
    width: 100%;
}

.wizard-step-title h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Comparison Highlights */
.comparison-growth-positive {
    color: var(--accent-green);
    font-weight: 600;
}

.comparison-growth-negative {
    color: var(--accent-red);
    font-weight: 600;
}

.variance-cell {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.method9-col.hidden {
    display: none !important;
}


/* =====================================================================
   SALES CONTRIBUTION MULTI-SELECT & ADVANCED FILTERS STYLING
   ===================================================================== */

/* 1. Contribution Layout Flex Alignments */
.contribution-layout {
    display: flex;
    align-items: stretch;
    width: 100%;
    margin-top: 20px;
}

.contrib-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    /* Prevents flex items from overflowing */
    padding-right: 24px;
}

/* 2. Collapsible Filter Sidebar (Right Panel Inspector) */
.contrib-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    position: sticky;
    top: 60px;
    transition: width 200ms ease, opacity 200ms ease, padding 200ms ease;
    opacity: 1;
}

.contrib-sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.contrib-sidebar::-webkit-scrollbar {
    width: 6px;
}

.contrib-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.sidebar-header h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.btn-close-sidebar:hover {
    color: var(--accent-red);
}

/* 3. Reusable Accordion Filters */
.sidebar-filters-accordion {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
}

.filter-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.filter-accordion-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.filter-accordion-header.expanded {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.filter-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-full);
    margin-left: auto;
    margin-right: 10px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.filter-badge.active {
    background: var(--accent-purple-glow);
    color: var(--accent-purple);
    border: 1px solid var(--accent-purple);
}

.filter-icon {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.filter-accordion-header.expanded .filter-icon {
    transform: rotate(180deg);
}

.filter-accordion-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-secondary);
}

.filter-search-wrapper {
    position: relative;
}

.filter-search-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition-smooth);
}

.filter-search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

.filter-shortcuts {
    display: flex;
    gap: 10px;
}

.btn-shortcut {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn-shortcut:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.filter-checkbox-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.filter-checkbox-list::-webkit-scrollbar {
    width: 4px;
}

.filter-checkbox-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
}

.filter-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    user-select: none;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.filter-checkbox-row:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-checkbox-row input {
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.filter-no-results {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    padding: 10px;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    margin-top: 4px;
}

/* 4. Selection Summary Bar */
.contrib-summary-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    flex-wrap: wrap;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 24px;
    border-right: 1px solid var(--border-color);
}

.summary-stat:last-of-type {
    border-right: none;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

#summary-products-count {
    color: var(--accent-blue);
}

#summary-colors-count {
    color: var(--accent-purple);
}

#summary-total-qty {
    color: var(--accent-green);
}

#summary-contrib-base {
    color: var(--accent-orange);
}

.btn-clear-all {
    margin-left: auto;
    padding: 6px 12px;
    font-size: 12px;
}

/* 5. Checkboxes inside Product & Color Lists */
.contrib-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding: 10px 14px;
}

.contrib-item-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.contrib-item-checkbox {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.contrib-item-meta {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
}

/* =====================================================================
   SIDEBAR LAYOUT SYSTEM (inspired by reference mockups)
   ===================================================================== */

/* Dashboard View Container with Left Sidebar & Right Frame */
.dashboard-layout-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* 1. App Sidebar Navigation */
.app-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-logo-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo-section .logo {
    justify-content: flex-start;
    margin-bottom: 0;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin: 16px 8px 8px 8px;
    text-transform: uppercase;
}

/* Redesign sidebar navigation buttons */
.sidebar-nav .nav-tab-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.sidebar-nav .nav-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav .nav-tab-btn.active {
    color: var(--text-primary);
    background: var(--accent-purple-glow);
    font-weight: 600;
}

.sidebar-profile-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-sidebar);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar {
    font-size: 28px;
    color: var(--accent-purple);
}

.profile-text {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-role {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-logout-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 6px;
    border-radius: 6px;
}

.btn-logout-icon:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.08);
}

/* 2. Main Frame & Top Header Styling */
.app-main-frame {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-secondary);
}

.app-header {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 280px;
}

.header-search-wrapper .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.header-search-wrapper input {
    width: 100%;
    padding: 6px 12px 6px 34px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 12px;
    outline: none;
    transition: var(--transition-smooth);
}

.header-search-wrapper input:focus {
    border-color: var(--accent-purple);
    background: var(--bg-primary);
    box-shadow: 0 0 0 1px var(--accent-purple);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-action-btn {
    position: relative;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.header-action-btn:hover {
    color: var(--text-primary);
}

.notification-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 6px;
    background: var(--accent-red);
    border-radius: var(--radius-full);
}

.header-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.header-user-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.app-content-body {
    padding: 24px;
    flex-grow: 1;
    overflow-y: auto;
}

/* Dropdown Options native styling overrides for dark mode readability */
select option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Custom Multiselect styles matching premium dark theme */
.custom-multiselect {
    position: relative;
    width: 100%;
}

.multiselect-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
    padding: 6px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.multiselect-trigger:hover {
    border-color: var(--accent-purple);
}

.multiselect-trigger .selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.multiselect-trigger .placeholder {
    color: var(--text-secondary);
    font-size: 14px;
}

.multiselect-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.multiselect-tag .remove-btn {
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.multiselect-tag .remove-btn:hover {
    color: var(--accent-red);
}

.multiselect-arrow {
    color: var(--text-secondary);
    font-size: 12px;
    transition: var(--transition-smooth);
    margin-left: 8px;
}

.custom-multiselect.open .multiselect-arrow {
    transform: rotate(180deg);
}

.multiselect-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
}

.multiselect-dropdown.hidden {
    display: none !important;
}

.dropdown-search-wrapper {
    position: relative;
    width: 100%;
}

.dropdown-search-wrapper input {
    width: 100%;
    height: 34px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding-left: 32px;
    padding-right: 12px;
    font-size: 13px;
}

.dropdown-search-wrapper input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.dropdown-search-wrapper .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
}

#product-colors-select-all-wrapper {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

#product-colors-select-all-wrapper:hover {
    background: rgba(255, 255, 255, 0.04);
}

.multiselect-dropdown .options-container {
    overflow-y: auto;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
    font-size: 13px;
}

.multiselect-option:hover {
    background-color: var(--bg-card-hover);
}

.multiselect-option input[type="checkbox"],
#product-colors-select-all-checkbox {
    accent-color: var(--accent-purple);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.multiselect-option span {
    color: var(--text-primary);
}

/* Scrollable modal wrapper */
.modal-card-scrollable {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 32px 24px 32px !important;
}

.modal-card-scrollable form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-card-scrollable .modal-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 0;
}

/* PLANNING SHEET STYLING */
.cell-edited {
    background-color: rgba(234, 179, 8, 0.08) !important;
    border-color: rgba(234, 179, 8, 0.4) !important;
    position: relative;
}

.cell-edited::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-top: 6px solid #eab308;
    border-left: 6px solid transparent;
}

.row-selected {
    background-color: rgba(58, 110, 165, 0.15) !important;
    border-left: 3px solid var(--accent-blue) !important;
}

.collapse-arrow {
    transition: transform var(--transition-smooth);
}

.collapse-arrow.collapsed {
    transform: rotate(-180deg);
}

.cell-invalid {
    color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
}

.cell-valid {
    color: #22c55e !important;
    background-color: rgba(34, 197, 94, 0.08) !important;
}

.collapsible-section {
    transition: all var(--transition-smooth);
}

.spreadsheet-table input.spreadsheet-input-pct {
    text-align: right;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.spreadsheet-table input.spreadsheet-input-pct:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--border-color);
}

.spreadsheet-table input.spreadsheet-input-pct:focus:not(:disabled) {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.spreadsheet-table select.spreadsheet-select {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    font-size: 11px;
    height: 26px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.spreadsheet-table select.spreadsheet-select:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
}

.spreadsheet-table select.spreadsheet-select:focus:not(:disabled) {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.spreadsheet-table input.spreadsheet-input-remarks {
    text-align: left;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.spreadsheet-table input.spreadsheet-input-remarks:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--border-color);
}

.spreadsheet-table input.spreadsheet-input-remarks:focus:not(:disabled) {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

/* TREE GRID STYLING */
.tree-grid-table tr.row-product {
    background-color: rgba(255, 255, 255, 0.01) !important;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.tree-grid-table tr.row-product:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

.tree-grid-table tr.row-color {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tree-grid-table tr.row-color:hover {
    background-color: rgba(255, 255, 255, 0.015) !important;
}

.tree-grid-table tr.row-size {
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.03);
}

.tree-grid-table tr.row-size:hover {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

.tree-grid-table td {
    padding: 10px 14px;
    vertical-align: middle;
}

/* Indentations */
.tree-grid-table .indent-color {
    padding-left: 28px !important;
}

.tree-grid-table .indent-size {
    padding-left: 52px !important;
}

/* Toggle chevron styling */
.tree-grid-table .toggle-icon {
    cursor: pointer;
    margin-right: 8px;
    width: 14px;
    display: inline-block;
    text-align: center;
    color: var(--text-muted);
    transition: transform var(--transition-smooth), color var(--transition-smooth);
}

.tree-grid-table .toggle-icon:hover {
    color: var(--text-primary);
}

.tree-grid-table .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Status badge styling */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-completed {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-pending {
    background-color: rgba(234, 179, 8, 0.1);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.status-missing {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Editable inputs styling inside grid */
.spreadsheet-table input.tree-grid-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.spreadsheet-table input.tree-grid-input:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.2);
}

.spreadsheet-table input.tree-grid-input:focus:not(:disabled) {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.spreadsheet-table input.tree-grid-input.text-right {
    text-align: right;
}

.spreadsheet-table input.tree-grid-input:disabled {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    cursor: not-allowed;
    text-shadow: none;
}

/* ==========================================================================
   AI PLANNING ASSISTANT STYLING (GLASSMORPHISM & PREMIUM DARK THEME)
   ========================================================================== */
.ai-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-family);
}

/* Toggle Button */
.ai-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: var(--text-primary);
    border: none;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: var(--transition-smooth);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.ai-toggle-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6);
}

.ai-toggle-btn:active {
    transform: scale(0.95);
}

/* Pulsing notification dot */
.ai-pulse-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: var(--accent-green);
    border-radius: 50%;
    border: 2.5px solid var(--bg-primary);
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Chat Panel */
.ai-chat-panel {
    width: 420px;
    height: 620px;
    border-radius: var(--radius-lg);
    background: rgba(32, 36, 51, 0.85);
    /* Frosty card bg */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    transform-origin: bottom right;
}

.ai-chat-panel.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.8) translate(50px, 50px);
    pointer-events: none;
}

/* Header */
.ai-chat-header {
    padding: 16px 20px;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-title-icon {
    font-size: 20px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-chat-title h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.ai-chat-title span {
    font-size: 11px;
    color: var(--text-secondary);
}

.ai-header-controls {
    display: flex;
    gap: 8px;
}

.ai-control-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.ai-control-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Settings Card Overlay */
.ai-settings-card {
    padding: 16px 20px;
    background: rgba(23, 25, 35, 0.95);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-settings-card.hidden {
    display: none;
}

.ai-settings-card h5 {
    font-size: 13px;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-settings-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-settings-field label {
    font-size: 10.5px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.ai-settings-field input,
.ai-settings-field select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    outline: none;
    font-size: 13px;
    transition: var(--transition-smooth);
}

.ai-settings-field input:focus,
.ai-settings-field select:focus {
    border-color: var(--accent-blue);
}

.ai-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

/* Messages Body */
.ai-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(17, 24, 39, 0.2);
}

.ai-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: ai-fade-in-message 0.25s ease forwards;
}

@keyframes ai-fade-in-message {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message.user {
    align-self: flex-end;
}

.ai-message.ai,
.ai-message.system {
    align-self: flex-start;
}

.ai-message .message-content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.ai-message.user .message-content {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: var(--text-primary);
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.ai-message.ai .message-content,
.ai-message.system .message-content {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom-left-radius: 2px;
}

/* Table inside message content */
.ai-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
}

.ai-message th,
.ai-message td {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.ai-message th {
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
}

/* Suggestions Container */
.ai-suggestions-container {
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid var(--border-color);
    background: rgba(23, 25, 35, 0.3);
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.ai-suggestions-container::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.ai-chip {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.ai-chip:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Input Area */
.ai-chat-input-area {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-card);
}

.ai-chat-input-area textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    outline: none;
    font-size: 13px;
    resize: none;
    height: 36px;
    line-height: 18px;
    max-height: 100px;
    transition: border-color 0.2s ease;
}

.ai-chat-input-area textarea:focus {
    border-color: var(--accent-blue);
}

.ai-send-button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-blue);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.ai-send-button:hover {
    background: var(--btn-primary-hover);
    transform: scale(1.05);
}

.ai-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
}

/* Typing Indicator Animation */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes ai-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Final Qty Column Header Dropdown Menu */
.final-qty-dropdown {
    position: absolute;
    top: 100%;
    right: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 220px;
    text-align: left;
    overflow: hidden;
    padding: 4px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: transform 150ms ease, opacity 150ms ease, visibility 150ms ease;
    pointer-events: none;
    visibility: hidden;
}

.final-qty-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}

/* Contribution Hyperlinks Navigation styling */
.contrib-hyperlink {
    cursor: pointer;
    text-decoration: underline;
    color: var(--accent-blue) !important;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.contrib-hyperlink:hover {
    color: #00b4d8 !important;
    text-shadow: 0 0 8px rgba(0, 180, 216, 0.4);
}

/* Fabric Detail Hyperlink Styling */
.fabric-link-btn {
    color: var(--accent-blue) !important;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.fabric-link-btn:hover {
    color: #60a5fa !important;
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Fabric Detail Matrix Table Styling */
.fabric-matrix-wrapper {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: auto;
    max-height: calc(100vh - 240px);
}

.fabric-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: var(--text-primary);
}

.fabric-matrix-table th,
.fabric-matrix-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.fabric-matrix-table th {
    position: sticky;
    top: 0;
    background: #1a2030;
    z-index: 10;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

/* Sticky Column 1: Fabric Name */
.fabric-matrix-table .sticky-col-fabric {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #131825;
    min-width: 150px;
    max-width: 200px;
}

/* Sticky Column 2: Color */
.fabric-matrix-table .sticky-col-color {
    position: sticky;
    left: 160px;
    z-index: 5;
    background: #131825;
    min-width: 150px;
    max-width: 220px;
    border-right: 2px solid var(--border-color);
}

/* Top-Left Header Cells (Double Sticky) */
.fabric-matrix-table th.sticky-col-fabric {
    z-index: 20;
    background: #1a2030;
}

.fabric-matrix-table th.sticky-col-color {
    z-index: 20;
    background: #1a2030;
}

/* Numeric DIA Columns */
.fabric-matrix-table td.matrix-cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.fabric-matrix-table td.matrix-cell-zero {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Row Total Column */
.fabric-matrix-table .matrix-col-total {
    text-align: right;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.06);
    color: var(--accent-blue);
    border-left: 2px solid var(--border-color);
}

/* Sticky Bottom Total Row */
.fabric-matrix-table tfoot tr {
    position: sticky;
    bottom: 0;
    background: #161b28;
    z-index: 12;
    font-weight: 700;
}

.fabric-matrix-table tfoot td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    background: #161b28;
}

.fabric-matrix-table tfoot td.sticky-col-fabric,
.fabric-matrix-table tfoot td.sticky-col-color {
    z-index: 16;
    background: #161b28;
}

.fabric-matrix-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.fabric-matrix-table tbody tr:hover td.sticky-col-fabric,
.fabric-matrix-table tbody tr:hover td.sticky-col-color {
    background-color: #1a2236;
}

/* ============================================================= */
/* TAB 4: EXCEL PLANNING VIEWPORT STYLES (SCOPED STRICTLY)      */
/* ============================================================= */

.excel-planning-container .excel-matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.excel-planning-container .excel-header-row th {
    background: #107c41;
    color: #ffffff;
    padding: 9px 12px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid #0d6535;
    position: sticky;
    top: 0;
    z-index: 20;
    white-space: nowrap;
    text-align: center;
}

.excel-planning-container .excel-header-row th:first-child,
.excel-planning-container .excel-header-row th.excel-col-frozen {
    text-align: left;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 25;
    background: #0d6535;
    min-width: 240px;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.35);
}

.excel-planning-container .excel-group-header-row td {
    background: #1e293b;
    color: #38bdf8;
    font-weight: 700;
    font-size: 12px;
    padding: 8px 12px;
    border-top: 1px solid #334155;
    border-bottom: 1px solid #334155;
    user-select: none;
}

.excel-planning-container .excel-row td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--font-mono, monospace);
    font-size: 12.5px;
    vertical-align: middle;
    text-align: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.excel-planning-container .excel-row td.excel-col-frozen {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--bg-card);
    font-family: inherit;
    font-weight: 600;
    min-width: 240px;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.25);
    border-right: 2px solid rgba(255, 255, 255, 0.12);
}

.excel-planning-container .excel-row:hover td.excel-col-frozen {
    background-color: #1e2538;
}

/* ============================================================= */
/* FULL CELL HIGHLIGHT STYLES: Non-Zero (> 0) vs Zero (= 0)      */
/* ============================================================= */

/* Non-Zero Cells (> 0): Bold green text with prominent dark-green fill */
.excel-planning-container td.excel-cell-nonzero {
    background-color: #064e3b !important;
    color: #34d399 !important;
    font-weight: 700 !important;
    border-right: 1px solid rgba(16, 185, 129, 0.2) !important;
    border-bottom: 1px solid rgba(16, 185, 129, 0.2) !important;
}

.excel-planning-container tr:hover td.excel-cell-nonzero {
    background-color: #065f46 !important;
    color: #6ee7b7 !important;
}

/* Zero Cells (= 0): Muted Low-Visibility Style */
.excel-planning-container td.excel-cell-zero {
    background-color: transparent !important;
    color: #64748b !important;
    font-weight: 400 !important;
    opacity: 0.55;
}

.excel-planning-container tr:hover td.excel-cell-zero {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: #94a3b8 !important;
    opacity: 0.8;
}

/* Total Column Highlight */
.excel-planning-container td.excel-cell-total-nonzero {
    background-color: #1e3a8a !important;
    color: #93c5fd !important;
    font-weight: 800 !important;
    border-right: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.excel-planning-container tr:hover td.excel-cell-total-nonzero {
    background-color: #1d4ed8 !important;
    color: #dbeafe !important;
}

.excel-planning-container td.excel-cell-total-zero {
    background-color: transparent !important;
    color: #64748b !important;
    font-weight: 400 !important;
    opacity: 0.55;
}

/* Subtotal Row */
.excel-planning-container .excel-subtotal-row td {
    padding: 8px 12px;
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    background: #111827;
}

.excel-planning-container .excel-subtotal-row td.excel-col-frozen {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 10;
    background: #161b28;
    font-family: inherit;
    border-right: 2px solid rgba(255, 255, 255, 0.12);
}

.excel-planning-container .excel-subtotal-row td.excel-cell-nonzero {
    background-color: #064e3b !important;
    color: #34d399 !important;
    font-weight: 800 !important;
}

/* Grand Total Row */
.excel-planning-container .excel-grand-total-row td {
    padding: 9px 12px;
    font-weight: 800;
    font-size: 13px;
    font-family: var(--font-mono, monospace);
    border-top: 2px solid #334155;
    border-bottom: 2px solid #334155;
    position: sticky;
    bottom: 0;
    z-index: 18;
    text-align: center;
    background: #0f172a;
}

.excel-planning-container .excel-grand-total-row td.excel-col-frozen {
    text-align: left;
    position: sticky;
    left: 0;
    bottom: 0;
    z-index: 22;
    background: #0b1120;
    color: #ffffff;
    font-family: inherit;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.35);
    border-right: 2px solid rgba(255, 255, 255, 0.12);
}

.excel-planning-container .excel-grand-total-row td.excel-cell-nonzero {
    background-color: #064e3b !important;
    color: #10b981 !important;
    font-weight: 800 !important;
}

.excel-planning-container .excel-scode-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 11.5px;
    color: var(--text-primary);
}

.excel-planning-container .excel-scode-checkbox-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.excel-planning-container .excel-scode-checkbox-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* =====================================================================
   BASE STOCK PLANNING MODULE (ISOLATED STYLES)
   ===================================================================== */
.base-stock-subtab-pane {
    animation: fadeIn 0.15s ease-in-out;
}

.base-stock-subtotal-row td {
    background: rgba(59, 130, 246, 0.08) !important;
    font-weight: 700 !important;
    border-top: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3) !important;
}

.base-stock-common-header-row td {
    background: rgba(255, 255, 255, 0.03) !important;
    font-weight: 600 !important;
}

.base-stock-common-member-row td {
    background: transparent !important;
}

.base-stock-standalone-row:hover,
.base-stock-common-member-row:hover,
.base-stock-common-header-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.base-stock-checklist-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* ============================================================= */
/* FINISHED GOODS BASE STOCK - TAB 3: TABLE VIEW MATRIX STYLES   */
/* ============================================================= */

.base-stock-table-view-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: var(--text-primary);
}

.base-stock-table-view-matrix th,
.base-stock-table-view-matrix td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.base-stock-table-view-matrix th {
    position: sticky;
    top: 0;
    background: #1a2030;
    z-index: 10;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

/* Sticky First Column: Color */
.base-stock-table-view-matrix .fg-matrix-col-color {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #161b28;
    min-width: 160px;
    max-width: 260px;
    border-right: 2px solid var(--border-color);
}

.base-stock-table-view-matrix th.fg-matrix-col-color {
    z-index: 20;
    background: #1a2030;
}

.base-stock-table-view-matrix tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

.base-stock-table-view-matrix tbody tr:hover td.fg-matrix-col-color {
    background-color: #1c2333;
}

/* Sticky Footer: Total Row */
.base-stock-table-view-matrix tfoot tr {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: #1a2030;
}

.base-stock-table-view-matrix tfoot td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
    background: #1a2030;
    font-weight: 700;
}

.base-stock-table-view-matrix tfoot td.fg-matrix-col-color {
    z-index: 20;
    background: #1a2030;
}

.base-stock-table-view-matrix .fg-matrix-col-total {
    border-left: 2px solid var(--border-color);
}

.fg-table-filter-btn.active-filter {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--accent-blue) !important;
    border-color: var(--accent-blue) !important;
}

/* Product/Group Section Styling in Tab 3 */
.fg-product-section {
    background: var(--bg-card, #202433);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fg-product-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #181d2a;
    border-bottom: 2px solid var(--border-color, rgba(255, 255, 255, 0.12));
}

.fg-product-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fg-path-badge-sa {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary, #9ca3af);
    border: 1px solid rgba(107, 114, 128, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fg-path-badge-cp {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green, #10b981);
    border: 1px solid rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


