:root {
    --primary: #ff9966;
    --secondary: #ff5e62;
    --accent: #00C9FF;
    --accent-secondary: #92FE9D;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --card-bg: #ffffff;
    --bg-color: #f0f2f5;
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.05), 0 6px 6px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 30px rgba(255, 94, 98, 0.15), 0 10px 10px rgba(0, 0, 0, 0.05);
    --transition-speed: 0.3s;
    --success-color: #00b894;
    --danger-color: #d63031;
    --warning-color: #fdcb6e;
    --info-color: #0984e3;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    .upload-info {
        margin-top: 20px;
        padding: 24px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
        border-radius: var(--radius-lg);
        font-size: 14px;
        border: 1px solid rgba(0, 0, 0, 0.05);
        display: none;
        box-shadow: 0 18px 40px rgba(255, 94, 98, 0.12);
    }

    .upload-info.active {
        display: block;
        animation: slideDown 0.3s ease;
    }

    .info-item {
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        border-radius: var(--radius-md);
        background: rgba(255, 255, 255, 0.85);
        border: 1px solid rgba(0, 0, 0, 0.03);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
    }

    .info-item + .info-item {
        margin-top: 12px;
    }

    .info-item-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        background: linear-gradient(135deg, rgba(255, 153, 102, 0.15), rgba(255, 94, 98, 0.12));
        border: 1px solid rgba(255, 255, 255, 0.8);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
        flex-shrink: 0;
    }

    .info-item-icon svg {
        width: 26px;
        height: 26px;
    }

    .info-item-text {
        flex: 1;
        color: var(--text-secondary);
        font-size: 14px;
        line-height: 1.6;
    }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.3);
    border: none;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 94, 98, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.fba-drop-btn {
    min-width: 280px;
    padding: 10px 16px;
    border: 2px dashed rgba(255, 255, 255, 0.6);
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.2;
}

.fba-drop-btn-main {
    font-size: 14px;
    font-weight: 700;
}

