/* Gestor Roles-Tareas — estética alineada a Reports / Usage / ControlPanel */

.admin-rt-page {
    padding: 8px 4px 20px;
}

.admin-rt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 14px;
}

.admin-rt-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
}

.admin-rt-subtitle {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #64748b;
    max-width: 42rem;
}

.admin-rt-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-rt-back {
    display: inline-flex;
    align-items: center;
    min-height: var(--sig-touch-min, 40px);
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.admin-rt-back:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.admin-rt-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.25fr);
    gap: 14px;
    align-items: stretch;
    min-width: 0;
}

.admin-rt-panel {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-rt-panel-title {
    font-weight: 700 !important;
    color: #0f172a;
    margin-bottom: 8px;
}

.admin-rt-muted {
    color: #64748b;
}

.admin-rt-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: min(70dvh, 720px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-rt-module-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: var(--sig-touch-min, 40px);
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: #0f172a;
}

.admin-rt-module-btn:hover {
    background: #f1f5f9;
}

.admin-rt-module-chevron {
    color: #64748b;
    flex-shrink: 0;
}

.admin-rt-module-name {
    flex: 1;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 0;
    word-break: break-word;
}

.admin-rt-module-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    background: #eef2f7;
    border-radius: 999px;
    padding: 2px 8px;
}

.admin-rt-tasks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 8px 18px;
}

.admin-rt-task-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: #0f172a;
}

.admin-rt-task-btn:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.admin-rt-task-btn.is-selected {
    background: rgba(1, 124, 174, 0.1);
    border-color: rgba(1, 124, 174, 0.35);
}

.admin-rt-task-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    word-break: break-word;
}

.admin-rt-task-id {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.admin-rt-empty-detail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    min-height: 220px;
    padding: 12px 4px;
}

.admin-rt-empty-icon {
    color: #94a3b8;
    margin-bottom: 4px;
}

.admin-rt-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 14px;
    margin-bottom: 12px;
}

.admin-rt-detail-title {
    margin: 0 !important;
    font-weight: 700 !important;
    color: #0f172a;
    word-break: break-word;
}

.admin-rt-save {
    min-height: var(--sig-touch-min, 40px);
    font-weight: 700 !important;
}

.admin-rt-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    background: #f8fafc;
}

.admin-rt-meta-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 12px;
    min-width: 0;
}

.admin-rt-meta-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.admin-rt-meta-value {
    font-size: 0.9rem;
    color: #0f172a;
    word-break: break-word;
}

.admin-rt-roles-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-rt-roles-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.admin-rt-roles-list {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: auto;
    max-height: min(48dvh, 420px);
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.admin-rt-role-item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    margin: 0;
    cursor: pointer;
    min-width: 0;
}

.admin-rt-role-item:last-child {
    border-bottom: 0;
}

.admin-rt-role-item:hover {
    background: #f8fafc;
}

.admin-rt-role-item.is-assigned {
    background: rgba(1, 124, 174, 0.06);
}

.admin-rt-role-item.is-assigned .admin-rt-role-name {
    color: #017cae;
    font-weight: 700;
}

.admin-rt-role-check {
    margin-top: -2px;
}

.admin-rt-role-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding-top: 6px;
}

.admin-rt-role-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    word-break: break-word;
}

.admin-rt-role-id {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

@media (max-width: 1100px) {
    .admin-rt-layout {
        grid-template-columns: 1fr;
    }

    .admin-rt-tree {
        max-height: min(42dvh, 360px);
    }

    .admin-rt-roles-list {
        max-height: min(40dvh, 360px);
    }
}

@media (max-width: 640px) {
    .admin-rt-meta-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .admin-rt-save {
        width: 100%;
    }

    .admin-rt-detail-head {
        flex-direction: column;
    }

    .admin-rt-back {
        width: 100%;
        justify-content: center;
    }
}
