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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* LEFT SIDEBAR */
.sidebar {
    background: linear-gradient(180deg, #1e3a5f 0%, #2d5a87 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.logo {
    text-align: center;
    color: white;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.logo h1 { font-size: 1.3em; margin-bottom: 4px; }
.logo-sub { font-size: 0.85em; opacity: 0.9; color: #60a5fa; }

.sidebar-card {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 14px;
}
.sidebar-card-title {
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-group {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 4px;
}
.toggle-group button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s;
}
.toggle-group button.active {
    background: white;
    color: #1e3a5f;
}

.user-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    outline: none;
}
.user-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #34d399;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
}
.user-value {
    background: white;
    color: #1e3a5f;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1em;
    width: 70px;
    text-align: center;
    border: 2px solid transparent;
    outline: none;
    transition: border-color 0.3s;
    -moz-appearance: textfield;
}
.user-value::-webkit-outer-spin-button,
.user-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.user-value:focus {
    border-color: #34d399;
}
.tier-label {
    color: rgba(255,255,255,0.8);
    font-size: 0.75em;
    text-align: center;
    margin-top: 8px;
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.product-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.product-item:hover {
    background: rgba(255,255,255,0.15);
}
.product-item.selected {
    background: rgba(52, 211, 153, 0.3);
    border-color: #34d399;
}
.product-item input {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: #34d399;
}
.product-item .name {
    flex: 1;
    color: white;
    font-size: 0.85em;
    font-weight: 500;
    display: flex;
    flex-direction: column;
}
.product-item .name .sku {
    font-size: 0.75em;
    color: rgba(255,255,255,0.6);
    font-weight: 400;
}
.product-item .price {
    color: #34d399;
    font-weight: 600;
    font-size: 0.85em;
}

.select-all-btn {
    width: 100%;
    padding: 10px;
    background: #34d399;
    color: #1e3a5f;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    font-size: 0.85em;
}
.select-all-btn:hover {
    background: #2dd4a0;
}

/* MAIN CONTENT */
.main-content {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* KPI ROW */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}
.kpi-card .icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.2em;
}
.kpi-card.cost .icon { background: #dbeafe; }
.kpi-card.sell .icon { background: #d1fae5; }
.kpi-card.profit .icon { background: #ede9fe; }
.kpi-card.margin .icon { background: #fef3c7; }
.kpi-card .label {
    font-size: 0.8em;
    color: #6b7280;
    margin-bottom: 6px;
}
.kpi-card .value {
    font-size: 1.6em;
    font-weight: bold;
}
.kpi-card.cost .value { color: #3b82f6; }
.kpi-card.sell .value { color: #10b981; }
.kpi-card.profit .value { color: #8b5cf6; }
.kpi-card.margin .value { color: #f59e0b; }

/* CHARTS ROW */
.charts-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}
.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.chart-card h3 {
    font-size: 0.95em;
    color: #374151;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-wrapper {
    height: 200px;
    position: relative;
}

/* BOTTOM ROW */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.incentive-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.incentive-card h3 {
    font-size: 0.95em;
    color: #374151;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-wrapper {
    margin-bottom: 16px;
}
.progress-bar-bg {
    background: #e5e7eb;
    border-radius: 8px;
    height: 24px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.8em;
    transition: width 0.5s;
}
.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7em;
    color: #9ca3af;
}

.tier-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.tier-box {
    padding: 12px 8px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s;
}
.tier-box.bronze { background: #fef3c7; }
.tier-box.silver { background: #f3f4f6; }
.tier-box.gold { background: #fef9c3; }
.tier-box.platinum { background: #dbeafe; }
.tier-box.active {
    border-color: #10b981;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.tier-box .tier-name {
    font-weight: 700;
    font-size: 0.8em;
    margin-bottom: 4px;
}
.tier-box .tier-range {
    font-size: 0.65em;
    color: #6b7280;
    margin-bottom: 6px;
}
.tier-box .tier-rebate {
    font-size: 1.2em;
    font-weight: bold;
    color: #059669;
}
.tier-box .tier-bonus {
    font-size: 0.65em;
    color: #7c3aed;
    margin-top: 4px;
}

.negotiation-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.negotiation-card h3 {
    font-size: 0.95em;
    color: #374151;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.discount-slider-wrapper {
    margin-bottom: 20px;
}
.discount-slider {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #10b981, #f59e0b, #ef4444);
    border-radius: 5px;
    outline: none;
}
.discount-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid #1e3a5f;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.discount-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75em;
    color: #9ca3af;
}

.negotiation-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.result-box {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
}
.result-box.discount { background: #fef2f2; }
.result-box.final { background: #ecfdf5; }
.result-box.net-margin { background: #f5f3ff; }
.result-box .result-label {
    font-size: 0.75em;
    color: #6b7280;
    margin-bottom: 6px;
}
.result-box .result-value {
    font-size: 1.4em;
    font-weight: bold;
}
.result-box.discount .result-value { color: #dc2626; }
.result-box.final .result-value { color: #059669; }
.result-box.net-margin .result-value { color: #7c3aed; }

/* IMPORTANT NOTES PANEL */
.notes-panel {
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    display: none;
    animation: slideIn 0.3s ease-out;
}
.notes-panel.perpetual-notes {
    background: #fef9e7;
    border: 1px solid #f6e58d;
}
.notes-panel.annual-notes {
    background: #e6f7f7;
    border: 1px solid #a8e6e6;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.notes-panel.visible {
    display: block;
}
.notes-panel h3 {
    font-size: 1em;
    color: #1e3a5f;
    margin-bottom: 16px;
    font-weight: 700;
}
.notes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 40px;
}
.note-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85em;
    color: #374151;
    line-height: 1.4;
}
.note-item::before {
    content: "•";
    color: #1e3a5f;
    font-weight: bold;
    flex-shrink: 0;
}