.fba-drop-btn-sub {
    font-size: 11px;
    opacity: 0.95;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 30px 40px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
    animation: slideDown 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.header h1 {
    font-size: 32px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon {
    filter: drop-shadow(0 4px 8px rgba(255, 94, 98, 0.3));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.header:hover .header-icon {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 8px 12px rgba(255, 94, 98, 0.4));
}

.dashboard-icon {
    filter: drop-shadow(0 4px 6px rgba(255, 94, 98, 0.2));
    transition: transform 0.3s ease;
}

.header:hover .dashboard-icon {
    transform: scale(1.1) rotate(-5deg);
}

.last-updated {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.05);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.upload-area {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    animation: fadeIn 0.8s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.upload-zone {
    border: 3px dashed #e0e0e0;
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 153, 102, 0.1), rgba(255, 94, 98, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.upload-zone:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.upload-zone:hover::before {
    opacity: 1;
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(0, 201, 255, 0.05);
    transform: scale(1.01);
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: inline-block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon {
    transform: scale(1.1) rotate(5deg);
}

.upload-text {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 14px;
}

.usage-toggle {
    margin-top: 20px;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
    transition: color 0.2s;
    padding: 5px 0;
}

.usage-toggle:hover {
    color: var(--secondary);
}

.upload-info {
    margin-top: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--radius-md);
    font-size: 13px;
    border-left: 4px solid var(--primary);
    display: none;
}

.upload-info.active {
    display: block;
    animation: slideDown 0.3s ease;
}



.file-list {
    margin-top: 25px;
    display: none;
}

.file-list.active {
    display: block;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border: 1px solid #eee;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    animation: slideIn 0.4s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

.file-item-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.file-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-badge--amazon {
    background: linear-gradient(135deg, #ff9966, #ff5e62);
}

.file-badge--selmon {
    background: linear-gradient(135deg, #7f7fd5, #86a8e7);
}

.file-item-source {
    font-weight: 600;
    color: var(--text-primary);
    background: #f0f2f5;
    padding: 3px 10px;
    border-radius: 999px;
}

.dashboard {
    display: none;
    animation: fadeIn 0.8s ease;
}

.dashboard.active {
    display: block;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.selmon-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 40px;
}

.selmon-panel-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.selmon-panel-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 153, 102, 0.15), rgba(255, 94, 98, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.selmon-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.selmon-panel-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.selmon-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.selmon-card {
    background: #f8f9fb;
    border-radius: var(--radius-md);
    padding: 16px 18px;
    border: 1px solid #edf2f7;
}

.selmon-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.selmon-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.selmon-card-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.selmon-mall-table {
    margin-top: 24px;
}

.selmon-mall-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.selmon-mall-table table {
    width: 100%;
    border-collapse: collapse;
}

.selmon-mall-table th {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px;
}

.selmon-mall-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    text-align: center;
}

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

.selmon-mall-empty {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.selmon-mall-amount {
    text-align: center;
    font-weight: 600;
}

.selmon-mall-qty {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.selmon-mall-percent {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 999px;
}

.summary-break {
    grid-column: 1 / -1;
    height: 10px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.8;
}

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

.card-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-value {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.card-change {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.card-change.positive {
    color: var(--success-color);
    background: rgba(0, 184, 148, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.card-change.negative {
    color: var(--danger-color);
    background: rgba(214, 48, 49, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

.chart-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-canvas {
    position: relative;
    height: 350px;
}

.table-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--card-shadow);
    margin-bottom: 40px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.03);
}

.table-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 0;
    border-bottom: 2px solid #f0f0f0;
    overflow-x: auto;
    padding-bottom: 10px;
}

.tab-button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--primary);
    background: rgba(255, 153, 102, 0.05);
}

.tab-button.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 10px rgba(255, 94, 98, 0.3);
}

.table-content {
    display: none;
    padding-top: 25px;
    animation: fadeIn 0.4s ease;
}

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

.table-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    gap: 15px;
}

.export-btn {
    background: linear-gradient(135deg, var(--success-color), #00cec9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 10px rgba(0, 184, 148, 0.3);
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 184, 148, 0.4);
    filter: brightness(1.1);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: left;
    padding: 15px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

th:first-child {
    border-top-left-radius: var(--radius-sm);
}

th:last-child {
    border-top-right-radius: var(--radius-sm);
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.2s;
}

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

tr:hover td {
    background: rgba(255, 153, 102, 0.03);
}

.profit-positive {
    color: var(--success-color);
    font-weight: 700;
}

.profit-negative {
    color: var(--danger-color);
    font-weight: 700;
}

.period-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
    background: white;
    padding: 15px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.period-button {
    padding: 8px 20px;
    border: 2px solid transparent;
    background: #f0f2f5;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.period-button:hover {
    background: #e4e6eb;
    transform: translateY(-1px);
}

.period-button.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 10px rgba(255, 94, 98, 0.3);
}

/* Modal Styles Refined */
.modal-content {
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    border: none;
}

.modal-header {
    background: linear-gradient(to right, #f8f9fa, #fff);
    padding: 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 24px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

#productSettingsTable th {
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#productSettingsTable input[type="text"],
#productSettingsTable input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #eee;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
}

#productSettingsTable input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 153, 102, 0.1);
}

/* Loading Spinner Refined */
.spinner {
    border: 4px solid rgba(255, 153, 102, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

@media (max-width: 768px) {
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr 1fr;
    }
}

/* Product Name Cell Styles */
.product-name-cell {
    max-width: 300px;
    padding: 0 !important;
    position: relative;
}

.name-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.name-text {
    padding: 12px 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
    box-sizing: border-box;
    color: inherit;
}

.name-hover {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: max-content;
    max-width: 600px;
    min-width: 100%;
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 100;
    padding: 12px 15px;
    white-space: normal;
    word-break: break-all;
    border-radius: 4px;
    border: 1px solid #eee;
    color: var(--text-primary);
    text-align: left;
}

.name-wrapper:hover .name-hover {
    display: block;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #f8f9fa 100%);
    min-height: 100vh;
    padding: 20px;
}

.nuruma-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transition: all var(--transition-speed) ease;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(255, 126, 95, 0.3);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 126, 95, 0.2);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: white;
    border-radius: 16px;
    padding: 24px 30px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    animation: slideDown 0.5s ease;
}

.header h1 {
    color: var(--text-primary);
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-area {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    animation: fadeIn 0.6s ease;
}

.upload-zone {
    border: 3px dashed var(--primary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    background: linear-gradient(135deg, rgba(255, 126, 95, 0.05) 0%, rgba(254, 180, 123, 0.1) 100%);
}

.upload-zone:hover {
    border-color: var(--secondary);
    background: linear-gradient(135deg, rgba(254, 180, 123, 0.1) 0%, rgba(126, 232, 250, 0.1) 100%);
    transform: translateY(-2px);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(126, 232, 250, 0.15);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 12px;
    animation: bounce 2s infinite;
}

.upload-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--text-secondary);
    font-size: 13px;
}



.file-list {
    margin-top: 20px;
    display: none;
}

.file-list.active {
    display: block;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.file-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

.file-item-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.file-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.file-status.success {
    background: rgba(0, 168, 98, 0.1);
    color: var(--success-color);
}

.file-status.processing {
    background: rgba(255, 153, 0, 0.1);
    color: var(--warning-color);
}

.file-status.error {
    background: rgba(204, 12, 57, 0.1);
    color: var(--danger-color);
}

.file-input {
    display: none;
}

.data-controls {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.control-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.reload-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 4px rgba(255, 126, 95, 0.3);
}

.reload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 126, 95, 0.4);
    background: linear-gradient(135deg, var(--secondary), var(--accent));
}

.reload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(255, 126, 95, 0.2);
}

.clear-btn {
    background: linear-gradient(135deg, var(--danger-color), #e74c3c);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 4px rgba(204, 12, 57, 0.3);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(204, 12, 57, 0.4);
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

.clear-note {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.dashboard {
    display: none;
    animation: fadeIn 0.8s ease;
}

.dashboard.active {
    display: block;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-break {
    grid-column: 1 / -1;
    height: 0;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

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

/* summary tooltip */
.summary-tooltip {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card.has-tooltip {
    position: relative;
    /* ツールチップがカード外に出るために必要 */
    overflow: visible;
}

.summary-tooltip::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.9);
}

/* CSSフォールバック: ホバー/フォーカス時に表示（JSが効かない環境でも表示） */
.card.has-tooltip:hover .summary-tooltip,
.card.has-tooltip:focus-within .summary-tooltip {
    opacity: 1;
    visibility: visible;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

.card-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-value {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

.card-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-change.positive {
    color: var(--success-color);
}

.card-change.negative {
    color: var(--danger-color);
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.chart-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-canvas {
    position: relative;
    height: 300px;
}

.table-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
    overflow-x: hidden;
}

.table-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.tab-button {
    flex: 0 0 auto;
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
}

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

.tab-button.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 10px rgba(255, 94, 98, 0.3);
    border-radius: 8px;
}

.tab-button.active::after {
    display: none;
}

.table-content {
    display: none;
}

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

.table-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.export-btn {
    background: linear-gradient(135deg, #00A862, #27ae60);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 4px rgba(0, 168, 98, 0.3);
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 168, 98, 0.4);
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.export-btn:active {
    transform: translateY(0);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--light-bg);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

th.sortable:hover {
    background: #e9ecef;
}

th.sortable:active {
    background: #dee2e6;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: var(--text-primary);
    font-size: 14px;
}

tr:hover {
    background: #f8f9fa;
}

.profit-positive {
    color: var(--success-color);
    font-weight: 600;
}

.profit-negative {
    color: var(--danger-color);
    font-weight: 600;
}

.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.period-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.period-button {
    padding: 8px 16px;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 4px rgba(255, 126, 95, 0.1);
}

.period-button:hover, .period-button.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 126, 95, 0.2);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-description {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.settings-table-container {
    overflow-x: auto;
}

#productSettingsTable {
    width: 100%;
    border-collapse: collapse;
}

#productSettingsTable th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
}

#productSettingsTable td {
    padding: 8px 12px;
}

#productSettingsTable input[type="text"],
#productSettingsTable input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#productSettingsTable input[type="number"] {
    text-align: right;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid #ddd;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Info icon and popup styles */
.info-icon {
    cursor: pointer;
    font-size: 0.75em;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: bold;
    font-style: normal;
    text-transform: none;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    vertical-align: middle;
}

.info-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(255, 126, 95, 0.4);
}

.expense-info-popup {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 20px;
    z-index: 1000;
    max-width: 400px;
    animation: fadeIn 0.2s ease;
}

.expense-info-popup::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid white;
    top: -10px;
    left: 20px;
}

.expense-info-popup h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 16px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

.expense-info-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.expense-info-popup li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.expense-info-popup li:last-child {
    border-bottom: none;
}

.expense-info-popup li::before {
    content: '• ';
    color: var(--primary);
    font-weight: bold;
    margin-right: 8px;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1;
    padding: 5px;
    transition: color 0.2s;
}

.popup-close:hover {
    color: var(--danger-color);
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inventory Forecast Table Styles */
#inventoryForecastTable th:not(:first-child) {
    text-align: center;
}

/* シーズンごとの商品名装飾 */
.season-spring .name-text { 
    border-left: 4px solid #ff9a9e; 
    background: linear-gradient(to right, rgba(255, 154, 158, 0.1), transparent);
}
.season-summer .name-text { 
    border-left: 4px solid #4facfe; 
    background: linear-gradient(to right, rgba(79, 172, 254, 0.1), transparent);
}
.season-autumn .name-text { 
    border-left: 4px solid #ff9966; 
    background: linear-gradient(to right, rgba(255, 153, 102, 0.1), transparent);
}
.season-winter .name-text { 
    border-left: 4px solid #a18cd1; 
    background: linear-gradient(to right, rgba(161, 140, 209, 0.1), transparent);
}

/* 仕入予測テーブルのレイアウト調整（ズレ防止） */
#inventoryForecastTable {
    table-layout: fixed; /* 列幅を固定 */
}

#inventoryForecastTable th,
#inventoryForecastTable td {
    padding: 10px 4px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#inventoryForecastTable th:first-child,
#inventoryForecastTable td:first-child {
    width: 250px; /* 商品名カラム */
    text-align: left;
}

#inventoryForecastTable th:not(:first-child),
#inventoryForecastTable td:not(:first-child) {
    width: 60px; /* 月・合計カラム */
    text-align: center;
}

#inventoryForecastTable td:not(:first-child) {
    font-family: 'Monaco', 'Consolas', monospace; /* 数字を等幅フォントに */
}

