/* ============================================================================
   RAPOR KİTİ (rk-*) — Finansal Planlama ve Personel raporlarının ORTAK dili
   ----------------------------------------------------------------------------
   Kaynak: docs/Tasarlanacak Raporlar/DRM_Budget_Finansal_Personel_Rapor_Blueprint.xlsx
   sayfa 12 (UI Standartları). Kural kodları yorumlarda geçer.

   Sürüm renkleri uygulama geneli senaryo standardından (/css/scenario-colors.css,
   --sc-*) gelir: Gerçekleşen yeşil · Bütçe mavi · Forecast mor · Geçen yıl gri.
   Core'daki ReportVersions (grafik renkleri) de aynı değerleri taşır.
   ============================================================================ */

:root {
    --rk-actual: var(--sc-actual);
    --rk-budget: var(--sc-budget);
    --rk-forecast: var(--sc-forecast);
    --rk-ly: var(--sc-lastyear);

    --rk-actual-tint: var(--sc-actual-tint);
    --rk-budget-tint: var(--sc-budget-tint);
    --rk-forecast-tint: var(--sc-forecast-tint);
    --rk-ly-tint: var(--sc-lastyear-tint);

    /* Sürüm başlık zeminleri — hücre tonunun bir kademe koyusu */
    --rk-actual-head: var(--sc-actual-soft);
    --rk-budget-head: var(--sc-budget-soft);
    --rk-forecast-head: var(--sc-forecast-soft);
    --rk-ly-head: var(--sc-lastyear-soft);

    --rk-fav: #15803d;
    --rk-unfav: #b91c1c;
    --rk-fav-bg: #ecfdf3;
    --rk-unfav-bg: #fef2f2;

    --rk-ink: #0f172a;
    --rk-ink-2: #334155;
    --rk-muted: #64748b;
    --rk-faint: #94a3b8;
    --rk-line: #e2e8f0;
    --rk-line-2: #eef2f7;
    --rk-bg: #f6f8fb;
    --rk-card: #ffffff;
    --rk-accent: #1d4ed8;
    --rk-accent-soft: #eff6ff;

    --rk-subtotal: #eaf1fb;
    --rk-section: #f3f6fb;

    --rk-radius: 12px;
    --rk-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .04);
}

/* ── Sayfa (GLOBAL-001: beyaz zemin, yüksek okunabilirlik) ─────────────── */
.rk-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px 24px;
    background: linear-gradient(180deg, #fbfdff 0, var(--rk-bg) 180px);
    color: var(--rk-ink);
    min-width: 0;
    font-variant-numeric: tabular-nums;

    /* FpReportFilterBar (fpr-*) değişkenlerini .fpr-shell'den alır; rapor kiti sayfası o kabuğun
       içinde olmadığından filtre çubuğu zeminsiz/çerçevesiz kalıyor, etiketler renk almıyordu. */
    --fpr-ink: var(--rk-ink);
    --fpr-ink-soft: var(--rk-ink-2);
    --fpr-dim: var(--rk-muted);
    --fpr-line: var(--rk-line);
    --fpr-line-soft: var(--rk-line-2);
    --fpr-bg: var(--rk-bg);
    --fpr-surface: #ffffff;
    --fpr-radius: 10px;
    --fpr-radius-sm: 8px;
    --fpr-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --fpr-shadow-md: 0 2px 6px rgba(15, 23, 42, .06);
    --fpr-info: var(--rk-accent);
    --fpr-info-bg: var(--rk-accent-soft);
}

/* ── Başlık: kırıntı + sağda son güncelleme ─────────────────────────────── */
.rk-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 2px;
}

.rk-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 750;
    letter-spacing: -.01em;
    line-height: 1.25;
}

.rk-crumbs a,
.rk-crumbs .rk-crumb {
    color: var(--rk-ink-2);
    text-decoration: none;
    font-weight: 650;
}

.rk-crumbs a:hover { color: var(--rk-accent); }
.rk-crumbs .rk-crumb-sep { color: var(--rk-faint); font-size: .8em; }
.rk-crumbs .rk-crumb-current { color: var(--rk-ink); }

/* Kırıntı hiyerarşisi: üst düzeyler küçük ve sakin, rapor adı baskın (kurumsal rapor başlığı). */
.rk-crumbs > a,
.rk-crumbs > .rk-crumb { font-size: .74em; font-weight: 600; color: var(--rk-muted); }
.rk-crumbs > .rk-crumb-sep { font-size: .56em; }
.rk-crumbs .rk-crumb-current { font-weight: 760; letter-spacing: -.015em; }

