* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 28px;
}

.page-header {
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: #111827;
}

.subtitle {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 15px;
}

.refresh-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 700;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
}

.last-updated {
    margin: 10px 4px 0;
    font-size: 13px;
    color: #6b7280;
}

.tab-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}

.tab-btn {
    border: none;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 600;
    background: #e5e7eb;
    color: #111827;
    cursor: pointer;
}

.tab-btn.active {
    background: #111827;
    color: #ffffff;
}

.tab-content {
    display: none;
}

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

.cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.card {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.total-card {
    background: #111827;
    color: #ffffff;
}

.card-header h2 {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(17, 24, 39, 0.04);
}

.total-card .metric {
    background: rgba(255, 255, 255, 0.08);
}

.label {
    font-size: 13px;
    color: #6b7280;
}

.total-card .label {
    color: rgba(255, 255, 255, 0.72);
}

.value-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.value-left {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
}

.value-right {
    margin-left: auto;
    min-width: 32px;
    text-align: right;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
    color: #6b7280;
}

.total-card .value-right {
    color: rgba(255, 255, 255, 0.78);
}

.single-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
}

.loading-card,
.error-card {
    text-align: center;
    font-size: 15px;
    color: #6b7280;
}

/* ÜRÜN SATIŞLARI TOOLBAR */
.sales-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.toolbar-sort-group {
    justify-self: end;
}

.toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    opacity: 0.75;
    margin-right: 2px;
    white-space: nowrap;
}

.filter-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    background: #e5e7eb;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn.active {
    background: #111827;
    color: #ffffff;
}

.sales-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.sales-panel {
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.sales-panel h2 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
}

.sales-mini-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.mini-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #f3f4f6;
}

.mini-label {
    font-size: 12px;
    color: #6b7280;
}

.mini-value {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.sales-placeholder {
    padding: 18px 14px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.table-wrapper {
    width: 100%;
    overflow-x: hidden;
    border-radius: 14px;
    background: #f9fafb;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.sales-table th,
.sales-table td {
    padding: 12px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    word-break: break-word;
}

.sales-table th {
    background: #eef2f7;
    font-weight: 700;
    color: #111827;
}

.sales-table td {
    color: #374151;
}

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

.global-loading {
    display: block;
}

.global-loading.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

@media (min-width: 480px) {
    .container {
        padding-top: 24px;
    }
}

@media (min-width: 768px) {
    .cards {
        grid-template-columns: 1fr 1fr;
    }

    .sales-mini-summary {
        grid-template-columns: 1fr 1fr;
    }

    .total-card {
        grid-column: 1 / -1;
        justify-self: center;
        width: 100%;
        max-width: calc(50% - 8px);
    }
}

@media (min-width: 900px) {
    .sales-columns {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .sales-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .toolbar-group {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        width: 100%;
    }

    .toolbar-sort-group {
        margin-left: 0;
        justify-content: flex-start;
    }
}

.label-percent {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 4px;
}

.leader-box {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background-color: #111827;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 480px) {
    .leader-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

.leader-title {
    opacity: 0.8;
    font-size: 13px;
    white-space: nowrap;
}

.leader-value {
    font-weight: 800;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.branch-status,
.sales-last-updated {
    margin: -6px 0 12px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.branch-status-warning {
    margin-top: 5px;
    color: #b45309;
    font-weight: 600;
}

.aggregate-warning,
.sales-warning-banner {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #fbbf24;
    border-radius: 12px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
    line-height: 1.5;
}

.sales-warning-banner {
    grid-column: 1 / -1;
    margin-bottom: 0;
}

.sales-last-updated {
    grid-column: 1 / -1;
    margin: 0;
}

.sales-insight {
    box-sizing: border-box;
    display: block;
    width: 100%;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background-color: #f3f4f6;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