/* 仕入予測テーブルのカスタムツールチップ */
#inventoryForecastTable td.forecast-cell-tooltip {
    overflow: visible;
}

.forecast-cell-tooltip {
    position: relative;
}

.forecast-cell-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(45, 52, 54, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 6px;
}

.forecast-cell-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(45, 52, 54, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
    pointer-events: none;
}

.forecast-cell-tooltip:hover::after,
.forecast-cell-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* テーブルリサイズ用 */
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px; /* クリックしやすいように少し太く */
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
    transition: background-color 0.2s;
}

.resize-handle:hover,
.resize-handle.active {
    background-color: var(--primary);
    opacity: 0.5;
}

/* リサイズ中はカーソルを強制 */
body.resizing {
    cursor: col-resize !important;
    user-select: none;
}

/* トレンド表示用スタイル */
.trend-decrease-1 {
    color: #d63031;
    font-weight: bold;
}
.trend-decrease-2 {
    color: #d63031;
    background-color: #ffebee;
    font-weight: bold;
}
.trend-decrease-3 {
    color: #c0392b;
    background-color: #ffcdd2;
    font-weight: bold;
    border: 1px solid #ef9a9a;
}

.trend-increase-1 {
    color: #00b894;
    font-weight: bold;
}
.trend-increase-2 {
    color: #00b894;
    background-color: #e8f5e9;
    font-weight: bold;
}
.trend-increase-3 {
    color: #008f7a;
    background-color: #c8e6c9;
    font-weight: bold;
    border: 1px solid #a5d6a7;
}