.rk-code {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    background: #e2e8f0;
    color: var(--rk-muted);
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .04em;
    vertical-align: middle;
}

.rk-subtitle {
    margin: 4px 0 0;
    font-size: .82rem;
    color: var(--rk-muted);
}

.rk-header-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rk-updated {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: .7rem;
    color: var(--rk-muted);
    line-height: 1.3;
}

.rk-updated b { color: var(--rk-ink-2); font-weight: 650; }

/* ── Düğmeler ────────────────────────────────────────────────────────── */
.rk-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--rk-line);
    border-radius: 8px;
    background: #fff;
    color: var(--rk-ink);
    font-size: .78rem;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .12s, color .12s, background .12s;
}

.rk-btn:hover:not(:disabled) { border-color: var(--rk-accent); color: var(--rk-accent); }
.rk-btn:disabled { opacity: .55; cursor: not-allowed; }
.rk-btn.primary { background: var(--rk-accent); border-color: var(--rk-accent); color: #fff; }
.rk-btn.primary:hover:not(:disabled) { background: #1e40af; color: #fff; }
.rk-btn.icon { width: 34px; padding: 0; justify-content: center; }

/* Personel raporları için ortak kapsam şeridi. Filtreler sayfa başlığından ayrılır;
   böylece uzun otel/departman adları güncelleme ve aksiyon kontrollerini sıkıştırmaz. */
.rk-filterbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid var(--rk-line);
    border-radius: var(--rk-radius);
    background: linear-gradient(105deg, rgba(255,255,255,.98), rgba(248,251,255,.98));
    box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
}

.rk-filterbar .fpr-filter { min-width: 190px; }
.rk-filter-context {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    color: var(--rk-muted);
    font-size: .72rem;
}
.rk-filter-context i { color: var(--rk-accent); }
.rk-report-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.rk-report-actions > span { margin-right: auto; color: var(--rk-muted); font-size: .71rem; }
.rk-report-actions > span i { color: #0f766e; margin-right: 4px; }
.rk-report-actions--premium {
    padding: 9px 11px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: linear-gradient(100deg, #f8fbff, #f0fdfa);
}
.rk-report-actions--premium > span { color: #475569; font-weight: 600; }
.rk-report-actions--premium > span i { color: #7c3aed; }
.rk-exception-list { display: grid; gap: 10px; }
.rk-exception-list > div { display: grid; grid-template-columns: 8px 1fr; column-gap: 9px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--rk-line-2); }
.rk-exception-list > div:last-child { border-bottom: 0; }
.rk-exception-list strong { font-size: .78rem; color: var(--rk-ink); }
.rk-exception-list small { grid-column: 2; color: var(--rk-muted); font-size: .7rem; margin-top: 2px; }
.rk-risk-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.rk-metric-stack { display: grid; gap: 13px; }
.rk-metric-stack > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--rk-line-2); }
.rk-metric-stack > div:last-child { border-bottom: 0; padding-bottom: 0; }
.rk-metric-stack span { color: var(--rk-muted); font-size: .73rem; }
.rk-metric-stack strong { color: var(--rk-ink); font-size: .92rem; }

/* Açma/kapama anahtarları (Oda Başı, Kişi Başı…) */
.rk-toggles {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--rk-line);
    border-radius: 9px;
    background: #fff;
}

.rk-toggle {
    height: 26px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--rk-muted);
    font-size: .72rem;
    font-weight: 650;
    cursor: pointer;
}

.rk-toggle:hover { color: var(--rk-ink); }
.rk-toggle.on { background: var(--rk-accent-soft); color: var(--rk-accent); }
.rk-toggle:disabled { opacity: .45; cursor: not-allowed; }

