/* /yetkiler — CntPermissionTree + CntPermissionRoleMatrix (13.10.2026)
   Kabuk pencereye sığar (yükseklik permTree.js sadesFitPermShells ile ölçülür); kaydırma
   yalnız sol sayfa listesinde ve içerikte olur, sayfa kaymaz. */

.perm-shell { display: flex; flex-direction: column; overflow: hidden; margin-bottom: 0; }
.perm-shell[data-fit="true"] { height: calc(100vh - 300px); min-height: 480px; }
.perm-shell > .card-header { background: var(--ins-card-bg); }

/* Menü sekmeleri: sığmazsa yatay kayar, alt alta dökülmez */
.perm-menu-tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.perm-menu-tabs .nav-link { font-size: .9rem; border-radius: .4rem .4rem 0 0; }
.perm-menu-tabs .nav-link:hover:not(.active) { background: var(--ins-tertiary-bg); }
/* Seçili sekme: tema ana rengiyle (anahtarlar ve sol listedeki seçili sayfa ile aynı) */
.perm-menu-tabs .nav-link.active {
    background: var(--ins-primary-bg-subtle);
    color: var(--ins-primary-text-emphasis) !important;
    border-bottom-color: var(--ins-primary) !important;
    font-weight: 600;
}

/* Sol sayfa listesi */
.perm-page-list { width: 230px; }
.perm-page-item {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .45rem .75rem; border-radius: .4rem; font-size: .9rem;
    color: var(--ins-body-color); text-decoration: none;
}
.perm-page-item:hover { background: var(--ins-tertiary-bg); color: var(--ins-emphasis-color); }
.perm-page-item.active { background: var(--ins-primary-bg-subtle); color: var(--ins-primary-text-emphasis); font-weight: 600; }
.perm-page-count { font-size: .75rem; color: var(--ins-secondary-color); flex-shrink: 0; }
.perm-page-item.active .perm-page-count { color: inherit; }

/* Süzgeç açıkken uyanı olmayan sekme/sayfa */
.perm-dim:not(.active) { opacity: .45; }

/* Sayfa başlığı + doluluk */
.perm-progress { width: 150px; height: 7px; }

/* Bölüm kartı */
.perm-section { border: 1px solid var(--ins-border-color); border-radius: .6rem; overflow: hidden; }
.perm-section + .perm-section { margin-top: .75rem; }
.perm-section-head { background: var(--ins-tertiary-bg); padding: .55rem 1rem; }

/* Yetki satırı */
.perm-row { display: flex; align-items: center; gap: 1rem; padding: .65rem 1rem; border-top: 1px solid var(--ins-border-color-translucent); cursor: pointer; margin: 0; }
.perm-section-head + .perm-row, .perm-flat > .perm-row:first-child { border-top: 0; }
.perm-row:hover { background: var(--ins-tertiary-bg); }
.perm-row-name { font-size: .93rem; font-weight: 600; color: var(--ins-emphasis-color); }
.perm-row-desc { font-size: .82rem; color: var(--ins-secondary-color); line-height: 1.4; margin-top: .1rem; }
.perm-row-key { width: 220px; font-size: .74rem; color: var(--ins-secondary-color); }
.perm-row .form-switch { padding-left: 0; margin: 0; min-height: 0; }
.perm-row .form-switch .form-check-input { width: 2.4em; height: 1.3em; margin: 0; cursor: pointer; float: none; }

/* Renkli görünüm (13.10.2026, kalıcı) — .perm-tinted kabukta. Renk anlam taşır:
   açık satır = tema tonu; bölüm başlığı doluluğa göre (boş / kısmi / tam); kullanıcı
   modunda ek izin ve kısıt solda renkli şerit. Sınıf kalkınca sade görünüm aynen döner. */
.perm-tinted .perm-row.is-on { background: rgba(var(--ins-primary-rgb), .06); }
.perm-tinted .perm-row.is-on:hover { background: rgba(var(--ins-primary-rgb), .11); }
.perm-tinted .perm-row.is-grant { box-shadow: inset 4px 0 0 var(--ins-success); background: rgba(var(--ins-success-rgb), .09); }
.perm-tinted .perm-row.is-deny { box-shadow: inset 4px 0 0 var(--ins-danger); background: rgba(var(--ins-danger-rgb), .07); }
.perm-tinted .perm-section.fill-part { border-color: rgba(var(--ins-primary-rgb), .35); }
.perm-tinted .perm-section.fill-part > .perm-section-head { background: rgba(var(--ins-primary-rgb), .08); }
.perm-tinted .perm-section.fill-full { border-color: rgba(var(--ins-primary-rgb), .55); }
.perm-tinted .perm-section.fill-full > .perm-section-head { background: rgba(var(--ins-primary-rgb), .16); }
.perm-tinted .perm-section-count { padding: .1rem .5rem; border-radius: 999px; font-weight: 600; background: var(--ins-card-bg); color: var(--ins-secondary-color) !important; }
.perm-tinted .perm-section.fill-part .perm-section-count,
.perm-tinted .perm-section.fill-full .perm-section-count { color: var(--ins-primary-text-emphasis) !important; }

/* Alt kaydet çubuğu */
.perm-shell > .card-footer { background: var(--ins-card-bg); }
.perm-shell > .card-footer.perm-dirty { background: var(--ins-warning-bg-subtle); }

/* Rol matrisi */
.perm-matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.perm-matrix th, .perm-matrix td { border-bottom: 1px solid var(--ins-border-color-translucent); background: var(--ins-card-bg); }
.perm-matrix thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; font-size: .75rem; font-weight: 600; color: var(--ins-secondary-color); padding: .5rem .25rem; }
.perm-matrix .perm-mx-first { position: sticky; left: 0; z-index: 1; min-width: 300px; max-width: 360px; padding: .55rem 1rem; }
.perm-matrix thead .perm-mx-first { z-index: 3; text-align: left; }
.perm-matrix .perm-mx-role { width: 82px; min-width: 82px; text-align: center; }
.perm-matrix thead .perm-mx-role button { font-size: .75rem; font-weight: 600; line-height: 1.25; white-space: normal; color: inherit; background: none; border: 0; padding: .15rem; width: 100%; }
.perm-matrix thead .perm-mx-role button:hover { color: var(--ins-primary); }
.perm-matrix .perm-mx-group td { background: var(--ins-tertiary-bg); font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ins-secondary-color); padding: .5rem 1rem; }
.perm-matrix tbody tr:hover td { background: var(--ins-tertiary-bg); }
.perm-matrix .perm-mx-diff td.perm-mx-first { box-shadow: inset 3px 0 0 var(--ins-warning); }
.perm-cell {
    width: 28px; height: 28px; border-radius: .4rem; border: 1.5px solid;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
/* Hücre dolu kutu, ikon beyaz; iki temada da aynı. Açık = tema yeşili + tik,
   kapalı = sabit orta gri (#9ca3af, beyaz çarpıyla okunur kontrast) + çarpı. */
.perm-cell { background: #9ca3af; border-color: #9ca3af; color: #fff; }
.perm-cell:hover:not(:disabled) { background: #868e98; border-color: #868e98; }
.perm-cell.on { background: var(--ins-primary); border-color: var(--ins-primary); }
.perm-cell.on:hover:not(:disabled) { filter: brightness(.92); background: var(--ins-primary); border-color: var(--ins-primary); }
.perm-cell i { font-size: 1rem; color: #fff; -webkit-text-stroke: .4px #fff; }
.perm-cell.changed { outline: 2px solid var(--ins-warning); outline-offset: 1px; }
.perm-cell:disabled { opacity: .6; }