/* FBA在庫による仕入予測タブ: 商品名先頭20文字で同一親ASIN推定・行グループ色
   --fba-row-bg を <tr> に CSS変数として設定し、<td> に直接適用する。
   グローバルの tr:hover / tr:hover td を上書きして常時表示を保証する。 */
#fbaForecastTable tbody tr.fba-row-group td {
    background-color: var(--fba-row-bg, transparent);
}
#fbaForecastTable tr:hover {
    background: transparent;
}
#fbaForecastTable tbody tr.fba-row-group:hover td {
    background-color: var(--fba-row-bg, transparent);
    filter: brightness(0.94);
}
#fbaForecastTable tr:hover td {
    background: var(--fba-row-bg, transparent);
}

/* FBA在庫による仕入予測タブ: カスタムツールチップ（商品名・仕入推奨ヶ月分） */
.fba-custom-tooltip {
    display: none;
    position: fixed;
    z-index: 10000;
    max-width: 400px;
    max-height: 240px;
    overflow: auto;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}

/* FBA在庫による仕入予測タブ: スクロールラッパー */
.fba-table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 75vh;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* FBA在庫による仕入予測タブ: ソート可能ヘッダー */
#fbaForecastTable {
    table-layout: fixed;
    width: 100%;
    min-width: 100%;
}