/* ── Kart ───────────────────────────────────────────────────────────── */
.rk-card {
    background: var(--rk-card);
    border: 1px solid var(--rk-line);
    border-radius: var(--rk-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 5px 18px rgba(15, 23, 42, .04);
    min-width: 0;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.rk-card:hover { border-color: #cbd5e1; }

.rk-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rk-line-2);
}

.rk-card-head h3 {
    margin: 0;
    font-size: .92rem;
    font-weight: 700;
    color: var(--rk-ink);
}

.rk-card-head > i { color: var(--rk-accent); font-size: .9rem; }
.rk-card-head .rk-card-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rk-card-unit { margin-left: auto; font-size: .7rem; font-weight: 650; color: var(--rk-muted); }
.rk-card-body { padding: 12px 16px 14px; }

/* ── KPI (GLOBAL-003: değer + karşılaştırma + sapma; gereksiz metin yok) ─ */
.rk-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.rk-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 102px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #d7e1eb;
    border-top: 3px solid #dce8f2;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    min-width: 0;
    text-align: left;
    color: inherit;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
/* Köşedeki dekoratif radyal leke kaldırıldı: kurumsal raporda kart yalnız veri taşır. */
.rk-kpi:hover { border-color: #b9c8da; }

a.rk-kpi:hover,
button.rk-kpi:hover { border-color: #bfdbfe; cursor: pointer; }

.rk-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.rk-kpi-title {
    font-size: .74rem;
    font-weight: 700;
    color: var(--rk-ink-2);
    line-height: 1.3;
}

.rk-kpi-icon {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--rk-accent-soft);
    color: var(--rk-accent);
    font-size: .8rem;
}

.rk-kpi-value {
    font-size: 1.27rem;
    font-weight: 750;
    color: var(--rk-ink);
    letter-spacing: -.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rk-kpi-value-label {
    align-self: flex-start;
    margin: 2px 0 -2px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--rk-budget-tint);
    color: var(--rk-budget);
    font-size: .61rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.rk-kpi-value.rk-na { font-size: 1rem; color: var(--rk-faint); font-weight: 650; }

.rk-kpi-compare {
    font-size: .72rem;
    color: var(--rk-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rk-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .74rem;
    font-weight: 750;
}

.rk-kpi-delta.rk-na { color: var(--rk-faint); font-weight: 600; }

/* ── Sapma renkleri (GLOBAL-011: doğaya göre) ───────────────────────── */
.rk-fav { color: var(--rk-fav); }
.rk-unfav { color: var(--rk-unfav); }
.rk-neutral { color: var(--rk-muted); }

/* ── Izgara düzenleri ───────────────────────────────────────────────── */
.rk-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rk-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 1280px) {
    .rk-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .rk-row-3,
    .rk-row-2 { grid-template-columns: 1fr; }
    .rk-page { padding: 14px 16px 24px; }
    .rk-filterbar .fpr-filter { flex: 1 1 100%; }
}


/* Veri kapsamı uyarıları: küçük yuvarlak simge + üzerine gelince/odaklanınca açılan liste.
   Kök satır tıklamaları engellemez (pointer-events), yalnız simge ve liste etkileşimlidir. */
.rk-notice-pin {
    position: relative;
    z-index: 30;
    display: flex;
    justify-content: flex-end;
    margin: 0 0 6px;
    pointer-events: none;
}
.rk-notice-pin.is-inline { display: inline-flex; margin: 0 0 0 auto; }
.rk-notice-pin-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #f2d28b;
    border-radius: 50%;
    background: #fef3c7;
    color: #a16207;
    font-size: .72rem;
    cursor: help;
    pointer-events: auto;
}
.rk-notice-pin.is-info .rk-notice-pin-btn { border-color: #bfdbfe; background: #dbeafe; color: #1d4ed8; }
.rk-notice-pin-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.rk-notice-pin-count {
    position: absolute;
    top: -6px;
    right: -7px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #b45309;
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
    line-height: 16px;
}
.rk-notice-pin.is-info .rk-notice-pin-count { background: #1d4ed8; }
.rk-notice-pop {
    position: absolute;
    top: 100%;
    right: 0;
    display: none;
    width: min(460px, calc(100vw - 32px));
    padding-top: 6px;
    pointer-events: auto;
}
.rk-notice-pop > strong,
.rk-notice-pop > ul { display: block; background: #fffdf7; border: 1px solid #f2d28b; }
.rk-notice-pin.is-info .rk-notice-pop > strong,
.rk-notice-pin.is-info .rk-notice-pop > ul { background: #f8fbff; border-color: #bfdbfe; }
.rk-notice-pop > strong {
    padding: 8px 12px 6px;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    color: #713f12;
    font-size: .74rem;
}
.rk-notice-pin.is-info .rk-notice-pop > strong { color: #1e3a8a; }
.rk-notice-pop > ul {
    margin: 0;
    padding: 0 12px 6px;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    list-style: none;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
}
.rk-notice-pop li { display: flex; align-items: flex-start; gap: 7px; padding: 6px 0; border-top: 1px solid rgba(245, 229, 189, .8); color: #854d0e; font-size: .7rem; line-height: 1.4; }
.rk-notice-pop li.info { color: #1e40af; }
.rk-notice-pop li > i { margin-top: 2px; }
.rk-notice-pin:hover .rk-notice-pop,
.rk-notice-pin:focus-within .rk-notice-pop { display: block; }
/* Ayrı satırdaki simge boş bir satır açmaz: yüksekliği sıfırdır ve iki blok arasındaki boşluğun
   ortasına, sağ kenara rozet gibi oturur (önceki ve sonraki bloğun iç boşluğuna taşar, içeriğe binmez). */
.rk-notice-pin:not(.is-inline) { height: 0; margin: -6px 0; }
.rk-notice-pin:not(.is-inline) .rk-notice-pin-btn { transform: translateY(-50%); }
.rk-notice-pin:not(.is-inline) .rk-notice-pop { padding-top: 16px; }
/* Hemen ardından gelen eylem satırının (Excel/Yazdır) sağ ucu simgeye yer bırakır. */
.rk-notice-pin:not(.is-inline) + .rk-report-actions { padding-right: 36px; }

/* ── Durum (yükleniyor / boş / hata) ───────────────────────────────── */
.rk-state {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    min-height: 240px;
    padding: 28px;
    color: var(--rk-muted);
    text-align: center;
    font-size: .86rem;
}

.rk-state i { font-size: 1.6rem; color: var(--rk-faint); }
.rk-state.error i { color: var(--rk-unfav); }
.rk-state p { margin: 0; max-width: 560px; }

/* İlk açılışta gerçek sayfa geometrisini koruyan skeleton. Spinner içeren boş bir
   kart yerine başlık/KPI/grafik/tablo ritmini gösterir; streaming render ile interaktif
   render arasındaki geçişte hata parlamasını ve layout sıçramasını önler. */
.rk-report-skeleton { display: grid; gap: 12px; min-width: 0; }
.rk-skeleton {
    position: relative;
    overflow: hidden;
    border: 1px solid #e1e9f2;
    border-radius: 10px;
    background: #edf2f7;
}
.rk-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
    animation: rk-skeleton-sweep 1.25s ease-in-out infinite;
}
.rk-skeleton-title { width: min(420px, 62%); height: 34px; }
.rk-skeleton-filter { height: 58px; }
.rk-skeleton-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.rk-skeleton-kpi { height: 102px; }
.rk-skeleton-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rk-skeleton-chart { height: 250px; }
.rk-skeleton-table { height: min(420px, 42vh); }
@keyframes rk-skeleton-sweep { 100% { transform: translateX(100%); } }

@media (max-width: 1100px) {
    .rk-skeleton-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rk-skeleton-charts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .rk-skeleton::after { animation: none; }
}

/* ── P&L tablosu (GLOBAL-008/009/010) ──────────────────────────────── */
.rk-grid-wrap {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 220px);
    border-top: 1px solid var(--rk-line-2);
}

.rk-grid-wrap.rk-full {
    max-height: none;
}

.rk-grid {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .8125rem;
    /* Rakam sütunları alt alta hizalı okunur (rk-page dışındaki kit tablolarında da). */
    font-variant-numeric: tabular-nums lining-nums;
}

/* Yapışkan başlık (GLOBAL-009) */
.rk-grid thead th {
    position: sticky;
    z-index: 3;
    background: #f8fbff;
    color: var(--rk-ink-2);
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid var(--rk-line);
}

.rk-grid thead tr:nth-child(1) th { top: 0; height: 30px; }
.rk-grid thead tr:nth-child(2) th { top: 30px; height: 26px; font-size: .68rem; font-weight: 650; color: var(--rk-muted); }

.rk-grid th.rk-group {
    text-align: center;
    border-left: 1px solid var(--rk-line);
    font-size: .74rem;
    color: #12355b;
    background: #edf5ff;
}

.rk-grid th.rk-group .rk-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: 0;
}

.rk-grid th.rk-group .rk-na-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 5px;
    background: #fef3c7;
    color: #92400e;
    font-size: .6rem;
    font-weight: 700;
}

.rk-grid td,
.rk-grid thead tr:nth-child(2) th,
.rk-grid thead tr:only-child th:not(.rk-col-name) {
    padding: 0 10px;
    text-align: right;
}

.rk-grid td {
    height: 28px;
    border-bottom: 1px solid var(--rk-line-2);
    white-space: nowrap;
    color: var(--rk-ink-2);
}

.rk-grid td.rk-first-in-group,
.rk-grid thead tr:nth-child(2) th.rk-first-in-group { border-left: 1px solid var(--rk-line); }

/* Sürüm kolon tonları — başlık bir kademe koyu, gövde açık ton; sürüm rengi üst çizgide */
.rk-grid thead th.rk-v-actual { background-color: var(--rk-actual-head); }
.rk-grid thead th.rk-v-budget { background-color: var(--rk-budget-head); }
.rk-grid thead th.rk-v-forecast { background-color: var(--rk-forecast-head); }
.rk-grid thead th.rk-v-ly { background-color: var(--rk-ly-head); }
.rk-grid thead th.rk-v-var { background-color: #f1f5f9; }
.rk-grid thead th.rk-group.rk-v-actual { box-shadow: inset 0 3px 0 var(--rk-actual); color: var(--sc-actual-text); }
.rk-grid thead th.rk-group.rk-v-budget { box-shadow: inset 0 3px 0 var(--rk-budget); color: var(--sc-budget-text); }
.rk-grid thead th.rk-group.rk-v-forecast { box-shadow: inset 0 3px 0 var(--rk-forecast); color: var(--sc-forecast-text); }
.rk-grid thead th.rk-group.rk-v-ly { box-shadow: inset 0 3px 0 var(--rk-ly); color: var(--sc-lastyear-text); }
.rk-grid thead th.rk-group.rk-v-var { box-shadow: inset 0 3px 0 #94a3b8; color: #334155; }

.rk-grid .rk-num-neg { color: var(--rk-ink-2); }
.rk-grid .rk-cell-na { color: var(--rk-faint); }

/* Dondurulmuş ilk kolonlar (GLOBAL-008) */
.rk-grid .rk-sticky {
    position: sticky;
    z-index: 2;
    background: #fff;
    text-align: left;
}

.rk-grid thead .rk-sticky { z-index: 4; }
.rk-grid .rk-col-code { left: 0; min-width: 92px; max-width: 92px; }
.rk-grid .rk-col-name { left: 92px; min-width: 300px; max-width: 360px; border-right: 1px solid var(--rk-line); box-shadow: 6px 0 8px -8px rgba(15, 23, 42, .25); }
.rk-grid .rk-col-name.rk-col-name-first { left: 0; min-width: 360px; max-width: 440px; }

.rk-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.rk-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.rk-twisty {
    flex: none;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--rk-muted);
    cursor: pointer;
    font-size: .64rem;
}

.rk-twisty:hover { background: var(--rk-accent-soft); color: var(--rk-accent); }
.rk-twisty.leaf { visibility: hidden; }

.rk-headcount {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--rk-accent-soft);
    color: var(--rk-accent);
    font-size: .62rem;
    font-weight: 700;
    white-space: nowrap;
}

.rk-drill {
    flex: none;
    margin-left: auto;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--rk-faint);
    cursor: pointer;
    font-size: .68rem;
    opacity: 0;
}

.rk-grid tr:hover .rk-drill { opacity: 1; }
.rk-drill:hover { background: var(--rk-accent-soft); color: var(--rk-accent); }

/* Tablo hücresi ya da kart başlığındaki küçük detay düğmesi (varyans listesi, trend kartları). */
.rk-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    min-width: 26px;
    padding: 0 7px;
    border: 1px solid var(--rk-line, #e2e8f0);
    border-radius: 6px;
    background: #fff;
    color: var(--rk-muted);
    font-size: .72rem;
    font-weight: 650;
    cursor: pointer;
}
.rk-icon-btn:hover { background: var(--rk-accent-soft); color: var(--rk-accent); border-color: transparent; }
@media print { .rk-icon-btn { display: none !important; } }

/* Satır tipleri (GLOBAL-008: ara toplam görsel olarak ayrılır) */
.rk-grid tr.rk-r-section td { font-weight: 800; color: #0b2f58; text-transform: uppercase; letter-spacing: .012em; border-top: 2px solid #5f83aa; border-bottom-color: #c3d8ee; }
.rk-grid tr.rk-r-group td { font-weight: 740; color: #173b61; }
.rk-grid tr.rk-r-group td.rk-sticky { text-transform: uppercase; }
.rk-grid tr.rk-r-subtotal td { color: var(--rk-ink); }
.rk-grid tr.rk-r-account td { color: var(--rk-muted); font-size: .72rem; }
.rk-grid tbody tr:not(.rk-r-template-bg) td { background-color: #fff; }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-v-actual { background-color: var(--rk-actual-tint); }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-v-budget { background-color: var(--rk-budget-tint); }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-v-forecast { background-color: var(--rk-forecast-tint); }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-v-ly { background-color: var(--rk-ly-tint); }
.rk-grid tr.rk-r-template-bg td { background-color: var(--rk-template-bg) !important; }
/* Şablon renkli satırda (ara toplam) sürüm sütunu tonunu kaybetmez: şablon zemininin üstüne sürüm rengi katmanı. */
.rk-grid tr.rk-r-template-bg td.rk-v-actual { background-image: linear-gradient(var(--sc-actual-band), var(--sc-actual-band)); }
.rk-grid tr.rk-r-template-bg td.rk-v-budget { background-image: linear-gradient(var(--sc-budget-band), var(--sc-budget-band)); }
.rk-grid tr.rk-r-template-bg td.rk-v-forecast { background-image: linear-gradient(var(--sc-forecast-band), var(--sc-forecast-band)); }
.rk-grid tr.rk-r-template-bg td.rk-v-ly { background-image: linear-gradient(var(--sc-lastyear-band), var(--sc-lastyear-band)); }
.rk-grid tr.rk-r-template-fg td { color: var(--rk-template-fg) !important; }
.rk-grid tr.rk-r-template-bold td { font-weight: 800; }
.rk-grid tr.rk-r-template-top td { border-top: 2px solid #64748b; }
.rk-grid tr.rk-r-template-bottom td { border-bottom: 2px solid #64748b; }
.rk-grid tr:not(.rk-r-template-bg):hover td { background-image: linear-gradient(rgba(29, 78, 216, .045), rgba(29, 78, 216, .045)); }

/* Sapma: doğaya göre olumlu yeşil, olumsuz kırmızı (GLOBAL-011). Şablon yazı rengi
   (!important) sapma rengini ezmesin diye burada da !important kullanılır. */
.rk-grid tbody td.rk-fav { color: var(--rk-fav) !important; font-weight: 700; }
.rk-grid tbody td.rk-unfav { color: var(--rk-unfav) !important; font-weight: 700; }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-fav { background-color: var(--rk-fav-bg); }
.rk-grid tbody tr:not(.rk-r-template-bg) td.rk-unfav { background-color: var(--rk-unfav-bg); }
/* Koyu bant satırında (lacivert bölüm başlığı) koyu yeşil/kırmızı okunmuyordu: aynı yön, açık ton. */
.rk-grid tbody tr.rk-r-template-dark td.rk-fav { color: var(--sc-favorable-on-dark) !important; }
.rk-grid tbody tr.rk-r-template-dark td.rk-unfav { color: var(--sc-adverse-on-dark) !important; }

/* ── Grafik ─────────────────────────────────────────────────────────── */
.rk-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 4px;
    font-size: .72rem;
    color: var(--rk-muted);
}

.rk-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rk-chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }

/* ── Alt bilgi ──────────────────────────────────────────────────────── */
.rk-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--rk-line-2);
    font-size: .7rem;
    color: var(--rk-muted);
}

/* ── Yazdırma ───────────────────────────────────────────────────────── */
@media print {
    .rk-page { background: #fff; padding: 0; gap: 8px; }
    .rk-btn, .rk-toggles, .rk-drill, .rk-twisty { display: none !important; }
    .rk-grid-wrap { max-height: none; overflow: visible; }
    .rk-card { box-shadow: none; break-inside: avoid; }

    /* Kâğıtta seçim kutuları anlamsız: kapsam başlık altındaki satırda (otel · dönem · para birimi)
       zaten yazılı. Filtre çubuğu, sürüm seçicileri, uyarı simgesi ve yüzen düğmeler basılmaz. */
    .rk-header-side,
    .rk-page .fpr-filterbar,
    .rk-notice-pin,
    .rk-card-tools select,
    .rk-report-actions,
    .online-users-dock { display: none !important; }
    .rk-header { padding: 0 0 4px; border-bottom: 2px solid var(--rk-ink); }
    .rk-crumbs > a, .rk-crumbs > .rk-crumb-sep { display: none; }
    .rk-kpi { box-shadow: none; min-height: 0; break-inside: avoid; }
    .rk-kpi-spark { display: none; }
    /* Uzun tabloda yalnız dış kart kırılmaz; tablo sayfalara bölünür, başlık her sayfada tekrar eder. */
    .rk-card:has(.rk-grid) { break-inside: auto; }
    .rk-grid { width: 100%; font-size: 7.5pt; }
    .rk-grid thead { display: table-header-group; }
    .rk-grid thead th { position: static; }
    .rk-grid .rk-sticky { position: static; box-shadow: none; }
    .rk-grid td { height: auto; padding-top: 2px; padding-bottom: 2px; }
    .rk-grid tr { break-inside: avoid; }
    .rk-grid .rk-col-name, .rk-grid .rk-col-name.rk-col-name-first { min-width: 0; max-width: none; }
    .rk-page, .rk-grid td, .rk-grid th, .rk-kpi { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.rk-notice-link { margin-left: 6px; font-weight: 700; color: inherit; text-decoration: underline; white-space: nowrap; }

/* ── Operasyonel istatistikler (tablo başı, P&L toplamlarından ayrı) ─────────── */
.rk-grid tbody tr.rk-r-stat-head td {
    background: #0f2744;
    color: #e2e8f0;
    font-weight: 700;
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 0;
}
.rk-grid tbody tr.rk-r-stat-head .rk-twisty { color: #cbd5e1; }
.rk-grid tbody tr.rk-r-stat-head .rk-name-text i { margin-right: 6px; color: #7dd3fc; }
.rk-stat-count {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(125, 211, 252, .18);
    color: #bae6fd;
    font-size: .7rem;
    letter-spacing: 0;
}
.rk-grid tbody tr.rk-r-stat-group td {
    background: #f1f5fb;
    color: var(--rk-ink-2);
    font-weight: 600;
    font-size: .76rem;
}
.rk-grid tbody tr.rk-r-stat td { background: #f8fafd; color: var(--rk-ink-2); }
.rk-grid tbody tr.rk-r-stat td.rk-col-name,
.rk-grid tbody tr.rk-r-stat-group td.rk-col-name { box-shadow: inset 3px 0 0 #7dd3fc; }
.rk-grid tbody tr.rk-r-stat:hover td { background: #eef4fb; }
.rk-stat-rule {
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 4px;
    background: #e2e8f0;
    color: var(--rk-muted);
    font-size: .66rem;
    font-weight: 600;
    white-space: nowrap;
}
.rk-grid tbody tr.rk-r-stat td.rk-neutral { color: var(--rk-ink-2); }
/* Son istatistik satırı ile P&L arasında belirgin ayrım */
.rk-grid tbody tr.rk-r-stat + tr:not(.rk-r-stat):not(.rk-r-stat-group) td { border-top: 2px solid #cbd5e1; }


/* ── Başlıkta sürüm senaryosu seçicisi (Bütçe / Forecast) ─────────────── */
.rk-version-pick select { max-width: 220px; }
.rk-version-pick span { display: inline-flex; align-items: center; gap: 5px; }
.rk-version-pick .rk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }

/* Detay çekmecesi açıkken arkadaki sayfa kaymasın (tekerlek çekmeceyi kaydırır). */
html:has(.rkd-backdrop), html:has(.fpsd-backdrop) { overflow: hidden; }
html:has(.rkd-backdrop) body, html:has(.fpsd-backdrop) body { overflow: hidden; }
/* Sağ alttaki çevrimiçi kullanıcılar düğmesi (z-index 10000) çekmecenin tablosunun üstüne biniyordu. */
html:has(.rkd-backdrop) .online-users-dock, html:has(.fpsd-backdrop) .online-users-dock { display: none; }

/* Şirket / grup bazlı portföy tablosu */
.rk-pf-wrap { overflow-x: auto; }
.rk-pf { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
.rk-pf th { padding: 7px 10px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: .68rem; font-weight: 800; color: #475569; text-align: right; white-space: nowrap; }
.rk-pf thead tr:first-child th { text-align: center; text-transform: uppercase; letter-spacing: .04em; border-left: 1px solid #eef2f7; }
.rk-pf th.lbl, .rk-pf td.lbl { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 220px; }
.rk-pf th.lbl { background: #f8fafc; z-index: 2; text-transform: uppercase; letter-spacing: .04em; }
.rk-pf th.v-a { background: var(--sc-actual-soft); color: var(--sc-actual-text); }
.rk-pf th.v-c { background: #f3f4f6; }
.rk-pf th.v-c.v-budget { background: var(--sc-budget-soft); color: var(--sc-budget-text); }
.rk-pf th.v-c.v-forecast { background: var(--sc-forecast-soft); color: var(--sc-forecast-text); }
.rk-pf th.v-c.v-ly { background: var(--sc-lastyear-soft); color: var(--sc-lastyear-text); }
.rk-pf td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; text-align: right; white-space: nowrap; }
.rk-pf td.v-a { background: var(--sc-actual-tint); font-weight: 650; color: #0f172a; }
.rk-pf td.v-c { color: #475569; }
.rk-pf td.fav { color: #15803d; font-weight: 700; }
.rk-pf td.unfav { color: #b91c1c; font-weight: 700; }
.rk-pf td.lbl span { font-weight: 700; color: #0f172a; }
.rk-pf td.lbl em { margin-left: 6px; font-style: normal; font-size: .68rem; color: #64748b; font-weight: 600; }
.rk-pf tr.child td.lbl { padding-left: 38px; }
.rk-pf tr.child td.lbl span { font-weight: 550; color: #334155; }
.rk-pf tr.child td { background: #fcfdff; }
.rk-pf tr.total td { border-top: 2px solid #cbd5e1; background: #f8fafc; font-weight: 800; }
.rk-pf tr.total td.lbl { background: #f8fafc; }
.rk-pf-exp { width: 22px; height: 22px; margin-right: 4px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; color: #475569; cursor: pointer; font-size: .6rem; }
.rk-pf-share { display: inline-block; width: 60px; height: 6px; margin-right: 6px; border-radius: 3px; background: #e2e8f0; vertical-align: middle; overflow: hidden; }
.rk-pf-share i { display: block; height: 100%; background: var(--sc-actual); }
.rk-pf td b { font-weight: 650; color: #334155; }
.rk-pf tr.subtotal td { border-top: 1px solid #cbd5e1; font-weight: 750; background: #fbfcfe; }
.rk-pf tr.subtotal td.lbl { background: #fbfcfe; }

/* Çoklu Otel Karşılaştırma (FIN-RPT-020) */
.rk-bench-rank {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--rk-line-2);
    color: var(--rk-muted);
    font-size: .66rem;
    font-weight: 750;
}
.rk-grid tr.rk-bench-total td { font-weight: 750; color: var(--rk-ink); border-top: 1px solid #cbd5e1; }
.rk-grid tr.rk-bench-total td.rk-sticky { background: #f8fafc; }

/* Sapma Analizi */
.rk-va-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 1280px) { .rk-va-top { grid-template-columns: 1fr; } }
.rk-va-dept { width: 100%; }
.rk-va-dept tr.rk-va-on td { background: #eff6ff !important; }
.rk-va-wrap { max-height: 640px; overflow: auto; }
.rk-va-table { width: 100%; }
.rk-va-table thead th { position: sticky; top: 0; z-index: 2; }
.rk-va-table .rk-col-name { min-width: 240px; }
.rk-va-rank { width: 36px; color: #94a3b8; text-align: center !important; }
.rk-va-scope { text-align: left !important; color: #475569; white-space: nowrap; }
.rk-va-impact { min-width: 190px; white-space: nowrap; }
.rk-va-bar { position: relative; display: inline-block; width: 90px; height: 8px; margin-right: 8px; vertical-align: middle; background: linear-gradient(90deg, transparent 49.5%, #cbd5e1 49.5%, #cbd5e1 50.5%, transparent 50.5%); }
.rk-va-bar i { position: absolute; top: 0; height: 100%; border-radius: 2px; }
.rk-va-bar.pos i { left: 50%; background: #16a34a; }
.rk-va-bar.neg i { right: 50%; background: #dc2626; }
.rk-va-pareto { font-weight: 800; color: #0f172a; }
.rk-va-search { height: 30px; padding: 0 10px; border: 1px solid #dbe3ed; border-radius: 8px; font-size: .76rem; min-width: 180px; }
.rk-toggle em { font-style: normal; opacity: .7; margin-left: 3px; }
.rk-va-table td.rk-col-name, .rk-va-table th.rk-col-name, .rk-va-dept td.rk-col-name, .rk-va-dept th.rk-col-name,
.rk-va-table td.rk-va-scope, .rk-va-table th.rk-va-scope { text-align: left !important; }

/* Hesap Detayı */
.rk-ad-wrap { max-height: calc(100vh - 360px); min-height: 420px; }
.rk-ad-table tr.rk-ad-group td { background: #f1f5f9 !important; font-weight: 800; color: #0f172a; cursor: pointer; border-top: 1px solid #cbd5e1; }
.rk-ad-table tr.rk-ad-group td.rk-col-name i { width: 14px; color: #64748b; font-size: .7rem; }
.rk-ad-table tr.rk-ad-group td.rk-col-name em { margin-left: 6px; font-style: normal; font-weight: 700; font-size: .66rem; color: #64748b; background: #fff; border-radius: 999px; padding: 1px 7px; }
.rk-ad-table tr.rk-ad-line { cursor: pointer; }
.rk-ad-table tr.rk-ad-line:hover td { background-color: #eef4ff !important; }
.rk-ad-table tr.rk-ad-line td.rk-col-name { padding-left: 26px; }
.rk-ad-table td.rk-col-name code { margin-right: 6px; font-size: .68rem; color: #64748b; }
.rk-ad-trend { width: 110px; text-align: center !important; }
.rk-ad-spark { display: block; margin: 0 auto; }
