* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 1rem 1.25rem;
    line-height: 1.45;
    color: #1a1a1a;
    background: #f5f5f5;
}

.top-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab {
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    border: 1px solid #d8d8d8;
    background: #fff;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 0.9rem;
}

.tab.active {
    border-color: #7ba5ff;
    background: #eef4ff;
}

.tab.disabled {
    opacity: 0.55;
}

h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.controls form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

button,
select {
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 0.85rem;
}

.alert {
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
}

.alert.success {
    border-color: #6fcf97;
    background: #edf9f1;
}

.alert.error {
    border-color: #eb5757;
    background: #fff1f1;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.zone-critical {
    background: #ffe7e7;
}

.zone-low {
    background: #fff7df;
}

.zone-normal {
    background: #ebf8ee;
}

.zone-excess {
    background: #e8f2ff;
}

.zone-no_sales {
    background: #f0ecff;
}

.market-rec {
    max-width: 220px;
    font-size: 0.85rem;
    color: #444;
}

.product-name {
    max-width: 280px;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 0.5rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

th {
    background: #fafafa;
    font-weight: 600;
    white-space: nowrap;
}

tbody tr:hover {
    background: #f9f9f9;
}

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

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

.muted {
    color: #666;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
}

.kpi-label {
    font-size: 0.8rem;
    color: #666;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin: 0.2rem 0;
}

.kpi-hint {
    font-size: 0.75rem;
    color: #888;
}

.section-block {
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.chart-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem 1rem 0.85rem;
    margin-bottom: 1rem;
    max-width: 100%;
}

.chart-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
}

.chart-legend-hint {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
}

.chart-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.chart-wrap {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 100%;
}

.chart-wrap--medium {
    height: 260px;
}

.row-highlight {
    background: #eef4ff;
}

.row-highlight:hover {
    background: #e3ecff;
}
