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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    overflow: hidden;
}

.dashboard-header {
    background: #111214;
    color: white;
    padding: 1.1rem 1.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.dashboard-logo {
    height: 48px;
    width: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.dashboard-container {
    height: calc(100vh - 80px);
    padding: 1rem;
}

.split-container {
    display: flex;
    height: 100%;
    gap: 1rem;
}

.split-container.vertical {
    flex-direction: column;
}

.split-pane {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
}

.pane-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1.25rem 1.25rem;
    overflow: auto;
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.pane-content h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 0.4rem;
    padding-bottom: 0;
}

.legend-container, .control-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.control-stack {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.legend-container ul {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.control-group label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7f8c8d;
}

.control-group select {
    border: 1px solid #dbe3ef;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    font-size: 0.95rem;
    background: #fff;
    color: #2c3e50;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #34495e;
}

.legend-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.legend-marker--box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.legend-marker--line {
    width: 3px;
    height: 16px;
    border-radius: 2px;
}

.metric {
    display: flex;
    justify-content: flex-end;
    font-size: 0.8rem;
    line-height: 1.2;
}

.metric-units {
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-revenue {
    font-weight: 600;
    color: #1e3c72;
}

/* Table styles */
.table-wrapper {
    flex: 1;
    overflow: auto;
}

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

.table-wrapper thead th {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    text-align: left;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #7f8c8d;
    padding: 0.6rem 0.4rem;
    z-index: 5;
}

.table-wrapper tbody td {
    padding: 0.55rem 0.4rem;
    font-size: 0.95rem;
    color: #2c3e50;
    border-bottom: 1px solid rgba(44, 62, 80, 0.06);
}

.table-wrapper tbody tr:last-child td {
    border-bottom: none;
}

.table-wrapper tbody tr:hover {
    background: rgba(46, 204, 113, 0.08);
}

.vendor-name {
    font-weight: 600;
    color: #1e3c72;
}

.vendor-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(30, 60, 114, 0.08);
    color: #1e3c72;
    margin-left: 0.4rem;
}

.vendor-tag.gls {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

.modal-chip.lrs {
    background: rgba(30, 60, 114, 0.15);
    color: #1e3c72;
}

.modal-chip.gls {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.territory-subtext {
    font-size: 0.7rem;
    color: #7f8c8d;
    margin-left: 0.25rem;
}

.numeric-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.total-cell {
    font-weight: 600;
    color: #1e3c72;
}

.brand-row {
    background: #f3f6ff;
}

.brand-row td {
    font-weight: 600;
    color: #1e3c72;
}

.format-row td:first-child {
    padding-left: 1.5rem;
    color: #4a5b73;
    font-size: 0.92rem;
}

.trend-indicator {
    margin-left: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.trend-indicator.positive {
    color: #27ae60;
}

.trend-indicator.negative {
    color: #e74c3c;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: min(900px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #f0f2f7;
    gap: 1rem;
}

.modal-chip {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(52, 73, 94, 0.08);
    color: #34495e;
    margin-bottom: 0.25rem;
}

.modal-subtext {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.2rem;
}

.modal-summary {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.modal-summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #7f8c8d;
    letter-spacing: 0.05em;
}

.modal-summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3c72;
    margin-top: 0.15rem;
}

.modal-table-wrapper {
    padding: 1rem 1.5rem 1.5rem;
    overflow: auto;
}

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

#storeModalTable thead th {
    text-align: left;
    font-size: 0.8rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 0.75rem;
}

#storeModalTable tbody td {
    padding: 0.45rem 0.25rem;
    border-bottom: 1px solid rgba(30, 60, 114, 0.08);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background: rgba(46, 204, 113, 0.08);
}

/* Split.js gutter styling */
.gutter {
    background-color: #e8eef5;
    background-repeat: no-repeat;
    background-position: 50%;
    transition: background-color 0.2s;
}

.gutter:hover {
    background-color: #d0dae8;
}

.gutter.gutter-horizontal {
    cursor: col-resize;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
}

.gutter.gutter-vertical {
    cursor: row-resize;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=');
}

/* Brand Sales Chart Container */
#brand-sales-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

#brandSalesChart {
    flex: 1;
    max-height: 100%;
}

.brand-pane {
    display: flex;
    gap: 1rem;
    height: 100%;
    align-items: stretch;
}

.brand-chart-area {
    flex: 1;
    min-width: 0;
}

.brand-summary {
    flex: 0 0 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

#segmentTotalsChart {
    width: 100%;
    height: 100%;
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #7f8c8d;
    font-size: 1rem;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Territory Map */
.territory-map {
    flex: 1;
    min-height: 0;
    border-radius: 6px;
    overflow: hidden;
}

.territory-label {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.territory-label .name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.territory-label .actual {
    font-size: 0.9rem;
    color: #34495e;
    margin-bottom: 2px;
}

.territory-label .forecast {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.territory-label .variance {
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 4px;
}

.territory-label .variance.positive {
    color: #27ae60;
}

.territory-label .variance.negative {
    color: #e74c3c;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
    
    .pane-content {
        padding: 1rem;
    }
}

