/* Sprint 19.1 · Enterprise Navigation + RBAC Studio */
:root {
    --navy-950: #071f38;
    --navy-900: #0a2b4b;
    --navy-800: #103b63;
    --nav-cyan: #25c7dc;
    --rbac-border: #dbe7f3;
    --rbac-muted: #64748b;
}

@media (min-width: 1101px) {
    .app-shell { grid-template-columns: 304px minmax(0, 1fr) !important; }
}

.sidebar {
    background: linear-gradient(180deg, #0b3154 0%, var(--navy-950) 72%, #061a2f 100%) !important;
    border-right: 1px solid rgba(105, 203, 236, .15);
    box-shadow: 12px 0 35px rgba(5, 27, 49, .08);
}

.sidebar-company {
    margin: 0 14px 12px !important;
    border: 1px solid rgba(67, 196, 235, .28) !important;
    background: linear-gradient(135deg, rgba(24, 91, 137, .52), rgba(12, 60, 98, .72)) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.sidebar-nav {
    gap: 2px !important;
    padding: 4px 9px 12px !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(72, 180, 221, .45) transparent;
}

.sidebar-nav .menu-group {
    position: relative;
    border-radius: 12px;
}

.sidebar-nav .nav-section-button {
    width: 100%;
    min-height: 33px;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 7px;
    padding: 3px 7px !important;
    color: #a9bfd2 !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: transparent !important;
    text-align: left;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.sidebar-nav .nav-section-button:hover,
.sidebar-nav .menu-group.active-group > .nav-section-button {
    color: #f8fbff !important;
    background: rgba(35, 126, 181, .17) !important;
    border-color: rgba(74, 184, 226, .14) !important;
}

.nav-section-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    color: #72d8ec;
    background: rgba(36, 153, 202, .13);
    border-radius: 8px;
    font-size: 12px;
    font-style: normal;
}

.nav-section-title {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 9.35px;
    font-weight: 800;
    letter-spacing: .04em;
}

.nav-section-count {
    min-width: 21px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    color: #91aec3;
    background: rgba(255, 255, 255, .055);
    border-radius: 7px;
    font-size: 9px;
    font-weight: 800;
}

.nav-section-caret {
    color: #7fa3bc;
    font-size: 15px;
    transform: rotate(-90deg);
    transition: transform .18s ease;
}

.nav-section-button[aria-expanded="true"] .nav-section-caret { transform: rotate(0); }
.nav-section-button[aria-expanded="true"] .nav-section-count { color: #b6eef7; background: rgba(37, 199, 220, .13); }

.sidebar-nav .nav-group-children {
    position: relative;
    display: grid;
    gap: 2px;
    margin: 2px 0 5px 14px;
    padding: 2px 0 2px 13px;
    border-left: 1px solid rgba(94, 177, 211, .22);
}

.sidebar-nav .nav-link {
    position: relative;
    min-height: 33px !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 3px 7px !important;
    color: #bad0df !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    font-size: 11.15px !important;
    font-weight: 600 !important;
    line-height: 1.25;
    transition: transform .15s ease, color .15s ease, background .15s ease;
}

.sidebar-nav .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .06) !important;
    transform: translateX(2px);
}

.sidebar-nav .nav-link.active {
    color: #fff !important;
    background: linear-gradient(90deg, rgba(28, 151, 204, .34), rgba(58, 72, 186, .22)) !important;
    border-color: rgba(83, 200, 235, .28) !important;
    box-shadow: 0 7px 18px rgba(1, 19, 36, .16), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.sidebar-nav .nav-link.active::before {
    content: "";
    position: absolute;
    left: -15px;
    width: 3px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--nav-cyan);
    box-shadow: 0 0 12px rgba(37, 199, 220, .7);
}

.sidebar-nav .nav-link .nav-icon {
    width: 26px !important;
    height: 26px !important;
    display: grid;
    place-items: center;
    color: #7ed8e9;
    background: rgba(38, 144, 189, .14) !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}

.sidebar-nav > .nav-link { margin-bottom: 5px; }

/* Permission workspace: Module > page > exact action policy */
.rbac-path-guide {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 20px;
    color: #64748b;
    background: #f8fbfe;
    border-top: 1px solid #e8f0f7;
    border-bottom: 1px solid #e8f0f7;
    font-size: 11px;
}

.rbac-path-guide span {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: #1767ad;
    background: #e4f2ff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
}

.rbac-path-guide b { color: #36526b; font-weight: 750; }
.rbac-path-guide i { color: #a2b5c6; font-size: 16px; font-style: normal; }

.rbac-studio {
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(285px, 34%) minmax(420px, 1fr);
    background: #f4f8fc;
    border-top: 0;
}

.rbac-tree-pane {
    min-width: 0;
    background: #fbfdff;
    border-right: 1px solid var(--rbac-border);
}

.rbac-tree-pane > header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 17px;
    border-bottom: 1px solid var(--rbac-border);
}

.rbac-tree-pane > header h3 { margin: 4px 0 0; color: #102f4c; font-size: 16px; }
.rbac-tree-pane > header > span { padding: 6px 9px; color: #49708d; background: #edf5fb; border-radius: 8px; font-size: 10px; font-weight: 800; }
.rbac-tree-scroll { max-height: 610px; overflow: auto; padding: 10px; scrollbar-width: thin; scrollbar-color: #b7cadb transparent; }
.rbac-tree-module { margin-bottom: 7px; border: 1px solid #dfebf5; border-radius: 11px; overflow: hidden; background: #fff; }
.rbac-tree-module.current { border-color: #9ecfeb; box-shadow: 0 5px 16px rgba(37, 111, 164, .08); }

.rbac-tree-module-button,
.rbac-tree-resource {
    width: 100%;
    border: 0;
    cursor: pointer;
    text-align: left;
}

.rbac-tree-module-button {
    min-height: 54px;
    display: grid;
    grid-template-columns: 16px 31px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: #163a58;
    background: #f5f9fd;
}

.rbac-tree-module-button:hover { background: #edf6fc; }
.rbac-tree-caret { color: #7796ac; transform: rotate(-90deg); transition: transform .15s ease; }
.rbac-tree-module-button[aria-expanded="true"] .rbac-tree-caret { transform: rotate(0); }
.rbac-tree-module-button .module-icon { width: 31px; height: 31px; display: grid; place-items: center; color: #1875ba; background: #e2f2ff; border-radius: 9px; font-size: 10px; font-style: normal; }
.rbac-tree-module-button > span:nth-child(3), .rbac-tree-resource > span:nth-child(3) { min-width: 0; display: grid; gap: 2px; }
.rbac-tree-module-button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.rbac-tree-module-button small { color: #8299aa; font-size: 9px; }
.rbac-tree-module-button em { color: #4b718e; background: #fff; border: 1px solid #dbe8f2; border-radius: 8px; padding: 4px 6px; font-size: 9px; font-style: normal; font-weight: 800; }
.rbac-tree-resources { padding: 4px 6px 7px; }

.rbac-tree-resource {
    position: relative;
    min-height: 52px;
    display: grid;
    grid-template-columns: 12px 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    color: #375a74;
    background: transparent;
    border-radius: 8px;
}

.rbac-tree-resource:hover { background: #f1f7fc; }
.rbac-tree-resource.selected { color: #0b528a; background: #e8f5ff; box-shadow: inset 3px 0 #178acc; }
.rbac-tree-line { height: 100%; border-left: 1px solid #cfdfeb; border-bottom: 1px solid #cfdfeb; border-radius: 0 0 0 6px; }
.rbac-resource-icon { width: 27px; height: 27px; display: grid !important; place-items: center; color: #5e849e; background: #edf4f9; border-radius: 7px; }
.rbac-tree-resource strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; }
.rbac-tree-resource small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8aa0b1; font-size: 8.5px; }
.rbac-tree-resource em { color: #6b879a; font-size: 9px; font-style: normal; font-weight: 800; }

.rbac-tree-empty { padding: 34px 18px; color: #7b92a4; text-align: center; font-size: 11px; }
.rbac-detail-pane { min-width: 0; padding: 18px; }
.rbac-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 2px 2px 16px; border-bottom: 1px solid var(--rbac-border); }
.rbac-breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; color: #7890a3; font-size: 10px; }
.rbac-breadcrumb i { font-style: normal; }
.rbac-breadcrumb b { color: #2675ad; }
.rbac-detail-header h3 { margin: 0; color: #0d2f4d; font-size: 20px; }
.rbac-detail-header p { margin: 5px 0 0; color: #71889a; font-size: 10px; }
.rbac-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 7px; }
.rbac-selection-chip { padding: 7px 10px; color: #1769a6; background: #e4f3ff; border-radius: 9px; font-size: 10px; font-weight: 850; }

.rbac-permission-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.rbac-permission-card { min-width: 0; min-height: 82px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 0 25px; align-items: center; gap: 10px; padding: 11px; background: #fff; border: 1px solid #dce7f0; border-radius: 11px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.rbac-permission-card:hover { transform: translateY(-1px); border-color: #a9cbe2; box-shadow: 0 8px 18px rgba(25, 73, 110, .07); }
.rbac-permission-card.enabled { border-color: #8bc6e8; background: linear-gradient(135deg, #fff, #f2faff); }
.rbac-permission-card.locked { cursor: default; }
.rbac-permission-card input { width: 1px; height: 1px; opacity: 0; }
.rbac-action-icon { width: 41px; height: 41px; display: grid; place-items: center; color: #2473aa; background: #e7f3fb; border-radius: 10px; font-size: 10px; font-weight: 900; }
.rbac-action-icon.write { color: #7452b9; background: #f0eaff; }
.rbac-action-icon.elevated { color: #a66512; background: #fff2d8; }
.rbac-action-icon.critical { color: #b5414b; background: #ffe8ea; }
.rbac-permission-copy { min-width: 0; display: grid; gap: 3px; }
.rbac-permission-copy strong { color: #183b57; font-size: 11px; }
.rbac-permission-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #607b90; font-size: 9.5px; }
.rbac-permission-copy code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8ba0af; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8.5px; }
.rbac-risk { padding: 4px 6px; color: #52738a; background: #edf4f8; border-radius: 6px; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.rbac-risk.write { color: #7452b9; background: #f1eaff; }
.rbac-risk.elevated { color: #9a600e; background: #fff1d5; }
.rbac-risk.critical { color: #ad3743; background: #ffe5e8; }
.rbac-checkmark { width: 24px; height: 24px; display: grid; place-items: center; color: transparent; border: 1px solid #bdd0de; border-radius: 7px; font-size: 12px; font-weight: 900; }
.rbac-permission-card.enabled .rbac-checkmark { color: #fff; border-color: #1cae82; background: #1cae82; }
.rbac-permission-card.locked .rbac-checkmark { color: #fff; border-color: #4678c6; background: #4678c6; }
.rbac-policy-note { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; color: #587287; background: #eef6fb; border: 1px solid #d9e9f4; border-radius: 10px; font-size: 10px; line-height: 1.55; }
.rbac-policy-note > span { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; color: #1574b5; background: #d9effd; border-radius: 50%; font-weight: 900; }
.rbac-policy-note p { margin: 0; }
.rbac-detail-empty { min-height: 430px; display: grid; place-content: center; justify-items: center; color: #738da0; text-align: center; }
.rbac-detail-empty > span { width: 54px; height: 54px; display: grid; place-items: center; color: #2c88c4; background: #e2f3ff; border-radius: 15px; font-size: 22px; }
.rbac-detail-empty h3 { margin: 14px 0 5px; color: #234963; }
.rbac-detail-empty p { margin: 0; font-size: 11px; }

@media (max-width: 1450px) {
    .rbac-permission-list { grid-template-columns: 1fr; }
    .rbac-studio { grid-template-columns: minmax(270px, 38%) minmax(380px, 1fr); }
}

@media (max-width: 1050px) {
    .rbac-studio { grid-template-columns: 1fr; }
    .rbac-tree-pane { border-right: 0; border-bottom: 1px solid var(--rbac-border); }
    .rbac-tree-scroll { max-height: 360px; }
    .rbac-detail-header { flex-direction: column; }
    .rbac-detail-actions { justify-content: flex-start; }
}

@media (max-width: 700px) {
    .rbac-path-guide { overflow-x: auto; white-space: nowrap; }
    .rbac-permission-list { grid-template-columns: 1fr; }
    .rbac-permission-card { grid-template-columns: 38px minmax(0, 1fr) 24px; }
    .rbac-risk { display: none; }
    .rbac-detail-pane { padding: 12px; }
}
