:root {
    --portal-border: rgba(15, 23, 42, 0.08);
    --portal-border-strong: rgba(13, 110, 253, 0.16);
    --portal-muted: #6c757d;
    --portal-ink: #1f2937;
    --portal-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
    --portal-shadow-hover: 0 14px 30px rgba(15, 23, 42, 0.12);
    --portal-surface: linear-gradient(180deg, rgba(13, 110, 253, 0.03), rgba(13, 110, 253, 0));
}

/* Sidebar: marka yazısını gizle, logoyu büyük + ortalı + beyaz arkaplanlı göster */
#jazzy-sidebar .sidebar-brand {
    padding: 0.75rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
#jazzy-sidebar .sidebar-brand .brand-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 !important;
}
#jazzy-sidebar .sidebar-brand .brand-text {
    display: none !important;
}
#jazzy-sidebar .sidebar-brand .brand-image {
    width: auto !important;
    max-width: 80%;
    max-height: 72px;
    height: auto !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
    object-fit: contain;
}

/* Sidebar: grup başlıklarını gizle — tüm linkler tek liste olarak görünsün */
#jazzy-sidebar .nav-header {
    display: none !important;
}

.portal-section-card {
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.portal-section-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--portal-shadow-hover);
    border-color: var(--portal-border-strong);
}

.portal-card-header {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: rgba(255, 255, 255, 0.96);
}

.portal-card-header .card-title {
    color: var(--portal-ink);
    font-size: 1rem;
    font-weight: 700;
}

.portal-kpi {
    background: var(--portal-surface);
    overflow: hidden;
}

.portal-kpi::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--bs-primary);
}

.portal-kpi-success::before {
    background: var(--bs-success);
}

.portal-kpi-warning::before {
    background: var(--bs-warning);
}

.portal-kpi-info::before {
    background: var(--bs-info);
}

.portal-kpi-danger::before {
    background: var(--bs-danger);
}

.portal-kpi .card-body {
    position: relative;
}

.portal-kpi-value {
    margin-top: 0.45rem;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--portal-ink);
}

.portal-kpi-subtitle {
    margin-top: 0.45rem;
    color: var(--portal-muted);
    font-size: 0.83rem;
    line-height: 1.4;
}

.portal-kpi-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.portal-callout-card {
    background: linear-gradient(180deg, rgba(25, 135, 84, 0.03), rgba(25, 135, 84, 0));
}

.portal-input-panel {
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.04), rgba(255, 255, 255, 0.98));
}

.portal-form-card {
    position: sticky;
    top: 1rem;
}

.portal-form-group {
    padding: 0 0 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.portal-form-group:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.portal-form-group-title {
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--portal-muted);
}

.portal-submit-btn {
    min-height: 2.9rem;
    font-weight: 600;
    border-radius: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

/* Kritik noktalar: yeni satır — Simülasyon Yap ile aynı birincil stil, ikon odaklı */
.portal-add-tier-btn {
    min-width: 3rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.portal-add-tier-plus {
    display: inline-block;
    color: #fff;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
    transform: translateY(-0.06em);
}

.portal-results-shell {
    position: relative;
}

.portal-results-shell.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.portal-results-shell.is-loading::after {
    content: none;
}

.portal-chart {
    min-height: 17rem;
}

.portal-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

.portal-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--portal-muted);
}

.portal-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.portal-chart-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
}

.portal-chart-label {
    font-size: 0.72rem;
    fill: #6c757d;
}

.portal-chart-grid {
    stroke: rgba(108, 117, 125, 0.16);
    stroke-width: 1;
}

.portal-chart-axis {
    stroke: rgba(108, 117, 125, 0.28);
    stroke-width: 1.4;
}

.portal-chart-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.portal-chart-area {
    opacity: 0.15;
}

.portal-chart-bar {
    rx: 10;
    ry: 10;
}

.portal-chart-value {
    font-size: 0.72rem;
    fill: #495057;
    font-weight: 600;
}

.portal-status-badge {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.portal-fullscreen-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(4px);
}

.portal-fullscreen-loading.is-visible {
    display: flex;
}