#fbaForecastTable thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#fba-inventory-forecast-tab .table-header {
    box-sizing: border-box;
    justify-content: flex-start;
    flex-wrap: nowrap;
}

#fbaForecastTable th,
#fbaForecastTable td {
    text-align: center;
}

#fbaForecastTable .fba-product-name {
    text-align: left;
}

#fbaForecastTable thead th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: sticky;
    padding-right: 20px;
}
#fbaForecastTable thead th[data-sort]:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
#fbaForecastTable thead th.fba-sort-active.fba-sort-asc::after {
    content: ' ▲';
    font-size: 0.75em;
    opacity: 0.8;
}
#fbaForecastTable thead th.fba-sort-active.fba-sort-desc::after {
    content: ' ▼';
    font-size: 0.75em;
    opacity: 0.8;
}

#fbaForecastTable .fba-resizable-col {
    overflow: visible;
}

#fbaForecastTable .fba-col-resizer {
    position: absolute;
    top: 0;
    right: -3px;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    z-index: 2;
}

#fbaForecastTable .fba-col-resizer::before {
    content: '';
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

#fbaForecastTable thead th:hover .fba-col-resizer::before,
#fbaForecastTable .fba-col-resizer:hover::before {
    background: rgba(0, 201, 255, 0.8);
}

/* FBA在庫による仕入予測タブ: 商品名セル（縦長防止） */
/* <td> は通常のテーブルセルのまま。display:-webkit-box を直接設定しない */
#fbaForecastTable .fba-product-name {
    max-width: none;
}
/* 中間省略済みテキストを1〜2行で表示（CSS切り詰め不要） */
#fbaForecastTable .fba-product-name-inner {
    overflow: hidden;
    line-height: 1.4;
    word-break: break-all;
}

/* FBA在庫による仕入予測タブ: 在庫状況バッジ */
.fba-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
}
.fba-status-short {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}
.fba-status-ok {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}
.fba-status-excess {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}
