/* Tema institusi AnalytiCPL: Hijau UIN dan kuning emas. */
:root {
    --uin-green: #00703c;
    --uin-green-dark: #005c32;
    --uin-green-soft: #eaf6ef;
    --uin-gold: #d6a514;
    --uin-gold-dark: #a97900;
    --uin-gold-soft: #fff8df;
}

/*
 * Filament 4 membungkus theme di cascade layers. Untuk deklarasi !important,
 * layer yang dideklarasikan lebih awal memiliki prioritas lebih tinggi.
 * Tempatkan kontrak kontras tabel di layer pertama milik Filament agar warna
 * sel header tidak dikalahkan oleh komponen/utility bawaannya.
 */
@layer properties {
    .fi-ta-table thead th {
        background-color: #075c3a !important;
        background-image: linear-gradient(135deg, #075c3a 0%, #08764a 100%) !important;
        border-color: rgba(255, 255, 255, .18) !important;
        color: #fff !important;
    }

    .fi-ta-table thead th *,
    .fi-ta-table thead th button,
    .fi-ta-table thead th a,
    .fi-ta-table thead th svg {
        color: #fff !important;
    }
}

/* Fluid working canvas on every Filament page, including collapsed sidebar. */
.fi-main,
.fi-page,
.fi-page > section,
.fi-page-content {
    width: 100% !important;
    max-width: none !important;
}

@media (min-width: 1024px) {
    .fi-main {
        padding-left: clamp(1rem, 1.6vw, 2rem) !important;
        padding-right: clamp(1rem, 1.6vw, 2rem) !important;
    }
}

/* Topik/judul halaman di atas filter. */
.fi-header-heading {
    color: var(--uin-green-dark) !important;
    padding-left: .85rem;
    border-left: .32rem solid var(--uin-gold);
}

.fi-header-subheading {
    color: #52645b !important;
    padding-left: 1.2rem;
}

.uin-page-topic {
    color: var(--uin-green-dark) !important;
    padding: .7rem .9rem;
    border-left: 4px solid var(--uin-gold);
    border-radius: .35rem;
    background: var(--uin-green-soft);
}

.uin-form-card {
    border-color: rgba(0, 112, 60, .25) !important;
    box-shadow: 0 5px 18px rgba(0, 92, 50, .07) !important;
}

/* Semua section/form mendapat identitas visual yang konsisten. */
.fi-section {
    overflow: hidden;
    border-color: rgba(0, 112, 60, .22) !important;
    box-shadow: 0 5px 18px rgba(0, 92, 50, .07) !important;
}

.fi-section-header {
    background: var(--uin-green-soft);
    border-bottom: 1px solid rgba(0, 112, 60, .18);
}

.fi-section-header-heading,
.fi-section-header .fi-section-header-heading {
    color: var(--uin-green-dark) !important;
    font-weight: 700 !important;
}

.fi-fo-field-wrp-label label,
.fi-fo-field-wrp-label span {
    color: #244c38;
    font-weight: 600;
}

.fi-input-wrp:focus-within {
    border-color: var(--uin-green) !important;
    box-shadow: 0 0 0 3px rgba(0, 112, 60, .13) !important;
}

/* Repeater, termasuk Riwayat Pendidikan pada Informasi Dosen. */
.fi-fo-repeater > ul > li,
.fi-fo-repeater-item {
    border-left: 3px solid rgba(0, 112, 60, .45) !important;
    background: #fbfdfc !important;
}

/* Judul dan kepala tabel. */
.fi-ta-header-heading {
    color: var(--uin-green-dark) !important;
    font-weight: 750 !important;
}

.uin-table-title {
    color: var(--uin-green-dark) !important;
    padding-left: .7rem;
    border-left: 4px solid var(--uin-gold);
}

.fi-ta-table thead,
.fi-ta-table thead tr {
    background: var(--uin-green) !important;
}

.fi-ta-table thead th,
.fi-ta-table thead th span,
.fi-ta-table thead th button {
    color: #fff !important;
}

/* Filament memberi warna latar pada tiap <th>. Terapkan warna pada sel,
   bukan hanya <thead>, agar utility bg-gray tidak menghasilkan teks putih
   di atas latar yang nyaris putih seperti pada tabel Mata Kuliah. */
.fi-ta-table thead th {
    background-color: #075c3a !important;
    background-image: linear-gradient(135deg, #075c3a 0%, #08764a 100%) !important;
    border-color: rgba(255, 255, 255, .18) !important;
}

.fi-ta-table thead th *,
.fi-ta-table thead th svg {
    color: #fff !important;
    fill: currentColor;
}

.fi-ta-table tbody tr:hover {
    background-color: var(--uin-gold-soft) !important;
}

.uin-data-table thead,
.uin-data-table thead tr {
    background: var(--uin-green) !important;
}

.uin-data-table thead th,
.uin-data-table thead th * {
    color: #fff !important;
}

.uin-data-table tbody tr:hover {
    background-color: var(--uin-gold-soft) !important;
}

/*
 * Sistem tabel global AnalytiCPL.
 * Selector dibuat cukup umum untuk tabel Blade/Livewire, namun tanpa
 * !important pada warna sel agar heatmap dan matriks khusus tetap menang.
 */
:where(.fi-main, .fi-modal, .fi-slide-over) table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    overflow: hidden;
    border: 1px solid rgba(15, 118, 74, .14);
    border-radius: .8rem;
    background: rgba(255, 255, 255, .98);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, .04),
        0 7px 24px rgba(0, 112, 60, .075),
        0 0 0 1px rgba(255, 255, 255, .72) inset;
    color: #26372f;
    font-variant-numeric: tabular-nums;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table thead {
    background: linear-gradient(135deg, #075c3a 0%, #08764a 58%, #0a8052 100%);
    box-shadow:
        0 5px 15px rgba(0, 70, 40, .15),
        0 1px 0 rgba(255, 255, 255, .12) inset;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table thead th {
    height: 3.15rem;
    padding: .72rem 1rem;
    border-bottom: 1px solid rgba(0, 112, 60, .16);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: .035em;
    text-align: left;
    text-transform: uppercase;
    vertical-align: middle;
    background-color: #075c3a;
    background-image: linear-gradient(135deg, #075c3a 0%, #08764a 100%);
}

:where(.fi-main, .fi-modal, .fi-slide-over) table thead th + th {
    border-left: 1px solid rgba(255, 255, 255, .14);
}

:where(.fi-main, .fi-modal, .fi-slide-over) table thead th *,
:where(.fi-main, .fi-modal, .fi-slide-over) table thead th button,
:where(.fi-main, .fi-modal, .fi-slide-over) table thead th a {
    color: inherit;
}

/* Kontras header mengalahkan utility warna lokal, tetapi tetap dapat
   dioverride oleh tabel khusus seperti heatmap dan matriks PA. */
.fi-main table thead th,
.fi-modal table thead th,
.fi-slide-over table thead th {
    color: #fff;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody td {
    padding: .78rem 1rem;
    border-bottom: 1px solid rgba(100, 116, 139, .105);
    color: #405048;
    font-size: .84rem;
    line-height: 1.5;
    vertical-align: middle;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr {
    background: rgba(255, 255, 255, .96);
    transition: background-color 140ms ease, box-shadow 140ms ease;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr:nth-child(even) {
    background: rgba(247, 251, 249, .94);
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr:hover {
    position: relative;
    z-index: 1;
    background: #f2faf5;
    box-shadow:
        3px 0 0 var(--uin-gold) inset,
        0 3px 13px rgba(0, 112, 60, .075);
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr:last-child td {
    border-bottom: 0;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tbody td:first-child {
    color: #263d31;
    font-weight: 600;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table tfoot td {
    padding: .72rem 1rem;
    border-top: 1px solid rgba(0, 112, 60, .15);
    background: #f4f9f6;
    color: #31543f;
    font-weight: 700;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table a {
    font-weight: 650;
    text-underline-offset: 2px;
}

:where(.fi-main, .fi-modal, .fi-slide-over) table button {
    min-height: 2rem;
}

/* Tabel Filament mendapat header institusional yang tetap lembut. */
.fi-ta-table {
    border-radius: .8rem !important;
    box-shadow:
        0 7px 24px rgba(0, 112, 60, .08),
        0 0 18px rgba(0, 112, 60, .035) !important;
}

.fi-ta-table thead,
.fi-ta-table thead tr {
    background: linear-gradient(135deg, #087447 0%, #16865a 100%) !important;
}

.fi-ta-table tbody td {
    padding-top: .8rem !important;
    padding-bottom: .8rem !important;
}

@media (max-width: 767px) {
    :where(.fi-main, .fi-modal, .fi-slide-over) table {
        border-radius: .65rem;
    }

    :where(.fi-main, .fi-modal, .fi-slide-over) table thead th,
    :where(.fi-main, .fi-modal, .fi-slide-over) table tbody td,
    :where(.fi-main, .fi-modal, .fi-slide-over) table tfoot td {
        padding: .65rem .75rem;
    }
}

/* Tombol utama: hijau UIN, interaksi/aksen: emas. */
.fi-btn.fi-color-primary {
    color: #fff !important;
    background: var(--uin-green) !important;
    border-color: var(--uin-green-dark) !important;
    box-shadow: 0 3px 8px rgba(0, 92, 50, .2) !important;
}

.fi-btn.fi-color-primary:hover {
    color: #fff !important;
    background: var(--uin-green-dark) !important;
    border-color: var(--uin-green-dark) !important;
}

.fi-btn.fi-color-warning {
    color: #173d2a !important;
    background-color: var(--uin-gold) !important;
}

.uin-action-primary {
    color: #fff !important;
    background: var(--uin-green) !important;
    border: 1px solid var(--uin-green-dark) !important;
}

.uin-action-primary:hover {
    color: #fff !important;
    background: var(--uin-green-dark) !important;
}

.uin-action-secondary {
    color: var(--uin-green-dark) !important;
    border-color: var(--uin-gold) !important;
    background: var(--uin-gold-soft) !important;
}

.uin-action-secondary:hover {
    color: #fff !important;
    background: var(--uin-green) !important;
    border-color: var(--uin-green) !important;
}

.fi-link.fi-color-primary,
.fi-ac-link-action.fi-color-primary {
    color: var(--uin-green) !important;
}

/* Dark mode tetap nyaman dibaca. */
.dark .fi-section-header {
    background: rgba(0, 112, 60, .22);
}

.dark .fi-section-header-heading,
.dark .fi-header-heading,
.dark .fi-fo-field-wrp-label label,
.dark .fi-fo-field-wrp-label span {
    color: #d8f3e4 !important;
}

/* Pengaturan Role & Permission */
.role-permission-step {
    min-height: 100%;
}

.role-permission-step > .fi-section-header {
    background: #f2f7f4;
    border-top: 3px solid var(--uin-green);
}

.role-permission-step .fi-section-header-heading {
    font-size: 1rem !important;
}

.role-scope-note {
    padding: .9rem;
    border: 1px solid #d7e8df;
    border-radius: .7rem;
    color: #426052;
    background: #f7fbf9;
    font-size: .82rem;
    line-height: 1.55;
}

.role-permission-config .fi-fo-checkbox-list-option-label {
    font-size: .82rem;
}

.role-permission-config fieldset > legend,
.role-permission-config .fi-fo-checkbox-list-group-label {
    color: var(--uin-green-dark) !important;
    font-weight: 750 !important;
}

.role-preview-card {
    overflow: hidden;
    border: 1px solid #d8e5de;
    border-radius: .9rem;
    background: #fff;
    box-shadow: 0 7px 22px rgba(0, 92, 50, .08);
}

.role-preview-brand {
    padding: 1rem 1.1rem;
    color: #fff;
    background: var(--uin-green-dark);
    font-size: 1.05rem;
    font-weight: 800;
}

.role-preview-role {
    margin: 1rem 1rem .25rem;
    color: var(--uin-green-dark);
    font-size: 1.05rem;
    font-weight: 800;
}

.role-preview-card > p {
    margin: 0 1rem 1rem;
    color: #64756c;
    font-size: .78rem;
}

.role-preview-card ul {
    margin: 0;
    padding: .3rem 1rem 1rem;
    list-style: none;
}

.role-preview-card li {
    display: flex;
    gap: .55rem;
    padding: .52rem 0;
    border-bottom: 1px solid #edf2ef;
    color: #263f33;
    font-size: .82rem;
}

.role-preview-card li span {
    color: var(--uin-green);
    font-weight: 800;
}

.role-preview-empty {
    color: #7c8b83 !important;
}

.role-preview-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    padding: 1rem;
    background: var(--uin-green-soft);
    color: #365445;
    font-size: .75rem;
}

.role-preview-summary span {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.role-preview-summary strong {
    color: var(--uin-green-dark);
    font-size: 1rem;
}

.dark .role-preview-card,
.dark .role-scope-note {
    border-color: #33483e;
    background: #18231e;
    color: #d6e4dc;
}

.dark .role-preview-card li,
.dark .role-preview-role {
    color: #d8f3e4;
}

/* Identitas aplikasi, lembaga, dan unit aktif pada top header */
.app-topbar-identity {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-width: 0;
    padding-inline: .35rem 1rem;
}

.app-topbar-brand {
    color: var(--uin-green-dark);
    font-size: 1rem;
    font-weight: 850;
    white-space: nowrap;
}

.app-topbar-context {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-left: 1px solid #d7e5dd;
    padding-left: .85rem;
    font-size: .68rem;
    line-height: 1.25;
}

.app-topbar-context span,
.app-topbar-context strong {
    max-width: 28rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-context span { color: #68786f; font-weight: 550; }
.app-topbar-context strong { color: #263d32; font-weight: 750; }

.dark .app-topbar-brand { color: #79c99d; }
.dark .app-topbar-context { border-color: #35483e; }
.dark .app-topbar-context span { color: #9fb0a7; }
.dark .app-topbar-context strong { color: #e2eee7; }

@media (max-width: 767px) {
    .app-topbar-context { display: none; }
    .app-topbar-brand { font-size: .9rem; }
}

/* Matriks permission role */
.permission-matrix-shell {
    overflow: hidden;
    border: 1px solid #d9e5de;
    border-radius: .8rem;
    background: #fff;
}

.permission-matrix-help {
    padding: .75rem 1rem;
    border-bottom: 1px solid #e4ece7;
    background: #f5faf7;
    color: #52675c;
    font-size: .78rem;
}

.permission-matrix-scroll {
    max-width: 100%;
    overflow-x: auto;
}

.permission-matrix-group + .permission-matrix-group {
    border-top: 1px solid #d9e5de;
}

.permission-matrix-group-heading {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    padding: .8rem 1rem;
    background: #fff;
}

.permission-matrix-group-heading strong {
    color: var(--uin-green-dark);
    font-size: .88rem;
}

.permission-matrix-group-heading span {
    color: #6d7d74;
    font-size: .72rem;
}

.permission-matrix-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .78rem;
}

.permission-matrix-table th,
.permission-matrix-table td {
    min-width: 5.2rem;
    height: 3.5rem;
    border-right: 1px solid #e5ece8;
    border-bottom: 1px solid #e5ece8;
    padding: .5rem;
    text-align: center;
    vertical-align: middle;
}

.permission-matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #edf6f1;
    color: var(--uin-green-dark);
    font-weight: 800;
}

.permission-matrix-table .permission-module-column {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 16rem;
    min-width: 16rem;
    max-width: 16rem;
    background: #fbfdfc;
    text-align: left;
}

.permission-matrix-table thead .permission-module-column {
    z-index: 4;
    background: var(--uin-green-dark);
    color: #fff;
}

.permission-matrix-table tbody tr:hover td,
.permission-matrix-table tbody tr:hover .permission-module-column {
    background: #f3faf6;
}

.permission-row-toggle,
.permission-column-toggle {
    width: 100%;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.permission-row-toggle { text-align: left; }
.permission-row-toggle strong { display: block; color: #173c29; font-size: .82rem; }
.permission-row-toggle small { display: block; margin-top: .2rem; color: #728278; font-size: .68rem; font-weight: 500; line-height: 1.3; }

.permission-matrix-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.permission-matrix-checkbox input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.permission-matrix-checkbox span {
    display: grid;
    width: 1.2rem;
    height: 1.2rem;
    place-items: center;
    border: 1.5px solid #b7c8bf;
    border-radius: .3rem;
    background: #fff;
}

.permission-matrix-checkbox input:checked + span {
    border-color: var(--uin-green);
    background: var(--uin-green);
}

.permission-matrix-checkbox input:checked + span::after {
    content: '✓';
    color: #fff;
    font-size: .78rem;
    font-weight: 900;
}

.permission-cell-unavailable { background: #f7f8f7; }
.permission-empty-cell { color: #c5cec9; }

.dark .permission-matrix-shell { border-color: #33473d; background: #16231c; }
.dark .permission-matrix-group + .permission-matrix-group { border-color: #33473d; }
.dark .permission-matrix-group-heading { background: #16231c; }
.dark .permission-matrix-group-heading strong { color: #bfe5ce; }
.dark .permission-matrix-group-heading span { color: #93a99c; }
.dark .permission-matrix-help,
.dark .permission-matrix-table thead th { border-color: #33473d; background: #20372b; color: #c5ead4; }
.dark .permission-matrix-table th,
.dark .permission-matrix-table td { border-color: #304239; }
.dark .permission-matrix-table .permission-module-column { background: #192a21; }
.dark .permission-row-toggle strong { color: #e0f1e7; }
.dark .permission-cell-unavailable { background: #142019; }

/* Kontrol tampil/sembunyi ringkasan role */
.role-preview-toggle-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: -.2rem;
}

.role-preview-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: .45rem .8rem;
    border: 1px solid #bfd5c8;
    border-radius: .55rem;
    background: #f4faf6;
    color: var(--uin-green-dark);
    cursor: pointer;
    font-size: .75rem;
    font-weight: 750;
}

.role-preview-toggle:hover {
    border-color: var(--uin-green);
    background: #e9f5ed;
}

.fi-grid-col.role-config-expanded {
    --col-span-xl: span 12 / span 12 !important;
    grid-column: 1 / -1 !important;
}

.fi-grid-col.role-preview-panel-hidden {
    display: none !important;
}

.dark .role-preview-toggle {
    border-color: #426351;
    background: #1b3024;
    color: #bfe5ce;
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table {
    border-color: rgba(110, 231, 183, .16);
    background: #17231d;
    color: #d8e7de;
    box-shadow: 0 8px 26px rgba(0, 0, 0, .24);
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table thead {
    background: linear-gradient(135deg, #06442c 0%, #075c3a 100%);
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table thead th {
    border-color: rgba(110, 231, 183, .14);
    color: #f2fff7;
    background-color: #06442c;
    background-image: linear-gradient(135deg, #06442c 0%, #075c3a 100%);
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr {
    background: #17231d;
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr:nth-child(even) {
    background: #1a2821;
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table tbody tr:hover {
    background: #21372b;
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table tbody td {
    border-color: rgba(148, 163, 184, .12);
    color: #cad9d0;
}

.dark :where(.fi-main, .fi-modal, .fi-slide-over) table tbody td:first-child {
    color: #e0eee6;
}
