@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0b2b6c 0%, #0847ba 100%);
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --accent: #e2182c;
    --accent-hover: #ff2a40;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.85rem 2.5rem;
    background: rgba(8, 20, 48, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.25s ease;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: white;
}

.brand-logo {
    height: 40px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    margin-right: 1.75rem;
}

.header-user-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
}

.header-user-info strong {
    color: #ffffff;
    font-weight: 700;
}

.user-store-pill {
    font-size: 0.72rem;
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.user-store-pill.pill-all {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.user-store-pill.pill-store {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.header-right,
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    flex-shrink: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.news-ticker-container {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: transparent;
    border: none;
    padding: 0.15rem 0;
    font-size: 0.88rem;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.news-ticker-source {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    padding: 0.2rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.25s ease;
    user-select: none;
    box-sizing: border-box;
}

.news-ticker-nav-vertical {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    margin-right: 0.35rem;
    justify-content: center;
}

.news-ticker-nav-vertical .news-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    width: 20px;
    height: 12px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.news-ticker-nav-vertical .news-nav-btn:hover {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.45);
}

.news-ticker-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.news-ticker-link {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    transition: opacity 0.28s ease, color 0.2s ease;
}

.news-ticker-link:hover {
    color: #60a5fa;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 1050px) {
    header {
        flex-wrap: wrap;
        padding: 0.85rem 1.25rem;
        gap: 0.75rem;
    }

    .header-left {
        order: 2;
        width: 100%;
        margin-right: 0;
        margin-top: 0.25rem;
    }

    .header-right {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }
}

.container {
    max-width: 96%;
    margin: 1.5rem auto;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

/* Excel Download Button (Harmonious Emerald Theme) */
.btn-excel {
    background: rgba(16, 124, 65, 0.16) !important;
    border: 1px solid rgba(51, 196, 129, 0.38) !important;
    color: #e2e8f0 !important;
    backdrop-filter: blur(8px);
    border-radius: 8px;
    transition: all 0.25s ease;
}

.btn-excel:hover {
    background: rgba(16, 124, 65, 0.32) !important;
    border-color: rgba(51, 196, 129, 0.65) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(16, 124, 65, 0.3) !important;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background-color: #0a1f44;
    color: #ffffff;
    outline: none;
    font-size: 0.95rem;
    cursor: text;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input[type="file"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background-color: #0a1f44;
    color: #ffffff;
    outline: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

select option {
    background-color: #091a38;
    color: #ffffff;
    padding: 0.6rem 1rem;
}

.input-group input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(226, 24, 44, 0.25);
}

/* Flash messages */
.flash-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.flash-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid #10b981;
}

.flash-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid #ef4444;
}

.flash-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid #f59e0b;
}

.flash-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid #3b82f6;
}

/* Dashboard Data */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.last-updated {
    font-size: 0.85rem;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    display: inline-block;
    margin-top: 0.4rem;
    font-weight: 600;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.15rem 1.4rem;
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.25);
}

.kpi-icon {
    font-size: 1.8rem;
    padding: 0.65rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.kpi-info h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.kpi-info .kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
}

/* Store Cards Grid */
.store-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .store-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 600px) {
    .store-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

.store-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.store-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
}

.store-card.active-store {
    border-color: var(--accent);
    background: rgba(226, 24, 44, 0.2);
    box-shadow: 0 0 15px rgba(226, 24, 44, 0.4);
}

.store-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.store-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

.store-card-body {
    margin-top: 0.2rem;
}

.store-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fca5a5;
    line-height: 1.1;
}

.store-card-sub {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Filters */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.search-box {
    flex: 2;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(226, 24, 44, 0.25);
}

.filter-select {
    flex: 1;
    min-width: 180px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    user-select: none;
}

.toggle-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.toggle-chip.active-danger {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #fca5a5;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.toggle-chip.active-warning {
    background: rgba(245, 158, 11, 0.25);
    border-color: #f59e0b;
    color: #fde68a;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.filter-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-export {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid var(--card-border);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-export:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Tables with Sticky Header */
.table-scroll-container {
    overflow-x: auto;
    max-height: 65vh;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(10, 25, 55, 0.45);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.data-table th {
    position: sticky;
    top: 0;
    background: #081d42;
    color: #cbd5e1;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--card-border);
    z-index: 5;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    text-align: left;
}

.data-table td {
    padding: 0.70rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.86rem;
    color: #e2e8f0;
    vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.cell-center,
.data-table th.cell-center,
.data-table td.cell-center {
    text-align: center;
}

.cell-desc {
    min-width: 250px;
    max-width: 480px;
    font-weight: 600;
    font-size: 0.86rem;
    color: #ffffff;
    letter-spacing: 0.01em;
}

/* Product Code Tag (Unified Font) */
.item-code-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.83rem;
    letter-spacing: 0.03em;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.22);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
}

/* Section Tag (Unified Font) */
.section-tag {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* CD Stock Value */
.cd-stock-val {
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.88rem;
    color: #ffffff;
}

.badge {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-green {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-orange {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-red {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Store Stock Badges */
.badge-stock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 26px;
    padding: 0 0.55rem;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.badge-stock-zero {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.badge-stock-low {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.38);
}

.badge-stock-ok {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.32);
}

/* Modal Generic Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 13, 33, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-box {
    background: #091a38;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 2rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Universal Module Navigation Tabs */
.nav-tab-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}

.nav-tab-btn.active {
    background: #2563eb !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
    border: 1px solid #3b82f6 !important;
}

.nav-tab-btn:not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid var(--card-border);
    font-weight: 600;
}

.nav-tab-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateY(-1px);
}