.portal-loading-box {
    min-width: 16rem;
    padding: 1.4rem 1.6rem;
    border: 1px solid rgba(13, 110, 253, 0.18);
    border-radius: 1.1rem;
    background: #fff;
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.18);
    text-align: center;
}

.portal-loading-box .spinner-border {
    width: 2.4rem;
    height: 2.4rem;
    margin-bottom: 0.85rem;
}

.portal-simulation-busy {
    cursor: progress;
    overflow: hidden;
}

.portal-results-title,
.portal-section-title {
    color: var(--portal-ink);
    font-size: 1.05rem;
    font-weight: 750;
}

.portal-results-title {
    margin: 0.35rem 0 0.85rem;
}

.portal-entitlement-block {
    padding: 1rem;
    border: 1px solid rgba(13, 110, 253, 0.12);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.72);
}

/* Türkçe karakterlerde farklı fontlara düşüp kalınlık/yükseklik bozulmasını önlemek için tek yığın + tek satır başlık */
.portal-entitlement-table thead th,
.portal-breakdown-card thead th {
    color: var(--portal-muted);
    font-size: 0.78rem;
    font-weight: 400;
    font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-synthesis: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

.portal-breakdown-card .table-responsive {
    -webkit-overflow-scrolling: touch;
}

.portal-disabled-input {
    background-color: rgba(108, 117, 125, 0.12) !important;
}

.portal-breakdown-card {
    background: linear-gradient(180deg, rgba(25, 135, 84, 0.035), rgba(255, 255, 255, 0.98));
    overflow: visible;
}

.portal-filter-toolbar {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portal-filter-dropdown {
    position: relative;
    z-index: 10;
}

.portal-filter-dropdown > summary {
    list-style: none;
    cursor: pointer;
}

.portal-filter-dropdown > summary::-webkit-details-marker {
    display: none;
}

.portal-filter-dropdown[open] .portal-filter-dropdown-body {
    display: block;
}

.portal-filter-dropdown[open] {
    z-index: 30;
}

.portal-filter-dropdown-body {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: auto;
    z-index: 20;
    min-width: 14rem;
    margin-top: 0.5rem;
    padding: 0.8rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
    display: none;
    max-height: 18rem;
    overflow: auto;
}

.portal-segmented-control {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.25rem;
    border: 1px solid rgba(13, 110, 253, 0.14);
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.05);
}

.portal-segment-btn {
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    color: #495057;
    background: transparent;
    font-weight: 650;
    transition: color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.portal-segment-btn:hover,
.portal-segment-btn.active {
    color: #0d6efd;
    background: #fff;
    box-shadow: 0 8px 18px rgba(13, 110, 253, 0.13);
}

.portal-soft-badge {
    color: #0f5132;
    background: rgba(25, 135, 84, 0.12);
    border: 1px solid rgba(25, 135, 84, 0.18);
}

.portal-share-cell {
    min-width: 8rem;
}

.portal-share-progress {
    height: 0.45rem;
    margin-top: 0.4rem;
    background: rgba(13, 110, 253, 0.08);
}

.app-footer,
.main-footer {
    display: none !important;
}

/* Kullanıcı menüsü: sadece "Oturumu Kapat" kalsın */
#jazzy-usermenu .dropdown-header,
#jazzy-usermenu .dropdown-divider,
#jazzy-usermenu a.dropdown-item,
#jazzy-usermenu a.dropdown-footer {
    display: none !important;
}

.table-responsive {
    border-radius: 0.85rem;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.portal-combined-table {
    table-layout: fixed;
    width: 100%;
    font-size: 0.86rem;
}

/*
 * Mağaza/Marka/Takım kırılım tabloları: fixed layout’ta ilk sütunlar metin nedeniyle genişleyip
 * Sonuç + Pay sütununu sağda sıkıştırıyordu. Sütun sayısına göre eşit yüzde genişlik.
 */
.portal-relation-breakdown thead tr:has(> th:nth-child(5):last-child) > th,
.portal-relation-breakdown tbody tr:has(> td:nth-child(5):last-child) > td {
    width: 20%;
}

.portal-relation-breakdown thead tr:has(> th:nth-child(4):last-child) > th,
.portal-relation-breakdown tbody tr:has(> td:nth-child(4):last-child) > td {
    width: 25%;
}

.portal-relation-breakdown thead tr:has(> th:nth-child(3):last-child) > th,
.portal-relation-breakdown tbody tr:has(> td:nth-child(3):last-child) > td {
    width: 33.333%;
}

/* Yalnızca gövde hücreleri; thead başlıklarında nowrap/font için ayrı kural var */
.portal-combined-table > tbody > tr > * {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Önceden 800 idi — Jazzmin/Bootstrap sırasında portal-breakdown kurallarını eziyordu */
.portal-combined-table thead th {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--portal-muted);
    font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-synthesis: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.table-hover tbody tr {
    transition: background-color 0.16s ease, transform 0.16s ease;
}

.table-hover tbody tr:hover {
    background: rgba(13, 110, 253, 0.04);
}

.portal-drag-col {
    width: 2.25rem;
    vertical-align: middle;
}

.portal-drag-handle {
    cursor: grab;
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
}

.portal-drag-handle:active {
    cursor: grabbing;
}

.portal-sortable-th {
    cursor: pointer;
    user-select: none;
}

.portal-sortable-th:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.45);
    outline-offset: 2px;
}

.portal-tier-dragging {
    opacity: 0.65;
}

/* Sürüklerken satırın üstüne mü / altına mı bırakılacağı önizlemesi */
.portal-entitlement-table tbody tr.portal-tier-drop-above td {
    box-shadow: inset 0 3px 0 0 var(--bs-primary);
}

.portal-entitlement-table tbody tr.portal-tier-drop-below td {
    box-shadow: inset 0 -3px 0 0 var(--bs-primary);
}

@media (max-width: 991.98px) {
    .portal-form-card {
        position: static;
    }
}

.portal-scenario-toolbar .card-body {
    padding-bottom: 1rem;
}

.portal-results-toolbar .portal-export-buttons .btn {
    margin-bottom: 0.25rem;
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }
    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    nav, header, .navbar, .breadcrumb,
    #jazzy-sidebar, .main-sidebar,
    .portal-fullscreen-loading,
    .portal-scenario-toolbar,
    .portal-input-panel,
    .portal-export-buttons,
    .portal-submit-btn,
    .portal-add-tier-btn,
    .portal-tier-actions,
    .portal-drag-col,
    .portal-filter-toolbar,
    .alert,
    button {
        display: none !important;
    }
    .content-wrapper, .main-content, main {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Bootstrap row gutter'ı (.g-3 vs.) print'te tamamen sıfırlanır */
    .row {
        --bs-gutter-x: 0 !important;
        --bs-gutter-y: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: block !important;
    }
    .row > [class*="col-"] {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 0 !important;
    }
    .col-12, [class*="col-md-"], [class*="col-xl-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 4mm !important;
    }
    .card.portal-kpi,
    .card.portal-breakdown-card,
    .card.portal-section-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .card-body {
        padding: 8px 10px !important;
    }
    .portal-breakdown-card {
        break-before: auto;
        page-break-before: auto;
    }
    .portal-results-title {
        font-size: 1.25rem;
        margin: 6px 0 4px 0;
    }

    /* KPI kartlarını kompakt yap */
    .portal-kpi .card-body {
        padding: 6px 10px !important;
    }
    .portal-kpi .portal-kpi-value {
        font-size: 1.4rem !important;
        margin: 0 !important;
    }
    .portal-kpi .portal-kpi-subtitle,
    .portal-kpi .text-muted {
        font-size: 0.7rem !important;
    }

    /* Tablo: sabit kolon dağılımı + word-break ile sütun karışmasını önle */
    .table {
        font-size: 11px !important;
        table-layout: fixed !important;
        width: 100% !important;
        break-inside: auto;
        page-break-inside: auto;
    }
    .table th,
    .table td {
        white-space: normal !important;
        word-break: break-word !important;
        padding: 4px 6px !important;
        line-height: 1.25 !important;
        vertical-align: middle !important;
    }
    /* Para/yüzde sütunları (sağa hizalı) — rakam parçalanmasın */
    .table th.text-end,
    .table td.text-end {
        white-space: nowrap !important;
    }
    .table thead {
        display: table-header-group;
    }
    .table tr {
        break-inside: avoid;
        page-break-inside: avoid;
        page-break-after: auto;
    }
}
